MPxCustomEvaluator Class Reference

#include <MPxCustomEvaluator.h>

Class Description

Base class for custom evaluation overrides in the evaluation manager.

+ Examples:

Public Types

enum  ConsolidationType { kConsolidateNone, kConsolidateSubgraph, kConsolidateFlood }
 Defines the type of consolidation during cluster creation. More...
 

Public Member Functions

 MPxCustomEvaluator ()
 Constructor. More...
 
 ~MPxCustomEvaluator ()
 Destructor.
 
bool active (MStatus *ReturnStatus=NULL) const
 Is evaluator active. More...
 
void setActive (bool isNowActive, MStatus *ReturnStatus=NULL)
 Change evaluator active state. More...
 
bool ready (MStatus *ReturnStatus=NULL) const
 Is evaluator ready to be used for evaluation. More...
 
void setReady (bool isNowReady, MStatus *ReturnStatus=NULL)
 Change evaluator ready state. More...
 
ConsolidationType consolidation (MStatus *ReturnStatus=NULL) const
 Get current consolidation type used during cluster creation. More...
 
void setConsolidation (ConsolidationType newType, MStatus *ReturnStatus=NULL)
 Set the consolidation type to be used when clusters are created. More...
 
virtual bool markIfSupported (const MEvaluationNode *node)
 Mark supported nodes. More...
 
virtual void preEvaluate (const MEvaluationGraph *graph)
 Called just before a graph evaluation starts. More...
 
virtual void postEvaluate (const MEvaluationGraph *graph)
 Called just after a graph evaluation finishes. More...
 
virtual bool clusterInitialize (const MCustomEvaluatorClusterNode *cluster)
 Prepare cluster for evaluation. More...
 
virtual bool clusterReady (const MCustomEvaluatorClusterNode *cluster)
 Check to see if the cluster is ready for evaluation. More...
 
virtual void clusterTerminate (const MCustomEvaluatorClusterNode *cluster)
 Cleanup for cluster. More...
 
virtual void clusterEvaluate (const MCustomEvaluatorClusterNode *cluster)
 Evaluate given cluster (will only receive clusters that belong to this evaluator) More...
 

Static Public Member Functions

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

Friends

class MCustomEvaluatorClusterNode
 
class MEvaluationNodeIterator
 
class MFnPlugin
 

Member Enumeration Documentation

Defines the type of consolidation during cluster creation.

Enumerator
kConsolidateNone 

Create single cluster per node/cycle cluster.

kConsolidateSubgraph 

Group nodes to form subgraph cluster, favoring long clusters.

kConsolidateFlood 

Group nodes to form subgraph cluster, favoring big clusters and partitioning speed.

Constructor & Destructor Documentation

Constructor.

Also creates our internal evaluator.

Member Function Documentation

bool active ( MStatus ReturnStatus = NULL) const

Is evaluator active.

Parameters
[out]ReturnStatusReturns success or object error when internal object is not associated with this evaluator
Returns
true if evaluator should receive scheduling then evaluation notifications.
void setActive ( bool  isNowActive,
MStatus ReturnStatus = NULL 
)

Change evaluator active state.

Parameters
[in]isNowActiveNew active state
[out]ReturnStatusReturns success or object error when internal object is not associated with this evaluator
bool ready ( MStatus ReturnStatus = NULL) const

Is evaluator ready to be used for evaluation.

Parameters
[out]ReturnStatusReturns success or object error when internal object is not associated with this evaluator
Returns
true when evaluator is ready for to preform evaluation
void setReady ( bool  isNowReady,
MStatus ReturnStatus = NULL 
)

Change evaluator ready state.

Parameters
[in]isNowReadyNew ready state
[out]ReturnStatusReturns success or object error when internal object is not associated with this evaluator
MPxCustomEvaluator::ConsolidationType consolidation ( MStatus ReturnStatus = NULL) const

Get current consolidation type used during cluster creation.

Parameters
[out]ReturnStatusReturns success or object error when internal object is not associated with this evaluator
Returns
Current consolidation type set for this evaluator
void setConsolidation ( MPxCustomEvaluator::ConsolidationType  newType,
MStatus ReturnStatus = NULL 
)

Set the consolidation type to be used when clusters are created.

Parameters
[in]newTypeNew consolidation type to set for this evaluator
[out]ReturnStatusReturns success or object error when internal object is not associated with this evaluator
bool markIfSupported ( const MEvaluationNode node)
virtual

Mark supported nodes.

This call marks node as supported by the evaluator. It is safe to cause evaluation in this call, but this evaluation cost will increase partitioning time and won't reduce the next evaluation time. It is up to the developer to decide whether evaluation is required or the already-evaluated data in the datablock can be used. Call .outputValue/.outputArrayValue in the first case and .inputValue/.inputArrayValue in the second (the first is preferred).

Zero, one or more nodes can be marked by this call, since the dependency node design can involve multiple nodes being joined in a single setup (e.g. IK chains).

Parameters
[in]nodeNode to set or clear supported bit
+ Examples:
void preEvaluate ( const MEvaluationGraph graph)
virtual

Called just before a graph evaluation starts.

Parameters
[in]graphGraph that is just about to begin evaluation
+ Examples:
void postEvaluate ( const MEvaluationGraph graph)
virtual

Called just after a graph evaluation finishes.

Parameters
[in]graphGraph that has just finished evaluation
+ Examples:
bool clusterInitialize ( const MCustomEvaluatorClusterNode cluster)
virtual

Prepare cluster for evaluation.

This is called just before the cluster begins evaluation.

Parameters
[in]clusterCluster node to initialize
Returns
true if initialization was successful
+ Examples:
bool clusterReady ( const MCustomEvaluatorClusterNode cluster)
virtual

Check to see if the cluster is ready for evaluation.

It can happen that cluster initialization takes longer and is performed in a background thread. Instead of waiting, the evaluation manager will compute the cluster's node values using an evaluation node until the evaluator is ready to take over.

It is safe and allowed for custom evaluator to switch back to unready state.

Parameters
[in]clusterCluster node to check for readiness
Returns
true if the cluster is ready for evaluation
void clusterTerminate ( const MCustomEvaluatorClusterNode cluster)
virtual

Cleanup for cluster.

The cluster will be deleted every time the graph is invalidated, but it's up to the custom evaluator to decide if it wants to clear its internal representation or maybe it's possible to have some of this setup reusable.

To reuse internal representation of an cluster, developer can decide to keep hash of depend nodes that were in the cluster.

Parameters
[in]clusterCluster node to terminate
+ Examples:
void clusterEvaluate ( const MCustomEvaluatorClusterNode cluster)
virtual

Evaluate given cluster (will only receive clusters that belong to this evaluator)

Parameters
[in]clusterCluster node to evaluate
+ Examples:
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:
  • MPxCustomEvaluator.h
  • MPxCustomEvaluator.cpp