- Main Page
- Related Pages
- Modules
- Classes
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Friends

# MDataBlock Class Reference

# OpenMaya - API module for common classes

Search for all occurrences

## Detailed 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:

  affectsNode.cpp, animCubeNode.cpp, anisotropicShader.cpp, apiMeshCreator.cpp, apiMeshCreator.h, apiMeshShape.cpp, apiMeshShape.h, arcLenNode.cpp, backfillShader.cpp, blindDataMesh.cpp, blindDataMesh.h, blindDataShader.cpp, blindDataShader.h, brickShader.cpp, buildRotationNode.cpp, cellShader.cpp, cgfxShaderNode.cpp, cgfxShaderNode.h, cgfxVector.cpp, cgfxVector.h, checkerShader.cpp, circleNode.cpp, clearcoat.cpp, closestPointOnCurveNode.cpp, closestPointOnCurveNode.h, compositingShader.cpp, contrastShader.cpp, curvedArrowsNode.cpp, cvColorNode.cpp, cvColorShader.cpp, depthShader.cpp, displacementShader.cpp, dynExprField.cpp, dynExprField.h, exampleMRampAttribute.cpp, flameShader.cpp, footPrintManip.cpp, footPrintNode.cpp, fullLoftNode.cpp, gammaShader.cpp, genericAttributeNode.cpp, geometrySurfaceConstraint.cpp, geometrySurfaceConstraint.h, geomShader.cpp, GLSLShaderNode.cpp, GLSLShaderNode.h, hwColorPerVertexShader.cpp, hwDecalBumpShader_NV20.cpp, hwDecalBumpShader_NV20.h, hwPhongShader.cpp, hwPhongShader.h, hwReflectBumpShader_NV20.cpp, hwReflectBumpShader_NV20.h, hwRefractReflectShader_NV20.cpp, hwRefractReflectShader_NV20.h, hwToonShader_NV20.cpp, hwToonShader_NV20.h, hwUnlitShader.cpp, hwUnlitShader.h, interpShader.cpp, jitterNode.cpp, lambertShader.cpp, latticeNoise.h, latticeNoiseNode.cpp, lavaShader.cpp, lightShader.cpp, meshOpNode.cpp, meshOpNode.h, mixtureShader.cpp, multiCurveNode.cpp, noiseShader.cpp, offsetNode.cpp, ownerEmitter.cpp, ownerEmitter.h, particleAttrNode.cpp, particleAttrNode.h, phongShader.cpp, pointOnMeshInfoNode.cpp, pointOnMeshInfoNode.h, pointOnSubdNode.cpp, pointOnSubdNode.h, polyTrgNode.cpp, quadricShape.cpp, renderAccessNode.cpp, rockingTransform.cpp, rockingTransformCheck.cpp, rockingTransformCheck.h, shadowMatteShader.cpp, shellNode.cpp, shiftNode.cpp, simpleEmitter.cpp, simpleEmitter.h, simpleFluidEmitter.cpp, simpleFluidEmitter.h, simpleLoftNode.cpp, simpleSpring.cpp, simpleSpring.h, sineNode.cpp, slopeShaderNode.cpp, slopeShaderNode.h, solidCheckerShader.cpp, splitUVNode.cpp, splitUVNode.h, stringFormatNode.cpp, sweptEmitter.cpp, sweptEmitter.h, swissArmyManip.cpp, testNobjectNode.cpp, testNobjectNode.h, testNucleusNode.cpp, testNucleusNode.h, torusField.cpp, torusField.h, transCircleNode.cpp, volumeShader.cpp, weightListNode.cpp, and yTwistNode.cpp.

`#include <MDataBlock.h>`

List of all members.

## 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.
MDataHandle | inputValue (const MObject &attribute, MStatus *ReturnStatus=NULL)
| Gets a handle to this data block for the given plug's data.
MDataHandle | outputValue (const MPlug &plug, MStatus *ReturnStatus=NULL)
| Gets a handle to this data block for the given attributes's data.
MDataHandle | outputValue (const MObject &attribute, MStatus *ReturnStatus=NULL)
| Gets a handle to this data block for the given attributes's data.
MArrayDataHandle | inputArrayValue (const MPlug &plug, MStatus *ReturnStatus=NULL)
| Gets an array handle to this data block for the given plug's data.
MArrayDataHandle | inputArrayValue (const MObject &attribute, MStatus *ReturnStatus=NULL)
| Gets an array handle to this data block for the given plug's data.
MArrayDataHandle | outputArrayValue (const MPlug &plug, MStatus *ReturnStatus=NULL)
| Gets a handle to this data block for the given plug.
MArrayDataHandle | outputArrayValue (const MObject &attribute, MStatus *ReturnStatus=NULL)
| Gets a handle to this data block for the given attributes's data.
MStatus | setClean (const MPlug &plug)
| Tells the dependency graph that the given plug has been updated and is now clean.
MStatus | setClean (const MObject &attribute)
| Tells the dependency graph that the given attribute has been updated and is now clean.
bool | isClean (const MPlug &plug)
| Queries the dependency graph to see whether the given plug is clean.
bool | isClean (const MObject &attribute, MStatus *ReturnStatus=NULL)
| Queries the dependency graph to see whether the given attribute is clean.
MDGContext | context (MStatus *ReturnStatus=NULL)
| Returns a copy of the dependecy graph context for which this data block was created.
MStatus | setContext (const MDGContext &ctx)
| Set the dependency graph context for this data block.
## Static Public Member Functions
static const char * | className ()
| Returns the name of this class.
## Friends
class | MArrayDataBuilder Search for all occurrences
class | MPxNode Search for all occurrences
class | MPlug Search for all occurrences

