C++ API Reference

DAG Path. More...

#include <MDagPath.h>

Public Member Functions

 MDagPath ()
 Class Constructor. More...
 
 MDagPath (const MDagPath &src)
 Copy constructor. More...
 
virtual ~MDagPath ()
 Class Destructor. More...
 
MStatus getAllPathsBelow (MDagPathArray &pathArray)
 Return all paths to leaf objects below this path excluding transforms. More...
 
bool hasFn (MFn::Type type, MStatus *ReturnStatus=nullptr) const
 Returns true if the object at the end of this DAG path supports the given function set. More...
 
MFn::Type apiType (MStatus *ReturnStatus=nullptr) const
 Returns the type of the object at the end of the path. More...
 
bool isValid (MStatus *ReturnStatus=nullptr) const
 Determines if Path is valid. More...
 
MObject node (MStatus *ReturnStatus=nullptr) const
 Retrieves the DAG Node for this DAG Path. More...
 
MObject transform (MStatus *ReturnStatus=nullptr) const
 Retrieves the lowest Transform in the DAG Path. More...
 
unsigned int length (MStatus *ReturnStatus=nullptr) const
 Determines the number of DAG Nodes in the Path not including the root. More...
 
MStatus extendToShape ()
 If the object at the end of this path is a transform and there is a shape node directly beneath it in the hierarchy, then the path is extended to that geometry node. More...
 
MStatus extendToShapeDirectlyBelow (unsigned int)
 This method is used if the end of the path is a transform and there are shapes directly below the transform. More...
 
MStatus numberOfShapesDirectlyBelow (unsigned int &) const
 If the object at the end of this path is a transform, this method will return the number of shapes directly below the transform. More...
 
MStatus push (const MObject &child)
 Push an object onto the end of the path. More...
 
MStatus pop (unsigned int num=1)
 Pop the given number of objects off of the end of the path. More...
 
unsigned int childCount (MStatus *ReturnStatus=nullptr) const
 Return the number of children that the object at the end of the path has. More...
 
MObject child (unsigned int i, MStatus *ReturnStatus=nullptr) const
 Return the child object at the given index, where the parent is the object at the end of the path. More...
 
MMatrix inclusiveMatrix (MStatus *ReturnStatus=nullptr) const
 Determines the inclusive matrix of the Path. More...
 
MMatrix exclusiveMatrix (MStatus *ReturnStatus=nullptr) const
 Determines the exclusive matrix of the Path. More...
 
MMatrix inclusiveMatrixInverse (MStatus *ReturnStatus=nullptr) const
 Determines the inverse inclusive matrix of the Path. More...
 
MMatrix exclusiveMatrixInverse (MStatus *ReturnStatus=nullptr) const
 Determines the inverse exclusive matrix of the Path. More...
 
MDagPathoperator= (const MDagPath &src)
 Assigns the DAG Path on the RHS of the operator to the DAG Path on the LHS. More...
 
bool operator== (const MDagPath &src) const
 Determines if the DAG Path on the LHS of the operator is equal to the DAG Path on the RHS. More...
 
MStatus set (const MDagPath &src)
 Sets this DAG Path equal to the specified DAG Path. More...
 
unsigned int pathCount (MStatus *ReturnStatus=nullptr) const
 Return the number of paths which make up this path. More...
 
MStatus getPath (MDagPath &path, unsigned int i=0) const
 Return the i'th path. More...
 
MString fullPathName (MStatus *ReturnStatus=nullptr) const
 Return a string representing the full path from the root of the dag to this object. More...
 
MString partialPathName (MStatus *ReturnStatus=nullptr) const
 Return a string representing the partial path from the root of the dag to this object. More...
 
bool isInstanced (MStatus *ReturnStatus=nullptr) const
 Returns true if the object at the end of the DAG path is instanced. More...
 
unsigned int instanceNumber (MStatus *ReturnStatus=nullptr) const
 For an instanced object, this returns the instance number that this path represents in the DAG. More...
 
bool isVisible (MStatus *ReturnStatus=nullptr) const
 Returns true if the DAG Node at the end of the path is visible to the viewport. More...
 
bool isTemplated (MStatus *ReturnStatus=nullptr) const
 Returns true if the DAG Node at the end of the path is templated. More...
 
MDAGDrawOverrideInfo getDrawOverrideInfo () const
 Get the draw override information for the given path. More...
 

Static Public Member Functions

static MStatus getAllPathsTo (const MObject &node, MDagPathArray &pathArray)
 Determines all Paths to the specified DAG Node. More...
 
static MStatus getAPathTo (const MObject &node, MDagPath &path)
 Determines the Path to the specified DAG Node. More...
 
static MStatus matchTransform (const MDagPath &source, const MDagPath &target, const MDagPath &relative, MTransformationMatrix &transformationMatrix, bool preserveOffsetParentMatrix=true, bool preservePivot=true, bool preservePivotOffset=false)
 Introduced in 2022.0 More...
 
static const char * className ()
 Returns the name of this class. More...
 
static MDagPath getAPathTo (const MObject &node, MStatus *ReturnStatus=nullptr)
 Deprecated in 2019.0 More...
 

Detailed Description

DAG Path.

Provides methods for obtaining one or all Paths to a specified DAG Node, determining if a Path is valid and if two Paths are equivalent, obtaining the length, transform, and inclusive and exclusive matrices of a Path, as well as performing Path to Path assignment.

DAG Paths may be used as parameters to some methods in the DAG Node Function Set (MFnDagNode).

It is often useful to combine DAG Paths into DAG Path arrays (MDagPathArray).

Use this DAG Path Class to obtain and query Paths to DAG Nodes. A DAG path is a path from the world node to a particular object in the DAG.

If a DAG object is instanced, then an MDagPath is required to identify a particular instance. DAG paths are also required when doing world space transformations.

Use this class in conjunction with the DAG Iterator (MItDag), DAG Node Function Set (MFnDagNode) and DAG Path Array class (MDagPathArray) to query and edit the DAG.

Examples:
AbcBullet/AbcBullet.cpp, AbcBullet/AbcWriteJob.cpp, AbcBullet/AbcWriteJob.h, AbcBullet/MayaTransformCollectionWriter.cpp, AbcBullet/MayaTransformCollectionWriter.h, AbcBullet/MayaTransformWriter.cpp, AbcBullet/MayaTransformWriter.h, AbcBullet/MayaUtility.cpp, AbcBullet/MayaUtility.h, AbcExport/AbcExport.cpp, AbcExport/AbcWriteJob.cpp, AbcExport/AbcWriteJob.h, AbcExport/MayaCameraWriter.cpp, AbcExport/MayaCameraWriter.h, AbcExport/MayaLocatorWriter.cpp, AbcExport/MayaLocatorWriter.h, AbcExport/MayaMeshWriter.cpp, AbcExport/MayaMeshWriter.h, AbcExport/MayaNurbsCurveWriter.cpp, AbcExport/MayaNurbsCurveWriter.h, AbcExport/MayaNurbsSurfaceWriter.cpp, AbcExport/MayaNurbsSurfaceWriter.h, AbcExport/MayaPointPrimitiveWriter.cpp, AbcExport/MayaPointPrimitiveWriter.h, AbcExport/MayaTransformWriter.cpp, AbcExport/MayaTransformWriter.h, AbcExport/MayaUtility.cpp, AbcExport/MayaUtility.h, AbcImport/AbcImport.cpp, AbcImport/CameraHelper.cpp, AbcImport/CreateSceneHelper.cpp, AbcImport/CreateSceneHelper.h, AbcImport/util.cpp, AbcImport/util.h, animExportUtil/animExportUtil.cpp, animExportUtil/animExportUtil.h, animInfoCmd/animInfoCmd.cpp, apiDirectionalLightShape/apiDirectionalLightShape.cpp, apiMeshShape/apiMeshGeometryOverride.cpp, apiMeshShape/apiMeshGeometryOverride.h, apiMeshShape/apiMeshShape.cpp, apiMeshShape/apiMeshSubSceneOverride.cpp, apiMeshShape/apiMeshSubSceneOverride.h, atomImportExport/atomFileUtils.cpp, atomImportExport/atomImportExport.cpp, atomImportExport/atomNodeNameReplacer.cpp, cameraMessageCmd/cameraMessageCmd.cpp, cameraSetSubclass/testExCameraSetCmd.cpp, cgFx/cgfxEffectDef.cpp, cgFx/cgfxEffectDef.h, cgFx/cgfxShaderCmd.cpp, cgFx/cgfxShaderNode.cpp, cgFx/cgfxShaderNode.h, cleanPerFaceAssignment/cleanPerFaceAssignmentCmd.cpp, closestPointCmd/closestPointCmd.cpp, closestPointOnCurve/closestPointOnCurveCmd.cpp, closestPointOnCurve/closestPointOnCurveNode.cpp, closestPointOnCurve/closestTangentUAndDistance.cpp, closestPointOnCurve/closestTangentUAndDistance.h, closestPointOnNurbsSurfaceCmd/closestPointOnNurbsSurfaceCmd.cpp, clusterWeightFunction/clusterWeightFunction.cpp, componentScaleManip/componentScaleManip.cpp, convertEdgesToFacesCmd/convertEdgesToFacesCmd.cpp, convertVerticesToEdgesCmd/convertVerticesToEdgesCmd.cpp, convertVerticesToFacesCmd/convertVerticesToFacesCmd.cpp, customAttrManip/customAttrManip.cpp, cvColorNode/cvColorNode.cpp, cvExpandCmd/cvExpandCmd.cpp, cvPosCmd/cvPosCmd.cpp, dagMessageCmd/dagMessageCmd.cpp, dx11Shader/dx11Shader.cpp, dx11Shader/dx11Shader.h, dx11Shader/dx11ShaderCmd.cpp, exportJointClusterDataCmd/exportJointClusterDataCmd.cpp, exportSkinClusterDataCmd/exportSkinClusterDataCmd.cpp, findTexturesPerPolygonCmd/findTexturesPerPolygonCmd.cpp, footPrintManip/footPrintManip.cpp, footPrintNode/footPrintNode.cpp, footPrintNode_AnimatedMaterial/footPrintNode_GeometryOverride_AnimatedMaterial.cpp, footPrintNode_GeometryOverride/footPrintNode_GeometryOverride.cpp, footPrintNode_SubSceneOverride/footPrintNode_SubSceneOverride.cpp, fragmentDumper/fragmentDumper.cpp, geometryOverrideExample1/geometryOverrideExample1.cpp, geometryOverrideExample1/geometryOverrideExample1.h, geometryOverrideExample2/geometryOverrideExample2.cpp, geometryOverrideExample2/geometryOverrideExample2.h, geometryReplicator/geometryReplicator.cpp, geometrySurfaceConstraint/geometrySurfaceConstraint.cpp, geometrySurfaceConstraint/geometrySurfaceConstraint.h, glslShader/GLSLShader.cpp, glslShader/GLSLShader.h, glslShader/GLSLShaderCmd.cpp, gpuCache/CacheWriter.cpp, gpuCache/gpuCacheCmd.cpp, gpuCache/gpuCacheCmd.h, gpuCache/gpuCacheDrawOverride.cpp, gpuCache/gpuCacheDrawOverride.h, gpuCache/gpuCacheMaterialBakers.cpp, gpuCache/gpuCacheMaterialBakers.h, gpuCache/gpuCacheShapeNode.cpp, gpuCache/gpuCacheSubSceneOverride.cpp, gpuCache/gpuCacheSubSceneOverride.h, gpuCache/gpuCacheUtil.cpp, gpuCache/gpuCacheUtil.h, grabUVMain.cpp, hairCollisionSolver/hairCollisionSolver.cpp, helix2Cmd/helix2Cmd.cpp, helixTool/helixTool.cpp, hlslShader/hlslShader.cpp, hwPhongShader/hwPhongShader.cpp, ik2Bsolver/ik2Bsolver.cpp, instanceCallbackCmd/instanceCallbackCmd.cpp, instancerListCmd/instancerListCmd.cpp, intersectCmd/intersectCmd.cpp, intersectOnNurbsSurfaceCmd/intersectOnNurbsSurfaceCmd.cpp, lassoTool/lassoTool.cpp, lensDistortionCallback/lensDistortionCallback.cpp, lineManip/lineManip.cpp, lineManipContainer/lineManipContainer.cpp, listLightLinksCmd/listLightLinksCmd.cpp, listPolyHolesCmd/listPolyHolesCmd.cpp, listRichSelectionCmd/listRichSelectionCmd.cpp, lockEvent/lockEvent.cpp, manipOverride/customTriadManip.cpp, manipOverride/customTriadManip.h, manipOverride/manipOverride.cpp, maTranslator/maTranslator.cpp, MayaPluginForSpreticle/spReticleLoc.cpp, MayaPluginForSpreticle/spReticleLoc.h, meshOpCmd/meshOpCmd.cpp, meshOpCmd/polyModifierCmd.cpp, meshOpCmd/polyModifierCmd.h, motionPathCmd/motionPathCmd.cpp, moveCurveCVsCmd/moveCurveCVsCmd.cpp, moveManip/moveManip.cpp, moveNumericTool/moveNumericTool.cpp, moveTool/moveTool.cpp, narrowPolyRenderOverride/narrowPolyRenderOverride.cpp, objExport/objExport.cpp, paintCallback/paintCallback.cpp, peltOverlapCmd/peltOverlapCmd.cpp, pointManip/pointManip.cpp, pointOnMeshInfo/getPointAndNormal.cpp, pointOnMeshInfo/getPointAndNormal.h, pointOnMeshInfo/pointOnMeshCmd.cpp, pointOnMeshInfo/pointOnMeshInfoNode.cpp, polyMessageCmd/polyMessageCmd.cpp, polyRawExporter/polyExporter.cpp, polyRawExporter/polyExporter.h, polyRawExporter/polyRawExporter.cpp, polyRawExporter/polyRawExporter.h, polyRawExporter/polyRawWriter.cpp, polyRawExporter/polyRawWriter.h, polyRawExporter/polyWriter.cpp, polyRawExporter/polyWriter.h, polyX3DExporter/polyExporter.cpp, polyX3DExporter/polyExporter.h, polyX3DExporter/polyWriter.cpp, polyX3DExporter/polyWriter.h, polyX3DExporter/polyX3DExporter.cpp, polyX3DExporter/polyX3DExporter.h, polyX3DExporter/polyX3DWriter.cpp, polyX3DExporter/polyX3DWriter.h, rawfootPrintNode/rawfootPrintNode.cpp, renderViewRenderCmd/renderViewRenderCmd.cpp, renderViewRenderRegionCmd/renderViewRenderRegionCmd.cpp, richMoveCmd/richMoveCmd.cpp, rotateManip/rotateManip.cpp, sampleCmd/sampleCmd.cpp, sampleParticles/sampleParticles.cpp, scanDagCmd/scanDagCmd.cpp, scanDagSyntax/scanDagSyntax.cpp, simpleEmitter/simpleEmitter.cpp, simpleEmitter/simpleEmitter.h, simpleEvaluationDraw/simpleEvaluationDraw.cpp, simpleSolverNode/simpleSolverNode.cpp, skinClusterWeights/skinClusterWeights.cpp, spiralAnimCurveCmd/spiralAnimCurveCmd.cpp, splitUVCmd/polyModifierCmd.cpp, splitUVCmd/polyModifierCmd.h, splitUVCmd/splitUVCmd.cpp, squareScaleManip/squareScaleManip.cpp, squareScaleManip/squareScaleManip.h, squareScaleManipContext/squareScaleManipContext.cpp, squareScaleManipContext/squareScaleManipContext.h, squaresNode_noDepthTest/squaresNode_noDepthTest.cpp, surfaceBumpManip/surfaceBumpManip.cpp, surfaceTwistCmd/surfaceTwistCmd.cpp, swissArmyManip/swissArmyManip.cpp, template/zoomCameraTemplate/zoomCameraTemplate.cpp, tessellatedQuad/TessellatedQuadGeomOverride.cpp, tessellatedQuad/TessellatedQuadGeomOverride.h, tessellatedQuad/TessellatedQuadNode.cpp, tessellatedQuad/TessellatedQuadNode.h, testCameraSetCmd/testCameraSetCmd.cpp, threadedBoundingBox/threadedBoundingBox.cpp, torusField/torusField.cpp, torusField/torusField.h, transformDrawNode/transformDrawNode.cpp, translateCmd/translateCmd.cpp, uiDrawManager/uiDrawManager.cpp, viewDX11DeviceAccess/viewDX11DeviceAccess.cpp, viewObjectFilter/viewObjectFilter.cpp, viewRenderOverride/viewRenderOverrideOperations.cpp, viewRenderOverridePointLightShadows/viewRenderOverridePointLightShadows.cpp, viewRenderOverrideShadows/viewRenderOverrideShadows.cpp, and zoomCameraCmd/zoomCameraCmd.cpp.

Constructor & Destructor Documentation

OPENMAYA_MAJOR_NAMESPACE_OPEN MDagPath ( )

Class Constructor.

Creates a DAG Path

MDagPath ( const MDagPath src)

Copy constructor.

Duplicate the given path.

Parameters
[in]srcthe path to be copied
~MDagPath ( )
virtual

Class Destructor.

No additional action.

Member Function Documentation

MStatus getAllPathsTo ( const MObject node,
MDagPathArray pathArray 
)
static

Determines all Paths to the specified DAG Node.

Parameters
[in]nodeDAG Node for which Paths are determined
[out]pathArrayArray containing all DAG Paths to the specified Node (implicit return)
Returns
Status Code
Status Codes:
  • MS::kSuccess Success
  • MS::kInvalidParameter Invalid parameter passed for node - Node is not accessible, does not exist or is not a DAG Node
  • MS::kFailure Unknown failure to determine Paths
Examples:
footPrintNode_SubSceneOverride/footPrintNode_SubSceneOverride.cpp, and gpuCache/gpuCacheSubSceneOverride.cpp.
MStatus getAPathTo ( const MObject node,
MDagPath path 
)
static

Determines the Path to the specified DAG Node.

The Path returned is rooted at the World. If the object is instanced and has multiple paths, then the first one that is found is returned.

Parameters
[in]nodeDAG Node for which Paths are determined
[out]pathreference to the path of the specified DAG Node
Returns
Status Code
Status Codes:
  • MS::kSuccess Success
  • MS::kInvalidParameter Invalid parameter passed for node - Node is not accessible, does not exist or is not a DAG Node
  • MS::kFailure Unknown failure to determine Path
Examples:
animInfoCmd/animInfoCmd.cpp, closestPointCmd/closestPointCmd.cpp, dagMessageCmd/dagMessageCmd.cpp, dx11Shader/dx11Shader.cpp, footPrintNode_SubSceneOverride/footPrintNode_SubSceneOverride.cpp, geometryOverrideExample1/geometryOverrideExample1.cpp, geometryOverrideExample2/geometryOverrideExample2.cpp, geometryReplicator/geometryReplicator.cpp, glslShader/GLSLShader.cpp, gpuCache/gpuCacheSubSceneOverride.cpp, ik2Bsolver/ik2Bsolver.cpp, intersectCmd/intersectCmd.cpp, maTranslator/maTranslator.cpp, meshOpCmd/polyModifierCmd.cpp, polyMessageCmd/polyMessageCmd.cpp, simpleSolverNode/simpleSolverNode.cpp, and splitUVCmd/polyModifierCmd.cpp.
MStatus matchTransform ( const MDagPath source,
const MDagPath target,
const MDagPath relative,
MTransformationMatrix transformationMatrix,
bool  preserveOffsetParentMatrix = true,
bool  preservePivot = true,
bool  preservePivotOffset = false 
)
static

Introduced in 2022.0

Calculates the transformationMatrix which, when applied to the source, object will bring the source object to the location of the target object.

2022.0:
Introduced in this version.

A relative object can be provided if we want to specify an alternate parent of source object for the calculations. An empty MDagPath means we want to use the current parent.

A number of flags can be used to specify whether we want to preserve the current offsetParentMatrix and/or pivot locations or whether we want to calculate the transformationMatrix as if they were initialized to identity.

Parameters
[in]sourcedagPath to calculate the transformationMatrix for
[in]targetdagPath to match the source to
[in]relativedagPath to be used as alternative parent for source. When set to an empty MDagPath the current parent is used
[in]transformationMatrixthe transformation matrix to be calculated
[in]preserveOffsetParentMatrixtrue in order to calculate with the current offsetParentMatrix of source or false to use identity. Default is true
[in]preservePivottrue in order to calculate with the current rotate and scale pivots of source or false to use identity. Default is true
[in]preservePivotOffsettrue in order to calculate with the current rotate and scale pivot translate offsets of source or false to use identity. Default is false
[out]ReturnStatusstatus code
Returns
Status Code
Status Codes:
  • MS::kSuccess Success
  • MS::kFailure Unknown failure to determine transform
MStatus getAllPathsBelow ( MDagPathArray pathArray)

Return all paths to leaf objects below this path excluding transforms.

Parameters
[out]pathArrayArray containing all DAG Paths below this path excluding transforms.
Returns
Status Code
Status Codes:
  • MS::kSuccess Success
  • MS::kInvalidParameter Invalid DAG path
  • MS::kFailure Unknown failure to determine Paths
bool hasFn ( MFn::Type  type,
MStatus ReturnStatus = nullptr 
) const

Returns true if the object at the end of this DAG path supports the given function set.

If the object at the end of this DAG path is a transform node and has a child that is a shape, then that node will be checked as well. All function sets that take an MDagPath

Parameters
[in]typefunction set type to check
[out]ReturnStatusstatus code
Returns
Boolean value indicating whether the function set is supported
Status Codes:
  • MS::kSuccess Success
  • MS::kFailure Invalid object
Examples:
AbcBullet/MayaTransformWriter.cpp, AbcExport/MayaTransformWriter.cpp, closestPointOnCurve/closestPointOnCurveCmd.cpp, cvExpandCmd/cvExpandCmd.cpp, gpuCache/gpuCacheShapeNode.cpp, listLightLinksCmd/listLightLinksCmd.cpp, objExport/objExport.cpp, pointOnMeshInfo/pointOnMeshCmd.cpp, scanDagCmd/scanDagCmd.cpp, scanDagSyntax/scanDagSyntax.cpp, skinClusterWeights/skinClusterWeights.cpp, surfaceTwistCmd/surfaceTwistCmd.cpp, viewDX11DeviceAccess/viewDX11DeviceAccess.cpp, and viewObjectFilter/viewObjectFilter.cpp.
MFn::Type apiType ( MStatus ReturnStatus = nullptr) const

Returns the type of the object at the end of the path.

Parameters
[out]ReturnStatusstatus code
Returns
Type of the object
Status Codes:
  • MS::kSuccess Success
  • MS::kFailure Invalid object
Examples:
cleanPerFaceAssignment/cleanPerFaceAssignmentCmd.cpp, and geometryReplicator/geometryReplicator.cpp.
MObject node ( MStatus ReturnStatus = nullptr) const

Retrieves the DAG Node for this DAG Path.

Parameters
[out]ReturnStatusStatus Code
Returns
DAG Node for this DAG Path
Status Codes:
  • MS::kSuccess Success
  • MS::kFailure Invalid object or no node
Examples:
AbcBullet/MayaTransformCollectionWriter.cpp, AbcExport/AbcWriteJob.cpp, AbcExport/MayaCameraWriter.cpp, AbcExport/MayaLocatorWriter.cpp, AbcExport/MayaMeshWriter.cpp, AbcExport/MayaNurbsCurveWriter.cpp, AbcExport/MayaNurbsSurfaceWriter.cpp, AbcExport/MayaPointPrimitiveWriter.cpp, AbcImport/AbcImport.cpp, AbcImport/CameraHelper.cpp, AbcImport/util.cpp, animExportUtil/animExportUtil.cpp, atomImportExport/atomFileUtils.cpp, atomImportExport/atomImportExport.cpp, atomImportExport/atomNodeNameReplacer.cpp, cameraSetSubclass/testExCameraSetCmd.cpp, cgFx/cgfxEffectDef.cpp, closestPointCmd/closestPointCmd.cpp, closestPointOnCurve/closestPointOnCurveCmd.cpp, componentScaleManip/componentScaleManip.cpp, cvColorNode/cvColorNode.cpp, dagMessageCmd/dagMessageCmd.cpp, dx11Shader/dx11Shader.cpp, footPrintManip/footPrintManip.cpp, footPrintNode/footPrintNode.cpp, geometrySurfaceConstraint/geometrySurfaceConstraint.cpp, glslShader/GLSLShader.cpp, gpuCache/gpuCacheCmd.cpp, gpuCache/gpuCacheDrawOverride.cpp, gpuCache/gpuCacheMaterialBakers.cpp, gpuCache/gpuCacheSubSceneOverride.cpp, gpuCache/gpuCacheUtil.cpp, lensDistortionCallback/lensDistortionCallback.cpp, listPolyHolesCmd/listPolyHolesCmd.cpp, maTranslator/maTranslator.cpp, MayaPluginForSpreticle/spReticleLoc.cpp, meshOpCmd/polyModifierCmd.cpp, objExport/objExport.cpp, pointOnMeshInfo/pointOnMeshCmd.cpp, polyMessageCmd/polyMessageCmd.cpp, rawfootPrintNode/rawfootPrintNode.cpp, simpleEvaluationDraw/simpleEvaluationDraw.cpp, skinClusterWeights/skinClusterWeights.cpp, splitUVCmd/polyModifierCmd.cpp, splitUVCmd/splitUVCmd.cpp, squaresNode_noDepthTest/squaresNode_noDepthTest.cpp, swissArmyManip/swissArmyManip.cpp, testCameraSetCmd/testCameraSetCmd.cpp, threadedBoundingBox/threadedBoundingBox.cpp, transformDrawNode/transformDrawNode.cpp, uiDrawManager/uiDrawManager.cpp, viewRenderOverridePointLightShadows/viewRenderOverridePointLightShadows.cpp, and viewRenderOverrideShadows/viewRenderOverrideShadows.cpp.
MObject transform ( MStatus ReturnStatus = nullptr) const

Retrieves the lowest Transform in the DAG Path.

Parameters
[out]ReturnStatusStatus Code
Returns
Lowest Transform for this DAG Path
Status Codes:
  • MS::kSuccess Success
  • MS::kInvalidParameter This object has no transform (i.e. this is the world node)
  • MS::kFailure Invalid object
Examples:
AbcExport/MayaNurbsCurveWriter.cpp, dagMessageCmd/dagMessageCmd.cpp, dx11Shader/dx11Shader.cpp, glslShader/GLSLShader.cpp, gpuCache/gpuCacheDrawOverride.cpp, scanDagCmd/scanDagCmd.cpp, scanDagSyntax/scanDagSyntax.cpp, spiralAnimCurveCmd/spiralAnimCurveCmd.cpp, and transformDrawNode/transformDrawNode.cpp.
unsigned int length ( MStatus ReturnStatus = nullptr) const

Determines the number of DAG Nodes in the Path not including the root.

Parameters
[out]ReturnStatusstatus code
Returns
Number of DAG Nodes not including the root
Status Codes:
  • MS::kSuccess Success
  • MS::kFailure Invalid object
Examples:
AbcBullet/AbcWriteJob.cpp, AbcBullet/MayaTransformCollectionWriter.cpp, AbcBullet/MayaUtility.cpp, AbcExport/AbcWriteJob.cpp, AbcExport/MayaUtility.cpp, gpuCache/gpuCacheCmd.cpp, gpuCache/gpuCacheSubSceneOverride.cpp, and maTranslator/maTranslator.cpp.
MStatus extendToShape ( )

If the object at the end of this path is a transform and there is a shape node directly beneath it in the hierarchy, then the path is extended to that geometry node.

NOTE: This method will fail if there multiple shapes below the transform.

Returns
Status code
Status Codes:
  • MS::kSuccess operation successful
  • MS::kInvalidParameter DAG path does not lead to a transform or there is no geometry below it
  • MS::kFailure the object is invalid
Examples:
AbcImport/CreateSceneHelper.cpp, cleanPerFaceAssignment/cleanPerFaceAssignmentCmd.cpp, closestPointOnCurve/closestPointOnCurveCmd.cpp, findTexturesPerPolygonCmd/findTexturesPerPolygonCmd.cpp, fragmentDumper/fragmentDumper.cpp, listLightLinksCmd/listLightLinksCmd.cpp, listPolyHolesCmd/listPolyHolesCmd.cpp, meshOpCmd/meshOpCmd.cpp, meshOpCmd/polyModifierCmd.cpp, pointOnMeshInfo/pointOnMeshCmd.cpp, polyMessageCmd/polyMessageCmd.cpp, skinClusterWeights/skinClusterWeights.cpp, splitUVCmd/polyModifierCmd.cpp, splitUVCmd/splitUVCmd.cpp, threadedBoundingBox/threadedBoundingBox.cpp, viewRenderOverridePointLightShadows/viewRenderOverridePointLightShadows.cpp, and viewRenderOverrideShadows/viewRenderOverrideShadows.cpp.
MStatus extendToShapeDirectlyBelow ( unsigned int  index)

This method is used if the end of the path is a transform and there are shapes directly below the transform.

The shape to extend to is set by passing in an appropriate index parameter.

Use the numberOfShapesDirectlyBelow() method to determine how many shapes are below

Parameters
[in]indexcontains the index of the shape to extend the path to
Returns
Status code
Status Codes:
  • MS::kSuccess operation successful
  • MS::kInvalidParameter DAG path does not lead to a transform or there is no geometry below it
  • MS::kFailure the object is invalid
MStatus numberOfShapesDirectlyBelow ( unsigned int &  num) const

If the object at the end of this path is a transform, this method will return the number of shapes directly below the transform.

Parameters
[in]numon success, this parameter will be set to the number of shapes directly underneath the transform
Returns
Status code
Status Codes:
  • MS::kSuccess operation successful
  • MS::kInvalidParameter DAG path does not lead to a transform or there is no geometry below it
  • MS::kFailure the object is invalid
Examples:
dx11Shader/dx11ShaderCmd.cpp, and glslShader/GLSLShaderCmd.cpp.
MStatus push ( const MObject child)

Push an object onto the end of the path.

The object must be a child of the object that is currently at the end of the path.

Parameters
[in]childchild object to push onto the path
Returns
Status code
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure unexpected error or invalid object
  • MS::kInvalidParameter child is invalid or is not a child of the object at the end of this path
Examples:
AbcImport/CreateSceneHelper.cpp, AbcImport/util.cpp, and gpuCache/gpuCacheCmd.cpp.
MStatus pop ( unsigned int  num = 1)

Pop the given number of objects off of the end of the path.

Parameters
[in]numnumber of objects to pop off of the path
Returns
Status code
Status Codes:
  • MS::kSuccess operation successful
  • MS::kInvalidParameter the number of objects to pop is greater than the length of the path
  • MS::kFailure the object is invalid
Examples:
AbcBullet/AbcWriteJob.cpp, AbcBullet/MayaUtility.cpp, AbcExport/AbcWriteJob.cpp, AbcExport/MayaUtility.cpp, AbcImport/CreateSceneHelper.cpp, apiDirectionalLightShape/apiDirectionalLightShape.cpp, apiMeshShape/apiMeshSubSceneOverride.cpp, footPrintManip/footPrintManip.cpp, gpuCache/gpuCacheCmd.cpp, gpuCache/gpuCacheShapeNode.cpp, gpuCache/gpuCacheSubSceneOverride.cpp, ik2Bsolver/ik2Bsolver.cpp, maTranslator/maTranslator.cpp, and swissArmyManip/swissArmyManip.cpp.
unsigned int childCount ( MStatus ReturnStatus = nullptr) const

Return the number of children that the object at the end of the path has.

Parameters
[out]ReturnStatusstatus code
Returns
The number of children
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure invalid object
Examples:
AbcImport/CreateSceneHelper.cpp, AbcImport/util.cpp, animExportUtil/animExportUtil.cpp, atomImportExport/atomImportExport.cpp, gpuCache/gpuCacheCmd.cpp, viewDX11DeviceAccess/viewDX11DeviceAccess.cpp, and viewObjectFilter/viewObjectFilter.cpp.
MObject child ( unsigned int  index,
MStatus ReturnStatus = nullptr 
) const

Return the child object at the given index, where the parent is the object at the end of the path.

Parameters
[in]indexchild's index
[out]ReturnStatusstatus code
Returns
A handle to the child
Status Codes:
  • MS::kSuccess operation successful
  • MS::kInvalidParameter the index is out of range
  • MS::kFailure the object is invalid
Examples:
AbcImport/CreateSceneHelper.cpp, AbcImport/util.cpp, and gpuCache/gpuCacheCmd.cpp.
MMatrix inclusiveMatrix ( MStatus ReturnStatus = nullptr) const
MMatrix exclusiveMatrix ( MStatus ReturnStatus = nullptr) const

Determines the exclusive matrix of the Path.

Parameters
[out]ReturnStatusstatus code
Returns
The matrix for all transforms in the Path excluding the end Node in the Path if it is Transform
Status Codes:
  • MS::kSuccess success
  • MS::kFailure the object is invalid
Examples:
AbcExport/AbcWriteJob.cpp, ik2Bsolver/ik2Bsolver.cpp, and moveManip/moveManip.cpp.
MMatrix inclusiveMatrixInverse ( MStatus ReturnStatus = nullptr) const

Determines the inverse inclusive matrix of the Path.

Parameters
[out]ReturnStatusstatus code
Returns
The inverse of the matrix for all Transforms in the Path including the end Node in the Path if it is a Transform
Status Codes:
  • MS::kSuccess success
  • MS::kFailure the object is invalid
Examples:
closestPointOnNurbsSurfaceCmd/closestPointOnNurbsSurfaceCmd.cpp, and intersectOnNurbsSurfaceCmd/intersectOnNurbsSurfaceCmd.cpp.
MMatrix exclusiveMatrixInverse ( MStatus ReturnStatus = nullptr) const

Determines the inverse exclusive matrix of the Path.

Parameters
[out]ReturnStatusstatus code
Returns
The inverse of the matrix for all transforms in the Path excluding the end Node in the Path if it is Transform
Status Codes:
  • MS::kSuccess success
  • MS::kFailure the object is invalid
MDagPath & operator= ( const MDagPath src)

Assigns the DAG Path on the RHS of the operator to the DAG Path on the LHS.

Parameters
[in]srcthe path to be copied
Returns
A bitwise copy of the the DAG Path on the LHS
bool operator== ( const MDagPath src) const

Determines if the DAG Path on the LHS of the operator is equal to the DAG Path on the RHS.

Parameters
[in]srcThe path to be compared.
Returns
True is the objects are equal
MStatus set ( const MDagPath src)

Sets this DAG Path equal to the specified DAG Path.

Parameters
[in]srcDAG Path to be copied.
Returns
Status code
Status Codes:
  • MS::kSuccess success
  • MS::kFailure the object is invalid
Examples:
gpuCache/gpuCacheSubSceneOverride.cpp.
unsigned int pathCount ( MStatus ReturnStatus = nullptr) const

Return the number of paths which make up this path.

Parameters
[out]ReturnStatusstatus code
Returns
The path count
Status Codes:
  • MS::kSuccess success
  • MS::kFailure the object is invalid
Examples:
maTranslator/maTranslator.cpp.
MStatus getPath ( MDagPath path,
unsigned int  i = 0 
) const

Return the i'th path.

The zero'th path is the top-most path and must be rooted by the world. Additional paths are paths in the underworld of the object at the end of the previous path (path i-1).

Parameters
[out]pathreference to the destination path
[in]ithe index of the path to retrieve
Returns
Status code
Status Codes:
  • MS::kSuccess success
  • MS::kFailure the object is invalid
  • MS::kInvalidParameter 'i' is out of range. Must be < pathCount().
Examples:
AbcImport/CameraHelper.cpp, customAttrManip/customAttrManip.cpp, footPrintManip/footPrintManip.cpp, manipOverride/customTriadManip.cpp, manipOverride/manipOverride.cpp, maTranslator/maTranslator.cpp, moveManip/moveManip.cpp, and swissArmyManip/swissArmyManip.cpp.
MString partialPathName ( MStatus ReturnStatus = nullptr) const

