PDA

View Full Version : Using expressions on multiple objects



bendingiscool
10-22-2008, 07:15 AM
Hey guys,
Basically what I am after is a way of running an expression on multiple objects, for instance...

polySphere -name "ball";
expression -s "ball.translateX = time;" -o pSphere1 -ae 1 -uc all ;

will make the ball head in the X direction over time, but how would I be able to select multiple objects and giving each of them this expression, as the expression above is only going to work on the first object.

Many thanks in advance as this is bugging me loads

Chris

Haruyuki
11-15-2008, 06:34 PM
You can use "for" loop to create expression for each object.

Example:

Select objects and use this MEL script:

string $selObjs[] = `ls -sl -long`;
for ($eachObj in $selObjs)
{expression -s ("\"" + $eachObj + ".translateX = time;\"");}