Creative COW SIGN IN :: SPONSORS :: ADVERTISING :: ABOUT US :: CONTACT US
Creative COW's LinkedIn GroupCreative COW's Facebook PageCreative COW on TwitterCreative COW's Google+ PageCreative COW on YouTube
MAYA:MAYA ForumMAYA TutorialsMAYA

Re: MEL: assign a unique multiplier

COW Forums : MAYA

VIEW ALL   •   ADD A NEW POST   •   PRINT
Share on Facebook
Respond to this post   •   Return to posts index   •   Read entire thread


Steve SayerRe: MEL: assign a unique multiplier
by on Apr 13, 2005 at 8:22:12 pm

[Geoff Bailey] "Lastly, none of this solves my original problem (thanks for the other comments, though): how to avoid 1200 expressions."

EEEK.

Sorry, I mistook the focus of your original post.

Good heavens, Geoff, only one expression should be needed.

What you want to do is create an iterative loop that will step through all your layers automatically, incrementing the offset for each. Try something like the following. This example uses four NURBS spheres, the first one keyframed manually:
int $i;
vector $position = <<0,0,0>>;
for ($i = 2; $i < 5; $i++)
{
string $object = ("nurbsSphere" + $i);

float $offset = $i * 3;

float $valueX = `getAttr -time (frame - $offset) nurbsSphere1.translateX`;
float $valueY = `getAttr -time (frame - $offset) nurbsSphere1.translateY`;
float $valueZ = `getAttr -time (frame - $offset) nurbsSphere1.translateZ`;

vector $position = <<$valueX, $valueY, $valueZ>>;

eval("setAttr " + $object + ".translate " + $position);
}
The key here is using commands nested in a 'for' loop.

The incremenent integer $i counts up as the 'for' loop iterates, and the 'getAttr' and 'eval' commands incorporate the resulting offset into each iteration of the read-and-set attribute operations.

Hmmm, I see Joaquin has posted a reply. I don't know exactly what you're doing with layers and instances; hopefully something that I've posted here will turn out to be useful. Post again if I haven't explained anything well enough.

-Steve


Posts IndexRead Thread
Reply   Like  
Share on Facebook


Current Message Thread:




LOGIN TO REPLY



FORUMSTUTORIALSMAGAZINESTOCKYARDVIDEOSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

Creative COW LinkedIn Group Creative COW Facebook Page Creative COW on Twitter
© 2013 CreativeCOW.net All rights are reserved. - Privacy Policy

[Top]