SimplyMaya Forums

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

SM Forums / Maya Questions / Programming / Variable to implement number in object name?

Programming MEL Scripts, Expressions & Programming Related Topics

Join the conversation. Reply to post
Thread Tools
29-11-2017, 04:39 PM   #1
Registered User
Join Date: Nov 2017
Posts: 1
Variable to implement number in object name?
Hi everyone!

I have this simple task, where I want to offset the values on multiple animation curves on différent objects.
Objects names are: MPath01_uValue, MPath02_uValue, etc....

I use a for loop, so I would like to apply the offset on the MPath01_uValue in the first loop, then apply the offset on the MPath02_uValue, etc...

Can we make the 01, 02... in the names variable???
Don't know how, I'm still new to programming...
I tried to make an int $OffAnim = 1; place the variable in the name like: MPath0($OffAnim)_uValue which of course doesn't work at all!

any help please?

here's my script:

float $uvMin = 0;
float $uvMax = 1;
for( $OffAnim=1; $OffAnim<26; ++$OffAnim )
selectKey -add -k -f 0 MPath($OffAnim)_uValue ;
keyframe -animation keys -absolute -valueChange $uvMin ;
selectKey -add -k -f 1 MPath($OffAnim)_uValue ;
keyframe -animation keys -absolute -valueChange $uvMax ;
$uvMin = $uvMin + 0.04;
$uvMax = $uvMax + 0.04;
  Reply with quote

Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert Camera Translation to Object rotation? jimvfx Animation 0 28-01-2015 10:06 PM
trouble opening maya scene jooleyinboots Maya Technical Issues 2 03-02-2014 09:11 PM
Normal Map definitions djwaterman Lighting & Rendering 2 25-05-2012 12:50 PM
Duplicating object a set number of times with specific measurement between them should_be_shot Maya Basics & Newbie Lounge 2 20-04-2010 01:11 PM
Object appearance. yaki Animation 1 25-04-2004 06:37 PM