SimplyMaya Forums

Welcome to the forum, feel free to ask questions here.

Home / forum / Animation / Mel Scripts & Programming / Using expressions on multiple objects
Register FAQ Members List Calendar Mark Forums Read

New Thread
 
Thread Tools
Old 21-10-2008, 08:10 AM   #1
bendingiscool
Subscriber
 
bendingiscool's Avatar
 
Join Date: Jul 2006
Location: London
Posts: 567
Thanks: 0
Thanked 1 Time in 1 Post
Default 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
bendingiscool is offline   Reply With Quote
Old 22-10-2008, 01:46 AM   #2
gster123
Moderator
 
gster123's Avatar
 
Join Date: May 2005
Location: Manchester Uk
Posts: 6,300
Thanks: 1
Thanked 51 Times in 45 Posts
Default

Could you not create an array to hold the object names and have it go through that?
__________________
"No pressure, no diamonds" Thomas Carlyle
gster123 is offline   Reply With Quote
Old 22-10-2008, 05:43 AM   #3
bendingiscool
Subscriber
 
bendingiscool's Avatar
 
Join Date: Jul 2006
Location: London
Posts: 567
Thanks: 0
Thanked 1 Time in 1 Post
Default

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
bendingiscool is offline   Reply With Quote
New Thread

« Previous Thread | Next Thread »

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem solving many dynamic objects in a pile? rohiniduggal Dynamics & Special Effects 3 14-01-2011 06:26 PM
Strange Problem - Unable to change attributes for multiple objects anthonysw3 Technical Issues 4 04-12-2010 10:56 PM
New Feature: Multiple Image Upload David Members Lounge 0 30-11-2010 08:40 PM

1 Month

$34

Month-to-month billing
$34/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
 
 

3 months

$87

Billing every 3 months
$29/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $5 per month or $15 in total compared to monthly billing with this package.

12 months

$288

Billing every 12 months
$24/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $10 per month or $120 in total compared to monthly billing with this package.

Your plan will automatically renew. You can cancel at any time via your PayPal account to avoid being charged again.

You can view the FAQ on our video plans here. You can contact us directly here. By clicking one of the buttons above, you agree to our Terms and Privacy Policy.