
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have been trying to add some dynamic attributes to my Python API custom node and have been having no luck getting the dependency relationships working. My understanding is that using the MPxNode.setDependentsDirty method is the way to go. The method gets called when a plug is dirtied and it is responsible for returning a list of dependent plugs which should also be dirtied. None of the scripted devkit examples demonstrate this functionality so I had to make one. Attached is a Python port of the "affectsNode.cpp" example... it is a straight port to Python with the only exception that I create the dynamic attributes in the postConstructor method.
To test this, load the module and, in the Node Editor window add the node (Tab... then type "affects"). Experiment with typing values in for the 'A' attribute and note that setDependentsDirty is being called and 'B' is supposedly being marked dirty. Hover your mouse over the 'B' attribute in the Node Editor and note that the value returned is zero. Also note that the compute method on the node is never called. All behavior points to the affectedPlugs MPlugArray being ignored.
I've tested this behavior on Maya 2017 and 2018 but an internet search suggests this problem may be quite old. As an aside, I also looked into overriding the MPxNode.dependsOn method in my node but that method doesn't seem to ever get called.
Any suggestions?
Rob Engle
AND... I just tried to post this and the web form doesn't allow '*.py' attachments? On a programming forum? Renamed it to affectsNode.txt
Solved! Go to Solution.