Python API 2.0 Reference
OpenMaya.MPlug Class Reference
+ Inheritance diagram for OpenMaya.MPlug:

Public Member Functions

def __eq__ ()
 
def __ge__ ()
 
def __gt__ ()
 
def __init__ ()
 
def __le__ ()
 
def __lt__ ()
 
def __ne__ ()
 
def __str__ ()
 
def array ()
 
def asBool ()
 
def asChar ()
 
def asDouble ()
 
def asFloat ()
 
def asInt ()
 
def asMAngle ()
 
def asMDataHandle ()
 
def asMDistance ()
 
def asMObject ()
 
def asMTime ()
 
def asShort ()
 
def asString ()
 
def attribute ()
 
def child ()
 
def connectedTo ()
 
def connectionByPhysicalIndex ()
 
def constructHandle ()
 
def copy ()
 
def destinations ()
 
def destinationsWithConversions ()
 
def destructHandle ()
 
def elementByLogicalIndex ()
 
def elementByPhysicalIndex ()
 
def evaluateNumElements ()
 
def getExistingArrayAttributeIndices ()
 
def getSetAttrCmds ()
 
def isDefaultValue ()
 
def isFreeToChange ()
 
def logicalIndex ()
 
def name ()
 
def node ()
 
def numChildren ()
 
def numConnectedChildren ()
 
def numConnectedElements ()
 
def numElements ()
 
def parent ()
 
def partialName ()
 
def proxied ()
 
def selectAncestorLogicalIndex ()
 
def setAttribute ()
 
def setBool ()
 
def setChar ()
 
def setDouble ()
 
def setFloat ()
 
def setInt ()
 
def setMAngle ()
 
def setMDataHandle ()
 
def setMDistance ()
 
def setMObject ()
 
def setMPxData ()
 
def setMTime ()
 
def setNumElements ()
 
def setShort ()
 
def setString ()
 
def source ()
 
def sourceWithConversion ()
 

Static Public Member Functions

def __new__ ()
 

Static Public Attributes

Value Selectors
int kAll = 0
 
int kChanged = 2
 
int kLastAttrSelector = 3
 
int kNonDefault = 1
 
isFreeToChange Results
int kChildrenNotFreeToChange = 2
 
int kFreeToChange = 0
 
int kNotFreeToChange = 1
 

Properties

 info = property(...)
 
 isArray = property(...)
 
 isCaching = property(...)
 
 isChannelBox = property(...)
 
 isChild = property(...)
 
 isCompound = property(...)
 
 isConnected = property(...)
 
 isDestination = property(...)
 
 isDynamic = property(...)
 
 isElement = property(...)
 
 isFromReferencedFile = property(...)
 
 isIgnoredWhenRendering = property(...)
 
 isKeyable = property(...)
 
 isLocked = property(...)
 
 isNetworked = property(...)
 
 isNull = property(...)
 
 isProcedural = property(...)
 
 isProxy = property(...)
 
 isSource = property(...)
 

Detailed Description

Create and access dependency node plugs.

Constructors

SignatureParametersDescription
MPlug()  

Default constructor. Returns a new, empty MPlug object.

MPlug(src) src - MPlug

Copy constructor. Returns a new MPlug object referencing the same plug as src.

MPlug(node, attribute) node - MObject
attribute - MObject

Returns a new plug for the given attribute of the given node.

Sequence Support

We explicitly do not support indexing because that is conditional on the plug being an array of plugs, which is not always the case, and due to potential confusion over logical versus physical index. Thus it is better handled through the elementByLogicalIndex() and elementByPhysicalIndex() methods.

Comparison Support

MPlug == MPlug

True if both plugs refer to the same attribute of the same node.

MPlug == MObject

True if the MObject refers to the same attribute as the plug.

MObject == MPlug

True if the MObject refers to the same attribute as the plug.

MPlug != MPlug

True if the plugs refer to different nodes, or to different attributes of the same node.

MPlug != MObject

True if the MObject does not refer to the same attribute as the plug.

MObject != MPlug True if the MObject does not refer to the same attribute as the plug.

All other comparison operators will raise a TypeError exception.

 


Constructor & Destructor Documentation

def OpenMaya.MPlug.__init__ ( )
Initialize self.  See help(type(self)) for accurate signature.

