Python API 2 MPxNode stops evaluating when adding keyframe to input transforms

Python API 2 MPxNode stops evaluating when adding keyframe to input transforms

Anonymous
Not applicable
819 Views
2 Replies
Message 1 of 3

Python API 2 MPxNode stops evaluating when adding keyframe to input transforms

Anonymous
Not applicable

I am writing an MPxNode in Python API 2 to implement a custom IK solver - My setup is Windows 10, Maya 2019

 

I take an input world matrix of a locator used as an end effector and calculates output angles.

This works nicely when I am simply moving the locator around in the viewport. However, as soon as I add a keyframe to the locator and scrub in the timeline, my node no longer evaluates.

 

This issue happens both for Evaluation Mode: "Parallel" and "Serial", but works correctly in "DG"

 

While the solution might be to simply use DG evaluation mode, my workflow would be significantly impacted by not having cached playback, so I would love to find a workaround.

 

Can anyone think of why this may happen and how to fix it or investigate further?

 

Cheers and thanks in advance

0 Likes
820 Views
2 Replies
Replies (2)
Message 2 of 3

jmreinhart
Advisor
Advisor

One of the difference between DG and Parallel is that if you are using Paralllel evaluation,  the setDependentsDirty method will not evaluate. That could be your issue. You're intended to use the preEvaluate method instead for Parallel, but the documentation on that method is a bit lacking. 

0 Likes
Message 3 of 3

Anonymous
Not applicable

Mmm. I have seen that mentioned several places now but I cannot figure out exactly what it refers to.

I am not intentionally using setDependentsDirty but I may be missing something.

 

My node is doing the following:

1) reading input attributes

2) doing its thing and setting output plugs

ie: "out_data_handle.setMAngle(angle)"
3) marking all output plugs as clean

ie: "out_data_handle.setClean()"

 

So, I am cleaning the plugs, but I assume that this isn't the same as setDependsDirty?

 

I will look further into preEvaluate in any case

 

Cheers

0 Likes