Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Programming (https://simplymaya.com/forum/forumdisplay.php?f=32)
-   -   Using expressions on multiple objects (https://simplymaya.com/forum/showthread.php?t=31162)

bendingiscool 21-10-2008 08:10 AM

Using expressions on multiple objects
 
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

gster123 22-10-2008 01:46 AM

Could you not create an array to hold the object names and have it go through that?

bendingiscool 22-10-2008 05:43 AM

Turns out I was just going at it in an overcomplicated fashion, here's the working script...

//give expression to all selected
for($n in `ls -sl`){

expression -s ($n + ".translateX = time;") -o $n -ae 1 -uc all ;

}

Cheers,

Chris


All times are GMT. The time now is 09:16 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018