Member Function Documentation

def OpenMaya.MPlug.__eq__ ( )
Return self==value.
def OpenMaya.MPlug.__ge__ ( )
Return self>=value.
def OpenMaya.MPlug.__gt__ ( )
Return self>value.
def OpenMaya.MPlug.__le__ ( )
Return self<=value.
def OpenMaya.MPlug.__lt__ ( )
Return self<value.
def OpenMaya.MPlug.__ne__ ( )
Return self!=value.
def OpenMaya.MPlug.__new__ ( )
static
Create and return a new object.  See help(type) for accurate signature.
def OpenMaya.MPlug.__str__ ( )
Return str(self).
OpenMaya.MPlug.array ( )
Returns a plug for the array of plugs of which this plug is an element.
Signature: array()
Parameters:  
Returns: MPlug
Description: Returns a plug for the array of plugs of which this plug is an element. Raises a TypeError if this plug is not an element of an array of plugs.
OpenMaya.MPlug.asBool ( )
Retrieves the plug's value, as a boolean.
Signature: asBool(context=MDGContext.kNormal)
Parameters: context - MDGContext
Returns: bool
Description: Retrieves the plug's value, at the time specified by the context, as a boolean.
OpenMaya.MPlug.asChar ( )
Retrieves the plug's value, as a single-byte integer.
Signature: asChar(context=MDGContext.kNormal)
Parameters: context - MDGContext
Returns: int
Description: Retrieves the plug's value, at the time specified by the context, as a single-byte integer.
OpenMaya.MPlug.asDouble ( )
Retrieves the plug's value, as a double-precision float.
Signature: asDouble(context=MDGContext.kNormal)
Parameters: context - MDGContext
Returns: float
Description: Retrieves the plug's value, at the time specified by the context, as a double-precision float.
OpenMaya.MPlug.asFloat ( )
Retrieves the plug's value, as a single-precision float.
Signature: asFloat(context=MDGContext.kNormal)
Parameters: context - MDGContext
Returns: float
Description: Retrieves the plug's value, at the time specified by the context, as a single-precision float.
OpenMaya.MPlug.asInt ( )
Retrieves the plug's value, as a regular integer.
Signature: asInt(context=MDGContext.kNormal)
Parameters: context - MDGContext
Returns: int
Description: Retrieves the plug's value, at the time specified by the context, as a regular integer.
OpenMaya.MPlug.asMAngle ( )
Retrieves the plug's value, as an MAngle.
Signature: asMAngle(context=MDGContext.kNormal)
Parameters: context - MDGContext
Returns: MAngle
Description: Retrieves the plug's value, at the time specified by the context, as an MAngle.
def OpenMaya.MPlug.asMDataHandle ( )
Retrieve the current value of the attribute this plug references.
OpenMaya.MPlug.asMDistance ( )
Retrieves the plug's value, as an MDistance.
Signature: asMDistance(context=MDGContext.kNormal)
Parameters: context - MDGContext
Returns: MDistance
Description: Retrieves the plug's value, at the time specified by the context, as an MDistance.
OpenMaya.MPlug.asMObject ( )
Retrieves the plug's value, as as an MObject containing a direct reference to the plug's data.
Signature: asMObject(context=MDGContext.kNormal)
Parameters: context - MDGContext
Returns: MObject
Description: Retrieves the plug's value, at the time specified by the context, and returns it as an MObject containing a direct reference to the plug's data.
OpenMaya.MPlug.asMTime ( )
Retrieves the plug's value, as an MTime.
Signature: asMTime(context=MDGContext.kNormal)
Parameters: context - MDGContext
Returns: MTime
Description: Retrieves the plug's value, at the time specified by the context, as an MTime.
OpenMaya.MPlug.asShort ( )
Retrieves the plug's value, as a short integer.
Signature: asShort(context=MDGContext.kNormal)
Parameters: context - MDGContext
Returns: int
Description: Retrieves the plug's value, at the time specified by the context, as a short integer.
OpenMaya.MPlug.asString ( )
Retrieves the plug's value, as a string.
Signature: asString(context=MDGContext.kNormal)
Parameters: context - MDGContext
Returns: string
Description: Retrieves the plug's value, at the time specified by the context, as a string.
OpenMaya.MPlug.attribute ( )
Returns the attribute currently referenced by this plug.
Signature: attribute()
Parameters:  
Returns: MObject
Description: Returns the attribute currently referenced by this plug.
OpenMaya.MPlug.child ( )
Returns a plug for the specified child attribute of this plug.
Signature: child(attribute)
Parameters: attribute - MObject
Returns: MPlug
Description: Returns a plug for the specified child attribute of this plug. Raises a TypeError if this plug is not compound.
Signature: child(index)
Parameters: index - int
Returns: MPlug
Description: Returns a plug for the index'th child of this plug. Raises a TypeError if this plug is not compound.
OpenMaya.MPlug.connectedTo ( )
Returns an array of plugs which are connected to this one.
Signature: connectedTo(asDest, asSrc)
Parameters: asDest - bool
asSrc - bool
Returns: MPlugArray
Description: Returns an array of plugs which are connected to this one. If asDest is True connections in which this plug is the destination will be included in the array. If asSrc is True connections in which this plug is the source will be included in the array.
OpenMaya.MPlug.connectionByPhysicalIndex ( )
Returns a plug for the index'th connected element of this plug.
Signature: connectionByPhysicalIndex(index)
Parameters: index - int
Returns: MPlug
Description: Returns a plug for the index'th connected element of this plug. Raises a TypeError if this plug is not an array of plugs.
OpenMaya.MPlug.constructHandle ( )
Constructs a data handle for the plug.
Signature: constructHandle(block)
Parameters: block - MDataBlock
Returns: MDataHandle
Description: Constructs a data handle for the plug.
def OpenMaya.MPlug.copy ( )
Copies one plug to another.
def OpenMaya.MPlug.destinations ( )
If this plug is a source, return the destination plugs connected to it.
If this plug is not a source, a null plug is returned.
This method will produce the networked version of the connected plug.
def OpenMaya.MPlug.destinationsWithConversions ( )
If this plug is a source, return the destination plugs connected to it.
This method is very similar to the destinations() method.  The only difference is that the destinations() method skips over any unit conversion node connected to this source, and returns the destination of the unit conversion node.
destinationsWithConversionNode() does not skip over unit conversion nodes, and returns the destination plug on a unit conversion node, if present.
Note that the behavior of connectedTo() is identical to destinationsWithConversions(), that is, do not skip over unit conversion nodes.
OpenMaya.MPlug.destructHandle ( )
Destroys a data handle previously constructed using constructHandle().
Signature: destructHandle(handle)
Parameters: handle - MDataHandle
Returns: Reference to self.
Description: Destroys a data handle previously constructed using constructHandle().
OpenMaya.MPlug.elementByLogicalIndex ( )
Returns a plug for the element of this plug array having the specified logical index.
Signature: elementByLogicalIndex(index)
Parameters: index - int
Returns: MPlug
Description: Returns a plug for the element of this plug array having the specified logical index. Raises a TypeError if this plug is not an array of plugs.
OpenMaya.MPlug.elementByPhysicalIndex ( )
Returns a plug for the element of this plug array having the specified physical index.
Signature: elementByPhysicalIndex(index)
Parameters: index - int
Returns: MPlug
Description: Returns a plug for the element of this plug array having the specified physical index. Raises a TypeError if this plug is not an array of plugs.
OpenMaya.MPlug.evaluateNumElements ( )
Like numElements() but evaluates all connected elements first to ensure that they are included in the count.
Signature: evaluateNumElements()
Parameters:  
Returns: int
Description: Like numElements() but evaluates all connected elements first to ensure that they are included in the count. Raises a TypeError if the plug is not a plug array.
OpenMaya.MPlug.getExistingArrayAttributeIndices ( )
Returns an array of all the plug's logical indices which are currently in use.
Signature: getExistingArrayAttributeIndices()
Parameters:  
Returns: MIntArray
Description: Returns an array of all the plug's logical indices which are currently in use. Raises a TypeError if the plug is not a plug array.
OpenMaya.MPlug.getSetAttrCmds ( )
Returns a list of strings containing the setAttr commands (in MEL syntax) for this plug and all of its descendents.
Signature: getSetAttrCmds(valueSelector=kAll, useLongNames=False)
Parameters: valueSelector - Value Selector constant
useLongNames - bool
Returns: list of strings
Description: Returns a list of strings containing the setAttr commands (in MEL syntax) for this plug and all of its descendents.
def OpenMaya.MPlug.isDefaultValue ( )
Returns a value indicating if the plug's value is equivalent to the plug's default value.
OpenMaya.MPlug.isFreeToChange ( )
Returns a value indicating if the plug's value can be changed, after taking into account the effects of locking and connections.
Signature: isFreeToChange(checkAncestors=True, checkChildren=True)
Parameters:  
Returns: isFreeToChange Result constant
Description: Returns a value indicating if the plug's value can be changed, after taking into account the effects of locking and connections.
OpenMaya.MPlug.logicalIndex ( )
Returns this plug's logical index within its parent array.
Signature: logicalIndex()
Parameters:  
Returns: int
Description: Returns this plug's logical index within its parent array. Raises a TypeError if the plug is not an element of an array of plugs.
OpenMaya.MPlug.name ( )
Returns the name of the plug.
Signature: name()
Parameters:  
Returns: string
Description: Returns the name of the plug.
OpenMaya.MPlug.node ( )
Returns the node that this plug belongs to.
Signature: node()
Parameters:  
Returns: MObject
Description: Returns the node that this plug belongs to.
OpenMaya.MPlug.numChildren ( )
Returns the number of children this plug has.
Signature: numChildren()
Parameters:  
Returns: int
Description: Returns the number of children this plug has. Raises a TypeError if the plug is not compound.
OpenMaya.MPlug.numConnectedChildren ( )
Returns the number of this plug's children which have connections.
Signature: numConnectedChildren()
Parameters:  
Returns: int
Description: Returns the number of this plug's children which have connections. Raises a TypeError if the plug is not compound.
OpenMaya.MPlug.numConnectedElements ( )
Returns the number of this plug's elements which have connections.
Signature: numConnectedElements()
Parameters:  
Returns: int
Description: Returns the number of this plug's elements which have connections. Raises a TypeError if the plug is not an array of plugs.
OpenMaya.MPlug.numElements ( )
Returns the number of the plug's logical indices which are currently in use. Connected elements which have not yet been evaluated may not yet fully exist and may be excluded from the count.
Signature: numElements()
Parameters:  
Returns: int
Description: Returns the number of the plug's logical indices which are currently in use. Connected elements which have not yet been evaluated may not yet fully exist and may be excluded from the count. Raises a TypeError if the plug is not a plug array.
OpenMaya.MPlug.parent ( )
Returns a plug for the parent of this plug.
Signature: parent()
Parameters:  
Returns: MPlug
Description: Returns a plug for the parent of this plug. Raises a TypeError if this plug is not the child of a compound plug.
OpenMaya.MPlug.partialName ( )
Returns the name of the plug, formatted according to various criteria.
Signature: partialName(includeNodeName=False, includeNonMandatoryIndices=False, includeInstancedIndices=False, useAlias=False, useFullAttributePath=False, useLongNames=False)
Parameters: includeNodeName - bool
includeNonMandatorIndices - bool
includeInstancedIndices - bool
useAlias - bool
useFullAttributePath - bool
useLongNames - bool
Returns: string
Description: Returns the name of the plug, formatted according to various criteria.
def OpenMaya.MPlug.proxied ( )
Returns the proxied plug for this plug.
OpenMaya.MPlug.selectAncestorLogicalIndex ( )
Changes the logical index of the specified attribute in the plug's path.
Signature: selectAncestorLogicalIndex(index, attribute=MObject.kNullObj)
Parameters: index - int
attribute - MObject
Returns: Reference to self.
Description: Changes the logical index of the specified attribute in the plug's path. Raises a TypeError if the current plug is networked. or if attribute is not an array.
OpenMaya.MPlug.setAttribute ( )
Switches the plug to reference the given attribute of the same node as the previously referenced attribute.
Signature: setAttribute(attr)
Parameters: attr - MObject
Returns: Reference to self.
Description: Switches the plug to reference the given attribute of the same node as the previously referenced attribute.
OpenMaya.MPlug.setBool ( )
Sets the plug's value as a boolean.
Signature: setBool(value)
Parameters: value - bool
Returns: Reference to self
Description: Sets the plug's value as a boolean.
OpenMaya.MPlug.setChar ( )
Sets the plug's value as a single-byte integer.
Signature: setChar(value)
Parameters: value - int
Returns: Reference to self
Description: Sets the plug's value as a single-byte integer.
OpenMaya.MPlug.setDouble ( )
Sets the plug's value as a double-precision float.
Signature: setDouble(value)
Parameters: value - float
Returns: Reference to self
Description: Sets the plug's value as a double-precision float.
OpenMaya.MPlug.setFloat ( )
Sets the plug's value as a single-precision float.
Signature: setFloat(value)
Parameters: value - float
Returns: Reference to self
Description: Sets the plug's value as a single-precision float.
OpenMaya.MPlug.setInt ( )
Sets the plug's value as a regular integer.
Signature: setInt(value)
Parameters: value - int
Returns: Reference to self
Description: Sets the plug's value as a regular integer.
OpenMaya.MPlug.setMAngle ( )
Sets the plug's value as an MAngle.
Signature: setMAngle(value)
Parameters: value - MAngle
Returns: Reference to self
Description: Sets the plug's value as an MAngle.
OpenMaya.MPlug.setMDataHandle ( )
Sets the plug's value as a data handle.
Signature: setMDataHandle(value)
Parameters: value - MDataHandle
Returns: Reference to self
Description: Sets the plug's value using a data handle.
OpenMaya.MPlug.setMDistance ( )
Sets the plug's value as an MDistance.
Signature: setMDistance(value)
Parameters: value - MDistance
Returns: Reference to self
Description: Sets the plug's value as an MDistance.
OpenMaya.MPlug.setMObject ( )
Sets the plug's value as an MObject.
Signature: setMObject(value)
Parameters: value - MObject
Returns: Reference to self
Description: Sets the plug's value as an MObject.
OpenMaya.MPlug.setMPxData ( )
Sets the plug's value using custom plug-in data.
Signature: setMPxData(value)
Parameters: value - MPxData
Returns: Reference to self
Description: Sets the plug's value using custom plug-in data.
OpenMaya.MPlug.setMTime ( )
Sets the plug's value as an MTime.
Signature: setMTime(value)
Parameters: value - MTime
Returns: Reference to self
Description: Sets the plug's value as an MTime.
OpenMaya.MPlug.setNumElements ( )
Pre-allocates space for count elements in an array of plugs.
Signature: setNumElements(count)
Parameters: count - int
Returns: Reference to self
Description: Pre-allocates space for count elements in an array of plugs. Raises a TypeError if the plug is not a plug array or if it already has elements.
OpenMaya.MPlug.setShort ( )
Sets the plug's value as a short integer.
Signature: setShort(value)
Parameters: value - int
Returns: Reference to self
Description: Sets the plug's value as a short integer.
OpenMaya.MPlug.setString ( )
Sets the plug's value as a string.
Signature: setString(value)
Parameters: value - string
Returns: Reference to self
Description: Sets the plug's value as a string.
def OpenMaya.MPlug.source ( )
If this plug is a destination, return the source plug connected to it.
If this plug is not a destination, a null plug is returned.
This method will produce the networked version of the connectedplug.
def OpenMaya.MPlug.sourceWithConversion ( )
If this plug is a destination, return the source plug connected to it.
This method is very similar to the source() method.  The only difference is that the source() method skips over any unit conversionnode connected to this destination, and returns the source of the unit conversion node.
sourceWithConversion() does not skip over unitconversion nodes, and returns the source plug on a unit conversionnode, if present.
Note that the behavior of connectedTo() is identical to sourceWithConversion(), that is, do not skip over unit conversion nodes.

