Public Member Functions | Static Public Member Functions

MDagModifier Class Reference

This reference page is linked to from the following overview topics: Autodesk Maya 2013, Creating and Manipulating Objects, Example: Creating an IK Joint Chain.


Search for all occurrences

Detailed Description

Dependency graph modifier.

An MDagModifier is used to change the structure of the DAG. This includes adding nodes, making new connections, and removing existing connections. To perform operations using an MDagModifier, register all of the changes that are to be made and then call the doIt method to make the changes. Undo is provided through the undoIt method.

Examples:

offsetNode.cpp, polyModifierCmd.h, and polyPrimitiveCmd.cpp.

#include <MDagModifier.h>

Inheritance diagram for MDagModifier:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 MDagModifier ()
 The class constructor.
 ~MDagModifier ()
 The class destructor.
MObject createNode (const MTypeId &typeId, const MObject &parent=MObject::kNullObj, MStatus *ReturnStatus=NULL)
 This method adds an operation to this DAG modifier that will add a new node of the given type to the DAG.
MObject createNode (const MString &type, const MObject &parent=MObject::kNullObj, MStatus *ReturnStatus=NULL)
 This method adds an operation to this DAG modifier that will add a new node of the given type to the DAG.
MStatus reparentNode (const MObject &node, const MObject &newParent=MObject::kNullObj)
 This method adds an operation to this DAG modifier that will reparent a node in the DAG.

Static Public Member Functions

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

Member Function Documentation

MObject createNode ( const MTypeId typeId,
const MObject parent = MObject::kNullObj,
MStatus ReturnStatus = NULL 
)

This method adds an operation to this DAG modifier that will add a new node of the given type to the DAG.

This method may not be used to construct new dependency graph nodes that are not in the DAG. Use MDGModifier for that purpose.

When createNode is called, the new node is created and the MObject handle for it is returned. It should be noted that the node will not be added to the DAG until the doIt method is called.

It is legal to pass in a null object as the parent. When this occurs, the new object gets parented under the world node.

Note that nodes cannot exist in the DAG unless they are under a transform. This method will automatically create a transform if one is required. If a transform is created, then the MObject for the transform will be returned instead of the one for the node.

If a node is created with this method, but the operation is undone, then the MDagModifier will take responsibility for freeing the node. This will be done when the MDagModifier is destructed.

Parameters:
[in]typeIdtype of the node to create
[in]parentparent object in the DAG
[out]ReturnStatusreturn status
Returns:
A handle for the new node, or the transform above if one is created as a parent.
Status Codes:
Examples:
offsetNode.cpp.
MObject createNode ( const MString type,
const MObject parent = MObject::kNullObj,
MStatus ReturnStatus = NULL 
)

This method adds an operation to this DAG modifier that will add a new node of the given type to the DAG.

This method may not be used to construct new dependency graph nodes that are not in the DAG. Use MDGModifier for that purpose.

When createNode is called, the new node is created and the MObject handle for it is returned. It should be noted that the node will not be added to the DAG until the doIt method is called.

It is legal to pass in a null object as the parent. When this occurs, the new object gets parented under the world node.

Note that nodes cannot exist in the DAG unless they are under a transform. This method will automatically create a transform if one is required. If a transform is created, then the MObject for the transform will be returned instead of the one for the node.

If a node is created with this method, but the operation is undone, then the MDagModifier will take responsibility for freeing the This will be done when the MDagModifier is destructed.

Parameters:
[in]typetype of the node to create
[in]parentparent object in the DAG
[out]ReturnStatusreturn status
Returns:
A handle for the new node, or the transform above if one is created as a parent.
Status Codes:
MStatus reparentNode ( const MObject node,
const MObject newParent = MObject::kNullObj 
)

This method adds an operation to this DAG modifier that will reparent a node in the DAG.

If the parent passed in is NULL, then the node will be reparented under the world.

Parameters:
[in]nodenode to reparent
[out]newParentnew parent for the node
Returns:
Return Status
Status Codes:
const char * className ( ) [static]

Returns the name of this class.

Returns:
The name of this class.

Reimplemented from MDGModifier.


MDagModifier MDagModifier MDagModifier MDagModifier MDagModifier MDagModifier MDagModifier MDagModifier MDagModifier MDagModifier
MDagModifier MDagModifier MDagModifier MDagModifier MDagModifier MDagModifier MDagModifier MDagModifier MDagModifier MDagModifier