## Member Function Documentation

MDataHandle inputValue | ( | const MPlug & | plug,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Search for all occurrences

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] | plug | the plug whose data you wish to access
  [out] | ReturnStatus | the return status

Returns:
  Data handle for the given plug's data

Status Codes:
  - MS::kSuccess operation successful

Examples:
  affectsNode.cpp, animCubeNode.cpp, anisotropicShader.cpp, apiMeshCreator.cpp, apiMeshShape.cpp, arcLenNode.cpp, backfillShader.cpp, blindDataMesh.cpp, brickShader.cpp, buildRotationNode.cpp, cellShader.cpp, cgfxVector.cpp, checkerShader.cpp, circleNode.cpp, clearcoat.cpp, closestPointOnCurveNode.cpp, compositingShader.cpp, contrastShader.cpp, cvColorNode.cpp, cvColorShader.cpp, depthShader.cpp, displacementShader.cpp, dynExprField.cpp, flameShader.cpp, gammaShader.cpp, genericAttributeNode.cpp, geometrySurfaceConstraint.cpp, geomShader.cpp, hwColorPerVertexShader.cpp, hwPhongShader.cpp, hwToonShader_NV20.cpp, interpShader.cpp, jitterNode.cpp, lambertShader.cpp, latticeNoiseNode.cpp, lavaShader.cpp, lightShader.cpp, meshOpNode.cpp, mixtureShader.cpp, multiCurveNode.cpp, noiseShader.cpp, offsetNode.cpp, ownerEmitter.cpp, ownerEmitter.h, particleAttrNode.cpp, phongShader.cpp, pointOnMeshInfoNode.cpp, pointOnSubdNode.cpp, rockingTransformCheck.cpp, shadowMatteShader.cpp, shiftNode.cpp, simpleEmitter.cpp, simpleEmitter.h, simpleFluidEmitter.cpp, simpleLoftNode.cpp, simpleSpring.h, sineNode.cpp, slopeShaderNode.cpp, solidCheckerShader.cpp, splitUVNode.cpp, stringFormatNode.cpp, sweptEmitter.cpp, sweptEmitter.h, testNobjectNode.cpp, testNucleusNode.cpp, torusField.cpp, torusField.h, transCircleNode.cpp, volumeShader.cpp, and yTwistNode.cpp.

MDataHandle inputValue | ( | const MObject & | attribute,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Search for all occurrences

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] | attribute | the attribute of the node that you want to access
  [out] | ReturnStatus | the return status

Returns:
  Data handle for the given attributes's data

Status Codes:
  - MS::kSuccess operation successful
  - MS::kInvalidParameter object argument is invalid

