MDataBlock Class Reference

#include <MDataBlock.h>

Class Description

Dependency node data block.

An MDataBlock provides storage for the data being received by or sent by the node. It is the data for the plugs and attributes of the node. The data block is only valid during the compute method of the depend node. Pointers to the data block should not be retained after the compute method.

Access to the data in an MDataBlock is done using an MDataHandle or an MArrayDataHandle.

+ Examples:

Public Member Functions

virtual ~MDataBlock ()
 The class destructor.
 
MDataHandle inputValue (const MPlug &plug, MStatus *ReturnStatus=NULL)
 Gets a handle to this data block for the given plug's data. More...
 
MDataHandle inputValue (const MObject &attribute, MStatus *ReturnStatus=NULL)
 Gets a handle to this data block for the given attribute's data. More...
 
MDataHandle outputValue (const MPlug &plug, MStatus *ReturnStatus=NULL)
 Gets a handle to this data block for the given plug's data. More...
 
MDataHandle outputValue (const MObject &attribute, MStatus *ReturnStatus=NULL)
 Gets a handle to this data block for the given attribute's data. More...
 
MArrayDataHandle inputArrayValue (const MPlug &plug, MStatus *ReturnStatus=NULL)
 Gets an array handle to this data block for the given plug's data. More...
 
MArrayDataHandle inputArrayValue (const MObject &attribute, MStatus *ReturnStatus=NULL)
 Gets an array handle to this data block for the given attribute's data. More...
 
MArrayDataHandle outputArrayValue (const MPlug &plug, MStatus *ReturnStatus=NULL)
 Gets a handle to this data block for the given plug. More...
 
MArrayDataHandle outputArrayValue (const MObject &attribute, MStatus *ReturnStatus=NULL)
 Gets a handle to this data block for the given attribute's data. More...
 
MStatus setClean (const MPlug &plug)
 Tells the dependency graph that the given plug has been updated and is now clean. More...
 
MStatus setClean (const MObject &attribute)
 Tells the dependency graph that the given attribute has been updated and is now clean. More...
 
bool isClean (const MPlug &plug)
 Queries the dependency graph to see whether the given plug is clean. More...
 
bool isClean (const MObject &attribute, MStatus *ReturnStatus=NULL)
 Queries the dependency graph to see whether the given attribute is clean. More...
 
MDGContext context (MStatus *ReturnStatus=NULL)
 Returns a copy of the dependecy graph context for which this data block was created. More...
 
MStatus setContext (const MDGContext &ctx)
 Set the dependency graph context for this data block. More...
 

Static Public Member Functions

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

Friends

class MArrayDataBuilder
 
class MEvaluationNode
 
class MDataHandle
 
class MPxNode
 
class MPxAssembly
 
class MPlug
 

Member Function Documentation

MDataHandle inputValue ( const MPlug plug,
MStatus ReturnStatus = NULL 
)

Gets a handle to this data block for the given plug's data.

The data represented by the handle is guaranteed to be valid for reading. If the data is from a dirty connection, then the connection will be evaluated. If no connection is present, then the value that the plug has been set to will be returned. If the plug has not been set to a particular value, then the default value will be returned.

Parameters
[in]plugthe plug whose data you wish to access
[out]ReturnStatusthe return status
Returns
Data handle for the given plug's data
Status Codes:
  • MS::kSuccess operation successful
+ Examples:
MDataHandle inputValue ( const MObject attribute,
MStatus ReturnStatus = NULL 
)

Gets a handle to this data block for the given attribute's data.

The data represented by the handle is guaranteed to be valid for reading. If the data is from a dirty connection, then the connection will be evaluated. If no connection is present, then the value that the attribute has been set to will be returned. If the attribute has not been set to a particular value, then the default value will be returned.

Parameters
[in]attributethe attribute of the node that you want to access
[out]ReturnStatusthe return status
Returns
Data handle for the given attribute's data
Status Codes:
  • MS::kSuccess operation successful
  • MS::kInvalidParameter object argument is invalid
MDataHandle outputValue ( const MPlug plug,
MStatus ReturnStatus = NULL 
)

Gets a handle to this data block for the given plug's data.

The data is not guaranteed to be valid. No dependency graph evaluations will be done. Therefore, this handle should be used only for writing.

Parameters
[in]plugthe plug whose data you wish to access
[out]ReturnStatusthe return status
Returns
Data handle for the given plug's data
Status Codes:
  • MS::kSuccess operation successful
+ Examples:
MDataHandle outputValue ( const MObject attribute,
MStatus ReturnStatus = NULL 
)

Gets a handle to this data block for the given attribute's data.

The data is not guaranteed to be valid. No dependency graph evaluations will be done. Therefore, this handle should be used only for writing.

Parameters
[in]attributethe attribute of the node that you want to access
[out]ReturnStatusthe return status
Returns
Data handle for the given attribute's data
Status Codes:
  • MS::kSuccess operation successful
  • MS::kInvalidParameter object argument is invalid
