View Full Version : REALLY Always Evaluate ?
I have a little script that centers something between two points, and i have applied this script as an expression, but the thing is that i cant get it to evalute ALL the time ( the evaluate always just does the trick when i move the slider back and forth ).
So my question to all you MEL-scripters is: Can you make a script evaluate when i move one of the point or is there a way to make the script run in the background ( wich i think would be kinda slow ) ?
Very thankful for answers // Cyze
10-31-2003, 01:18 PM
I think two point constraints with weights of .5 would work for what you are doing, not to mention be easier.
But, as for making the expression evaluate ALL the time, I think you'll need a Dependency Graph connection directly. That way maya will be able to figure out exactly how everything relates to each part of the scene.
10-31-2003, 09:48 PM
Yeah -- if you're using getAttr and setAttr, the expression won't actually be connected in the DG and thus won't run except when the time slider is advanced.
so, instead of
float $x1 = `getAttr locator1.tx`;
float $x2 = `getAttr locator2.tx`;
setAttr locator3.tx (($x1 + $x2) / 2);
make sure you're using
locator3.tx = (locator1.tx + locator2.tx)/2;
Referring to attributes explicitly like this (which you can't do in a standalone MEL script but which is OK in an expression) tells Maya to connect the appropriate inputs and outputs to the expression node, which should solve problems like yours.
11-01-2003, 05:05 PM
wow Mark, you seem to explain that one pretty often between here and your forums....
you helped me with it just a few months ago :)
11-01-2003, 06:34 PM
well, it's possible it's not the problem, but it's a likely candidate.
For some reason, most people take a while to really internalize how expressions work, and that's kind of THE critical aspect to their behavior, so I find myself repeating it. :D
01-16-2006, 01: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.
vBulletin v3.0.5, Copyright ©2000-2014, Jelsoft Enterprises Ltd.