Hello. I find a problem with expression.
I'd like to write expression that continuously evaluated as I doing action - such as moving object.
for exaplme, here is a expression.
float $pos[] = getAttr target.translate
;
print($pos[0] + " " + $pos[1] + " " + $pos[2] + "n");
obj.tx = $pos[0];
obj.ty = $pos[1];
obj.tz = $pos[2];
I expect that target's translation is printed continuously and obj is follow target's movement as I move target. But when I move target, it didn't. The expression is not evaluated. And when I select other frame in framebar, then the expression is evaluated ( target translation is printed and obj moved. )
I think Maya perfrom some trick in expression for fast evaluation. I think Maya take into account relationship of current change (user input or frame advance) and each expression statement.
For example. I changed some statement as follows:
float $pos[] = getAttr target.translate
;
print($pos[0] + " " + $pos[1] + " " + $pos[2] + "n");
obj.tx = $pos[0] + target.tx*0; // add noop sentence
obj.ty = $pos[1];
obj.tz = $pos[2];
I added no operation sentence "+ target.tx*0" which have always zero value to the statement which set obj's X translation. Then this expression perform the same, except when I move target in X direction. When I move target in X direction, expression is evualuated continuously, other directin is not. I think Maya just evaluate statements which contain attribute names depend on current user action (translation or rotation, which direction? etc... ) How do you think about this?
Because of the lack of continuously expression evaluation, I cannot use expression! Is there any way to evaluate expression instantly?