OpenMaya.MDGModifier Class Reference

Class Description

Used to change the structure of the dependency graph.

 


+ Inheritance diagram for OpenMaya.MDGModifier:

Public Member Functions

__init__ ()
 
addAttribute ()
 
addExtensionAttribute ()
 
commandToExecute ()
 
connect ()
 
createNode ()
 
deleteNode ()
 
disconnect ()
 
doIt ()
 
linkExtensionAttributeToPlugin ()
 
newPlugValue ()
 
newPlugValueBool ()
 
newPlugValueChar ()
 
newPlugValueDouble ()
 
newPlugValueFloat ()
 
newPlugValueInt ()
 
newPlugValueMAngle ()
 
newPlugValueMDistance ()
 
newPlugValueMTime ()
 
newPlugValueShort ()
 
newPlugValueString ()
 
pythonCommandToExecute ()
 
removeAttribute ()
 
removeExtensionAttribute ()
 
removeExtensionAttributeIfUnset ()
 
removeMultiInstance ()
 
renameAttribute ()
 
renameNode ()
 
setNodeLockState ()
 
undoIt ()
 
unlinkExtensionAttributeFromPlugin ()
 

Constructor & Destructor Documentation

OpenMaya.MDGModifier.__init__ ( )
x.__init__(...) initializes x; see help(type(x)) for signature

Member Function Documentation

OpenMaya.MDGModifier.addAttribute ( )
addAttribute(MObject node, MObject attribute) -> self

Adds an operation to the modifier to add a new dynamic attribute to the
given dependency node. If the attribute is a compound its children will
be added as well, so only the parent needs to be added using this method.
OpenMaya.MDGModifier.addExtensionAttribute ( )
addExtensionAttribute(MNodeClass nodeClass, MObject attribute) -> self

Adds an operation to the modifier to add a new extension attribute to
the given node class. If the attribute is a compound its children will be
added as well, so only the parent needs to be added using this method.
OpenMaya.MDGModifier.commandToExecute ( )
commandToExecute(command) -> self

Adds an operation to the modifier to execute a MEL command. The command
should be fully undoable otherwise unexpected results may occur. If 
the command contains no undoable portions whatsoever, the call to
doIt() may fail, but only after executing the command. It is best to
use multiple commandToExecute() calls rather than batching multiple
commands into a single call to commandToExecute(). They will still be
undone together, as a single undo action by the user, but Maya will
better be able to recover if one of the commands fails.
OpenMaya.MDGModifier.connect ( )
connect(MPlug source, MPlug dest) -> self
connect(MObject sourceNode, MObject sourceAttr,
        MObject destNode,   MObject destAttr) -> self

Adds an operation to the modifier that connects two plugs in the
dependency graph. It is the user's responsibility to ensure that the
source and destination attributes are of compatible types. For instance,
if the source attribute is a nurbs surface then the destination must
also be a nurbs surface.
Plugs can either be specified with node and attribute MObjects or with
MPlugs.
OpenMaya.MDGModifier.createNode ( )
createNode(typeName) -> MObject
createNode(MTypeId typeId) -> MObject

Adds an operation to the modifier to create a node of the given type.
The new node is created and returned but will not be added to the
Dependency Graph until the modifier's doIt() method is called. Raises
TypeError if the named node type does not exist or if it is a DAG node
type.
OpenMaya.MDGModifier.deleteNode ( )
deleteNode(MObject node) -> self

Adds an operation to the modifer which deletes the specified node from
the Dependency Graph. If the modifier already contains other operations
on the same node (e.g. a disconnect) then they should be committed by
calling the modifier's doIt() before the deleteNode operation is added.
OpenMaya.MDGModifier.disconnect ( )
disconnect(MPlug source, MPlug dest) -> self
disconnect(MObject sourceNode, MObject sourceAttr,
           MObject destNode,   MObject destAttr) -> self

Adds an operation to the modifier that breaks a connection between two
plugs in the dependency graph.
Plugs can either be specified with node and attribute MObjects or with
MPlugs.
OpenMaya.MDGModifier.doIt ( )
doIt() -> self

Executes the modifier's operations. If doIt() is called multiple times
in a row, without any intervening calls to undoIt(), then only the
operations which were added since the previous doIt() call will be
executed. If undoIt() has been called then the next call to doIt() will
do all operations.
OpenMaya.MDGModifier.linkExtensionAttributeToPlugin ( )
linkExtensionAttributeToPlugin(MObject plugin, MObject attribute) -> self

The plugin can call this method to indicate that the extension attribute
defines part of the plugin, regardless of the node type to which it
attaches itself. This requirement is used when the plugin is checked to
see if it is in use or if is able to be unloaded or if it is required as
part of a stored file. For compound attributes only the topmost parent
attribute may be passed in and all of its children will be included,
recursively. Thus it's not possible to link a child attribute to a
plugin by itself. Note that the link is established immediately and is
not affected by the modifier's doIt() or undoIt() methods.
OpenMaya.MDGModifier.newPlugValue ( )
newPlugValue(MPlug plug, MObject value) -> self

Adds an operation to the modifier to set the value of a plug, where
value is an MObject data wrapper, such as created by the various
MFn*Data classes.
OpenMaya.MDGModifier.newPlugValueBool ( )
newPlugValueBool(MPlug plug, bool value) -> self

Adds an operation to the modifier to set a value onto a bool plug.
OpenMaya.MDGModifier.newPlugValueChar ( )
newPlugValueChar(MPlug plug, int value) -> self

Adds an operation to the modifier to set a value onto a char (single
byte signed integer) plug.
OpenMaya.MDGModifier.newPlugValueDouble ( )
newPlugValueDouble(MPlug plug, float value) -> self

Adds an operation to the modifier to set a value onto a double-precision
float plug.
OpenMaya.MDGModifier.newPlugValueFloat ( )
newPlugValueFloat(MPlug plug, float value) -> self

Adds an operation to the modifier to set a value onto a single-precision
float plug.
OpenMaya.MDGModifier.newPlugValueInt ( )
newPlugValueInt(MPlug plug, int value) -> self

Adds an operation to the modifier to set a value onto an int plug.
OpenMaya.MDGModifier.newPlugValueMAngle ( )
newPlugValueMAngle(MPlug plug, MAngle value) -> self

Adds an operation to the modifier to set a value onto an angle plug.
OpenMaya.MDGModifier.newPlugValueMDistance ( )
newPlugValueMDistance(MPlug plug, MDistance value) -> self

Adds an operation to the modifier to set a value onto a distance plug.
OpenMaya.MDGModifier.newPlugValueMTime ( )
newPlugValueMTime(MPlug plug, MTime value) -> self

Adds an operation to the modifier to set a value onto a time plug.
OpenMaya.MDGModifier.newPlugValueShort ( )
newPlugValueShort(MPlug plug, int value) -> self

Adds an operation to the modifier to set a value onto a short
integer plug.
OpenMaya.MDGModifier.newPlugValueString ( )
newPlugValueString(MPlug plug, string value) -> self

Adds an operation to the modifier to set a value onto a string plug.
OpenMaya.MDGModifier.pythonCommandToExecute ( )
pythonCommandToExecute(callable) -> selfpythonCommandToExecute(commandString) -> self

Adds an operation to the modifier to execute a Python command, which
can be passed as either a Python callable or a string containing the
text of the Python code to be executed. The command should be fully
undoable otherwise unexpected results may occur. If the command
contains no undoable portions whatsoever, the call to doIt() may fail,
but only after executing the command. It is best to use multiple calls
rather than batching multiple commands into a single call to
pythonCommandToExecute(). They will still be undone together, as a
single undo action by the user, but Maya will better be able to
recover if one of the commands fails.
OpenMaya.MDGModifier.removeAttribute ( )
removeAttribute(MObject node, MObject attribute) -> self

Adds an operation to the modifier to remove a dynamic attribute from the
given dependency node. If the attribute is a compound its children will
be removed as well, so only the parent needs to be removed using this
method. The attribute MObject passed in will be set to kNullObj. There
should be no function sets attached to the attribute at the time of the
call as their behaviour may become unpredictable.
OpenMaya.MDGModifier.removeExtensionAttribute ( )
removeExtensionAttribute(MNodeClass nodeClass, MObject attribute) -> self

Adds an operation to the modifier to remove an extension attribute from
the given node class. If the attribute is a compound its children will
be removed as well, so only the parent needs to be removed using this
method. The attribute MObject passed in will be set to kNullObj. There
should be no function sets attached to the attribute at the time of the
call as their behaviour may become unpredictable.
OpenMaya.MDGModifier.removeExtensionAttributeIfUnset ( )
removeExtensionAttributeIfUnset(MNodeClass nodeClass,
                    MObject attribute) -> self

Adds an operation to the modifier to remove an extension attribute from
the given node class, but only if there are no nodes in the graph with
non-default values for this attribute. If the attribute is a compound
its children will be removed as well, so only the parent needs to be
removed using this method. The attribute MObject passed in will be set
to kNullObj. There should be no function sets attached to the attribute
at the time of the call as their behaviour may become unpredictable.
OpenMaya.MDGModifier.removeMultiInstance ( )
removeMultiInstance(MPlug plug, bool breakConnections) -> self

Adds an operation to the modifier to remove an element of a multi (array) plug.
OpenMaya.MDGModifier.renameAttribute ( )
renameAttribute(MObject node, MObject attribute, 
string newShortName, string newShortName) -> self

Adds an operation to the modifer that renames a dynamic attribute on the given dependency node.
OpenMaya.MDGModifier.renameNode ( )
renameNode(MObject node, string newName) -> self

Adds an operation to the modifer to rename a node.
OpenMaya.MDGModifier.setNodeLockState ( )
setNodeLockState(MObject node, bool newState) -> self

Adds an operation to the modifier to set the lockState of a node.
OpenMaya.MDGModifier.undoIt ( )
undoIt() -> self

Undoes all of the operations that have been given to this modifier. It
is only valid to call this method after the doIt() method has been
called.
OpenMaya.MDGModifier.unlinkExtensionAttributeFromPlugin ( )
unlinkExtensionAttributeFromPlugin(MObject plugin,
                       MObject attribute) -> self

The plugin can call this method to indicate that it no longer requires
an extension attribute for its operation. This requirement is used when
the plugin is checked to see if it is in use or if is able to be unloaded
or if it is required as part of a stored file. For compound attributes
only the topmost parent attribute may be passed in and all of its
children will be unlinked, recursively. Thus it's not possible to unlink
a child attribute from a plugin by itself. Note that the link is broken
immediately and is not affected by the modifier's doIt() or undoIt()
methods.