C++ API Reference

Dependency graph (DG) context class. More...

#include <MDGContext.h>

Public Member Functions

 MDGContext ()
 Constructor. More...
 
 MDGContext (const MTime &when)
 Constructor. More...
 
 MDGContext (const MDGContext &in)
 Copy constructor. More...
 
 ~MDGContext ()
 Destructor.
 
bool isNormal (MStatus *ReturnStatus=NULL) const
 Determines if this context is that of "normal" evaluation. More...
 
MStatus getTime (MTime &) const
 Return the single time for which this context is valid. More...
 
MDGContextoperator= (const MDGContext &other)
 Assignment operator. More...
 
bool isCurrent (MStatus *ReturnStatus=NULL) const
 Determines if this context is the one currently being used for evaluation. More...
 
const MDGContext makeCurrent (MStatus *ReturnStatus=NULL) const
 Set the context to be the current evaluation context. More...
 

Static Public Member Functions

static const char * className ()
 Returns the name of this class. More...
 
static const MDGContext current ()
 Extract the current context being used for evaluation. More...
 

Detailed Description

Dependency graph (DG) context class.

Control the way in which dependency nodes are evaluated.

DG contexts are used to define the way in which a dependency node is going to be evaluated. Examples of such contexts include "normal", "at a given time, "for a specific instance", etc.

MDGContext is mainly used in two places; within methods that trigger evaluations, to define what kind of evaluate is being requested, and within data blocks (MDataBlock), to identify how the data was created.

There is always the notion of the "current evaluation context". That's the one that will be used when no context is specifically mentioned, and is the normal state of evaluation.

Note
In the past the current and normal context were the same thing. With the advent of background evaluation and caching this is no longer necessarily true. Always use the current context, unless you mean to deliberately change to a specific context.
Examples:
apiMeshShape/apiMeshShape.cpp, apiMeshShape/apiMeshShape.h, atomImportExport/atomCachedPlugs.cpp, atomImportExport/atomCachedPlugs.h, atomImportExport/atomImportExport.cpp, footPrintNode/footPrintNode.cpp, footPrintNode_AnimatedMaterial/footPrintNode_GeometryOverride_AnimatedMaterial.cpp, footPrintNode_GeometryOverride/footPrintNode_GeometryOverride.cpp, rawfootPrintNode/rawfootPrintNode.cpp, simpleEvaluationDraw/simpleEvaluationDraw.cpp, simpleEvaluationNode/simpleEvaluationNode.cpp, simplePhysicsEngine/simplePhysicsEngine.cpp, simpleSkipNode/simpleSkipNode.cpp, testMTopologyEvaluator/testMTopologyEvaluator.cpp, and testMTopologyEvaluator/testMTopologyEvaluator.h.

Constructor & Destructor Documentation

Constructor.

Creates a context to define the way in which a dependency node is evaluated. In this case the new context will be for a normal evaluation.

MDGContext ( const MTime atTime)

Constructor.

Creates a context to define the way in which a dependency node is evaluated. In this case the new context will be for an evaluation at a specific time.

Note
No data is kept between each creation of MDGContext at different times. Therefore timed contexts can't be used for cases where a value depends of the result of a previous frame, like simulation. Simulation nodes that don't work well with time contexts include cloth, particle, rigid body, follicle, hair, muscle, and fluid.
Parameters
[in]atTimeThe time in which the evaluation will take place
MDGContext ( const MDGContext other)

Copy constructor.

Duplicates the given DG context.

Parameters
[in]otherDG context to be copied.

Member Function Documentation

bool isNormal ( MStatus ReturnStatus = NULL) const

Determines if this context is that of "normal" evaluation.

Parameters
[out]ReturnStatusStatus code
Returns
  • true this context is normal
  • false this context is not normal
Status Codes:
  • MS::kSuccess Method was successful
  • MS::kFailure Object error
Examples:
apiMeshShape/apiMeshShape.cpp, footPrintNode/footPrintNode.cpp, rawfootPrintNode/rawfootPrintNode.cpp, simpleEvaluationDraw/simpleEvaluationDraw.cpp, simpleEvaluationNode/simpleEvaluationNode.cpp, and simplePhysicsEngine/simplePhysicsEngine.cpp.
MStatus getTime ( MTime timeVal) const

Return the single time for which this context is valid.

The context must be a timed context, i.e. not a normal one.

Parameters
[out]timeValStorage for the time
Returns
Status Code
Status Codes:
  • MS::kSuccess The time was successfully returned
  • MS::kFailure Context is not timed
MDGContext & operator= ( const MDGContext other)

Assignment operator.

Copies the RHS into this context.

Parameters
[in]otherDG context to be copied.
const char * className ( )
static

Returns the name of this class.

Returns
Name of this class.
const MDGContext current ( )
static

Extract the current context being used for evaluation.

Returns
Current evaluation context
Examples:
simpleEvaluationNode/simpleEvaluationNode.cpp.
bool isCurrent ( MStatus ReturnStatus = NULL) const

Determines if this context is the one currently being used for evaluation.

Parameters
[out]ReturnStatusStatus code
Returns
  • true this context is currently being used for evaluation
  • false this context is not currently being used for evaluation
Status Codes:
  • MS::kSuccess Method was successful
  • MS::kFailure Object error
const MDGContext makeCurrent ( MStatus ReturnStatus = NULL) const

Set the context to be the current evaluation context.

Parameters
[out]ReturnStatusStatus code
Returns
Previous current evaluation context
Status Codes:
  • MS::kSuccess Method was successful
  • MS::kFailure Object error

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