MArrayDataHandle inputArrayValue ( const MPlug plug,
MStatus ReturnStatus = NULL 
)

Gets an array handle to this data block for the given plug's data.

This is only valid if the given plug has array data. The data represented by the handle will be valid. If the data is from a dirty connection, then the connection will be evaluated. If no connection is present, then the value that the plug has been set to will be returned. If the plug has not been set to a particular value, then the default value will be returned.

Parameters
[in]plugthe plug whose data you wish to access
[out]ReturnStatusthe return status
Returns
Array data handle for the given plug's data
Status Codes:
  • MS::kSuccess operation successful
  • MS::kInvalidParameter current element is not an array
+ Examples:
MArrayDataHandle inputArrayValue ( const MObject attribute,
MStatus ReturnStatus = NULL 
)

Gets an array handle to this data block for the given attribute's data.

This is only valid if the given attribute has array data. The data represented by the handle will be valid. If the data is from a dirty connection, then the connection will be evaluated. If no connection is present, then the value that the attribute has been set to will be returned. If the attribute has not been set to a particular value, then the default value will be returned.

Parameters
[in]attributeThe attribute whose data you wish to access
[out]ReturnStatusThe return status
Returns
Array data handle for the given attribute's data
Status Codes:
  • MS::kSuccess operation successful
  • MS::kInvalidParameter object argument is invalid
MArrayDataHandle outputArrayValue ( const MPlug plug,
MStatus ReturnStatus = NULL 
)

Gets a handle to this data block for the given plug.

No dependency graph evaluations will be done, and therefore the data is not guaranteed to be valid (i.e. it may be dirty). Typically, this method is used to get the handle during compute in order to write output data to it.

Another usage of this method is to access an input array attribute without evaluating any of its array elements. One can then use MArrayDataHandle::jumpToElement to get to the particular element of interest, and evaluate its value using MArrayDataHandle::inputValue.

Parameters
[in]plugthe plug whose data you wish to access
[out]ReturnStatusthe return status
Returns
Array data handle for the given plug's data
Status Codes:
  • MS::kSuccess operation successful
  • MS::kInvalidParameter current element is not an array
+ Examples:
MArrayDataHandle outputArrayValue ( const MObject attribute,
MStatus ReturnStatus = NULL 
)

Gets a handle to this data block for the given attribute's data.

The data is not guaranteed to be valid. No dependency graph evaluations will be done. Therefore, this handle should be used only for writing.

Parameters
[in]attributethe attribute of the node that you want to access
[out]ReturnStatusthe return status
Returns
Array data handle for the given attribute's data
Status Codes:
  • MS::kSuccess operation successful
  • MS::kInvalidParameter object argument is invalid
MStatus setClean ( const MPlug plug)

Tells the dependency graph that the given plug has been updated and is now clean.

This should be called after the data in the plug has been recalculated from the inputs of the node.

Parameters
[in]plugthe plug that is to be marked clean
Returns
Result status code
Status Codes:
  • MS::kSuccess operation successful
  • MS::kInvalidParameter object argument is invalid
+ Examples:
MStatus setClean ( const MObject attribute)

Tells the dependency graph that the given attribute has been updated and is now clean.

This should be called after the data in the plug has been recalculated from the inputs of the node.

Parameters
[in]attributethe attribute that we have updated the data for
Returns
Result status code
Status Codes:
  • MS::kSuccess operation successful
  • MS::kInvalidParameter object argument is invalid
bool isClean ( const MPlug plug)

Queries the dependency graph to see whether the given plug is clean.

Parameters
[in]plugthe plug that is to be query
Returns
Result boolean code, true if plug is clean, false otherwise.
bool isClean ( const MObject attribute,
MStatus ReturnStatus = NULL 
)

Queries the dependency graph to see whether the given attribute is clean.

Parameters
[in]attributeThe attribute to query.
[out]ReturnStatusStatus code.
Returns
true if the attribute is clean, false otherwise.
Status Codes:
  • MS::kSuccess operation successful.
  • MS::kInvalidParameter The attribute is invalid.
MDGContext context ( MStatus ReturnStatus = NULL)

Returns a copy of the dependecy graph context for which this data block was created.

The context is used to specify how a dependency node is going to be evaluated.

Parameters
[out]ReturnStatusStatus code
Returns
The dependency graph context
Status Codes:
  • MS::kSuccess operation successful
  • MS::kInvalidParameter object error
+ Examples:
MStatus setContext ( const MDGContext ctx)

Set the dependency graph context for this data block.

The context is used to specify how a dependency node is going to be evaluated, thus replacing the context for the given datablock. This does not modify the dirty state of the datablock so that they apply to the new context.

This function should not be used for timed evaluation.

Parameters
[in]ctxthe dependency graph context
Returns
Status code
Status Codes:
  • MS::kSuccess operation successful
  • MS::kInvalidParameter object error
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:
  • MDataBlock.h
  • MDataBlock.cpp