MDataHandle outputValue | ( | const MPlug & | plug,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Search for all occurrences

Gets a handle to this data block for the given attributes'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] | plug | the plug whose data you wish to access
  [out] | ReturnStatus | the return status

Returns:
  Data handle for the given plug's data

Status Codes:
  - MS::kSuccess operation successful

Examples:
  affectsNode.cpp, animCubeNode.cpp, anisotropicShader.cpp, apiMeshShape.cpp, arcLenNode.cpp, backfillShader.cpp, blindDataMesh.cpp, blindDataShader.cpp, brickShader.cpp, buildRotationNode.cpp, cellShader.cpp, cgfxShaderNode.cpp, cgfxVector.cpp, checkerShader.cpp, circleNode.cpp, clearcoat.cpp, closestPointOnCurveNode.cpp, compositingShader.cpp, contrastShader.cpp, cvColorNode.cpp, cvColorShader.cpp, depthShader.cpp, displacementShader.cpp, flameShader.cpp, fullLoftNode.cpp, gammaShader.cpp, genericAttributeNode.cpp, geometrySurfaceConstraint.cpp, geomShader.cpp, GLSLShaderNode.cpp, hwColorPerVertexShader.cpp, hwDecalBumpShader_NV20.cpp, hwPhongShader.cpp, hwReflectBumpShader_NV20.cpp, hwRefractReflectShader_NV20.cpp, hwToonShader_NV20.cpp, hwUnlitShader.cpp, interpShader.cpp, jitterNode.cpp, lambertShader.cpp, latticeNoiseNode.cpp, lavaShader.cpp, lightShader.cpp, meshOpNode.cpp, mixtureShader.cpp, noiseShader.cpp, particleAttrNode.cpp, phongShader.cpp, pointOnMeshInfoNode.cpp, pointOnSubdNode.cpp, renderAccessNode.cpp, rockingTransform.cpp, rockingTransformCheck.cpp, shadowMatteShader.cpp, shellNode.cpp, shiftNode.cpp, simpleLoftNode.cpp, sineNode.cpp, slopeShaderNode.cpp, solidCheckerShader.cpp, splitUVNode.cpp, stringFormatNode.cpp, testNobjectNode.cpp, transCircleNode.cpp, and volumeShader.cpp.

MDataHandle outputValue | ( | const MObject & | attribute,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Search for all occurrences

Gets a handle to this data block for the given attributes'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] | attribute | the attribute of the node that you want to access
  [out] | ReturnStatus | the 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`
| ) |  |

Search for all occurrences

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] | plug | the plug whose data you wish to access
  [out] | ReturnStatus | the return status

Returns:
  Array data handle for the given attributes's data

Status Codes:
  - MS::kSuccess operation successful
  - MS::kInvalidParameter current element is not an array

Examples:
  anisotropicShader.cpp, backfillShader.cpp, dynExprField.cpp, fullLoftNode.cpp, geometrySurfaceConstraint.cpp, lambertShader.cpp, ownerEmitter.h, phongShader.cpp, shadowMatteShader.cpp, simpleEmitter.h, sweptEmitter.h, testNucleusNode.cpp, and weightListNode.cpp.

MArrayDataHandle inputArrayValue | ( | const MObject & | attribute,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Search for all occurrences

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] | attribute | The attribute whose data you wish to access
  [out] | ReturnStatus | The return status

Returns:
  Array data handle for the given attributes's data

Status Codes:
  - MS::kSuccess operation successful
  - MS::kInvalidParameter object argument is invalid

MArrayDataHandle outputArrayValue | ( | const MPlug & | plug,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Search for all occurrences

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] | plug | the plug whose data you wish to access
  [out] | ReturnStatus | the 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:
  apiMeshShape.cpp, dynExprField.cpp, multiCurveNode.cpp, ownerEmitter.cpp, simpleEmitter.cpp, stringFormatNode.cpp, sweptEmitter.cpp, and torusField.cpp.

MArrayDataHandle outputArrayValue | ( | const MObject & | attribute,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Search for all occurrences

Gets a handle to this data block for the given attributes'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] | attribute | the attribute of the node that you want to access
  [out] | ReturnStatus | the 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 | ) |

Search for all occurrences

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] | plug | the plug that is to be marked clean

Returns:
  Result status code

Status Codes:
  - MS::kSuccess operation successful
  - MS::kInvalidParameter object argument is invalid

Examples:
  affectsNode.cpp, animCubeNode.cpp, anisotropicShader.cpp, apiMeshCreator.cpp, arcLenNode.cpp, blindDataMesh.cpp, cgfxVector.cpp, circleNode.cpp, closestPointOnCurveNode.cpp, cvColorNode.cpp, dynExprField.cpp, fullLoftNode.cpp, genericAttributeNode.cpp, geometrySurfaceConstraint.cpp, hwColorPerVertexShader.cpp, jitterNode.cpp, latticeNoiseNode.cpp, ownerEmitter.cpp, pointOnMeshInfoNode.cpp, pointOnSubdNode.cpp, shellNode.cpp, simpleEmitter.cpp, simpleLoftNode.cpp, sineNode.cpp, sweptEmitter.cpp, testNobjectNode.cpp, testNucleusNode.cpp, torusField.cpp, and transCircleNode.cpp.

MStatus setClean | ( | const MObject & | attribute | ) |

Search for all occurrences

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] | attribute | the 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 | ) |

Search for all occurrences

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

Parameters:

  [in] | plug | the 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`
| ) |  |

Search for all occurrences

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

Parameters:

  [in] | attribute | The attribute to query.
  [out] | ReturnStatus | Status 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` | ) |

Search for all occurrences

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] | ReturnStatus | Status code

Returns:
  The dependency graph context

Status Codes:
  - MS::kSuccess operation successful
  - MS::kInvalidParameter object error

Examples:
  rockingTransformCheck.cpp.

MStatus setContext | ( | const MDGContext & | ctx | ) |

Search for all occurrences

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] | ctx | the dependency graph context

Returns:
  Status code

Status Codes:
  - MS::kSuccess operation successful
  - MS::kInvalidParameter object error

const char * className | ( |  | ) | `[static]`

Search for all occurrences

Returns the name of this class.

Returns:
  Name of this class.

MDataBlock MDataBlock MDataBlock MDataBlock MDataBlock MDataBlock MDataBlock MDataBlock MDataBlock MDataBlock
MDataBlock MDataBlock MDataBlock MDataBlock MDataBlock MDataBlock MDataBlock MDataBlock MDataBlock MDataBlock