OpenMaya.MPlug Class Reference

Class 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.

 


+ Inheritance diagram for OpenMaya.MPlug:

Public Member Functions

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

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
 
 isArray
 
 isCaching
 
 isChannelBox
 
 isChild
 
 isCompound
 
 isConnected
 
 isDestination
 
 isDynamic
 
 isElement
 
 isFromReferencedFile
 
 isIgnoredWhenRendering
 
 isKeyable
 
 isLocked
 
 isNetworked
 
 isNull
 
 isProcedural
 
 isSource
 

Constructor & Destructor Documentation

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

Member Function Documentation

OpenMaya.MPlug.__eq__ ( )
x.__eq__(y) <==> x==y
OpenMaya.MPlug.__ge__ ( )
x.__ge__(y) <==> x>=y
OpenMaya.MPlug.__gt__ ( )
x.__gt__(y) <==> x>y
OpenMaya.MPlug.__le__ ( )
x.__le__(y) <==> x<=y
OpenMaya.MPlug.__lt__ ( )
x.__lt__(y) <==> x<y
OpenMaya.MPlug.__ne__ ( )
x.__ne__(y) <==> x!=y
OpenMaya.MPlug.__str__ ( )
x.__str__() <==> str(x)
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.
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.
OpenMaya.MPlug.copy ( )
Copies one plug to another.
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.
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.
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.
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.
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.
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
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
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
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
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
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
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
static
 True if plug has any connections.
Name: isConnected
Type: bool
Access: R
Description: True if plug has any connections.
OpenMaya.MPlug.isDestination
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
static
 True if plug is for a dynamic attribute.
Name: isDynamic
Type: bool
Access: R
Description: True if plug is dynamic.
OpenMaya.MPlug.isElement
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
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
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
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
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
static
 True if plug is networked.
Name: isNetworked
Type: bool
Access: R
Description: True if plug is networked.
OpenMaya.MPlug.isNull
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
static
 True if plug is procedural.
Name: isProcedural
Type: bool
Access: R
Description: True if plug is procedural
OpenMaya.MPlug.isSource
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.