View Full Version : need mel help
JayWalker 03-14-2008, 09:01 PM I'm trying to create a script that will allow me to change the translation of lets say X to the group of objects that i have selected.
right now i have it set up something like
string $sel[]=`ls -sl`;
string $current;
for ($current in $sel)
{
print ("setAttr "+"$current"+".tx 5"\n");
}
i know this example even though it doesn't work could be done in the channel box but its going to end up being more complicated then this. any help would be greatly appreciated
|
|
skippye
03-14-2008, 09:31 PM
Hi JayWalker,
Maybe you can give a try with the eval function instead of print.
JayWalker
03-14-2008, 09:33 PM
how would i use an eval funtion?
skippye
03-14-2008, 09:36 PM
Like this, you should be all set.
string $sel[]=`ls -sl`;
string $current;
for ($current in $sel)
{
eval ("setAttr "+"$current"+".tx 5");
}
PS: Not tested.
strarup
03-14-2008, 10:34 PM
Hi,
eh... the problem is kinda that the $current is within the "-thingies... so in this case you will get $current instead of the actual value that $current represents...
string $sel[]=`ls -sl`;
string $current;
for ($current in $sel)
{
print ("setAttr \""+$current+".tx\" 5 \n");
setAttr ($current+".tx") 5;
}
or if using the eval...
string $sel[]=`ls -sl`;
string $current;
for ($current in $sel)
{
eval ("setAttr \""+$current+".tx\" 5;");
}
hope that help a bit... :)
kind regards
Strarup
twedzel
03-14-2008, 10:43 PM
loose the quotes around $current.
print ("setAttr" + $current + ".tx 5");
or the code to change it...
setAttr ($current + ".tx") 5;
opps Starup beat me to it.
JayWalker
03-14-2008, 10:49 PM
thank you all very much for your help, ill test it in a bit.
CGTalk Moderation
03-14-2008, 10:49 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.