When you start Maya 2016, you will automatically be in parallel evaluation mode. This is new default evaluation mode, replacing the legacy DG-based evaluation. Maya 2016 uses the DG’s dirty propagation mechanism to build the Evaluation Graph(EG). Dirty propagation is the process of walking through the DG, from animation curves to renderable objects, and marking attributes on DG nodes as needing to be re-evaluated (i.e., dirty). Unlike previous version of Maya that propagated dirty on every frame, Maya 2016 disables the dirty propagation once the EG is built, re-using the existing EG until it becomes invalid.
If your plug-in relies on custom dependency management, you’ll need to use new API extensions to ensure a correct evaluation. Since the EG is created using the legacy dirty-propagation mechanism, you’ll need to make sure your custom logic in the MPxNode::setDependentsDirty() method override are accounted for.
New MPxNode::preEvaluation API
To avoid performing expensive calculations every time MPxNode::compute() is called, one strategy plug-in developers can use is to store the results from previous evaluations and then relying on MPxNode::setDependentsDirty() to trigger re-computation. Once the EG has been built, the dirty propagation is disabled and the EG is re-used. Therefore, any custom logic in your plug-in that depends on setDependentsDirty() will no longer apply.
MPxNode::preEvaluation() allows your plug-in to determine which plugs/attributes are dirty and if any action is needed. This is usually only done within the MDGContext::fsNormal context. The new MEvaluationNode class can be used to determine what has been dirtied.
See the simpleEvaluationNode devkit example to understand how to use MPxNode::preEvaluation() method.
New MPxNode::postEvaluation API
Until now it was difficult to determine when all processing for a particular node instance was complete. Users sometimes resorted to complex bookkeeping/callbacks schemes to detect this situation and perform additional work, such as custom rendering. This mechanism was cumbersome and error prone. A new method, MPxNode::postEvaluation(), is called once all computations have been performed on a specific node instance. Since this method is called from a worker thread, it is possible to perform calculations for downstream graph operations, without blocking other Maya processing tasks.
See the simpleEvaluationDraw devkit example to understand how to use MPxNode::postEvaluation() method.
Comments
You can follow this conversation by subscribing to the comment feed for this post.