class MDagModifier

Jump to documentation

: public MDGModifier Dependency graph modifier. (OpenMaya) (OpenMaya.py)

Inheritance:

MDagModifier < MDGModifier

public members:

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 )

Inherited from MDGModifier:

public members:

MObject createNode ( const MTypeId &typeId, MStatus * ReturnStatus = NULL )
MObject createNode ( const MString &type, MStatus * ReturnStatus = NULL )
MStatus deleteNode ( const MObject & node )
MStatus renameNode ( const MObject & node, const MString &newName )
MStatus setNodeLockState ( const MObject & node, bool newState )
MStatus connect ( const MObject & sourceNode, const MObject & sourceAttr, const MObject & destNode, const MObject & destAttr )
MStatus disconnect ( const MObject & sourceNode, const MObject & sourceAttr, const MObject & destNode, const MObject & destAttr )
MStatus connect ( const MPlug & source, const MPlug & dest )
MStatus disconnect ( const MPlug & source, const MPlug & dest )
MStatus addAttribute ( const MObject & node, const MObject & attribute, MFnDependencyNode::MAttrClass type = MFnDependencyNode::kLocalDynamicAttr )
MStatus removeAttribute ( const MObject & node, const MObject & attribute, MFnDependencyNode::MAttrClass type = MFnDependencyNode::kLocalDynamicAttr )
MStatus commandToExecute ( const MString & command )
MStatus newPlugValue ( const MPlug & plug, MObject & plugValue )
MStatus doIt ()
MStatus undoIt ()

Documentation

A class that is used to modify the DAG and also supports undo
Description

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.

Functions

MDagModifier:: MDagModifier ()

Description

The class constructor.

MDagModifier:: ~MDagModifier ()

Description

The class destructor.

MObject MDagModifier:: createNode ( const MTypeId &typeId, const MObject & parent, MStatus * ReturnStatus )

Description

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.

Arguments

  • typeId type of the node to create
  • parent parent object in the DAG
  • ReturnStatus return status

Return Value

  • a handle for the new node, or the transform above if one is created as a parent.

Status Codes

  • MS::kSuccess operation successful
  • MS::kInvalidParameter the type passed in is not valid

MObject MDagModifier:: createNode ( const MString &type, const MObject & parent, MStatus * ReturnStatus )

Description

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.

Arguments

  • typeId type of the node to create
  • parent parent object in the DAG
  • ReturnStatus return status

Return Value

  • a handle for the new node, or the transform above if one is created as a parent.

Status Codes

  • MS::kSuccess operation successful
  • MS::kInvalidParameter the type passed in is not valid

MStatus MDagModifier:: reparentNode ( const MObject & node, const MObject & newParent )

Description

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.

Arguments

  • node node to reparent
  • newParent new parent for the node

Return Value

  • Return Status

Status Codes

  • MS::kSuccess operation successful
  • MS::kInvalidParameter node or parent is node valid

This class has no child classes.


Autodesk® Maya® 2008 © 1997-2007 Autodesk, Inc. All rights reserved. doc++ Copyright