Custom Node executing 'compute' method twice for each frame during playback

27 views
Skip to first unread message

Dylan Smith

unread,
Nov 14, 2016, 7:56:42 AM11/14/16
to Python Programming for Autodesk Maya
Heyo, I've got an odd issue. I've got a custom node with key frames on one of the attributes. Whenever I hit play, the 'setDependentsDirty' method doesn't get called, and instead the 'compute' method gets called twice. I pulled all the code except for 3 lines (which I will post below) out of the 'compute' method just to make sure that I hadn't written something that calls compute twice, but its still happening. Has anyone encountered this and know of a way to fix/deal with it. I can even work around the 'setDependentsDirty' issue, its just the double 'compute' problem that I really need help with.

Code left in Compute (sorry that its in c++. I'm writing something that generates geometry so I need to squeeze all the performance I can get)

MGlobal::displayInfo("COMPUTE CALLED!!!");
data.setClean(plug);
return MS::kSuccess;

Nicolas Chaverou

unread,
Nov 14, 2016, 8:16:21 AM11/14/16
to python_in...@googlegroups.com
Hey Dylan,

What's the type of the plug beeing keyframed (compound) ?
Any chance there're some attributeAffects relationship declared in the init ?

Best,

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/c270ff60-b13e-4345-a7a9-28173452bf5e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dylan Smith

unread,
Nov 14, 2016, 8:21:22 AM11/14/16
to Python Programming for Autodesk Maya
Hi Nicolas, The attribute is just a float. It does have a relationship, and that's to the output mesh. 

Dylan Smith

unread,
Nov 14, 2016, 11:01:23 PM11/14/16
to Python Programming for Autodesk Maya
For anyone who might be interested, I've figured out what's going on. So the first execution of compute is for the aOutMesh attribute that I've got on my node (which is what I was expecting). However the second execution is a bit odd. The attribute I'm changing on my node is called aNormalOffset, and it's set to be keyable (obviously). For some reason, my node thinks that it needs to compute the output plug of the aNormalOffset attribute, and so calls compute. A simple plug check prevents the extra calculation anyway so its not a big deal. I'm just confused because I've got a node with a similar set up and it doesn't call compute twice. Either way, as long as a proper plug check is in place it shouldn't present any problems (famous last words). Just thought this might be helpful in case anyone else runs into the same issue.
Reply all
Reply to author
Forward
0 new messages