Member Data Documentation

OpenMaya.MPlug.kAll = 0
static
Name: kAll
Type: int
Description: All values.
OpenMaya.MPlug.kChanged = 2
static
Name: kChanged
Type: int
Description: Values which have changed.
OpenMaya.MPlug.kChildrenNotFreeToChange = 2
static
Name: kChildrenNotFreeToChange
Type: int
Description: Some of the child plugs are not free to change.
OpenMaya.MPlug.kFreeToChange = 0
static
Name: kFreeToChange
Type: int
Description: All tested plugs are free to change.
OpenMaya.MPlug.kLastAttrSelector = 3
static
Name: kLastAttrSelector
Type: int
Description: End of list. Used for counting.
OpenMaya.MPlug.kNonDefault = 1
static
Name: kNonDefault
Type: int
Description: Values not at their defaults.
OpenMaya.MPlug.kNotFreeToChange = 1
static
Name: kNotFreeToChange
Type: int
Description: Some tested plugs are not free to change.

Property Documentation

OpenMaya.MPlug.info = property(...)
static
 Description of the plug for debugging purposes, in the form node:attr1.attr2[].attr3...
Name: info
Type: string
Access: R
Description: Description of the plug for debugging purposes, in the form node:attr1.attr2[].attr3...
OpenMaya.MPlug.isArray = property(...)
static
 True if plug is an array of plugs.
