Digital humans the art of the digital double
Ever wanted to know how digital doubles are created in the movie industry? This course will give you an insight into how it's done.
# 1 05-05-2011 , 04:19 PM
gtovey's Avatar
Registered User
Join Date: Jan 2011
Location: Oregon!!
Posts: 82

question about shelf commands

ok soo i have made a new shelf and i have made a command that rotates an object 90 degrees. but it only rotates once.. i need it to continually be able to rotate any ideas guys? thanks.


GT
# 2 05-05-2011 , 04:53 PM
gtovey's Avatar
Registered User
Join Date: Jan 2011
Location: Oregon!!
Posts: 82
i also have hotkeys for rotating it and i made to hotkeys rotate 90 and rotate 180 and i can switch between the 2 and get the right effect but then theres also moving the object left and right. i need to be able to move it 10 spaces each time i use the command not just move TO 10.. do u guys know wat im talking about??


GT
# 3 05-05-2011 , 06:27 PM
EduSciVis-er
Join Date: Dec 2005
Location: Toronto
Posts: 3,374
I would use something like:
object.translateX += 10; //instead of translateX = 10

# 4 05-05-2011 , 08:05 PM
Gen's Avatar
Super Moderator
Join Date: Dec 2006
Location: South FL
Posts: 3,522
You could try this code. It grabs the first object in the selection (by the sounds of it you would have only 1 item selected anyway). It stores the current translation X value and adds 10. You could add checks to throw warnings if nothing is selected or the attribute doesn't exist on the object but maybe that's overkill.

Code:
// get obj
string $sel[] = `ls -sl`;
string $obj= $sel[0];

// get current translate x value
int $translateX_value = `getAttr ($obj+ ".translateX")`;

// add 10 to said value
setAttr ($obj+ ".translateX") ($translateX_value + 10);


- Genny
__________________
::|| My CG Blog ||::
::|| My Maya FAQ ||::
# 5 05-05-2011 , 09:11 PM
LauriePriest's Avatar
Moderator
Join Date: May 2003
Location: London
Posts: 1,001
You just want to relatively rotate a selected object by x degrees?

just have the command be rotate -r -os x
same as +=


FX supervisor - double negative
# 6 05-05-2011 , 10:35 PM
gtovey's Avatar
Registered User
Join Date: Jan 2011
Location: Oregon!!
Posts: 82
im not sure why but i cant get those to work?? am i doing it wrong?


GT
# 7 05-05-2011 , 11:02 PM
EduSciVis-er
Join Date: Dec 2005
Location: Toronto
Posts: 3,374
Yes, you're probably doing it wrong.
It might be helpful to know a) What your experience level is with MEL and b) What exactly you did to create the rotater hotkeys.

# 8 06-05-2011 , 09:37 AM
LauriePriest's Avatar
Moderator
Join Date: May 2003
Location: London
Posts: 1,001
that command works on the current selection, so for example if you run `rotate -r - os 10 0 0;`
it will add 10 to the degrees to the x ( sorry forgot to say this command expects a vector, i put the x in to as the variable, it doesnt define the axis.


FX supervisor - double negative
# 9 06-05-2011 , 04:25 PM
gtovey's Avatar
Registered User
Join Date: Jan 2011
Location: Oregon!!
Posts: 82
ok well for the rotater hotkeys i just went to the hotkey editor and made a few custom hotkeys and then used the commands rotate -90 x etc.. i made one for rotating it -90 +90 -180 +180 and 0 degrees.. see wats happening and i realize t now is that i have the commands/hotkeys to rotate the object to the desired degree.. ex: -90.. but i want to be able to keep rotating the object everytime i use the hotkey that way there is only one key i have to use to keep rotating the object untill i get the desired effect is there a script or command i can use that can like set the origin of the object after it rotates soo i can then rotate it from there.. i hope you understand wat im talking about i feel like im talking gibberish!!


GT
# 10 09-05-2011 , 03:04 AM
EduSciVis-er
Join Date: Dec 2005
Location: Toronto
Posts: 3,374
What you're saying is making sense, but I really feel like you should take a bit of time off this Tetris project and learn some scripting (MEL, and Python if you feel like going the extra mile). What you're asking about is quite simple using MEL, but if you don't understand the foundation of it, you'll be asking for help with every single step. I hope that's reasonable, and you understand my reason for saying so.

# 11 09-05-2011 , 04:12 PM
gtovey's Avatar
Registered User
Join Date: Jan 2011
Location: Oregon!!
Posts: 82
no i understand and actually right now i'm spending every minute i can studying MEL and scripting.. and i am learning alot. But i have just touched the tip of the iceberg. so thanks i'll try to figure it out on my own.


GT
Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads