C++ API Reference
MDagModifier Class Reference

Dependency graph modifier. More...

#include <MDagModifier.h>

+ Inheritance diagram for MDagModifier:

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. More...
 
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. More...
 
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. More...
 
- Public Member Functions inherited from MDGModifier
 MDGModifier ()
 The class constructor.
 
virtual ~MDGModifier ()
 The class destructor.
 
MObject createNode (const MTypeId &typeId, MStatus *ReturnStatus=NULL)
 This method adds an operation to this dependency graph modifier that will add a new dependency graph node of the given type to the dependency graph. More...
 
MObject createNode (const MString &type, MStatus *ReturnStatus=NULL)
 This method adds an operation to this dependency graph modifier that will add a new dependency graph node of the given type to the dependency graph. More...
 
MStatus deleteNode (const MObject &node)
 This method adds an operation to this dependency graph modifier that will delete a dependency graph node from the dependency graph. More...
 
MStatus deleteNode (const MObject &node, bool includeParents)
 This method adds an operation to this dependency graph modifier that will delete a dependency graph node from the dependency graph. More...
 
MStatus renameNode (const MObject &node, const MString &newName)
 This method adds an operation to this dependency graph modifier that will rename a dependency graph node. More...
 
MStatus setNodeLockState (const MObject &node, bool newState)
 This method adds an operation to this dependency graph modifier that will set the lock state of the node. More...
 
MStatus connect (const MObject &sourceNode, const MObject &sourceAttr, const MObject &destNode, const MObject &destAttr)
 Adds an operation to this dependency graph modifier that connects two attributes of two nodes in the dependency graph. More...
 
MStatus disconnect (const MObject &sourceNode, const MObject &sourceAttr, const MObject &destNode, const MObject &destAttr)
 Adds an operation to this dependency graph modifier that disconnects two attributes of two nodes in the dependency graph. More...
 
MStatus connect (const MPlug &source, const MPlug &dest)
 Adds an operation to this dependency graph modifier that connects two plugs in the dependency graph. More...
 
MStatus disconnect (const MPlug &source, const MPlug &dest)
 Adds an operation to this dependency graph modifier that disconnects two plugs in the dependency graph. More...
 
MStatus addAttribute (const MObject &node, const MObject &attribute)
 Add a new dynamic attribute to the given dependency node. More...
 
MStatus removeAttribute (const MObject &node, const MObject &attribute)
 Removes a dynamic attribute from the given dependency node. More...
 
MStatus renameAttribute (const MObject &node, const MObject &attribute, const MString &shortName, const MString &longName)
 Renames a dynamic attribute on the given dependency node. More...
 
MStatus addExtensionAttribute (const MNodeClass &nodeClass, const MObject &attribute)
 Add a new extension attribute to the given dependency node class. More...
 
MStatus removeExtensionAttribute (const MNodeClass &nodeClass, const MObject &attribute)
 Removes an extension attribute from the given dependency node type. More...
 
MStatus removeExtensionAttributeIfUnset (const MNodeClass &nodeClass, const MObject &attribute)
 Removes an extension attribute from the given dependency node type but only if there are no nodes in the graph with non-default values for this attribute. More...
 
MStatus linkExtensionAttributeToPlugin (const MObject &plugin, const MObject &attribute)
 The plugin calls this to indicate that the extension attribute defines part of the plugin, regardless of the node type to which it attaches itself. More...
 
MStatus unlinkExtensionAttributeFromPlugin (const MObject &mPlugin, const MObject &mAttribute)
 Tells a plugin that it no longer requires an extension attribute for operation. More...
 
MStatus commandToExecute (const MString &command)
 Adds an operation to this dependency graph modifier that executes a MEL command. More...
 
MStatus pythonCommandToExecute (const MString &command)
 Adds an operation to this dependency graph modifier that executes a Python command/script. More...
 
MStatus newPlugValue (const MPlug &plug, MObject &plugValue)
 Adds an operation to this dependency graph modifier that sets a plug value. More...
 
MStatus newPlugValueBool (const MPlug &plug, bool plugValue)
 Adds an operation to this dependency graph modifier that sets a plug to a boolean value. More...
 