Name: isArray
Type: bool
Access: R
Description: True if plug is an array of plugs.
OpenMaya.MPlug.isCaching = property(...)
static
 True if plug's value is being cached.
Name: isCaching
Type: bool
Access: RW
Description: True if plug's value is being cached.
OpenMaya.MPlug.isChannelBox = property(...)
static
 True if plug will appear in Maya's Channel Box.
Name: isChannelBox
Type: bool
Access: RW
Description: True if plug will appear in Maya's Channel Box.
OpenMaya.MPlug.isChild = property(...)
static
 True if plug is a child of a compound parent.
Name: isChild
Type: bool
Access: R
Description: True if plug is a child of a compound parent.
OpenMaya.MPlug.isCompound = property(...)
static
 True if plug is compound parent with children.
Name: isCompound
Type: bool
Access: R
Description: True if plug is compound parent with children.
OpenMaya.MPlug.isConnected = property(...)
static
 True if plug has any connections.
Name: isConnected
Type: bool
Access: R
Description: True if plug has any connections.
OpenMaya.MPlug.isDestination = property(...)
static
 True if plug is the destination of a connection.
Name: isDestination
Type: bool
Access: R
Description: True if plug is the destination of a connection.
OpenMaya.MPlug.isDynamic = property(...)
static
 True if plug is for a dynamic attribute.
