Python API 2.0 Reference
|
Public Member Functions | |
def | __init__ () |
def | addAttribute () |
def | addExtensionAttribute () |
def | commandToExecute () |
def | connect () |
def | createNode () |
def | deleteNode () |
def | disconnect () |
def | doIt () |
def | linkExtensionAttributeToPlugin () |
def | newPlugValue () |
def | newPlugValueBool () |
def | newPlugValueChar () |
def | newPlugValueDouble () |
def | newPlugValueFloat () |
def | newPlugValueInt () |
def | newPlugValueMAngle () |
def | newPlugValueMDistance () |
def | newPlugValueMTime () |
def | newPlugValueShort () |
def | newPlugValueString () |
def | pythonCommandToExecute () |
def | removeAttribute () |
def | removeExtensionAttribute () |
def | removeExtensionAttributeIfUnset () |
def | removeMultiInstance () |
def | renameAttribute () |
def | renameNode () |
def | setNodeLockState () |
def | undoIt () |
def | unlinkExtensionAttributeFromPlugin () |
Static Public Member Functions | |
def | __new__ () |
Used to change the structure of the dependency graph.
def OpenMaya.MDGModifier.__init__ | ( | ) |
Initialize self. See help(type(self)) for accurate signature.
|
static |
Create and return a new object. See help(type) for accurate signature.
def 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.
def 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.
def 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.
def 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.
def 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.
def OpenMaya.MDGModifier.deleteNode | ( | ) |
deleteNode(MObject node) -> selfdeleteNode(MObject node, bool includeParents) -> self Adds an operation to the modifier which deletes the specified node from the Dependency Graph. If deleteNode() is called to delete nodes in a graph while other items are also in the queue, it might end up deleting the nodes before all the other tasks in the queue. In order to prevent unexpected outcomes, the modifier's doIt() should be called before the deleteNode operation is added so that the queue is emptied. Then, deleteNode() can be called and added to the queue. doIt() should be called immediately after to ensure that the queue is emptied before any other operations are added to it. The default behaviour when deleting a DAG node is to also include empty parents of the DAG node in the delete operation. If you do not want this behaviour set the includeParents argument to False.
def 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.
def 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.
def 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.
def 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.
def OpenMaya.MDGModifier.newPlugValueBool | ( | ) |
newPlugValueBool(MPlug plug, bool value) -> self Adds an operation to the modifier to set a value onto a bool plug.
def 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.
def 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.
def 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.
def OpenMaya.MDGModifier.newPlugValueInt | ( | ) |
newPlugValueInt(MPlug plug, int value) -> self Adds an operation to the modifier to set a value onto an int plug.
def OpenMaya.MDGModifier.newPlugValueMAngle | ( | ) |
newPlugValueMAngle(MPlug plug, MAngle value) -> self Adds an operation to the modifier to set a value onto an angle plug.
def OpenMaya.MDGModifier.newPlugValueMDistance | ( | ) |
newPlugValueMDistance(MPlug plug, MDistance value) -> self Adds an operation to the modifier to set a value onto a distance plug.
def OpenMaya.MDGModifier.newPlugValueMTime | ( | ) |
newPlugValueMTime(MPlug plug, MTime value) -> self Adds an operation to the modifier to set a value onto a time plug.
def OpenMaya.MDGModifier.newPlugValueShort | ( | ) |
newPlugValueShort(MPlug plug, int value) -> self Adds an operation to the modifier to set a value onto a short integer plug.
def OpenMaya.MDGModifier.newPlugValueString | ( | ) |
newPlugValueString(MPlug plug, string value) -> self Adds an operation to the modifier to set a value onto a string plug.
def 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.
def 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.
def 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.
def 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.
def OpenMaya.MDGModifier.removeMultiInstance | ( | ) |
removeMultiInstance(MPlug plug, bool breakConnections) -> self Adds an operation to the modifier to remove an element of a multi (array) plug.
def 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.
def OpenMaya.MDGModifier.renameNode | ( | ) |
renameNode(MObject node, string newName) -> self Adds an operation to the modifer to rename a node.
def OpenMaya.MDGModifier.setNodeLockState | ( | ) |
setNodeLockState(MObject node, bool newState) -> self Adds an operation to the modifier to set the lockState of a node.
def 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.
def 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.