Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Programming (https://simplymaya.com/forum/forumdisplay.php?f=32)
-   -   Variable to implement number in object name? (https://simplymaya.com/forum/showthread.php?t=45184)

cbernadet 29-11-2017 04:39 PM

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;
}


All times are GMT. The time now is 05:59 PM.

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