Return a string representing the partial path from the root of the dag to this object.

The partial path is the minimum path that is still unique. This string may contain wildcards.

Parameters
[out]ReturnStatusstatus code
Returns
The partial path name
Status Codes:
  • MS::kSuccess success
  • MS::kFailure the object is invalid
Examples:
AbcImport/CreateSceneHelper.cpp, atomImportExport/atomImportExport.cpp, atomImportExport/atomNodeNameReplacer.cpp, cameraMessageCmd/cameraMessageCmd.cpp, cgFx/cgfxShaderCmd.cpp, cgFx/cgfxShaderNode.cpp, closestPointOnNurbsSurfaceCmd/closestPointOnNurbsSurfaceCmd.cpp, exportJointClusterDataCmd/exportJointClusterDataCmd.cpp, exportSkinClusterDataCmd/exportSkinClusterDataCmd.cpp, intersectOnNurbsSurfaceCmd/intersectOnNurbsSurfaceCmd.cpp, and maTranslator/maTranslator.cpp.
bool isInstanced ( MStatus ReturnStatus = nullptr) const

Returns true if the object at the end of the DAG path is instanced.

It is instanced if there is more than one path to the node from the top of the DAG. Each instance of the node will be drawn separately in the view, but the geometry will be shared.

Parameters
[out]ReturnStatusstatus code
Returns
True if the DAG node at the end of the path is instanced
Status Codes:
  • MS::kSuccess success
  • MS::kFailure the object is invalid
Examples:
findTexturesPerPolygonCmd/findTexturesPerPolygonCmd.cpp.
unsigned int instanceNumber ( MStatus ReturnStatus = nullptr) const

For an instanced object, this returns the instance number that this path represents in the DAG.

The instance number can be used to determine which element of the world space array attributes of a DAG node to connect to get information regarding this instance.

Parameters
[out]ReturnStatusstatus code
Returns
The instance number represented by this path
Status Codes:
  • MS::kSuccess success
  • MS::kFailure the object is invalid
Examples:
apiMeshShape/apiMeshSubSceneOverride.cpp, cleanPerFaceAssignment/cleanPerFaceAssignmentCmd.cpp, closestPointOnCurve/closestPointOnCurveCmd.cpp, findTexturesPerPolygonCmd/findTexturesPerPolygonCmd.cpp, gpuCache/gpuCacheUtil.cpp, and pointOnMeshInfo/pointOnMeshCmd.cpp.
bool isVisible ( MStatus ReturnStatus = nullptr) const

Returns true if the DAG Node at the end of the path is visible to the viewport.

This method does not account for any viewport specific filtering.

If the object is not in the current render layer then it is not visible.

If the value of the visibility attribute is false for any DAG Node along the path, the object is invisible. Also, the object is invisible if it or its ancestor is in an invisible display layer. Additionally, intermediate objects are considered invisible as are objects which have the display geometry flag toggled to off (see the 'toggle' command).

Parameters
[out]ReturnStatusstatus code
Returns
True if the DAG node at the end of the path is visible
Status Codes:
  • MS::kSuccess success
  • MS::kFailure the object is invalid
Examples:
apiMeshShape/apiMeshSubSceneOverride.cpp, footPrintNode_SubSceneOverride/footPrintNode_SubSceneOverride.cpp, and gpuCache/gpuCacheSubSceneOverride.cpp.
bool isTemplated ( MStatus ReturnStatus = nullptr) const

Returns true if the DAG Node at the end of the path is templated.

If the value of the template attribute is true for any DAG Node along the path, this method will return true. If the display override for any DAG node along the path is template, this method will return true. Finally, this method will return true if any DAG node along the path is in a templated display layer.

Parameters
[out]ReturnStatusstatus code
Returns
True if the DAG node at the end of the path is templated
Status Codes:
  • MS::kSuccess success
  • MS::kFailure the object is invalid
Examples:
apiMeshShape/apiMeshGeometryOverride.cpp.
MDAGDrawOverrideInfo getDrawOverrideInfo ( ) const

Get the draw override information for the given path.

It will check from the bottom object of this path, then go upwards to find the first enabled draw override and record that information. If no enabled draw override is found, a default draw override information will be given with draw override disabled inside it.

Returns
Draw override information of this path.
Examples:
rawfootPrintNode/rawfootPrintNode.cpp.
const char * className ( )
static

Returns the name of this class.

Returns
The name of this class.
MDagPath getAPathTo ( const MObject node,
MStatus ReturnStatus = nullptr 
)
static

Deprecated in 2019.0

Determines the Path to the specified DAG Node.

Deprecated:
The function signature was inconsistent with the rest of the API. Please use the other MDagPath::getAPathTo method instead.
2019.0:
Deprecated in this version.

The Path returned is rooted at the World. If the object is instanced and has multiple paths, then the first one that is found is returned.

Parameters
[in]nodeDAG Node for which Paths are determined
[out]ReturnStatusStatus Code
Returns
Path to the specified Node
Status Codes:
  • MS::kSuccess Success
  • MS::kInvalidParameter Invalid parameter passed for object - Node is not accessible, does not exist or is not a DAG Node
  • MS::kFailure Unknown failure to determine Path

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