MStatus newPlugValueChar (const MPlug &plug, char plugValue)
 Adds an operation to this dependency graph modifier that sets a plug to a char value. More...
 
MStatus newPlugValueDouble (const MPlug &plug, double plugValue)
 Adds an operation to this dependency graph modifier that sets a plug to a double value. More...
 
MStatus newPlugValueFloat (const MPlug &plug, float plugValue)
 Adds an operation to this dependency graph modifier that sets a plug to a float value. More...
 
MStatus newPlugValueInt (const MPlug &plug, int plugValue)
 Adds an operation to this dependency graph modifier that sets a plug to an int value. More...
 
MStatus newPlugValueInt64 (const MPlug &plug, MInt64 plugValue)
 Adds an operation to this dependency graph modifier that sets a plug to a 64-bit int value. More...
 
MStatus newPlugValueMAngle (const MPlug &plug, const MAngle &plugValue)
 Adds an operation to this dependency graph modifier that sets a plug to an MAngle value. More...
 
MStatus newPlugValueMDistance (const MPlug &plug, const MDistance &plugValue)
 Adds an operation to this dependency graph modifier that sets a plug to an MDistance value. More...
 
MStatus newPlugValueMTime (const MPlug &plug, const MTime &plugValue)
 Adds an operation to this dependency graph modifier that sets a plug to an MTime value. More...
 
MStatus newPlugValueShort (const MPlug &plug, short plugValue)
 Adds an operation to this dependency graph modifier that sets a plug to a short value. More...
 
MStatus newPlugValueString (const MPlug &plug, const MString &plugValue)
 Adds an operation to this dependency graph modifier that sets a plug to a string value. More...
 
MStatus removeMultiInstance (const MPlug &plug, bool breakConnections)
 Adds an operation to this dependency graph modifier that removes an element of a multi (array) plug. More...
 
MStatus setMetadata (const MObject &node, const adsk::Data::Associations &metadata)
 Adds an operation to this dependency graph modifier that replaces metadata on a specific node. More...
 
MStatus deleteMetadata (const MObject &node)
 Adds an operation to this dependency graph modifier that deletes all metadata from a node. More...
 
MStatus doIt ()
 Executes all of the operations that have been given to this modifier. More...
 
MStatus undoIt ()
 Undoes all of the operations that have been given to this modifier. More...
 
MStatus addAttribute (const MObject &node, const MObject &attribute, MFnDependencyNode::MAttrClass type)
 This method is obsolete. More...
 
MStatus removeAttribute (const MObject &node, const MObject &attribute, MFnDependencyNode::MAttrClass type)
 This method is obsolete. More...
 

Static Public Member Functions

static const char * className ()
 Returns the name of this class. More...
 
- Static Public Member Functions inherited from MDGModifier
static const char * className ()
 Returns the name of this class. More...
 

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:
AbcImport/CameraHelper.cpp, AbcImport/LocatorHelper.cpp, atomImportExport/atomImportExport.cpp, meshOpCmd/polyModifierCmd.h, offsetNode/offsetNode.cpp, polyPrimitiveCmd/polyPrimitiveCmd.cpp, sceneAssembly/adskRepresentations.cpp, sceneAssembly/assemblyDefinition.cpp, sceneAssembly/assemblyDefinition.h, sceneAssembly/assemblyReference.cpp, sceneAssembly/assemblyReference.h, and splitUVCmd/polyModifierCmd.h.

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:
  • MS::kSuccess operation successful
  • MS::kInvalidParameter the type passed in is not valid
Examples:
atomImportExport/atomImportExport.cpp, offsetNode/offsetNode.cpp, and sceneAssembly/adskRepresentations.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 node. 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:
  • MS::kSuccess operation successful
  • MS::kInvalidParameter the type passed in is not valid
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:
  • MS::kSuccess operation successful
  • MS::kInvalidParameter node or parent is node valid
Examples:
AbcImport/CameraHelper.cpp.
const char * className ( )
static

Returns the name of this class.

Returns
The name of this class.

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