PDA

View Full Version : the order in which Maya calculates expressions


dunkel3d
09-09-2003, 08:19 PM
Does Maya simply calculate expressions in the order in which they appear in the expression editor or is there another way in which I'm not aware of?

I have a number of spheres, each w/ the same dynamic attr. This attr is calculated individually via an expression, named expression1, expression2, expression3 etc. Once the values are calculated, I want to gather all the values in an array, use them in a function that will give me a second array of values, and then combine each corresponding index in the two arrays in an equation to calculate the spheres rotation.

Should I then create a second set of expressions i.e., expression1A, expression1B, expression1C etc. for the array function or can I simply append to the existing expressions?

S

dwalden74
09-10-2003, 03:17 PM
Maya probably calculates expressions based on their position in the scene hierarchy, so I'm not sure there's a fast way to see in what order the different expressions are evaluated (but of course someone should correct me if I'm wrong).

The easiest way then would be to put all of this into one expression. It would also make things easier for you to manage. Hope this helps a bit!

:beer:
David

dunkel3d
09-10-2003, 03:25 PM
It does. Thanks David.

S

dwalden74
09-10-2003, 04:55 PM
No prob. Actually, what just occured to me is that an easy way to test in which order different expressions are evaluated is to add a simple "print" statement at the end of each expression, then look at the order in which these statements appear in your script editor as you update the timeline.

:beer:
David

dunkel3d
09-10-2003, 08:44 PM
That is precisely what I did. And it worked.

Thanks again.
S

mark_wilkins
09-11-2003, 01:40 AM
You absolutely can't rely on multiple expressions being executed in any particular order, unless one is upstream or downstream in the dependency graph from the other. In particular, Maya will only recalculate those expressions whose inputs have changed, so you may find that only a subset of your expressions recalculate on a given frame at all.

If you need precise control of the order of execution with respect to the global scene, look at using a script node.

-- Mark

CGTalk Moderation
01-16-2006, 02:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.