I’m going with matrix nodes instead of constraints though, so can’t just use your script. At least assuming it’s using constraints.
But I also think I worked it out since posting this thread, please correct me if I’m doing it wrong:
- I have a scriptNode that has code to generate scriptJob when scene opens
- scriptJob then watches a dummy switch attribute that’s not connected to anything
- when that attribute changes scriptJob knows which other attribute it needs to change. So it remembers position of the object, changes the attribute and restores object position
Still need to figure out how to adjust it to only use 1 script job though.
Another thing I’ve ran into is this discussion: https://forums.autodesk.com/t5/maya-programming/attributechange-scriptjob-and-its-lying-ways-help/td-p/6217887
That says that Maya’s default scriptJob that looks for attr change actually fires off even during frame change, which involves additional overhead. I’m not sure if it’s still a case in latest Maya, but as I’m trying to optimize as much as I can (within reason) I opted to go with this option too. Interested in your opinion on this, or maybe you’ll just find it useful for your tool.