C++ API Reference
MEvaluationNode Class Reference

Provides access to Evaluation Manager node information. More...

#include <MEvaluationNode.h>

Public Member Functions

 ~MEvaluationNode ()
 Destructor.
 
 MEvaluationNode (const MEvaluationNode &evalNode)
 Copy Constructor. More...
 
int parentCount () const
 Returns the number of parent nodes this evaluation node has. More...
 
MEvaluationNode parent (int index) const
 Returns the parent node of this evaluation node at given index. More...
 
int childCount () const
 Returns the number of children nodes this evaluation node has. More...
 
MEvaluationNode child (int index) const
 Returns the child node of this evaluation node at given index. More...
 
MEvaluationNodeIterator iterator (MStatus *ReturnStatus=nullptr) const
 Returns an iterator at the beginning of the dirty plug list. More...
 
bool dirtyPlugExists (const MObject &attribute, MStatus *ReturnStatus=nullptr) const
 Returns true if the specified attribute has a dirty plug. More...
 
MPlug dirtyPlug (const MObject &attribute, MStatus *ReturnStatus=nullptr) const
 Returns the top-most plug for the specified attribute if the attribute has dirty plugs. More...
 
MObject dependencyNode (MStatus *ReturnStatus=nullptr) const
 Returns the dependency node this evaluation node represents. More...
 
MDataBlock datablock (MStatus *ReturnStatus=nullptr) const
 Returns the datablock for this node. More...
 
void connect (MEvaluationNode &child, MStatus *ReturnStatus=nullptr)
 Connect two generic evaluation nodes. More...
 
void skipEvaluation (const MObject &attribute, bool allowSingleDownstreamDependency=false, MStatus *ReturnStatus=nullptr) const
 Hint the Evaluation Manager that the attribute can be skipped for the current evaluation. More...
 
bool skippingEvaluation (const MObject &attribute, MStatus *ReturnStatus=nullptr) const
 Returns true if the attribute was marked to be skipped. More...
 

Static Public Member Functions

static const char * className ()
 Returns the name of this class. More...
 

Detailed Description

Provides access to Evaluation Manager node information.

See also
MEvaluationNodeIterator

An evaluation node and the connections between them form an evaluation graph. Each evaluation context uses a unique evaluation graph with its own set of evaluation nodes. Evaluation graphs are scheduled to speed up the operations within Maya.

This class contains methods for querying which attributes or plugs on a node will be set dirty prior to evaluation by the evaluation manager.

It is sometimes necessary to know the dirty state of plugs/attributes if your node is handling custom information. This handling would be done in the MPxNode preEvaluation()/postEvaluation() methods.

If you need to access the list of dirty plugs in the evaluation node then use the internal iterator:

for( MEvaluationNodeIterator nodeIt = theNode.iterator(); ! nodeIt.isDone(); nodeIt.next() ) { doSomePlugThing( nodeIt.plug() ); }

Examples:
apiMeshShape/apiMeshShape.cpp, apiMeshShape/apiMeshShape.h, basicMorphNode/basicMorphNode.cpp, constraintEvaluator/constraintEvaluator.cpp, evaluationPruningEvaluator/evaluationPruningEvaluator.cpp, footPrintNode/footPrintNode.cpp, footPrintNode_AnimatedMaterial/footPrintNode_GeometryOverride_AnimatedMaterial.cpp, footPrintNode_GeometryOverride/footPrintNode_GeometryOverride.cpp, identityNode/identityNode.cpp, nameFilter/NameFilter.cpp, nameFilter/NameFilter.h, offsetNode/offsetNode.cpp, rawfootPrintNode/rawfootPrintNode.cpp, simpleEvaluationDraw/simpleEvaluationDraw.cpp, simpleEvaluationNode/simpleEvaluationNode.cpp, simpleEvaluator/simpleEvaluator.cpp, simplePhysicsEngine/simplePhysicsEngine.cpp, simpleSimulationNode/simpleSimulationNode.cpp, simpleSkipNode/simpleSkipNode.cpp, testMTopologyEvaluator/testMTopologyEvaluator.cpp, and testMTopologyEvaluator/testMTopologyEvaluator.h.

