MDagModifier Class Reference
[OpenMaya - API module for common classes]

#include <MDagModifier.h>

Inheritance diagram for MDagModifier:

Inheritance graph
[legend]
Collaboration diagram for MDagModifier:

Collaboration graph
[legend]

List of all members.


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, and polyModifierCmd.h.


Public Member Functions

 MDagModifier ()
 ~MDagModifier ()
MObject createNode (const MTypeId &typeId, const MObject &parent=MObject::kNullObj, MStatus *ReturnStatus=NULL)
MObject createNode (const MString &type, const MObject &parent=MObject::kNullObj, MStatus *ReturnStatus=NULL)
MStatus reparentNode (const MObject &node, const MObject &newParent=MObject::kNullObj)

Constructor & Destructor Documentation

MDagModifier::MDagModifier (  ) 

The class constructor.

MDagModifier::~MDagModifier (  ) 

The class destructor.


Member Function Documentation

MObject MDagModifier::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] typeId type of the node to create
[in] parent parent object in the DAG
[out] ReturnStatus return status
Returns:
A handle for the new node, or the transform above if one is created as a parent.
Status Codes:
Examples:

MObject MDagModifier::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] type type of the node to create
[in] parent parent object in the DAG
[out] ReturnStatus return status
Returns:
A handle for the new node, or the transform above if one is created as a parent.
Status Codes:

MStatus MDagModifier::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] node node to reparent
[out] newParent new parent for the node
Returns:
Return Status
Status Codes:


Autodesk® Maya® 2010 © 1997-2009 Autodesk, Inc. All rights reserved. Generated with doxygen 1.5.6