Maya 2020 fundamentals - modelling the real world
Get halfway through a model and find it's an unworkable mess? Can't add edge loops where you need them? Can't subdivide a mesh properly? If any of this sounds familiar check this course out.
# 1 21-10-2008 , 08:10 AM
bendingiscool's Avatar
Subscriber
Join Date: Jul 2006
Location: London
Posts: 567

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

# 2 22-10-2008 , 01:46 AM
gster123's Avatar
Moderator
Join Date: May 2005
Location: Manchester Uk
Posts: 6,300
Could you not create an array to hold the object names and have it go through that?


"No pressure, no diamonds" Thomas Carlyle
# 3 22-10-2008 , 05:43 AM
bendingiscool's Avatar
Subscriber
Join Date: Jul 2006
Location: London
Posts: 567
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

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