Constructor & Destructor Documentation

MEvaluationNode ( const MEvaluationNode evalNode)
default

Copy Constructor.

Parameters
[in]evalNodeAn existing evaluation node

Member Function Documentation

int parentCount ( ) const

Returns the number of parent nodes this evaluation node has.

Returns
The number of parent nodes this evauation node has.
Examples:
testMTopologyEvaluator/testMTopologyEvaluator.cpp.
MEvaluationNode parent ( int  index) const

Returns the parent node of this evaluation node at given index.

Parameters
[in]indexIndex of the parent evaluation node to access. No bound check is done so respect parentCount.
Returns
The MEvaluationNode parent object at given index.
Examples:
testMTopologyEvaluator/testMTopologyEvaluator.cpp.
int childCount ( ) const

Returns the number of children nodes this evaluation node has.

Returns
The number of children nodes this evauation node has.
Examples:
testMTopologyEvaluator/testMTopologyEvaluator.cpp.
MEvaluationNode child ( int  index) const

Returns the child node of this evaluation node at given index.

Parameters
[in]indexIndex of the child evaluation node to access. No bound check is done so respect childCount.
Returns
The MEvaluationNode child object at given index.
Examples:
testMTopologyEvaluator/testMTopologyEvaluator.cpp.
MEvaluationNodeIterator iterator ( MStatus ReturnStatus = nullptr) const

Returns an iterator at the beginning of the dirty plug list.

Parameters
[out]ReturnStatusStatus Code
Returns
Iterator positioned at the beginning of the evaluation node's dirty plug list
Status Codes:
  • MS::kSuccess The operation succeeded
  • MS::kFailure Object error - no evaluation node
bool dirtyPlugExists ( const MObject attribute,
MStatus ReturnStatus = nullptr 
) const

Returns true if the specified attribute has a dirty plug.

This call should be made from MPxNode::preEvaluation() and MPxNode::postEvaluation() to verify which plugs are going to be dirty and computed.

Note
Dirty plug is storing top-most array/parent of the plug tree in which given attribute exists. When a new computation starts with the evaluation manager, everything under a dirty plug is considered as dirty and will be computed.
Parameters
[in]attributeAttribute whose root plug is to be checked for membership in the dirty plug list
[out]ReturnStatusStatus Code
Returns
True if the attribute exists in the dirty plug list, otherwise false.
Status Codes:
  • MS::kSuccess The operation succeeded
  • MS::kInvalidParameter MObject parameter is not an attribute
  • MS::kFailure Object error - no plug
Examples:
apiMeshShape/apiMeshShape.cpp, footPrintNode/footPrintNode.cpp, footPrintNode_AnimatedMaterial/footPrintNode_GeometryOverride_AnimatedMaterial.cpp, footPrintNode_GeometryOverride/footPrintNode_GeometryOverride.cpp, rawfootPrintNode/rawfootPrintNode.cpp, simpleEvaluationDraw/simpleEvaluationDraw.cpp, simpleEvaluationNode/simpleEvaluationNode.cpp, and simplePhysicsEngine/simplePhysicsEngine.cpp.
MPlug dirtyPlug ( const MObject attribute,
MStatus ReturnStatus = nullptr 
) const

Returns the top-most plug for the specified attribute if the attribute has dirty plugs.

This call should be made from MPxNode::preEvaluation() and MPxNode::postEvaluation() to access a networked plug which is going to be dirty and computed.

Note
Dirty plug is storing top-most array/parent of the plug tree in which given attribute exists. When a new computation starts with the evaluation manager, everything under a dirty plug is considered as dirty and will be computed.
Parameters
[in]attributeAttribute whose root plug is returned if it is in the dirty plug list
[out]ReturnStatusStatus Code
Returns
The top-most dirty plug for the specified attribute if it exists, a null plug otherwise.
Status Codes:
  • MS::kSuccess The operation succeeded
  • MS::kInvalidParameter MObject parameter is not an attribute
  • MS::kFailure Object error - no plug
MObject dependencyNode ( MStatus ReturnStatus = nullptr) const

