PDA

View Full Version : ScriptJob - attributechange


Matte
07-17-2007, 06:55 PM
Hey,

I have a scriptjob that executes when a attribute on a given object changes value. One problem though. It seems the actual attribute that is tracked by the scriptjob has to be visible in the channel box for the scriptjob to execute!?

Which is kinda weird to me, since even if its not visible its stil updated, behind the scenes, so to speak. Of course it might have been designed to work that way, to limit the amount of overhead, but if its possible i would like to get it to update even if the object/attribute in question is not selected by the user. Anyone know a way around this maybe? Force an update of a "non" visible value in some way (so that the script executes even if the object with the attribute is not selected)?

/Matte

rtngkllr
07-18-2007, 10:44 PM
Something is amiss elsewhere! Maya DOES check for attribute changes via a scriptjob even though that object is invisible. Please see the example below...

polyCube -n "foo";
setAttr foo.visibility 0;
global proc doPrint()
{
print "attr changed!\n";
}
int $jnum = `scriptJob -ac foo.tx doPrint`;
setAttr foo.tx 1;

Matte
07-22-2007, 09:51 PM
You are right indeed, running your above code works all the time, for me aswell.

But, if you, for example. Let the foo.tx value be driven by another objects .tx via a direct connection, for example. Then you will see that the scriptjob will not execute at all. If foo is hidden ie. If you unhide it, it works right away.

I did kinda solve it though; Connect foo.tx to another attribute on another object (so that foo.tx is not the last in the "chain", so to speak). Then it works without problem, hidden or unhidden. :)

/Matte

CGTalk Moderation
07-22-2007, 09:51 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.