11 February, 2010

ScriptJob for Keyable Attribute Change Event

Reading from forums it seems that there is a resistance in using ScriptJobs amongst character TDs. And there are reasons for that. But, I think there are some good uses of scriptJob without hitting the performance.

I was trying to make an attribute that is boolean and it jumps from one value to the other like a step key. And I wanted to detect change in this attribute. So I used scriptJob to do the same. However, as soon as I make this attribute keyable, scriptJob does not work as intended. And the reason is that if you are scrubbing the timeline and jump from one key to the other and then release the mouse, it fires up change attribute event even if you are not on the keyframe! And there isn't any elegant way to solve this in MEL. So scriptJob even if powerful is limited when animation comes in the picture.

There is a work around logic to ensure within the scriptjob call that the attribute change was caused only by a manual change in channel box.

There is a similar problem with non-keyable attribute and scriotJob. However, that happens only if you are continuously playing animation in viewport and then stop the animation, not while scrubbing timeline.

No comments:

Post a Comment