Returns the dependency node this evaluation node represents.

Parameters
[out]ReturnStatusStatus Code
Returns
The MObject representing the dependency node for this evaluation node.
Status Codes:
  • MS::kSuccess The operation succeeded
  • MS::kFailure Object error.
Examples:
constraintEvaluator/constraintEvaluator.cpp, evaluationPruningEvaluator/evaluationPruningEvaluator.cpp, nameFilter/NameFilter.cpp, and testMTopologyEvaluator/testMTopologyEvaluator.cpp.
MDataBlock datablock ( MStatus ReturnStatus = nullptr) const

Returns the datablock for this node.

Parameters
[out]ReturnStatusStatus Code
Returns
The MDatablock representing the datablock for this evaluation node.
Status Codes:
  • MS::kSuccess The operation succeeded
  • MS::kFailure Object error.
Examples:
constraintEvaluator/constraintEvaluator.cpp, and testMTopologyEvaluator/testMTopologyEvaluator.cpp.
void connect ( MEvaluationNode child,
MStatus ReturnStatus = nullptr 
)

Connect two generic evaluation nodes.

Generic evaluation nodes are explicitly created by topology evaluators to override topology of base layer evaluation nodes claimed by topology cluster nodes.

Parameters
[in]childGeneric evaluation node to connect as a child
[out]ReturnStatusStatus Code
Status Codes:
  • MS::kSuccess Nodes were connected in evaluation graph
  • MS::kFailure Object error, trying to connect non-generic evaluation nodes
Examples:
testMTopologyEvaluator/testMTopologyEvaluator.cpp.
void skipEvaluation ( const MObject attribute,
bool  allowSingleDownstreamDependency = false,
MStatus ReturnStatus = nullptr 
) const

Hint the Evaluation Manager that the attribute can be skipped for the current evaluation.

This method tries to mark the attribute for the Evaluation Manager to skip its evaluation.

Attributes can be marked for their evaluation to be skipped if it's safe to do so. If the attribute is skipped, it will not be evaluated but will be left dirty so that subsequent pull evaluation will trigger evaluation and report the right value.

If the attribute is animated and driving more than one connected node, it is never safe to skip its evaluation, because the downstream nodes could trigger concurrent, and unsafe, pull evaluation. Therefore, this method does not have an effect if the attribute has more than one downstream dependency.

If the attribute has a single downstream dependency, it is potentially safe. Only a single node can pull on this attribute, but other nodes might be pulling on other attributes on the same node, which could result in a race condition. If the attribute is the only one skipped, the skipEvaluation method can allow a single connection through the allowSingleDownstreamDependency parameter.

If this attribute is not set, the skipEvaluation method will have the safest possible behavior of only skipping the evaluation if there are no downstream dependencies for the attribute to skip.

Note
This method should only be called from MPxNode::preEvaluation().
Skipping evaluation info is stored on the top-most array/parent of the plug tree in which given attribute exists. When skipping an attribute, everything under the top-most array/parent is what is actually considered for skipping.
Parameters
[in]attributeAttribute whose root plug is to be marked for skipping
[in]allowSingleDownstreamDependencyTrue to allow one downstream dependency, false for the safest behavior of allowing none.
[out]ReturnStatusStatus Code
Status Codes:
  • MS::kSuccess The operation succeeded. This does not guarantee the plug is marked for skipping.
  • MS::kInvalidParameter MObject parameter is not an attribute
  • MS::kFailure Object error - not the right type of evaluation node
Examples:
simpleSkipNode/simpleSkipNode.cpp.
bool skippingEvaluation ( const MObject attribute,
MStatus ReturnStatus = nullptr 
) const

Returns true if the attribute was marked to be skipped.

Parameters
[in]attributeAttribute whose root plug is to be checked for skipping
[out]ReturnStatusStatus Code
Status Codes:
  • MS::kSuccess The operation succeeded.
  • MS::kInvalidParameter MObject parameter is not an attribute
  • MS::kFailure Object error - not the right type of evaluation node
const char * className ( )
static

Returns the name of this class.

Returns
Name of this class.

The documentation for this class was generated from the following files: