PDA

View Full Version : Expresssion evaluation


alesmav
10-29-2003, 08:13 PM
Ih!

I have a problem with my expression evaluation. It gets evaluated after scrubbing the timeline. How do I make It evaluate every time I change the attribute from this expression?

ALES

Doogie
10-29-2003, 10:31 PM
Gathering from a few presentations I've attended, I think thats one reason to write a plugin over a MEL script. I believe the update isnt made (and nodes evaluated) until you let go of the time slider (or virtual slider)

mark_wilkins
10-30-2003, 12:24 AM
For the convenience of interested people here, I'll post my answer that I originally posted to the same question at the melscripting.com forums (http://forums.melscripting.com/).

This problem normally happens when you use getAttr instead of an actual attribute connection (where you directly assign the attribute to a variable.) For example, if you use:


float $myVal = `getAttr sphere1.myAttr`;


instead of


float $myVal = sphere1.myAttr;


then Maya won't know to update the expression until time or one of its other inputs change. The reason is that the second approach above creates an actual dependency graph connection from the sphere1 object to the expression object, while the first approach does not.

If, for some reason, you MUST use getAttr in an expression (and every now and then there's a good reason), then you can use the Connection Editor to connect the "message" attribute of the sphere1 object (or whatever your input object is) to the "message" attribute of the expression. This will tell Maya that there's a dependency between these nodes and (I think) may help your updating problem.

However, using the second way of connecting attributes above rather than the first is really the place to start.

-- Mark

SirCharles
02-10-2005, 05:59 PM
How do you connect the messege attributes? Every time I try to connect them I get an error saying they cannot be connected. I checked and neither of them are locked, and neither of them are connected to anything else. So there is no reason I shouldnt be able to connect them. Also, they dont show up in the connection editor as attributes so I had to use connectAttr to try to connect them.

macaroniKazoo
02-10-2005, 09:05 PM
hey mark, i thought the message attribute was useful simply because it did not pass messages between nodes. i remember reading/hearing somewhere that the message attribute was useful for creating connection based relationships between nodes that didn't affect performance because they never got flagged dirty.

having said that, theres a good chance i made it up, or dreamt it or something. :)

sir charles: you can't connect message attributes to each other. the message attribute is an output only attribute. i don't think its connectable. so you'll have to connect the message attribute to an input attribute on the expression (ie .input[1] for example)

CGTalk Moderation
02-10-2006, 10:00 PM
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.