Name: isDynamic
Type: bool
Access: R
Description: True if plug is dynamic.
OpenMaya.MPlug.isElement = property(...)
static
 True if plug is an element of an array of plugs.
Name: isElement
Type: bool
Access: R
Description: True if plug is an element of an array of plugs.
OpenMaya.MPlug.isFromReferencedFile = property(...)
static
 True if plug is part of a connection from a referenced file.
Name: isFromReferencedFile
Type: bool
Access: R
Description: True if plug is part of a connection from a referenced file.
OpenMaya.MPlug.isIgnoredWhenRendering = property(...)
static
 True if connetions to plug are ignored during rendering.
Name: isIgnoredWhenRendering
Type: bool
Access: R
Description: True if connections to plug are ignored during rendering.
OpenMaya.MPlug.isKeyable = property(...)
static
 True if keys can be set on plug from Maya's UI.
Name: isKeyable
Type: bool
Access: RW
Description: True if keys can be set on plug from Maya's UI.
OpenMaya.MPlug.isLocked = property(...)
static
 True if plug is locked against changes.
Name: isLocked
Type: bool
Access: RW
Description: True if plug is locked against changes.
OpenMaya.MPlug.isNetworked = property(...)
static
 True if plug is networked.
Name: isNetworked
Type: bool
Access: R
Description: True if plug is networked.
OpenMaya.MPlug.isNull = property(...)
static
 True if plug does not reference an attribute.
Name: isNull
Type: bool
Access: R
Description: True if plug does not reference an attribute.
OpenMaya.MPlug.isProcedural = property(...)
static
 True if plug is procedural.
Name: isProcedural
Type: bool
Access: R
Description: True if plug is procedural
OpenMaya.MPlug.isProxy = property(...)
static
 True if plug is a proxy plug.
OpenMaya.MPlug.isSource = property(...)
static
 True if plug is the source of a connection.
Name: isSource
Type: bool
Access: R
Description: True if plug is the source of a connection.