C++ API Reference

Create and Access dependency node plugs. More...

#include <MPlug.h>

Public Types

enum  MValueSelector { kAll, kNonDefault, kChanged, kLastAttrSelector }
 Which values to generate setAttr commands for. More...
 
enum  FreeToChangeState { kFreeToChange, kNotFreeToChange, kChildrenNotFreeToChange }
 Plug state returned by isFreeToChange. More...
 

Public Member Functions

 MPlug ()
 Constructor. More...
 
 MPlug (const MPlug &in)
 Copy constructor. More...
 
 MPlug (const MObject &node, const MObject &attribute)
 Constructor. More...
 
virtual ~MPlug ()
 Destructor.
 
MStatus setAttribute (MObject &attribute)
 This method is a convenience routine to allow quick movement between attributes on a single node. More...
 
MObject attribute (MStatus *ReturnStatus=nullptr) const
 This method returns the attribute that this plug refers to. More...
 
MObject node (MStatus *ReturnStatus=nullptr) const
 Returns the dependency node that this plug belongs to. More...
 
MString name (MStatus *ReturnStatus=nullptr) const
 Returns the name of this plug in the form 'nodeName.attributeName'. More...
 
MString partialName (bool includeNodeName=false, bool includeNonMandatoryIndices=false, bool includeInstancedIndices=false, bool useAlias=false, bool useFullAttributePath=false, bool useLongNames=false, MStatus *ReturnStatus=nullptr) const
 By default, this method returns the shortest possible name for the plug, but its parameters can be used to add parts back in. More...
 
MStatus getSetAttrCmds (MStringArray &cmds, MValueSelector valueSelector=kAll, bool useLongNames=false)
 Returns an array of strings containing setAttr commands for this plug and all of its descendent plugs. More...
 
bool isNetworked (MStatus *ReturnStatus=nullptr) const
 This method determines if the plug is networked or non-networked. More...
 
bool isArray (MStatus *ReturnStatus=nullptr) const
 This method determines if the plug is an array plug. More...
 
bool isElement (MStatus *ReturnStatus=nullptr) const
 This method determines if the plug is an element plug. More...
 
bool isCompound (MStatus *ReturnStatus=nullptr) const
 This method determines if the plug is a compound plug. More...
 
bool isChild (MStatus *ReturnStatus=nullptr) const
 This method determines if the plug is a child plug. More...
 
bool isProcedural (MStatus *ReturnStatus=nullptr) const
 This method determines if the plug is a procedural plug. More...
 
unsigned int logicalIndex (MStatus *ReturnStatus=nullptr) const
 Returns the logical index of the element this plug refers to. More...
 
bool isProxy (MStatus *ReturnStatus=nullptr) const
 Introduced in 2023.0 More...
 
MStatus selectAncestorLogicalIndex (unsigned int index, const MObject &attribute=MObject::kNullObj)
 This method is a convenience routine to allow quick iteration and construction of plugs with array plugs in their ancestry. More...
 
unsigned int getExistingArrayAttributeIndices (MIntArray &indices, MStatus *ReturnStatus=nullptr)
 This method will return a list of the logical indices of the elements in an array attribute that are either connected or have had their value set. More...
 
unsigned int numElements (MStatus *ReturnStatus=nullptr) const
 Return the total number of elements in the datablock of this array plug. More...
 
unsigned int evaluateNumElements (MStatus *ReturnStatus=nullptr)
 Return the total number of elements in the datablock of this array plug. More...
 
unsigned int numChildren (MStatus *ReturnStatus=nullptr) const
 Return the total number of children of this compound plug. More...
 
unsigned int numConnectedElements (MStatus *ReturnStatus=nullptr) const
 Return the total number of connected element plugs belonging to this array plug. More...
 
unsigned int numConnectedChildren (MStatus *ReturnStatus=nullptr) const
 Return the number of children of this plug that are connected in the dependency graph. More...
 
MPlug child (MObject &attr, MStatus *ReturnStatus=nullptr) const
 Returns a plug to a given attribute that is a child of this plug. More...
 
MPlug child (unsigned int index, MStatus *ReturnStatus=nullptr) const
 Returns a plug to a given attribute that is a child of this plug. More...
 
MPlug parent (MStatus *ReturnStatus=nullptr) const
 Returns the parent plug. More...
 
MPlug array (MStatus *ReturnStatus=nullptr) const
 Returns the array to which this element plug belongs. More...
 
MPlug elementByLogicalIndex (unsigned int logicalIndex, MStatus *ReturnStatus=nullptr) const
 This method will find and return a plug with the given logical index. More...
 
MPlug elementByPhysicalIndex (unsigned int physicalIndex, MStatus *ReturnStatus=nullptr) const
 This method will find and return a plug with the given physical index. More...
 
MPlug connectionByPhysicalIndex (unsigned int physicalIndex, MStatus *ReturnStatus=nullptr) const
 This method will find and return a connected plug with the given physical index for its connection. More...
 
bool connectedTo (MPlugArray &array, bool asDst, bool asSrc, MStatus *ReturnStatus=nullptr) const
 This method finds all of the plugs that this plug is connected with. More...
 
bool isConnected (MStatus *ReturnStatus=nullptr) const
 Determines if this plug is connected to one or more plugs. More...
 
MPlug source (MStatus *ReturnStatus=nullptr) const
 If this plug is a destination, return the source plug connected to it. More...
 
bool destinations (MPlugArray &theDestinations, MStatus *ReturnStatus=nullptr) const
 If this plug is a source, return the destination plugs connected to it. More...
 
MPlug sourceWithConversion (MStatus *ReturnStatus=nullptr) const
 If this plug is a destination, return the source plug connected to it. More...
 
bool destinationsWithConversions (MPlugArray &theDestinations, MStatus *ReturnStatus=nullptr) const
 If this plug is a source, return the destination plugs connected to it. More...
 
bool isKeyable (MStatus *ReturnStatus=nullptr) const
 Determines if this plug is keyable. More...
 
MStatus setKeyable (bool keyable)
 This overrides the default keyability of a plug set with MFnAttribute::setKeyable. More...
 
bool isLocked (MStatus *ReturnStatus=nullptr) const
 Determines the locked state of this plug's value. More...
 
MStatus setLocked (bool locked)
 Sets the locked state for this plug's value. More...
 
bool isChannelBoxFlagSet (MStatus *ReturnStatus=nullptr) const
 Returns true if this plug or its attribute has its channel box flag set. More...
 
MStatus setChannelBox (bool channelBox)
 Sets whether this plug is displayed in the channel box. More...
 
bool isCachingFlagSet (MStatus *ReturnStatus=nullptr) const
 Returns true if this plug or its attribute has its caching flag set. More...
 
MStatus setCaching (bool caching)
 Sets whether this plug is cached internally. More...
 
bool isNull (MStatus *ReturnStatus=nullptr) const
 This method determines whether this plug is valid. More...
 
MString info (MStatus *ReturnStatus=nullptr) const
 This method returns a string containing the name of the node this plug belongs to and the attributes that the plug refers to. More...
 
bool isFromReferencedFile (MStatus *ReturnStatus=nullptr) const
 This method determines whether this plug came from a referenced file. More...
 
bool isDynamic (MStatus *ReturnStatus=nullptr) const
 Determines whether the attribute is of dynamic type or not. More...
 
bool isIgnoredWhenRendering (MStatus *ReturnStatus=nullptr) const
 Determines whether a connection to the attribute should be ignored during rendering. More...
 
bool isDefaultValue (bool forceEval=true, MStatus *ReturnStatus=nullptr) const
 This method determines if the plug value is equivalent to the plug's default value. More...
 
MPlug::FreeToChangeState isFreeToChange (bool checkParents=true, bool checkChildren=true, MStatus *ReturnStatus=nullptr) const
 Returns true if the plug's value is allowed to be set directly. More...
 
MDataHandle constructHandle (MDataBlock &) const
 This method returns a data handle constructed for this plug. More...
 
void destructHandle (MDataHandle &) const
 This method destructs the data handle for this plug.
 
MObject asMObject (MStatus *ReturnStatus=nullptr) const
 Retrieve the value in the current evaluation context of the attribute this plug references. More...
 
MDataHandle asMDataHandle (MStatus *ReturnStatus=nullptr) const
 Retrieve the value in the current evaluation context of the attribute this plug references. More...
 
double asDouble (MStatus *ReturnStatus=nullptr) const
 Retrieve the value in the current evaluation context of the attribute this plug references. More...
 
float asFloat (MStatus *ReturnStatus=nullptr) const
 Retrieve the value in the current evaluation context of the attribute this plug references. More...
 
MInt64 asInt64 (MStatus *ReturnStatus=nullptr) const
 Retrieve the value in the current evaluation context of the attribute this plug references. More...
 
int asInt (MStatus *ReturnStatus=nullptr) const
 Retrieve the value in the current evaluation context of the attribute this plug references. More...
 
short asShort (MStatus *ReturnStatus=nullptr) const
 Retrieve the value in the current evaluation context of the attribute this plug references. More...
 
bool asBool (MStatus *ReturnStatus=nullptr) const
 Retrieve the value in the current evaluation context of the attribute this plug references. More...
 
MDistance asMDistance (MStatus *ReturnStatus=nullptr) const
 Retrieve the value in the current evaluation context of the attribute this plug references. More...
 
MAngle asMAngle (MStatus *ReturnStatus=nullptr) const
 Retrieve the value in the current evaluation context of the attribute this plug references. More...
 
MTime asMTime (MStatus *ReturnStatus=nullptr) const
 Retrieve the value in the current evaluation context of the attribute this plug references. More...
 
char asChar (MStatus *ReturnStatus=nullptr) const
 Retrieve the value in the current evaluation context of the attribute this plug references. More...
 
MString asString (MStatus *ReturnStatus=nullptr) const
 Retrieve the value in the current evaluation context of the attribute this plug references. More...
 
MStatus setMObject (const MObject &)
 Set the current value of the attribute this plug references. More...
 
MStatus setMPxData (const MPxData *)
 Set the current value of the attribute this plug references. More...
 
MStatus setMDataHandle (const MDataHandle &)
 Set the current value of the attribute this plug references with the values in the handle. More...
 
MStatus setDouble (double)
 Set the current value of the attribute this plug references. More...
 
MStatus setFloat (float)
 Set the current value of the attribute this plug references. More...
 
MStatus setInt64 (MInt64)
 Set the current value of the attribute this plug references. More...
 
MStatus setInt (int)
 Set the current value of the attribute this plug references. More...
 
MStatus setShort (short)
 Set the current value of the attribute this plug references. More...
 
MStatus setBool (bool)
 Set the current value of the attribute this plug references. More...
 
MStatus setMDistance (const MDistance &)
 Set the current value of the attribute this plug references. More...
 
MStatus setMAngle (const MAngle &)
 Set the current value of the attribute this plug references. More...
 
MStatus setMTime (const MTime &)
 Set the current value of the attribute this plug references. More...
 
MStatus setChar (char)
 Set the current value of the attribute this plug references. More...
 
MStatus setString (const MString &)
 Set the current value of the attribute this plug references. More...
 
MPlug proxied ()
 Introduced in 2023.0 More...
 
MPlugoperator= (const MPlug &other)
 Assignment operator. More...
 
MPlug operator[] (unsigned int physicalIndex) const
 This method will find and return a plug with the given physical index. More...
 
bool operator== (const MPlug &other) const
 Comparison operator for MPlugs. More...
 
bool operator== (const MObject &other) const
 Comparison operator for a plug and an attribute. More...
 
bool operator!= (const MPlug &other) const
 The inequality operator for MPlugs. More...
 
bool operator!= (const MObject &other) const
 The inequality operator for a plug and an attribute. More...
 
MStatus setNumElements (unsigned int)
 The method is used to pre-allocate the number of elements that an array plug will contain. More...
 
bool isSource (MStatus *ReturnStatus=nullptr) const
 Determines if this plug is connected as a source. More...
 
bool isDestination (MStatus *ReturnStatus=nullptr) const
 Determines if this plug is connected as a destination. More...
 
MStatus getValue (MObject &) const
 NO SCRIPT SUPPORT. More...
 
MStatus getValue (MDataHandle &) const
 NO SCRIPT SUPPORT. More...
 
MStatus getValue (double &) const
 NO SCRIPT SUPPORT. More...
 
MStatus getValue (float &) const
 NO SCRIPT SUPPORT. More...
 
MStatus getValue (MInt64 &) const
 NO SCRIPT SUPPORT. More...
 
MStatus getValue (int &) const
 NO SCRIPT SUPPORT. More...
 
MStatus getValue (short &) const
 NO SCRIPT SUPPORT. More...
 
MStatus getValue (bool &) const
 NO SCRIPT SUPPORT. More...
 
MStatus getValue (MDistance &) const
 NO SCRIPT SUPPORT. More...
 
MStatus getValue (MAngle &) const
 NO SCRIPT SUPPORT. More...
 
MStatus getValue (MTime &) const
 NO SCRIPT SUPPORT. More...
 
MStatus getValue (char &) const
 NO SCRIPT SUPPORT. More...
 
MStatus getValue (MString &) const
 NO SCRIPT SUPPORT. More...
 
MStatus setValue (const MObject &)
 NO SCRIPT SUPPORT. More...
 
MStatus setValue (const MPxData *)
 NO SCRIPT SUPPORT. More...
 
MStatus setValue (const MDataHandle &)
 NO SCRIPT SUPPORT. More...
 
MStatus setValue (double)
 NO SCRIPT SUPPORT. More...
 
MStatus setValue (float)
 NO SCRIPT SUPPORT. More...
 
MStatus setValue (MInt64)
 NO SCRIPT SUPPORT. More...
 
MStatus setValue (int)
 NO SCRIPT SUPPORT. More...
 
MStatus setValue (short)
 NO SCRIPT SUPPORT. More...
 
MStatus setValue (bool)
 NO SCRIPT SUPPORT. More...
 
MStatus setValue (const MDistance &)
 NO SCRIPT SUPPORT. More...
 
MStatus setValue (const MAngle &)
 NO SCRIPT SUPPORT. More...
 
MStatus setValue (const MTime &)
 NO SCRIPT SUPPORT. More...
 
MStatus setValue (char)
 NO SCRIPT SUPPORT. More...
 
MStatus setValue (const MString &)
 NO SCRIPT SUPPORT. More...
 
MStatus setValue (const char *)
 NO SCRIPT SUPPORT. More...
 
MPlug operator[] (MObject &attr) const
 NO SCRIPT SUPPORT. More...
 
 operator MObject () const
 NO SCRIPT SUPPORT. More...
 
bool operator! () const
 NO SCRIPT SUPPORT. More...
 
MObject asMObject (const MDGContext &, MStatus *ReturnStatus=nullptr) const
 Deprecated in 2018.0 More...
 
MDataHandle asMDataHandle (const MDGContext &, MStatus *ReturnStatus=nullptr) const
 Deprecated in 2018.0 More...
 
double asDouble (const MDGContext &, MStatus *ReturnStatus=nullptr) const
 Deprecated in 2018.0 More...
 
float asFloat (const MDGContext &, MStatus *ReturnStatus=nullptr) const
 Deprecated in 2018.0 More...
 
MInt64 asInt64 (const MDGContext &, MStatus *ReturnStatus=nullptr) const
 Deprecated in 2018.0 More...
 
int asInt (const MDGContext &, MStatus *ReturnStatus=nullptr) const
 Deprecated in 2018.0 More...
 
short asShort (const MDGContext &, MStatus *ReturnStatus=nullptr) const
 Deprecated in 2018.0 More...
 
bool asBool (const MDGContext &, MStatus *ReturnStatus=nullptr) const
 Deprecated in 2018.0 More...
 
MDistance asMDistance (const MDGContext &, MStatus *ReturnStatus=nullptr) const
 Deprecated in 2018.0 More...
 
MAngle asMAngle (const MDGContext &, MStatus *ReturnStatus=nullptr) const
 Deprecated in 2018.0 More...
 
MTime asMTime (const MDGContext &, MStatus *ReturnStatus=nullptr) const
 Deprecated in 2018.0 More...
 
char asChar (const MDGContext &, MStatus *ReturnStatus=nullptr) const
 Deprecated in 2018.0 More...
 
MString asString (const MDGContext &, MStatus *ReturnStatus=nullptr) const
 Deprecated in 2018.0 More...
 
MStatus getValue (MObject &, MDGContext &) const
 Deprecated in 2018.0 More...
 
MStatus getValue (MDataHandle &, MDGContext &) const
 Deprecated in 2018.0 More...
 
MStatus getValue (double &, MDGContext &) const
 Deprecated in 2018.0 More...
 
MStatus getValue (float &, MDGContext &) const
 Deprecated in 2018.0 More...
 
MStatus getValue (MInt64 &, MDGContext &) const
 Deprecated in 2018.0 More...
 
MStatus getValue (int &, MDGContext &) const
 Deprecated in 2018.0 More...
 
MStatus getValue (short &, MDGContext &) const
 Deprecated in 2018.0 More...
 
MStatus getValue (bool &, MDGContext &) const
 Deprecated in 2018.0 More...
 
MStatus getValue (MDistance &, MDGContext &) const
 Deprecated in 2018.0 More...
 
MStatus getValue (MAngle &, MDGContext &) const
 Deprecated in 2018.0 More...
 
MStatus getValue (MTime &, MDGContext &) const
 Deprecated in 2018.0 More...
 
MStatus getValue (char &, MDGContext &) const
 Deprecated in 2018.0 More...
 
MStatus getValue (MString &, MDGContext &) const
 Deprecated in 2018.0 More...
 

Static Public Member Functions

static const char * className ()
 Returns the name of this class. More...
 

Detailed Description

Create and Access dependency node plugs.

MPlug provides methods for creating plugs, and accessing the plugs' dependency node and attributes.

A plug is a point on a dependency node where a particular attribute can be connected. In simple cases the plug and attribute are equivalent. When you have array attributes, however, the plug is more specific in that it indicates which of the array elements is to be connected.

There are two main types of plugs: networked plugs and non-networked plugs. Non-networked plugs can be considered user plugs as they are created by users and belong to users. Networked plugs can be considered dependency node plugs as they are part of the dependency graph and can only be referenced by users.

In every dependency node there is a network or "tree" of plugs indicating connections that have been made to attributes of the node. The plugs in this tree are known as networked plugs as they belong to the dependency node's network.

Non-networked plugs are plugs that you can create in order to establish a new connection to an attribute, or to get or set a value on an attribute. When a connection is made using these plugs, a networked version of the plug is created and added to the dependency nodes network.

A networked plug cannot be explicitly created. They are created when a connection is established for some attribute of the node. Since the allocation of networked plugs is managed exclusively by Maya, a plugin should never reference a networked plug after changes are made to the DG. Instead, use a non-networked version of the plug, or get a new reference to the networked plug.

All a non-networked plug knows is how to uniquely describe the attribute that it references, in fact the purpose of a non-networked plug is to specify, without ambiguity, an attribute of a dependency node. A non-networked plug contains an array of array indices that plot the path from the root plug to this plug.

For simple attributes the plug and attribute are equivalent. Compound attributes are also unambiguous. A plug that refers to an array attribute, however, is more complex as it can refer to the array plug or an element plug in the array.

Several methods are provided for navigating the plug tree. The child() method can be used to retrieve the child plugs of a compound plug. The elementByLogicalIndex() and elementByPhysicalIndex() methods can be used to retrieve the element plugs of an array plug. The parent() and array() methods traverse the tree in the opposite direction: parent() retrieves a compound plug from a child plug, and array() retrieves an array plug from an element plug.

Since connections to arrays are sparse, element plugs have both logical and physical indexes. The logical indexes are used by MEL, and are sparse. Physical indexes, on the other hand, are not sparse. It is guaranteed that the physical indexes will range from 0 to numElements() - 1. Using the physical indexes, iterating over the element plugs in an array is easy:

// See note below on numElements() method
for (i = 0; i < arrayPlug.numElements (); i++)
{
MPlug elementPlug = arrayPlug [i];
unsigned int logicalIndex = elementPlug.logicalIndex();
// ...
}

This is equivalent to calling elementByPhysicalIndex() since the bracket operator uses physical indexes.

The ancestry of a plug is the tree above the plug: any parents or arrays which this plug belongs to. The selectAncestorLogicalIndex() method provides quick access to element plugs without walking the plug tree. A plug does not need to exist in the datablock or plug tree in order to be constructed using selectAncestorLogicalIndex(), but once a value is requested or set on the plug, it will be added to the datablock if it was not there already. For example:

// See note below on numElements() method
unsigned int count = plug.numElements();
if (0 == count) {
plug.setValue(setVal);
count = plug.numElements(); // count will now be 1 since we added a value
MObject getVal;
plug.getValue(getVal);
count = plug.numElements(); // count will now be 2 since we asked for a value
}

Once a value has been added to an array plug, it will usually remain in the datablock as long as the scene is open. The exception is for attributes that have their disconnect behavior set to kDelete: data for these attributes will be deleted when their connection is broken. When a file is saved, only array values that are not at their default values will be written out. Therefore, the number of elements in an array plug may change when the file is read in again.

Note
The numElements() call for array plugs returns a value based on the information in the datablock. It is possible to have un-evaluated connected items being excluded from the count since these items are not yet in the datablock. In this case, the numElements() method will return the correct answer if the evaluateNumElements() call is made first. But this cannot be done in the MPxNode::compute() method of a node.
Examples:
AbcBullet/AbcBullet.cpp, AbcBullet/AttributesWriter.cpp, AbcBullet/AttributesWriter.h, AbcBullet/MayaTransformCollectionWriter.cpp, AbcBullet/MayaTransformCollectionWriter.h, AbcBullet/MayaTransformWriter.cpp, AbcBullet/MayaTransformWriter.h, AbcBullet/MayaUtility.cpp, AbcBullet/MayaUtility.h, AbcExport/AbcExport.cpp, AbcExport/AbcWriteJob.cpp, AbcExport/AttributesWriter.cpp, AbcExport/AttributesWriter.h, AbcExport/MayaCameraWriter.cpp, AbcExport/MayaLocatorWriter.cpp, AbcExport/MayaMeshWriter.cpp, AbcExport/MayaNurbsCurveWriter.cpp, AbcExport/MayaTransformWriter.cpp, AbcExport/MayaTransformWriter.h, AbcExport/MayaUtility.cpp, AbcExport/MayaUtility.h, AbcImport/AlembicNode.cpp, AbcImport/AlembicNode.h, AbcImport/CreateSceneHelper.cpp, AbcImport/LocatorHelper.cpp, AbcImport/MeshHelper.cpp, AbcImport/NodeIteratorVisitorHelper.cpp, AbcImport/NodeIteratorVisitorHelper.h, AbcImport/NurbsCurveHelper.cpp, AbcImport/util.cpp, AbcImport/util.h, AbcImport/XformHelper.cpp, affectsNode/affectsNode.cpp, animCubeNode/animCubeNode.cpp, animExportUtil/animExportUtil.cpp, animInfoCmd/animInfoCmd.cpp, anisotropicShader/anisotropicShader.cpp, apiDirectionalLightShape/apiDirectionalLightShape.cpp, apiDirectionalLightShape/apiDirectionalLightShape.h, apiMeshShape/apiMeshCreator.cpp, apiMeshShape/apiMeshCreator.h, apiMeshShape/apiMeshGeometryOverride.cpp, apiMeshShape/apiMeshShape.cpp, apiMeshShape/apiMeshShape.h, apiMeshShape/apiMeshSubSceneOverride.cpp, arcLenNode/arcLenNode.cpp, atomImportExport/atomAnimLayers.cpp, atomImportExport/atomAnimLayers.h, atomImportExport/atomCachedPlugs.cpp, atomImportExport/atomCachedPlugs.h, atomImportExport/atomFileUtils.cpp, atomImportExport/atomFileUtils.h, atomImportExport/atomImportExport.cpp, atomImportExport/atomImportExport.h, backfillShader/backfillShader.cpp, basicBlendShape/basicBlendShape.cpp, basicBlendShapeDeformer/basicBlendShapeDeformer.cpp, basicMorphNode/basicMorphNode.cpp, blindComplexDataCmd/blindComplexDataCmd.cpp, blindDataShader/blindDataMesh.cpp, blindDataShader/blindDataMesh.h, blindDataShader/blindDataShader.cpp, blindDataShader/blindDataShader.h, blindDoubleDataCmd/blindDoubleDataCmd.cpp, brickShader/brickShader.cpp, buildRotationNode/buildRotationNode.cpp, cameraSetSubclass/exCameraSet.cpp, cameraSetSubclass/exCameraSet.h, cellShader/cellShader.cpp, cgFx/cgfxAttrDef.cpp, cgFx/cgfxAttrDef.h, cgFx/cgfxShaderNode.cpp, cgFx/cgfxShaderNode.h, cgFx/cgfxVector.cpp, cgFx/cgfxVector.h, cgFx/pluginMain.cpp, checkerShader/checkerShader.cpp, circleNode/circleNode.cpp, clearcoat.cpp, closestPointCmd/closestPointCmd.cpp, closestPointOnCurve/closestPointOnCurveCmd.cpp, closestPointOnCurve/closestPointOnCurveNode.cpp, closestPointOnCurve/closestPointOnCurveNode.h, colorTransformData/colorTransformData.cpp, componentScaleManip/componentScaleManip.cpp, compositingShader/compositingShader.cpp, constraintEvaluator/constraintEvaluator.cpp, contrastShader/contrastShader.cpp, createClipCmd/createClipCmd.cpp, customAttrManip/customAttrManip.cpp, customComponentTagNode/customComponentTagNode.cpp, customImagePlane/customImagePlane.cpp, cvColorNode/cvColorNode.cpp, dagPoseInfoCmd/dagPoseInfoCmd.cpp, depthShader/depthShader.cpp, displacementShader/displacementShader.cpp, dx11Shader/dx11ConeAngleToHotspotConverter.cpp, dx11Shader/dx11ConeAngleToHotspotConverter.h, dx11Shader/dx11Shader.cpp, dx11Shader/dx11Shader.h, dynExprField/dynExprField.cpp, dynExprField/dynExprField.h, exampleFalloff/smoothFalloffNode.cpp, exampleFalloff/smoothFalloffNode.h, exampleRampAttribute/exampleMRampAttribute.cpp, exportJointClusterDataCmd/exportJointClusterDataCmd.cpp, fileTexture/fileTexture.cpp, filteredAsciiFile/filteredAsciiFile.cpp, findFileTexturesCmd/findFileTexturesCmd.cpp, findTexturesPerPolygonCmd/findTexturesPerPolygonCmd.cpp, flameShader/flameShader.cpp, footPrintManip/footPrintManip.cpp, footPrintNode/footPrintNode.cpp, footPrintNode_AnimatedMaterial/footPrintNode_GeometryOverride_AnimatedMaterial.cpp, footPrintNode_GeometryOverride/footPrintNode_GeometryOverride.cpp, footPrintNode_SubSceneOverride/footPrintNode_SubSceneOverride.cpp, fullLoftNode/fullLoftNode.cpp, gameInputDevice/gameInputDevice.cpp, gammaShader/gammaShader.cpp, genericAttributeNode/genericAttributeNode.cpp, geometryReplicator/geometryReplicator.cpp, geometrySurfaceConstraint/geometrySurfaceConstraint.cpp, geometrySurfaceConstraint/geometrySurfaceConstraint.h, geometrytools.cpp, geomShader/geomShader.cpp, glslShader/GLSLShader.cpp, glslShader/GLSLShader.h, gpuCache/gpuCacheCmd.cpp, gpuCache/gpuCacheMaterialBakers.cpp, gpuCache/gpuCacheShapeNode.cpp, gpuCache/gpuCacheShapeNode.h, gpuCache/gpuCacheSubSceneOverride.cpp, gpuCache/gpuCacheSubSceneOverride.h, gpuCache/gpuCacheUtil.cpp, gpuCache/gpuCacheUtil.h, hlslShader/hlslShader.cpp, hlslShader/hlslShader.h, hwApiTextureTest/hwApiTextureTest.cpp, hwPhongShader/hwPhongShader.cpp, hwPhongShader/hwPhongShader.h, hwPhongShader/hwPhongShaderBehavior.cpp, hwPhongShader/hwPhongShaderBehavior.h, identityNode/identityNode.cpp, ik2Bsolver/ik2Bsolver.cpp, interpShader/interpShader.cpp, intersectCmd/intersectCmd.cpp, jitterNode/jitterNode.cpp, lambertShader/lambertShader.cpp, latticeNoise/latticeNoise.h, latticeNoise/latticeNoiseNode.cpp, lavaShader/lavaShader.cpp, lensDistortionCallback/lensDistortionCallback.cpp, lightShader/lightShader.cpp, lockEvent/lockEvent.cpp, manipOverride/customTriadManip.cpp, manipOverride/manipOverride.cpp, manipOverride/rockingTransform2.cpp, manipOverride/rockingTransform2.h, maTranslator/maTranslator.cpp, MayaPluginForSpreticle/spReticleLoc.cpp, MayaPluginForSpreticle/spReticleLoc.h, meshOpCmd/meshOpCmd.cpp, meshOpCmd/meshOpNode.cpp, meshOpCmd/meshOpNode.h, meshOpCmd/polyModifierCmd.cpp, meshOpCmd/polyModifierCmd.h, MetadataSample/tweakMetadataNode.cpp, MetadataSample/tweakMetadataNode.h, mixtureShader/mixtureShader.cpp, motionPathNode/motionPathNode.cpp, motionTraceCmd/motionTraceCmd.cpp, moveManip/moveManip.cpp, multiCurveNode/multiCurveNode.cpp, multiPlugInfoCmd/multiPlugInfoCmd.cpp, nodeInfoCmd/nodeInfoCmd.cpp, nodeMessageCmd/nodeMessageCmd.cpp, noiseShader/noiseShader.cpp, offsetNode/offsetNode.cpp, onbShader/onbShader.cpp, ownerEmitter/ownerEmitter.cpp, ownerEmitter/ownerEmitter.h, paintCallback/paintCallback.cpp, particleAttrNode/particleAttrNode.cpp, particleAttrNode/particleAttrNode.h, phongShader/phongShader.cpp, pointOnMeshInfo/pointOnMeshCmd.cpp, pointOnMeshInfo/pointOnMeshInfoNode.cpp, pointOnMeshInfo/pointOnMeshInfoNode.h, pointOnSubdNode/pointOnSubdNode.cpp, pointOnSubdNode/pointOnSubdNode.h, polyPrimitiveCmd/polyPrimitiveCmd.cpp, polyRawExporter/polyExporter.cpp, polyRawExporter/polyWriter.cpp, polyTrgNode/polyTrgNode.cpp, polyX3DExporter/polyExporter.cpp, polyX3DExporter/polyWriter.cpp, randomizerDevice/randomizerDevice.cpp, rawfootPrintNode/rawfootPrintNode.cpp, renderAccessNode/renderAccessNode.cpp, rockingTransform/rockingTransform.cpp, rockingTransform/rockingTransform.h, rockingTransformCheck/rockingTransform.cpp, rockingTransformCheck/rockingTransform.h, rotateManip/rotateManip.cpp, sceneAssembly/adskRepresentations.cpp, sceneAssembly/assemblyDefinition.cpp, sceneAssembly/assemblyReference.cpp, sceneAssembly/assemblyReference.h, shadowMatteShader/shadowMatteShader.cpp, shellNode/shellNode.cpp, shiftNode/shiftNode.cpp, simpleEmitter/simpleEmitter.cpp, simpleEmitter/simpleEmitter.h, simpleEvaluationDraw/simpleEvaluationDraw.cpp, simpleEvaluationNode/simpleEvaluationNode.cpp, simpleEvaluator/simpleEvaluator.cpp, simpleFluidEmitter/simpleFluidEmitter.cpp, simpleFluidEmitter/simpleFluidEmitter.h, simpleLoftNode/simpleLoftNode.cpp, simpleNoiseShader/simpleNoiseShader.cpp, simplePhysicsEngine/simplePhysicsEngine.cpp, simpleSimulationNode/simpleSimulationNode.cpp, simpleSkipNode/simpleSkipNode.cpp, simpleSpring/simpleSpring.cpp, simpleSpring/simpleSpring.h, sineNode/sineNode.cpp, slopeShader/slopeShaderBehavior.cpp, slopeShader/slopeShaderBehavior.h, slopeShader/slopeShaderNode.cpp, slopeShader/slopeShaderNode.h, solidCheckerShader/solidCheckerShader.cpp, splatDeformer/splatDeformer.cpp, splitUVCmd/polyModifierCmd.cpp, splitUVCmd/polyModifierCmd.h, splitUVCmd/splitUVCmd.cpp, splitUVCmd/splitUVNode.cpp, splitUVCmd/splitUVNode.h, squaresNode_noDepthTest/squaresNode_noDepthTest.cpp, sseDeformer/sseDeformer.cpp, stringFormatNode/stringFormatNode.cpp, surfaceBumpManip/surfaceBumpManip.cpp, sweptEmitter/sweptEmitter.cpp, sweptEmitter/sweptEmitter.h, swissArmyManip/swissArmyManip.cpp, testFailureNode/testFailureNode.cpp, testMTopologyEvaluator/testMTopologyEvaluator.cpp, testMTopologyEvaluator/testMTopologyEvaluator.h, testNobjectNode/testNobjectNode.cpp, testNobjectNode/testNobjectNode.h, testNpassiveNode/testNpassiveNode.cpp, testNpassiveNode/testNpassiveNode.h, testNsolverNode/testNsolverNode.cpp, testNsolverNode/testNsolverNode.h, testNucleusNode/testNucleusNode.cpp, testNucleusNode/testNucleusNode.h, topologyTrackingNode/topologyTrackingNode.cpp, torusField/torusField.cpp, torusField/torusField.h, transCircleNode/transCircleNode.cpp, transformDrawNode/transformDrawNode.cpp, udpDevice/udpDevice.cpp, uiDrawManager/uiDrawManager.cpp, volumeShader/volumeShader.cpp, vp2BlinnShader/vp2BlinnShader.cpp, vp2BlinnShader/vp2BlinnShader.h, and weightListNode/weightListNode.cpp.

Member Enumeration Documentation

Which values to generate setAttr commands for.

Enumerator
kAll 

All values.

kNonDefault 

Non default values.

kChanged 

Changed values.

kLastAttrSelector 

Last value, for counting.

Plug state returned by isFreeToChange.

Enumerator
kFreeToChange 

All tested plugs are free to change.

kNotFreeToChange 

Some of the tested plugs are not free to change.

kChildrenNotFreeToChange 

Some of the children are not free to change.

Constructor & Destructor Documentation

OPENMAYA_MAJOR_NAMESPACE_OPEN MPlug ( )

Constructor.

Creates an empty plug.

MPlug ( const MPlug other)

Copy constructor.

Duplicates the given plug.

Parameters
[in]otherPlug to be copied.
MPlug ( const MObject node,
const MObject attribute 
)

Constructor.

Creates a new plug for the specified attribute and dependency node.

The new plug can be used to establish or remove a connection to the attribute it references. The plug can also be used to query or set the value of the attribute.

This constructor will only create non-networked plugs. A networked version of this plug is automatically created and added to the dependency node's network when a connection to this plug is established.

Parameters
[in]nodethe dependency node this plug belongs to
[in]attributethe attribute this plug refers to

Member Function Documentation

MStatus setAttribute ( MObject attribute)

This method is a convenience routine to allow quick movement between attributes on a single node.

If the current plug is a networked plug, it becomes a new non-networked plug referring to the requested attribute. If the current plug is a non-networked plug, it is changed to refer to the requested attribute.

The passed attribute must be the attribute of a plug on the current node.

Parameters
[in]attributeattribute to change the plug to
Returns
Status code
Status Codes:
  • MS::kSuccess Operating succeeded
  • MS::kFailure Object error
MString name ( MStatus ReturnStatus = nullptr) const
MString partialName ( bool  includeNodeName = false,
bool  includeNonMandatoryIndices = false,
bool  includeInstancedIndices = false,
bool  useAlias = false,
bool  useFullAttributePath = false,
bool  useLongNames = false,
MStatus ReturnStatus = nullptr 
) const

By default, this method returns the shortest possible name for the plug, but its parameters can be used to add parts back in.

Parameters
[in]includeNodeNameIf true, then the plug's node name is prefixed to the name of the plug, with a dot separating it from the attribute name. If false, then just the attribute name is returned. (default: false)
[in]includeNonMandatoryIndicesIf the plug's attribute is a non-instanced element of a multi which is NOT marked as indexMatters, then setting this parameter true will cause its index to be included in the returned string anyway.
If the attribute is marked as indexMatters then its array index will be included regardless of the setting of this parameter.
If the attribute is instanced then it is not affected by this parameter. See the next parameter instead. (default: false)
[in]includeInstancedIndicesIf the plug's attribute is an element of an instanced multi, then setting this parameter true will cause the array index to be included in the returned string. For example, if you are planning to append the returned plug name to a node's dagPath, then the instance index is unnecessary as it can be determined from the dagPath. (default: false)
[in]useFullAttributePathNormally, the plug's attribute path is compressed so that any compound ancestors which do not serve to uniquely identify the plug are removed. Setting this parameter true will cause the full attribute path to be used. (default: false)
[in]useAliasDisplay aliased name if alias exists. (default: false)
[in]useLongNamesNormally, short attribute names are used. Setting this true will cause long names to be used. (default: false)
[out]ReturnStatusReturn status.
Returns
The name of the plug.
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure function set does not have a valid node
Examples:
AbcBullet/AttributesWriter.cpp, AbcExport/AttributesWriter.cpp, AbcImport/NodeIteratorVisitorHelper.cpp, AbcImport/util.cpp, affectsNode/affectsNode.cpp, atomImportExport/atomFileUtils.cpp, atomImportExport/atomImportExport.cpp, cgFx/cgfxShaderNode.cpp, dx11Shader/dx11Shader.cpp, footPrintNode_AnimatedMaterial/footPrintNode_GeometryOverride_AnimatedMaterial.cpp, footPrintNode_GeometryOverride/footPrintNode_GeometryOverride.cpp, and maTranslator/maTranslator.cpp.
MStatus getSetAttrCmds ( MStringArray cmds,
MPlug::MValueSelector  valueSelector = kAll,
bool  useLongNames = false 
)

Returns an array of strings containing setAttr commands for this plug and all of its descendent plugs.

Parameters
[out]cmdsArray of strings in which the setAttr commands are to be returned.

[in]valueSelector
kAll- return setAttr commands for the plug and its children, regardless of their values.
kNonDefault- only return setAttr commands for the plug or its children if they are not at their default values.
kChanged- for nodes from referenced files, setAttr commands are only returned if the plug or one of its children has changed since its file was loaded. For all other nodes, the behaviour is the same a kNonDefault.
Note that if the plug is compound and one of its children has changed, then setAttrs will be generated for *all* of its children, even those which have not changed.
(default: kAll)

[in]useLongNamesNormally, the returned commands will use the short names for flags and attributes. If this parameter is true then their long names will be used instead. (default: false)
Returns
Status code
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure function set does not have a valid node
bool isNetworked ( MStatus ReturnStatus = nullptr) const

This method determines if the plug is networked or non-networked.

Networked plugs are part of a dependency node network and define points where connections have been made to the nodes attributes.

Non-networked plugs are user created plugs that are used to refer to an attribute of a node so that it can be connected. If the attribute that the plug refers to has been connected then there will also be a corresponding networked plug.

Parameters
[out]ReturnStatusStatus Code
Returns
  • true
  • false
Status Codes:
  • MS::kSuccess The operation succeeded.
  • MS::kFailure Object error.
bool isArray ( MStatus ReturnStatus = nullptr) const

This method determines if the plug is an array plug.

Array plugs refer to array attributes and contain element plugs.

Parameters
[out]ReturnStatusStatus Code
Returns
  • true
  • false
Status Codes:
  • MS::kSuccess The operation succeeded.
  • MS::kFailure Object error.
Examples:
AbcBullet/AttributesWriter.cpp, AbcBullet/MayaUtility.cpp, AbcExport/AttributesWriter.cpp, AbcExport/MayaUtility.cpp, AbcImport/MeshHelper.cpp, apiMeshShape/apiMeshShape.cpp, meshOpCmd/polyModifierCmd.cpp, splatDeformer/splatDeformer.cpp, splitUVCmd/polyModifierCmd.cpp, and sseDeformer/sseDeformer.cpp.
bool isElement ( MStatus ReturnStatus = nullptr) const

This method determines if the plug is an element plug.

Element plugs refer to array attributes and are members of array plugs.

Parameters
[out]ReturnStatusStatus Code
Returns
  • true
  • false
Status Codes:
  • MS::kSuccess The operation succeeded.
  • MS::kFailure Object error.
Examples:
AbcBullet/AttributesWriter.cpp, AbcExport/AttributesWriter.cpp, and footPrintNode/footPrintNode.cpp.
bool isCompound ( MStatus ReturnStatus = nullptr) const

This method determines if the plug is a compound plug.

Compound plugs refer to compound attributes and have child plugs.

Parameters
[out]ReturnStatusStatus Code
Returns
  • true
  • false
Status Codes:
  • MS::kSuccess The operation succeeded.
  • MS::kFailure Object error.
Examples:
AbcBullet/MayaUtility.cpp, AbcExport/MayaUtility.cpp, meshOpCmd/polyModifierCmd.cpp, and splitUVCmd/polyModifierCmd.cpp.
bool isChild ( MStatus ReturnStatus = nullptr) const

This method determines if the plug is a child plug.

A child plug's parent is always a compound plug.

Parameters
[out]ReturnStatusStatus Code
Returns
  • true
  • false
Status Codes:
  • MS::kSuccess The operation succeeded.
  • MS::kFailure Object error.
Examples:
AbcBullet/AttributesWriter.cpp, and AbcExport/AttributesWriter.cpp.
bool isProcedural ( MStatus ReturnStatus = nullptr) const

This method determines if the plug is a procedural plug.

A procedural plug is one which is created by Maya's internal procedures or by the nodes themselves and which should not be saved to or restored from files.

Parameters
[out]ReturnStatusStatus Code
Returns
  • true
  • false
Status Codes:
  • MS::kSuccess The operation succeeded.
  • MS::kFailure Object error.
Examples:
maTranslator/maTranslator.cpp.
unsigned int logicalIndex ( MStatus ReturnStatus = nullptr) const

Returns the logical index of the element this plug refers to.

The logical index is a sparse index, equivalent to the array index used in MEL.

This plug must be an element plug, and may be either networked or non-networked.

Parameters
[out]ReturnStatusStatus Code
Returns
The logical array index of the element this plug refers to
Status Codes:
  • MS::kSuccess The operation succeeded
  • MS::kFailure Object error - no plug
  • MS::kInvalidDataType This plug is not an element plug
Examples:
apiMeshShape/apiMeshShape.cpp, basicMorphNode/basicMorphNode.cpp, dynExprField/dynExprField.cpp, meshOpCmd/polyModifierCmd.cpp, ownerEmitter/ownerEmitter.cpp, simpleEmitter/simpleEmitter.cpp, splatDeformer/splatDeformer.cpp, splitUVCmd/polyModifierCmd.cpp, sseDeformer/sseDeformer.cpp, sweptEmitter/sweptEmitter.cpp, and torusField/torusField.cpp.
bool isProxy ( MStatus ReturnStatus = nullptr) const

Introduced in 2023.0

Returns true if this plug is a proxy plug.

2023.0:
Introduced in this version.

A proxy plug is used for connection forwarding to another plug and does not have an associated datablock.

Parameters
[out]ReturnStatusStatus Code
Returns
  • true
  • false
Status Codes:
  • MS::kSuccess The operation succeeded
  • MS::kFailure Object error - no plug
MStatus selectAncestorLogicalIndex ( unsigned int  index,
const MObject attribute = MObject::kNullObj 
)

This method is a convenience routine to allow quick iteration and construction of plugs with array plugs in their ancestry.

It selects a plug into the current object by changing an ancestor array's logical index.

The passed attribute must be either the attribute of the current plug, or the attribute of an ancestor's plug. It must be an array attribute. By default, it refers to the attribute of the current plug.

If the passed attribute is the attribute of this plug, then this plug will change to refer to its indexth element plug.

For example, consider the following attribute tree. The topmost attribute is a compound attribute "in". It consists of two children: an enum attribute "operation" and a typed attribute "value". Both "value" and "in" are array attributes. To iterate through all of the values, you could write a loop like this:

MPlug inPlug (node, inAttribute);
MPlug valuePlug (node, valueAttribute);
MPlug plug (node, valueAttribute);
for (i = 0; i < inPlug.numElements (); i++)
{
valuePlug.selectAncestorLogicalIndex (i, inAttribute);
(for j = 0; j < valuePlug.numElements (); j++)
{
plug.selectAncestorLogicalIndex (i, inAttribute);
plug.selectAncestorLogicalIndex (j, valueAttribute);
// ...
}
}

This method is only valid for non-networked plugs since networked plugs are part of a dependency node and can only be modified by making or breaking connections.

Parameters
[in]indexindex value to be set
[in]attributearray attribute whose index will be changed
Returns
Status code
Status Codes:
  • MS::kSuccess Operation succeeded
  • MS::kFailure Object error or networked plug
Examples:
apiMeshShape/apiMeshShape.cpp, and gpuCache/gpuCacheUtil.cpp.
unsigned int getExistingArrayAttributeIndices ( MIntArray indices,
MStatus ReturnStatus = nullptr 
)

This method will return a list of the logical indices of the elements in an array attribute that are either connected or have had their value set.

This method is useful when the logical indices of connected/set elements are sparse.

Parameters
[in]indicesA list to store the logical indices of the set/connected elements.
[out]ReturnStatusStatus Code
Returns
The number of set/connected elements
Status Codes:
  • MS::kSuccess The indices were successfully obtained.
  • MS::kFailure Object error.
unsigned int numElements ( MStatus ReturnStatus = nullptr) const

Return the total number of elements in the datablock of this array plug.

The return count will include all existing non-connected elements plus connected elements if they have been evaluated. It will not include connected elements that have not yet been placed into the datablock. The method MPlug::evaluateNumElements can be used in the situation where you want an accurate count that includes all connected elements.

This method is only valid for array plugs, as no other plugs have elements.

Parameters
[out]ReturnStatusStatus Code
Returns
Total number of elements
Status Codes:
  • MS::kSuccess The count was successfully returned
  • MS::kFailure The plug is not an array plug or does not contain a valid node or attribute
Examples:
AbcBullet/AttributesWriter.cpp, AbcExport/AttributesWriter.cpp, AbcImport/MeshHelper.cpp, gpuCache/gpuCacheCmd.cpp, gpuCache/gpuCacheUtil.cpp, MayaPluginForSpreticle/spReticleLoc.cpp, meshOpCmd/polyModifierCmd.cpp, and splitUVCmd/polyModifierCmd.cpp.
unsigned int evaluateNumElements ( MStatus ReturnStatus = nullptr)

Return the total number of elements in the datablock of this array plug.

The return count will include both connected and non-connected elements, and will perform an evaluate in order to make sure that the datablock is as up-to-date as possible since some nodes do not place array elements into the datablock until the attribute is evaluated.

Because this method performs an evaluate, it should not be called from within the compute of a node. Instead, if you want to know the number of elements in an array plug while in a compute, use either MDataBlock::inputArrayValue or MDataBlock::outputArrayValue because they are more efficient and will not result in recursion.

This method is only valid for array plugs, as no other plugs have elements.

Parameters
[out]ReturnStatusStatus Code
Returns
Total number of elements
Status Codes:
  • MS::kSuccess The count was successfully returned
  • MS::kFailure The plug is not an array plug or does not contain a valid node or attribute
unsigned int numChildren ( MStatus ReturnStatus = nullptr) const

Return the total number of children of this compound plug.

This method is only valid for networked plugs as non-networked plugs contain no information about their children. If this plug is non-networked then a networked version of the plug will be used. If a networked plug does not exist then 0 will be returned.

This method is also only valid for compound plugs or the root plug, since no other plugs have children.

Parameters
[out]ReturnStatusStatus Code
Returns
Total number of children
Status Codes:
  • MS::kSuccess The count was successfully returned
  • MS::kFailure Object error
Examples:
AbcBullet/MayaUtility.cpp, AbcExport/MayaUtility.cpp, AbcImport/NodeIteratorVisitorHelper.cpp, componentScaleManip/componentScaleManip.cpp, meshOpCmd/polyModifierCmd.cpp, rotateManip/rotateManip.cpp, and splitUVCmd/polyModifierCmd.cpp.
unsigned int numConnectedElements ( MStatus ReturnStatus = nullptr) const

Return the total number of connected element plugs belonging to this array plug.

This method is only valid for networked plugs as non-networked plugs contain no information about their children. If this plug is non-networked then a networked version of the plug will be used. If a networked plug does not exist then 0 will be returned.

This method is also only valid for array plugs, as no other plugs have elements.

Parameters
[out]ReturnStatusStatus Code
Returns
Total number of elements
Status Codes:
  • MS::kSuccess The count was successfully returned
  • MS::kFailure Object error
Examples:
AbcBullet/MayaUtility.cpp, and AbcExport/MayaUtility.cpp.
unsigned int numConnectedChildren ( MStatus ReturnStatus = nullptr) const

Return the number of children of this plug that are connected in the dependency graph.

This method is only valid for networked plugs as non-networked plugs contain no information about their children. If this plug is non-networked then a networked version of the plug will be used. If a networked plug does not exist then 0 will be returned.

This method is only valid for compound plugs, since no other plugs have children.

Parameters
[out]ReturnStatusStatus Code
Returns
Total number of children
Status Codes:
  • MS::kSuccess The count was successfully returned
  • MS::kFailure Object error
  • MS::kInvalidDataType This is not a compound plug
Examples:
AbcBullet/MayaUtility.cpp, and AbcExport/MayaUtility.cpp.
MPlug child ( MObject obj,
MStatus ReturnStatus = nullptr 
) const

Returns a plug to a given attribute that is a child of this plug.

This method is only valid for compound plugs that are not arrays.

NOTE: To retrieve the child of a compound array plug the array index has to be specified by calling elementByLogicalIndex first.

Parameters
[in]objThe child attribute.
[out]ReturnStatusStatus code.
Returns
The child plug
Status Codes:
  • MS::kSuccess Child successfully returned
  • MS::kInvalidParameter The given attribute is not a child of this plug
  • MS::kInvalidDataType This is not a compound plug or is a compound array plug
  • MS::kFailure Object error or the given attribute is nullptr
Examples:
AbcBullet/MayaTransformCollectionWriter.cpp, AbcBullet/MayaUtility.cpp, AbcExport/MayaUtility.cpp, AbcImport/MeshHelper.cpp, AbcImport/NodeIteratorVisitorHelper.cpp, atomImportExport/atomFileUtils.cpp, componentScaleManip/componentScaleManip.cpp, gpuCache/gpuCacheCmd.cpp, gpuCache/gpuCacheUtil.cpp, MayaPluginForSpreticle/spReticleLoc.cpp, meshOpCmd/polyModifierCmd.cpp, rotateManip/rotateManip.cpp, sceneAssembly/assemblyDefinition.cpp, and splitUVCmd/polyModifierCmd.cpp.
MPlug child ( unsigned int  index,
MStatus ReturnStatus = nullptr 
) const

Returns a plug to a given attribute that is a child of this plug.

This method is only valid for compound plugs that are not arrays.

NOTE: To retrieve the child of a compound array plug the array index has to be specified by calling elementByLogicalIndex first.

Parameters
[in]indexThe index of the plug to be found
[out]ReturnStatusStatus code.
Returns
The child plug
Status Codes:
  • MS::kSuccess Child successfully returned
  • MS::kInvalidParameter The given attribute is not a child of this plug
  • MS::kInvalidDataType This is not a compound plug or is a compound array plug
  • MS::kFailure Object error or the given attribute is nullptr
MPlug parent ( MStatus ReturnStatus = nullptr) const

Returns the parent plug.

The parent plug will always be a compound plug. This method is only valid for networked child plugs.

Parameters
[in]ReturnStatusStatus Code
Returns
The parent of this plug.
Status Codes:
  • MS::kSuccess The parent was successfully returned
  • MS::kFailure Object error
Examples:
AbcBullet/AttributesWriter.cpp, AbcExport/AttributesWriter.cpp, anisotropicShader/anisotropicShader.cpp, apiDirectionalLightShape/apiDirectionalLightShape.cpp, apiMeshShape/apiMeshShape.cpp, backfillShader/backfillShader.cpp, brickShader/brickShader.cpp, buildRotationNode/buildRotationNode.cpp, cellShader/cellShader.cpp, cgFx/cgfxShaderNode.cpp, checkerShader/checkerShader.cpp, compositingShader/compositingShader.cpp, contrastShader/contrastShader.cpp, depthShader/depthShader.cpp, displacementShader/displacementShader.cpp, dx11Shader/dx11ConeAngleToHotspotConverter.cpp, exampleRampAttribute/exampleMRampAttribute.cpp, fileTexture/fileTexture.cpp, flameShader/flameShader.cpp, footPrintNode_AnimatedMaterial/footPrintNode_GeometryOverride_AnimatedMaterial.cpp, gammaShader/gammaShader.cpp, geomShader/geomShader.cpp, hwPhongShader/hwPhongShader.cpp, interpShader/interpShader.cpp, lavaShader/lavaShader.cpp, lightShader/lightShader.cpp, mixtureShader/mixtureShader.cpp, noiseShader/noiseShader.cpp, onbShader/onbShader.cpp, phongShader/phongShader.cpp, shadowMatteShader/shadowMatteShader.cpp, shiftNode/shiftNode.cpp, simpleNoiseShader/simpleNoiseShader.cpp, simplePhysicsEngine/simplePhysicsEngine.cpp, slopeShader/slopeShaderNode.cpp, solidCheckerShader/solidCheckerShader.cpp, volumeShader/volumeShader.cpp, and vp2BlinnShader/vp2BlinnShader.cpp.
MPlug array ( MStatus ReturnStatus = nullptr) const

Returns the array to which this element plug belongs.

This method is only valid for networked element plugs.

Parameters
[out]ReturnStatusStatus Code
Returns
The array of this plug.
Status Codes:
  • MS::kSuccess The array was successfully returned
  • MS::kFailure Object error
MPlug elementByLogicalIndex ( unsigned int  index,
MStatus ReturnStatus = nullptr 
) const

This method will find and return a plug with the given logical index.

The logical index is the sparse array index used in MEL scripts. If a plug does not exist at the given Index, Maya will create a plug at that index. This is not the case with elementByPhysicalIndex(). If needed, elementByLogicalIndex can be used to expand an array plug on a node. It is important to note that Maya assumes that all such plugs serve a purpose and it will not free non-networked plugs that result from such an array expansion.

The returned plug may or may not be connected.

Parameters
[in]indexThe index of the plug to be found
[out]ReturnStatusStatus Code
Returns
A plug with the given index
Status Codes:
  • MS::kSuccess a plug for the given index was successfully returned
  • MS::kFailure Could not get a plug for the given index
Examples:
AbcImport/NodeIteratorVisitorHelper.cpp, cameraSetSubclass/exCameraSet.cpp, closestPointOnCurve/closestPointOnCurveCmd.cpp, componentScaleManip/componentScaleManip.cpp, constraintEvaluator/constraintEvaluator.cpp, gpuCache/gpuCacheCmd.cpp, meshOpCmd/polyModifierCmd.cpp, pointOnMeshInfo/pointOnMeshCmd.cpp, and splitUVCmd/polyModifierCmd.cpp.
MPlug elementByPhysicalIndex ( unsigned int  index,
MStatus ReturnStatus = nullptr 
) const

This method will find and return a plug with the given physical index.

The index can range from 0 to numElements() - 1. This function is particularly useful for iteration through the element plugs of an array plug. It is equivalent to operator [] (int) This method is only valid for array plugs.

If the returned plug is networked, the networked plug will be returned. Otherwise, a non-networked plug will be returned.

Parameters
[in]indexThe physical array index of the plug to be found
[out]ReturnStatusStatus Code
Returns
A plug with the given index
Status Codes:
  • MS::kSuccess a plug for the given index was successfully returned
  • MS::kFailure Could not get a plug for the given index
Examples:
AbcImport/AlembicNode.cpp, MayaPluginForSpreticle/spReticleLoc.cpp, meshOpCmd/polyModifierCmd.cpp, and splitUVCmd/polyModifierCmd.cpp.
MPlug connectionByPhysicalIndex ( unsigned int  index,
MStatus ReturnStatus = nullptr 
) const

This method will find and return a connected plug with the given physical index for its connection.

The index can range from 0 to numConnectedElements() - 1. This method varies from elementByPhysicalIndex in that elementByPhysicalIndex will return plugs pointing to all existing data in the datablock regardless of whether the plug is connected or not.

This method is only valid for array plugs.

Parameters
[in]indexThe physical array index of the plug to be found
[out]ReturnStatusStatus Code
Returns
A plug with the given index
Status Codes:
  • MS::kSuccess a plug for the given index was successfully returned
  • MS::kFailure Could not get a plug for the given index
Examples:
AbcBullet/MayaUtility.cpp, and AbcExport/MayaUtility.cpp.
bool connectedTo ( MPlugArray array,
bool  asDst,
bool  asSrc,
MStatus ReturnStatus = nullptr 
) const

This method finds all of the plugs that this plug is connected with.

This method will always produce the networked version of the connected plugs.

NOTE: When asDst=true you are asking for a plug connecting in to this one i.e. a source plug that is driving this plug's value. There will only be one of these, or none.

NOTE: When asSrc=true you are asking for all plugs connecting out from this one i.e. destination plugs whose values are driven by this one. There can be any arbitrary number of these and order is not guaranteed so if you look for a specific output/destination plug be sure to check all of them.

It is generally not a good idea to ask for both at the same time since you won't know which are sources or destinations without checking. If you are only interested in the existence of a connection not the actual plug(s) to which this one is connected then use the appropriate connection check methods: isSource()/isDestination()/isConnected().

Calling this method with both asDst and asSrc set to false will do nothing.

Parameters
[in]arrayLocation for storing connected plugs (allocated by the caller)
[in]asDstCheck connections with this plug as destination. If there are such connections, put them in array.
[in]asSrcCheck connections with this plug as source. If there are such connections, put them in array.
[out]ReturnStatusStatus Code
Returns
  • true If the plug has connections as either source or destination. Note that the array is filled in only with the type of connecting plugs requested by asSrc and asDst. Therefore, the method could return true while the array has nothing in it if, for example, the plug has connections as source but the user passes asSrc = false to the method. The parameters asSrc and asDst have no effect on the boolean return value.
  • false If this plug has no connections
Status Codes:
  • MS::kSuccess Method returned successfully
  • MS::kFailure Object error
Examples:
AbcBullet/MayaUtility.cpp, AbcExport/MayaUtility.cpp, AbcImport/CreateSceneHelper.cpp, AbcImport/util.cpp, apiMeshShape/apiMeshSubSceneOverride.cpp, atomImportExport/atomCachedPlugs.cpp, atomImportExport/atomFileUtils.cpp, cgFx/cgfxAttrDef.cpp, constraintEvaluator/constraintEvaluator.cpp, dx11Shader/dx11Shader.cpp, findTexturesPerPolygonCmd/findTexturesPerPolygonCmd.cpp, glslShader/GLSLShader.cpp, gpuCache/gpuCacheCmd.cpp, gpuCache/gpuCacheMaterialBakers.cpp, gpuCache/gpuCacheUtil.cpp, gpuCache/gpuCacheUtil.h, maTranslator/maTranslator.cpp, meshOpCmd/polyModifierCmd.cpp, nodeInfoCmd/nodeInfoCmd.cpp, polyRawExporter/polyWriter.cpp, polyX3DExporter/polyWriter.cpp, simpleEvaluator/simpleEvaluator.cpp, simpleFluidEmitter/simpleFluidEmitter.cpp, slopeShader/slopeShaderBehavior.cpp, and splitUVCmd/polyModifierCmd.cpp.
bool isConnected ( MStatus ReturnStatus = nullptr) const

Determines if this plug is connected to one or more plugs.

Parameters
[out]ReturnStatusStatus Code
Returns
  • true If this plug is connected to another plug
  • false If this plug is not connected to another plug
Status Codes:
  • MS::kSuccess Method returned successfully
  • MS::kFailure Object error
Examples:
AbcBullet/MayaUtility.cpp, AbcExport/MayaUtility.cpp, AbcImport/NodeIteratorVisitorHelper.cpp, dx11Shader/dx11Shader.cpp, glslShader/GLSLShader.cpp, gpuCache/gpuCacheCmd.cpp, MayaPluginForSpreticle/spReticleLoc.cpp, meshOpCmd/polyModifierCmd.cpp, simpleFluidEmitter/simpleFluidEmitter.cpp, and splitUVCmd/polyModifierCmd.cpp.
MPlug source ( MStatus ReturnStatus = nullptr) const

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 connected plug.

Parameters
[out]ReturnStatusStatus Code
Returns
Source plug, or null plug if not a destination.
Status Codes:
  • MS::kSuccess Method returned successfully
  • MS::kFailure Object error (not attached to a Maya object)
Examples:
constraintEvaluator/constraintEvaluator.cpp, and testMTopologyEvaluator/testMTopologyEvaluator.cpp.
bool destinations ( MPlugArray theDestinations,
MStatus ReturnStatus = nullptr 
) const

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.

Parameters
[in]theDestinationsLocation for storing connected plugs (allocated by the caller). The array is first cleared, then the destination plugs are added.
[out]ReturnStatusStatus Code
Returns
Returns true if the plug has one or more destinations.
Status Codes:
  • MS::kSuccess Method returned successfully
  • MS::kFailure Object error (not attached to a Maya object)
MPlug sourceWithConversion ( MStatus ReturnStatus = nullptr) const

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 conversion node connected to this destination, and returns the source of the unit conversion node.

sourceWithConversion() does not skip over unit conversion nodes, and returns the source plug on a unit conversion node, if present.

Note that the behavior of connectedTo() is identical to sourceWithConversion(), that is, do not skip over unit conversion nodes.

Parameters
[out]ReturnStatusStatus Code
Returns
Source plug, or null plug if not a destination.
Status Codes:
  • MS::kSuccess Method returned successfully
  • MS::kFailure Object error (not attached to a Maya object)
bool destinationsWithConversions ( MPlugArray theDestinations,
MStatus ReturnStatus = nullptr 
) const

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.

destinationsWithConversions() 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.

Parameters
[in]theDestinationsLocation for storing connected plugs (allocated by the caller). The array is first cleared, then the destination plugs are added.
[out]ReturnStatusStatus Code
Returns
Returns true if the plug has one or more destinations.
Status Codes:
  • MS::kSuccess Method returned successfully
  • MS::kFailure Object error (not attached to a Maya object)
bool isKeyable ( MStatus ReturnStatus = nullptr) const

Determines if this plug is keyable.

The default keyability of a plug is determined by its attribute, and can be retrieved using MFnAttribute::isKeyable. Keyable plugs will be keyed by AutoKey and the Set Keyframe UI. Non-keyable plugs prevent the user from setting keys via the obvious UI provided for keying. Being non-keyable is not a hard block against adding keys to an attribute.

Parameters
[out]ReturnStatusStatus Code
Returns
  • true If this plug is keyable
  • false If this plug is not keyable
Status Codes:
  • MS::kSuccess Successful completion
  • MS::kFailure Object error
MStatus setKeyable ( bool  keyable)

This overrides the default keyability of a plug set with MFnAttribute::setKeyable.

Keyable plugs will be keyed by AutoKey and the Set Keyframe UI. Non-keyable plugs prevent the user from setting keys via the obvious UI provided for keying. Being non-keyable is not a hard block against adding keys to an attribute.

Parameters
[in]keyableTrue if this plug should be keyable
Returns
Status code
Status Codes:
  • MS::kSuccess Successful completion
  • MS::kFailure Object error
bool isLocked ( MStatus ReturnStatus = nullptr) const

Determines the locked state of this plug's value.

A plug's locked state determines whether or not the plug's value can be changed.

Parameters
[out]ReturnStatusStatus Code
Returns
  • true If this plug's value is locked
  • false If this plug's value is not locked
Status Codes:
  • MS::kSuccess Successful completion
  • MS::kFailure Object error
Examples:
maTranslator/maTranslator.cpp.
MStatus setLocked ( bool  locked)

Sets the locked state for this plug's value.

A plug's locked state determines whether or not the plug's value can be changed.

Parameters
[in]lockedTrue if this plug's value is to be locked
Returns
Status code
Status Codes:
  • MS::kSuccess Successful completion
  • MS::kFailure Object error
bool isChannelBoxFlagSet ( MStatus ReturnStatus = nullptr) const

Returns true if this plug or its attribute has its channel box flag set.

Attributes will appear in the channel box if their channel box flag is set or if they are keyable.

Parameters
[out]ReturnStatusStatus Code
Returns
  • true channel box flag has been set
  • false channel box flag has not been set
Status Codes:
  • MS::kSuccess Successful completion
  • MS::kFailure Object error
MStatus setChannelBox ( bool  inChannelBox)

Sets whether this plug is displayed in the channel box.

This overrides the default display of a plug set with MFnAttribute::setChannelBox. Keyable attributes are always shown in the channel box so this flag is ignored on keyable plugs.

Parameters
[in]inChannelBoxTrue if this plug should be displayed in the channel box
Returns
Status code
Status Codes:
  • MS::kSuccess Successful completion
  • MS::kFailure Object error
bool isCachingFlagSet ( MStatus ReturnStatus = nullptr) const

Returns true if this plug or its attribute has its caching flag set.

Parameters
[out]ReturnStatusStatus Code
Returns
  • true caching flag has been set
  • false caching flag has not been set
Status Codes:
  • MS::kSuccess Successful completion
  • MS::kFailure Object error
MStatus setCaching ( bool  isCaching)

Sets whether this plug is cached internally.

Note: turning caching on for a plug will force the plug to become networked. Network plugs take longer to look up in the DG; therefore you should only make a plug cached only if you are certain that the network plug look-up will take less than the saved evaluation cost.

Not all plugs can be made cached (or un-cached). If the attribute is defined to be cached, then you cannot uncache the attribute. As well, you cannot define caching on element plugs.

Parameters
[in]isCachingTrue if this plug should be cached
Returns
Status code
Status Codes:
  • MS::kSuccess Successful completion
  • MS::kFailure Object error
  • MS::kInvalidDataType Plug is a multi or plug is marked permanently cached.
bool isNull ( MStatus ReturnStatus = nullptr) const

This method determines whether this plug is valid.

A plug is valid if it refers to an attribute.

Parameters
[out]ReturnStatusStatus Code
Returns
  • true this plug is not valid
  • false this plug is valid
Status Codes:
  • MS::kSuccess This method was successful
  • MS::kFailure Object error
Examples:
AbcBullet/AbcBullet.cpp, AbcBullet/AttributesWriter.cpp, AbcBullet/MayaTransformWriter.cpp, AbcExport/AbcExport.cpp, AbcExport/AttributesWriter.cpp, AbcExport/MayaMeshWriter.cpp, AbcExport/MayaNurbsCurveWriter.cpp, AbcExport/MayaTransformWriter.cpp, AbcImport/AlembicNode.cpp, AbcImport/CreateSceneHelper.cpp, AbcImport/NodeIteratorVisitorHelper.cpp, apiMeshShape/apiMeshSubSceneOverride.cpp, atomImportExport/atomImportExport.cpp, colorTransformData/colorTransformData.cpp, componentScaleManip/componentScaleManip.cpp, dx11Shader/dx11Shader.cpp, findTexturesPerPolygonCmd/findTexturesPerPolygonCmd.cpp, footPrintNode/footPrintNode.cpp, footPrintNode_AnimatedMaterial/footPrintNode_GeometryOverride_AnimatedMaterial.cpp, glslShader/GLSLShader.cpp, gpuCache/gpuCacheCmd.cpp, gpuCache/gpuCacheMaterialBakers.cpp, gpuCache/gpuCacheSubSceneOverride.cpp, gpuCache/gpuCacheUtil.cpp, gpuCache/gpuCacheUtil.h, hlslShader/hlslShader.cpp, hwApiTextureTest/hwApiTextureTest.cpp, hwPhongShader/hwPhongShaderBehavior.cpp, manipOverride/rockingTransform2.cpp, MayaPluginForSpreticle/spReticleLoc.cpp, meshOpCmd/polyModifierCmd.cpp, moveManip/moveManip.cpp, polyRawExporter/polyWriter.cpp, polyX3DExporter/polyWriter.cpp, rockingTransform/rockingTransform.cpp, rockingTransformCheck/rockingTransform.cpp, simplePhysicsEngine/simplePhysicsEngine.cpp, slopeShader/slopeShaderBehavior.cpp, splitUVCmd/polyModifierCmd.cpp, surfaceBumpManip/surfaceBumpManip.cpp, and testMTopologyEvaluator/testMTopologyEvaluator.cpp.
MString info ( MStatus ReturnStatus = nullptr) const

This method returns a string containing the name of the node this plug belongs to and the attributes that the plug refers to.

The string is of the form dependNode:atr1.atr2[].attr3 ...

This method is useful for debugging purposes.

Parameters
[out]ReturnStatusStatus Code
Returns
Returns a string containing dependency node and attribute information for this plug.
Status Codes:
  • MS::kSuccess The string was successfully generated
  • MS::kFailure Object error
Examples:
apiMeshShape/apiMeshShape.cpp, nodeInfoCmd/nodeInfoCmd.cpp, nodeMessageCmd/nodeMessageCmd.cpp, and paintCallback/paintCallback.cpp.
bool isFromReferencedFile ( MStatus ReturnStatus = nullptr) const

This method determines whether this plug came from a referenced file.

A plug is considered to have come from a referenced file if it is connected and that connection was made within a referenced file.

Parameters
[out]ReturnStatusStatus Code
Returns
  • true plug was created within a referenced file
  • false plug was created within the current scene
Status Codes:
  • MS::kSuccess This method was successful
  • MS::kFailure Object error
Examples:
maTranslator/maTranslator.cpp.
bool isDynamic ( MStatus ReturnStatus = nullptr) const

Determines whether the attribute is of dynamic type or not.

Parameters
[out]ReturnStatusStatus Code
Returns
  • true If the attribute is dynamic
  • false If this attribute is not added by user.
Status Codes:
  • MS::kSuccess Successful completion
  • MS::kFailure Object error
bool isIgnoredWhenRendering ( MStatus ReturnStatus = nullptr) const

Determines whether a connection to the attribute should be ignored during rendering.

Parameters
[out]ReturnStatusStatus Code
Returns
  • true If connected, the attribute should be ingored during rendering.
  • false If connected, the attribute should not be ingored during rendering.
Status Codes:
  • MS::kSuccess Successful completion
  • MS::kFailure Object error
bool isDefaultValue ( bool  forceEval = true,
MStatus ReturnStatus = nullptr 
) const

This method determines if the plug value is equivalent to the plug's default value.

Optionally, disable evaluation of the plug before testing its value against the plug's default value. Disabling this option represents a performance optimization in cases where the plug's value is known to be valid and correct.

Parameters
[in]forceEvalEvaluate the plug prior to test.
[out]ReturnStatusStatus Code
Status Codes:
  • MS::kSuccess The operation succeeded.
  • MS::kFailure Object error.
MPlug::FreeToChangeState isFreeToChange ( bool  checkParents = true,
bool  checkChildren = true,
MStatus ReturnStatus = nullptr 
) const

Returns true if the plug's value is allowed to be set directly.

A plug isFreeToChange if it is not locked, and it is not a destination or if it is a destination, then it must be a special case (such as connected to an anim curve).

Normally this is not something that needs to be checked, since the DG or MEL operations take care of this for you.

If the parents are not free to change, then the children will not be free to change. However if the parents are free to change, some children may not be free to change.

Parameters
[in]checkParentsCheck parent plugs.
[in]checkChildrenCheck child plugs.
[out]ReturnStatusStatus Code
Returns
  • kFreeToChange All tested plugs are free to change.
  • kNotFreeToChange Some of the tested plugs are not free to change.
  • kChildrenNotFreeToChange Some of the children are not free to change.
Status Codes:
  • MS::kSuccess Successful completion
  • MS::kFailure Object error
Examples:
geometrySurfaceConstraint/geometrySurfaceConstraint.cpp.
MDataHandle constructHandle ( MDataBlock mBlock) const

This method returns a data handle constructed for this plug.

Returns
MDataHandle for this plug
MObject asMObject ( MStatus ReturnStatus = nullptr) const

Retrieve the value in the current evaluation context of the attribute this plug references.

This method returns a copy of the attribute value for the plug and not a reference. The setObject method of this class can be used to modify the plug's value.

Parameters
[out]ReturnStatusStatus Code
Returns
Value of plug as an MObject
Status Codes:
  • MS::kSuccess Value exists and is non-null, and contains the correct information
  • MS::kFailure Either the value is a nullptr value (kFailure) or the value does not exist (kObjectDoesNotExist failure)
Examples:
AbcBullet/AttributesWriter.cpp, AbcExport/AbcExport.cpp, AbcExport/AttributesWriter.cpp, AbcImport/AlembicNode.cpp, and gpuCache/gpuCacheMaterialBakers.cpp.
MDataHandle asMDataHandle ( MStatus ReturnStatus = nullptr) const

Retrieve the value in the current evaluation context of the attribute this plug references.

This method is useful when wanting to retrieve an entire set of values from an array plug with a single call. An MArrayDataHandle can then be constructed from the returned MDataHandle to access the array data values.

Parameters
[out]ReturnStatusStatus Code
Returns
Value of plug as an MDataHandle. When done using the returned handle, the caller must destroy it using MPlug::destructHandle().
Status Codes:
  • MS::kSuccess
  • MS::kFailure
Examples:
constraintEvaluator/constraintEvaluator.cpp.
double asDouble ( MStatus ReturnStatus = nullptr) const

Retrieve the value in the current evaluation context of the attribute this plug references.

Parameters
[out]ReturnStatusStatus Code
Returns
Value of plug as a double
Status Codes:
  • MS::kSuccess
  • MS::kFailure
Examples:
AbcBullet/AttributesWriter.cpp, AbcBullet/MayaTransformWriter.cpp, AbcExport/AttributesWriter.cpp, AbcExport/MayaCameraWriter.cpp, AbcExport/MayaLocatorWriter.cpp, AbcExport/MayaTransformWriter.cpp, and lensDistortionCallback/lensDistortionCallback.cpp.
float asFloat ( MStatus ReturnStatus = nullptr) const

Retrieve the value in the current evaluation context of the attribute this plug references.

Parameters
[out]ReturnStatusStatus Code
Returns
Value of plug as a float
Status Codes:
  • MS::kSuccess
  • MS::kFailure
Examples:
AbcBullet/AttributesWriter.cpp, AbcExport/AttributesWriter.cpp, AbcExport/MayaNurbsCurveWriter.cpp, gpuCache/gpuCacheCmd.cpp, and gpuCache/gpuCacheMaterialBakers.cpp.
MInt64 asInt64 ( MStatus ReturnStatus = nullptr) const

Retrieve the value in the current evaluation context of the attribute this plug references.

Parameters
[out]ReturnStatusStatus Code
Returns
Value of plug as an int
Status Codes:
  • MS::kSuccess
  • MS::kFailure
int asInt ( MStatus ReturnStatus = nullptr) const

Retrieve the value in the current evaluation context of the attribute this plug references.

Parameters
[out]ReturnStatusStatus Code
Returns
Value of plug as an int
Status Codes:
  • MS::kSuccess
  • MS::kFailure
Examples:
AbcBullet/AttributesWriter.cpp, AbcExport/AttributesWriter.cpp, AbcExport/MayaMeshWriter.cpp, gpuCache/gpuCacheMaterialBakers.cpp, and lensDistortionCallback/lensDistortionCallback.cpp.
short asShort ( MStatus ReturnStatus = nullptr) const

Retrieve the value in the current evaluation context of the attribute this plug references.

Parameters
[out]ReturnStatusStatus Code
Returns
Value of plug as a short
Status Codes:
  • MS::kSuccess
  • MS::kFailure
Examples:
AbcBullet/AttributesWriter.cpp, and AbcExport/AttributesWriter.cpp.
MDistance asMDistance ( MStatus ReturnStatus = nullptr) const

Retrieve the value in the current evaluation context of the attribute this plug references.

Parameters
[out]ReturnStatusStatus Code
Returns
Value of plug as an MDistance
Status Codes:
  • MS::kSuccess
  • MS::kFailure
MAngle asMAngle ( MStatus ReturnStatus = nullptr) const

Retrieve the value in the current evaluation context of the attribute this plug references.

Parameters
[out]ReturnStatusStatus Code
Returns
Value of plug as an MAngle
Status Codes:
  • MS::kSuccess
  • MS::kFailure
MTime asMTime ( MStatus ReturnStatus = nullptr) const

Retrieve the value in the current evaluation context of the attribute this plug references.

Parameters
[out]ReturnStatusStatus Code
Returns
Value of plug as an MTime
Status Codes:
  • MS::kSuccess
  • MS::kFailure
char asChar ( MStatus ReturnStatus = nullptr) const

Retrieve the value in the current evaluation context of the attribute this plug references.

Parameters
[in]ReturnStatusStatus Code
Returns
Value of plug as a char
Status Codes:
  • MS::kSuccess
  • MS::kFailure
Examples:
AbcBullet/AttributesWriter.cpp, and AbcExport/AttributesWriter.cpp.
MString asString ( MStatus ReturnStatus = nullptr) const

Retrieve the value in the current evaluation context of the attribute this plug references.

Parameters
[out]ReturnStatusStatus Code
Returns
Value of plug as an MString
Status Codes:
  • MS::kSuccess
  • MS::kFailure Object error or internal failure
Examples:
AbcBullet/AbcBullet.cpp, AbcBullet/AttributesWriter.cpp, AbcExport/AbcExport.cpp, AbcExport/AttributesWriter.cpp, AbcExport/MayaMeshWriter.cpp, gpuCache/gpuCacheCmd.cpp, and gpuCache/gpuCacheMaterialBakers.cpp.
MStatus setMObject ( const MObject val)

Set the current value of the attribute this plug references.

If the attribute is the destination of a connection then setting the value will have no effect as once the node is re-evaluated the attribute value will be reset.

Parameters
[in]valThe value to which the attribute will be set
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
  • MS::kLicenseFailure
MStatus setMPxData ( const MPxData val)

Set the current value of the attribute this plug references.

If the attribute is the destination of a connection then setting the value will have no effect as once the node is re-evaluated the attribute value will be reset.

Parameters
[in]valThe value to which the attribute will be set
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
  • MS::kLicenseFailure
MStatus setMDataHandle ( const MDataHandle handle)

Set the current value of the attribute this plug references with the values in the handle.

This method is most useful when the plug is an array plug, and you've filled the handle with data. Sending the value using this version of setValue will set the handle's data into the datablock and send out the appropriate attributeChanged messages to update the UI related to the attribute.

If the attribute is the destination of a connection then setting the value will have no effect as once the node is re-evaluated the attribute value will be reset.

Parameters
[in]handleThe handle containing the data to which the attribute will be set
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
  • MS::kLicenseFailure
MStatus setDouble ( double  val)

Set the current value of the attribute this plug references.

If the attribute is the destination of a connection then setting the value will have no effect as once the node is re-evaluated the attribute value will be reset.

Parameters
[in]valThe value to which the attribute will be set
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
  • MS::kLicenseFailure
Examples:
atomImportExport/atomFileUtils.cpp.
MStatus setFloat ( float  val)

Set the current value of the attribute this plug references.

If the attribute is the destination of a connection then setting the value will have no effect as once the node is re-evaluated the attribute value will be reset.

Parameters
[in]valThe value to which the attribute will be set
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
  • MS::kLicenseFailure
Examples:
atomImportExport/atomFileUtils.cpp.
MStatus setInt64 ( MInt64  val)

Set the current value of the attribute this plug references.

If the attribute is the destination of a connection then setting the value will have no effect as once the node is re-evaluated the attribute value will be reset.

Parameters
[in]valThe value to which the attribute will be set
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
  • MS::kLicenseFailure
MStatus setInt ( int  val)

Set the current value of the attribute this plug references.

If the attribute is the destination of a connection then setting the value will have no effect as once the node is re-evaluated the attribute value will be reset.

Parameters
[in]valThe value to which the attribute will be set
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
  • MS::kLicenseFailure
Examples:
atomImportExport/atomFileUtils.cpp.
MStatus setShort ( short  val)

Set the current value of the attribute this plug references.

If the attribute is the destination of a connection then setting the value will have no effect as once the node is re-evaluated the attribute value will be reset.

Parameters
[in]valThe value to which the attribute will be set
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
  • MS::kLicenseFailure
Examples:
atomImportExport/atomFileUtils.cpp.
MStatus setBool ( bool  val)

Set the current value of the attribute this plug references.

If the attribute is the destination of a connection then setting the value will have no effect as once the node is re-evaluated the attribute value will be reset.

Parameters
[in]valThe value to which the attribute will be set
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
  • MS::kLicenseFailure
Examples:
AbcImport/CreateSceneHelper.cpp, AbcImport/XformHelper.cpp, and atomImportExport/atomFileUtils.cpp.
MStatus setMDistance ( const MDistance val)

Set the current value of the attribute this plug references.

If the attribute is the destination of a connection then setting the value will have no effect as once the node is re-evaluated the attribute value will be reset.

Parameters
[in]valThe value to which the attribute will be set
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
  • MS::kLicenseFailure
Examples:
atomImportExport/atomFileUtils.cpp.
MStatus setMAngle ( const MAngle val)

Set the current value of the attribute this plug references.

If the attribute is the destination of a connection then setting the value will have no effect as once the node is re-evaluated the attribute value will be reset.

Parameters
[in]valThe value to which the attribute will be set
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
  • MS::kLicenseFailure
Examples:
atomImportExport/atomFileUtils.cpp.
MStatus setMTime ( const MTime val)

Set the current value of the attribute this plug references.

If the attribute is the destination of a connection then setting the value will have no effect as once the node is re-evaluated the attribute value will be reset.

Parameters
[in]valThe value to which the attribute will be set
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
  • MS::kLicenseFailure
Examples:
atomImportExport/atomFileUtils.cpp.
MStatus setChar ( char  val)

Set the current value of the attribute this plug references.

If the attribute is the destination of a connection then setting the value will have no effect as once the node is re-evaluated the attribute value will be reset.

Parameters
[in]valThe value to which the attribute will be set
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
  • MS::kLicenseFailure
Examples:
atomImportExport/atomFileUtils.cpp.
MStatus setString ( const MString val)

Set the current value of the attribute this plug references.

If the attribute is the destination of a connection then setting the value will have no effect as once the node is re-evaluated the attribute value will be reset.

Parameters
[in]valThe value to which the attribute will be set
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
  • MS::kLicenseFailure
Examples:
AbcImport/NodeIteratorVisitorHelper.cpp.
MPlug proxied ( )

Introduced in 2023.0

Returns the proxied plug for this plug.

2023.0:
Introduced in this version.

If this plug is an empty plug or not a proxy plug it will simply return itself. If this plug is a proxy but unconnected it will return a null plug. If this plug is valid and it is a proxy plug then it will return the proxied plug. Note that proxy attributes can be chained together so a proxy plug can be a proxy for another proxy plug. If that is the case, proxied will recurse until it finds the proxied plug in the chain of connections.

Returns
the proxied plug for this plug.
MPlug & operator= ( const MPlug other)

Assignment operator.

Copies one plug to another.

Networked plugs are not allowed to be duplicated so if the RHS is a networked plug then a non-networked version is returned.

Parameters
[in]otherthe plug to be copied
Returns
A reference to the copied plug
MPlug operator[] ( unsigned int  physicalIndex) const

This method will find and return a plug with the given physical index.

This is the same as the elementByPhysicalIndex method.

Parameters
[in]physicalIndexArray index of child plug
Returns
A plug with the given index
bool operator== ( const MPlug other) const

Comparison operator for MPlugs.

Plugs are considered equal if they refer to the same node and attribute unless both plugs are networked. In such cases a pointer comparison is done as there can only be one version of a networked plug.

If either or both plugs are null, the plugs are not considered equal.

Parameters
[in]otherOther plug to compare against
Returns
  • true If the plugs are equal
  • false If the plugs are not equal
bool operator== ( const MObject attr) const

Comparison operator for a plug and an attribute.

This actually compares the plug's attribute against the other attribute.

Parameters
[in]attrAttribute to compare against
Returns
  • true If the plug's attribute is equal
  • false If the plug's attribute is not equal
bool operator!= ( const MPlug other) const

The inequality operator for MPlugs.

Plugs are considered equal if they refer to the same node and attribute unless both plugs are networked. In such cases a pointer comparison is done as there can only be one version of a networked plug.

If either or both plugs are null, the plugs are not considered equal.

Parameters
[in]otherOther plug to compare against
Returns
  • true If the plugs are not equal
  • false If the plugs are equal
bool operator!= ( const MObject attr) const

The inequality operator for a plug and an attribute.

This actually compares the plug's attribute against the other attribute.

Parameters
[in]attrAttribute to compare against
Returns
  • true If the plug's attribute is not equal
  • false If the plug's attribute is equal
MStatus setNumElements ( unsigned int  elements)

The method is used to pre-allocate the number of elements that an array plug will contain.

The plug passed to this method must be an array plug and there must be no elements already allocated.

The numElements() method is used to find the number of elements already in the array plug.

Parameters
[in]elementsnew array size
Returns
  • kSuccess array plug size was changed
  • kFailure failed to change array plug size, plug is not array or array size is already non-zero.
bool isSource ( MStatus ReturnStatus = nullptr) const

Determines if this plug is connected as a source.

Parameters
[out]ReturnStatuspointer to a status code object
Returns
  • true plug is connected as a source
  • false plug is not connected as a source
Status Codes:
  • MS::kSuccess Method returned successfully
  • MS::kFailure Object error
Examples:
gpuCache/gpuCacheUtil.cpp.
bool isDestination ( MStatus ReturnStatus = nullptr) const

Determines if this plug is connected as a destination.

Parameters
[out]ReturnStatuspointer to a status code object
Returns
  • true plug is connected as a destination
  • false plug is not connected as a destination
Status Codes:
  • MS::kSuccess Method returned successfully
  • MS::kFailure Object error
Examples:
gpuCache/gpuCacheMaterialBakers.cpp, and gpuCache/gpuCacheUtil.cpp.
const char * className ( )
static

Returns the name of this class.

Returns
Name of this class.
MStatus getValue ( MObject val) const

NO SCRIPT SUPPORT.

Retrieve the current value of the attribute this plug references.

This method returns a copy of the attribute value for the plug and not a reference. The setObject method of this class can be used to modify the plug's value.

Python Notes

This method is not available from Python. Use asMObject() instead.

Parameters
[out]valStorage for the attribute value
Returns
Status Code
Status Codes:
  • MS::kSuccess Value exists and is non-null, and contains the correct information
  • MS::kFailure Either the value is a nullptr value (kFailure) or the value does not exist (kObjectDoesNotExist failure)
Examples:
AbcBullet/MayaTransformCollectionWriter.cpp, AbcExport/MayaNurbsCurveWriter.cpp, animInfoCmd/animInfoCmd.cpp, apiMeshShape/apiMeshShape.cpp, atomImportExport/atomFileUtils.cpp, cameraSetSubclass/exCameraSet.cpp, cgFx/cgfxShaderNode.cpp, closestPointCmd/closestPointCmd.cpp, colorTransformData/colorTransformData.cpp, componentScaleManip/componentScaleManip.cpp, customAttrManip/customAttrManip.cpp, dx11Shader/dx11Shader.cpp, findFileTexturesCmd/findFileTexturesCmd.cpp, findTexturesPerPolygonCmd/findTexturesPerPolygonCmd.cpp, footPrintNode/footPrintNode.cpp, footPrintNode_AnimatedMaterial/footPrintNode_GeometryOverride_AnimatedMaterial.cpp, footPrintNode_GeometryOverride/footPrintNode_GeometryOverride.cpp, glslShader/GLSLShader.cpp, gpuCache/gpuCacheCmd.cpp, hlslShader/hlslShader.cpp, ik2Bsolver/ik2Bsolver.cpp, intersectCmd/intersectCmd.cpp, manipOverride/manipOverride.cpp, MayaPluginForSpreticle/spReticleLoc.cpp, meshOpCmd/polyModifierCmd.cpp, polyRawExporter/polyExporter.cpp, polyRawExporter/polyWriter.cpp, polyX3DExporter/polyExporter.cpp, polyX3DExporter/polyWriter.cpp, rotateManip/rotateManip.cpp, sceneAssembly/assemblyDefinition.cpp, sceneAssembly/assemblyReference.cpp, shellNode/shellNode.cpp, splitUVCmd/polyModifierCmd.cpp, and swissArmyManip/swissArmyManip.cpp.
MStatus getValue ( MDataHandle val) const

NO SCRIPT SUPPORT.

Retrieve the current value of the attribute this plug references.

This method is useful when wanting to retrieve an entire set of values from an array plug with a single call. An MArrayDataHandle can then be constructed from the returned MDataHandle to access the array data values.

After using the returned MDataHandle, the caller must destroy the handle using MPlug::destructHandle().

Parameters
[out]valStorage for the attribute value
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure Object error or internal failure
MStatus getValue ( double &  val) const

NO SCRIPT SUPPORT.

Retrieve the current value of the attribute this plug references.

Python Notes

This method is not available from Python. Use asDouble() instead.

Parameters
[out]valStorage for the attribute value
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
MStatus getValue ( float &  val) const

NO SCRIPT SUPPORT.

Retrieve the current value of the attribute this plug references.

Python Notes

This method is not available from Python. Use asFloat() instead.

Parameters
[out]valStorage for the attribute value
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
MStatus getValue ( MInt64 &  val) const

NO SCRIPT SUPPORT.

Retrieve the current value of the attribute this plug references.

Python Notes

This method is not available from Python. Use asInt64() instead.

Parameters
[out]valStorage for the attribute value
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
MStatus getValue ( int &  val) const

NO SCRIPT SUPPORT.

Retrieve the current value of the attribute this plug references.

Python Notes

This method is not available from Python. Use asInt() instead.

Parameters
[out]valStorage for the attribute value
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
MStatus getValue ( short &  val) const

NO SCRIPT SUPPORT.

Retrieve the current value of the attribute this plug references.

Python Notes

This method is not available from Python. Use asShort() instead.

Parameters
[out]valStorage for the attribute value
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
MStatus getValue ( bool &  val) const

NO SCRIPT SUPPORT.

Retrieve the current value of the attribute this plug references.

Python Notes

This method is not available from Python. Use asBool() instead.

Parameters
[out]valStorage for the attribute value
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
MStatus getValue ( MDistance val) const

NO SCRIPT SUPPORT.

Retrieve the current value of the attribute this plug references.

Python Notes

This method is not available from Python. Use asMDistance() instead.

Parameters
[out]valStorage for the attribute value
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
MStatus getValue ( MAngle val) const

NO SCRIPT SUPPORT.

Retrieve the current value of the attribute this plug references.

Python Notes

This method is not available from Python. Use asMAngle() instead.

Parameters
[out]valStorage for the attribute value
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
MStatus getValue ( MTime val) const

NO SCRIPT SUPPORT.

Retrieve the current value of the attribute this plug references.

Python Notes

This method is not available from Python. Use asMTime() instead.

Parameters
[out]valStorage for the attribute value
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
MStatus getValue ( char &  val) const

NO SCRIPT SUPPORT.

Retrieve the current value of the attribute this plug references.

Python Notes

This method is not available from Python. Use asChar() instead.

Parameters
[out]valStorage for the attribute value
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
MStatus getValue ( MString val) const

NO SCRIPT SUPPORT.

Retrieve the current value of the attribute this plug references.

Python Notes

This method is not available from Python. Use asString() instead.

Parameters
[out]valStorage for the attribute value
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure Object error or internal failure
MStatus setValue ( const MObject val)

NO SCRIPT SUPPORT.

Set the current value of the attribute this plug references.

If the attribute is the destination of a connection then setting the value will have no effect as once the node is re-evaluated the attribute value will be reset.

Python Notes

This method is not available from Python. Use setMObject() instead.

Parameters
[in]valThe value to which the attribute will be set
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
  • MS::kLicenseFailure
Examples:
AbcImport/AlembicNode.cpp, AbcImport/CreateSceneHelper.cpp, AbcImport/LocatorHelper.cpp, AbcImport/MeshHelper.cpp, AbcImport/NodeIteratorVisitorHelper.cpp, AbcImport/NurbsCurveHelper.cpp, atomImportExport/atomCachedPlugs.cpp, cameraSetSubclass/exCameraSet.cpp, cgFx/cgfxShaderCmd.cpp, cgFx/pluginMain.cpp, closestPointOnCurve/closestPointOnCurveCmd.cpp, dx11Shader/dx11Shader.cpp, glslShader/GLSLShader.cpp, hlslShader/hlslShader.cpp, manipOverride/manipOverride.cpp, meshOpCmd/polyModifierCmd.cpp, pointOnMeshInfo/pointOnMeshCmd.cpp, polyPrimitiveCmd/polyPrimitiveCmd.cpp, sceneAssembly/adskRepresentations.cpp, sceneAssembly/assemblyDefinition.cpp, and splitUVCmd/polyModifierCmd.cpp.
MStatus setValue ( const MPxData val)

NO SCRIPT SUPPORT.

Set the current value of the attribute this plug references.

If the attribute is the destination of a connection then setting the value will have no effect as once the node is re-evaluated the attribute value will be reset.

Python Notes

This method is not available from Python. Use setMPxData() instead.

Parameters
[in]valThe value to which the attribute will be set
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
  • MS::kLicenseFailure
MStatus setValue ( const MDataHandle handle)

NO SCRIPT SUPPORT.

Set the current value of the attribute this plug references with the values in the handle.

This method is most useful when the plug is an array plug, and you've filled the handle with data. Sending the value using this version of setValue will set the handle's data into the datablock and send out the appropriate attributeChanged messages to update the UI related to the attribute.

If the attribute is the destination of a connection then setting the value will have no effect as once the node is re-evaluated the attribute value will be reset.

Python Notes

This method is not available from Python. Use setMDataHandle() instead.

Parameters
[in]handleThe handle containing the data to which the attribute will be set
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
  • MS::kLicenseFailure
MStatus setValue ( double  val)

NO SCRIPT SUPPORT.

Set the current value of the attribute this plug references.

If the attribute is the destination of a connection then setting the value will have no effect as once the node is re-evaluated the attribute value will be reset.

Python Notes

This method is not available from Python. Use setDouble() instead.

Parameters
[in]valThe value to which the attribute will be set
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
  • MS::kLicenseFailure
MStatus setValue ( float  val)

NO SCRIPT SUPPORT.

Set the current value of the attribute this plug references.

If the attribute is the destination of a connection then setting the value will have no effect as once the node is re-evaluated the attribute value will be reset.

Python Notes

This method is not available from Python. Use setFloat() instead.

Parameters
[in]valThe value to which the attribute will be set
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
  • MS::kLicenseFailure
MStatus setValue ( MInt64  val)

NO SCRIPT SUPPORT.

Set the current value of the attribute this plug references.

If the attribute is the destination of a connection then setting the value will have no effect as once the node is re-evaluated the attribute value will be reset.

Python Notes

This method is not available from Python. Use setInt64() instead.

Parameters
[in]valThe value to which the attribute will be set
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
  • MS::kLicenseFailure
MStatus setValue ( int  val)

NO SCRIPT SUPPORT.

Set the current value of the attribute this plug references.

If the attribute is the destination of a connection then setting the value will have no effect as once the node is re-evaluated the attribute value will be reset.

Python Notes

This method is not available from Python. Use setInt() instead.

Parameters
[in]valThe value to which the attribute will be set
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
  • MS::kLicenseFailure
MStatus setValue ( short  val)

NO SCRIPT SUPPORT.

Set the current value of the attribute this plug references.

If the attribute is the destination of a connection then setting the value will have no effect as once the node is re-evaluated the attribute value will be reset.

Python Notes

This method is not available from Python. Use setShort() instead.

Parameters
[in]valThe value to which the attribute will be set
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
  • MS::kLicenseFailure
MStatus setValue ( bool  val)

NO SCRIPT SUPPORT.

Set the current value of the attribute this plug references.

If the attribute is the destination of a connection then setting the value will have no effect as once the node is re-evaluated the attribute value will be reset.

Python Notes

This method is not available from Python. Use setBool() instead.

Parameters
[in]valThe value to which the attribute will be set
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
  • MS::kLicenseFailure
MStatus setValue ( const MDistance val)

NO SCRIPT SUPPORT.

Set the current value of the attribute this plug references.

If the attribute is the destination of a connection then setting the value will have no effect as once the node is re-evaluated the attribute value will be reset.

Python Notes

This method is not available from Python. Use setMDistance() instead.

Parameters
[in]valThe value to which the attribute will be set
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
  • MS::kLicenseFailure
MStatus setValue ( const MAngle val)

NO SCRIPT SUPPORT.

Set the current value of the attribute this plug references.

If the attribute is the destination of a connection then setting the value will have no effect as once the node is re-evaluated the attribute value will be reset.

Python Notes

This method is not available from Python. Use setMAngle() instead.

Parameters
[in]valThe value to which the attribute will be set
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
  • MS::kLicenseFailure
MStatus setValue ( const MTime val)

NO SCRIPT SUPPORT.

Set the current value of the attribute this plug references.

If the attribute is the destination of a connection then setting the value will have no effect as once the node is re-evaluated the attribute value will be reset.

Python Notes

This method is not available from Python. Use setMTime() instead.

Parameters
[in]valThe value to which the attribute will be set
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
  • MS::kLicenseFailure
MStatus setValue ( char  val)

NO SCRIPT SUPPORT.

Set the current value of the attribute this plug references.

If the attribute is the destination of a connection then setting the value will have no effect as once the node is re-evaluated the attribute value will be reset.

Python Notes

This method is not available from Python. Use setChar() instead.

Parameters
[in]valThe value to which the attribute will be set
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
  • MS::kLicenseFailure
MStatus setValue ( const MString val)

NO SCRIPT SUPPORT.

Set the current value of the attribute this plug references.

If the attribute is the destination of a connection then setting the value will have no effect as once the node is re-evaluated the attribute value will be reset.

Python Notes

This method is not available from Python. Use setString() instead.

Parameters
[in]valThe value to which the attribute will be set
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
  • MS::kLicenseFailure
MStatus setValue ( const char *  val)

NO SCRIPT SUPPORT.

Set the current value of the attribute this plug references.

If the attribute is the destination of a connection then setting the value will have no effect as once the node is re-evaluated the attribute value will be reset.

Python Notes

This method is not available from Python. Use setString() instead.

Parameters
[in]valThe value to which the attribute will be set
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
  • MS::kLicenseFailure
MPlug operator[] ( MObject attr) const

NO SCRIPT SUPPORT.

Returns a plug to the given attribute.

This is only valid for attributes with no arrays in their ancestry.

Parameters
[in]attrThe attribute of the plug
Returns
A plug referring to the given attribute, or a nullptr plug if the operation fails.
operator MObject ( ) const

NO SCRIPT SUPPORT.

This method returns the attribute for this plug.

Returns
The attribute for this plug
bool operator! ( ) const

NO SCRIPT SUPPORT.

Returns true if this plug is not valid.

A plug is considered valid if it refers to an attribute.

Returns
  • true The plug is NOT valid
  • false The plug is valid
MObject asMObject ( const MDGContext ctx,
MStatus ReturnStatus = nullptr 
) const

Deprecated in 2018.0

Retrieve the value in the given context of the attribute this plug references.

Deprecated:
Use asMObject(MStatus*) instead. If needed, use MDGContextGuard to switch the context.
2018.0:
Deprecated in this version.
Note
Use this method only when you are deliberately evaluating at a different context, e.g. at a different time, otherwise use the overload with no context.

This method returns a copy of the attribute value for the plug and not a reference. The setObject method of this class can be used to modify the plug's value.

Parameters
[in]ctxContext in which to evaluate the plug
[out]ReturnStatusStatus Code
Returns
Value of plug as an MObject
Status Codes:
  • MS::kSuccess Value exists and is non-null, and contains the correct information
  • MS::kFailure Either the value is a nullptr value (kFailure) or the value does not exist (kObjectDoesNotExist failure)
MDataHandle asMDataHandle ( const MDGContext ctx,
MStatus ReturnStatus = nullptr 
) const

Deprecated in 2018.0

Retrieve the value in the given context of the attribute this plug references.

Deprecated:
Use asMDataHandle(MStatus*) instead. If needed, use MDGContextGuard to switch the context.
2018.0:
Deprecated in this version.
Note
Use this method only when you are deliberately evaluating at a different context, e.g. at a different time, otherwise use the overload with no context.

This method is useful when wanting to retrieve an entire set of values from an array plug with a single call. An MArrayDataHandle can then be constructed from the returned MDataHandle to access the array data values.

Parameters
[in]ctxContext in which to evaluate the plug
[out]ReturnStatusStatus Code
Returns
Value of plug as an MDataHandle. When done using the returned handle, the caller must destroy it using MPlug::destructHandle().
Status Codes:
  • MS::kSuccess
  • MS::kFailure
double asDouble ( const MDGContext ctx,
MStatus ReturnStatus = nullptr 
) const

Deprecated in 2018.0

Retrieve the value in the given context of the attribute this plug references.

Deprecated:
Use asDouble(MStatus*) instead. If needed, use MDGContextGuard to switch the context.
2018.0:
Deprecated in this version.
Note
Use this method only when you are deliberately evaluating at a different context, e.g. at a different time, otherwise use the overload with no context.
Parameters
[in]ctxContext in which to evaluate the plug
[out]ReturnStatusStatus Code
Returns
Value of plug as a double
Status Codes:
  • MS::kSuccess
  • MS::kFailure
float asFloat ( const MDGContext ctx,
MStatus ReturnStatus = nullptr 
) const

Deprecated in 2018.0

Retrieve the value in the given context of the attribute this plug references.

Deprecated:
Use asFloat(MStatus*) instead. If needed, use MDGContextGuard to switch the context.
2018.0:
Deprecated in this version.
Note
Use this method only when you are deliberately evaluating at a different context, e.g. at a different time, otherwise use the overload with no context.
Parameters
[in]ctxContext in which to evaluate the plug
[out]ReturnStatusStatus Code
Returns
Value of plug as a float
Status Codes:
  • MS::kSuccess
  • MS::kFailure
MInt64 asInt64 ( const MDGContext ctx,
MStatus ReturnStatus = nullptr 
) const

Deprecated in 2018.0

Retrieve the value in the given context of the attribute this plug references.

Deprecated:
Use asInt64(MStatus*) instead. If needed, use MDGContextGuard to switch the context.
2018.0:
Deprecated in this version.
Note
Use this method only when you are deliberately evaluating at a different context, e.g. at a different time, otherwise use the overload with no context.
Parameters
[in]ctxContext in which to evaluate the plug
[out]ReturnStatusStatus Code
Returns
Value of plug as an int
Status Codes:
  • MS::kSuccess
  • MS::kFailure
int asInt ( const MDGContext ctx,
MStatus ReturnStatus = nullptr 
) const

Deprecated in 2018.0

Retrieve the value in the given context of the attribute this plug references.

Deprecated:
Use asInt(MStatus*) instead. If needed, use MDGContextGuard to switch the context.
2018.0:
Deprecated in this version.
Note
Use this method only when you are deliberately evaluating at a different context, e.g. at a different time, otherwise use the overload with no context.
Parameters
[in]ctxContext in which to evaluate the plug
[out]ReturnStatusStatus Code
Returns
Value of plug as an int
Status Codes:
  • MS::kSuccess
  • MS::kFailure
short asShort ( const MDGContext ctx,
MStatus ReturnStatus = nullptr 
) const

Deprecated in 2018.0

Retrieve the value in the given context of the attribute this plug references.

Deprecated:
Use asShort(MStatus*) instead. If needed, use MDGContextGuard to switch the context.
2018.0:
Deprecated in this version.
Note
Use this method only when you are deliberately evaluating at a different context, e.g. at a different time, otherwise use the overload with no context.
Parameters
[in]ctxContext in which to evaluate the plug
[out]ReturnStatusStatus Code
Returns
Value of plug as a short
Status Codes:
  • MS::kSuccess
  • MS::kFailure
bool asBool ( const MDGContext ctx,
MStatus ReturnStatus = nullptr 
) const

Deprecated in 2018.0

Retrieve the value in the given context of the attribute this plug references.

Deprecated:
Use asBool(MStatus*) instead. If needed, use MDGContextGuard to switch the context.
2018.0:
Deprecated in this version.
Note
Use this method only when you are deliberately evaluating at a different context, e.g. at a different time, otherwise use the overload with no context.
Parameters
[in]ctxContext in which to evaluate the plug
[out]ReturnStatusStatus Code
Returns
Value of plug as a bool
Status Codes:
  • MS::kSuccess
  • MS::kFailure
MDistance asMDistance ( const MDGContext ctx,
MStatus ReturnStatus = nullptr 
) const

Deprecated in 2018.0

Retrieve the value in the given context of the attribute this plug references.

Deprecated:
Use asMDistance(MStatus*) instead. If needed, use MDGContextGuard to switch the context.
2018.0:
Deprecated in this version.
Note
Use this method only when you are deliberately evaluating at a different context, e.g. at a different time, otherwise use the overload with no context.
Parameters
[in]ctxContext in which to evaluate the plug
[out]ReturnStatusStatus Code
Returns
Value of plug as an MDistance
Status Codes:
  • MS::kSuccess
  • MS::kFailure
MAngle asMAngle ( const MDGContext ctx,
MStatus ReturnStatus = nullptr 
) const

Deprecated in 2018.0

Retrieve the value in the given context of the attribute this plug references.

Deprecated:
Use asMAngle(MStatus*) instead. If needed, use MDGContextGuard to switch the context.
2018.0:
Deprecated in this version.
Note
Use this method only when you are deliberately evaluating at a different context, e.g. at a different time, otherwise use the overload with no context.
Parameters
[in]ctxContext in which to evaluate the plug
[out]ReturnStatusStatus Code
Returns
Value of plug as an MAngle
Status Codes:
  • MS::kSuccess
  • MS::kFailure
MTime asMTime ( const MDGContext ctx,
MStatus ReturnStatus = nullptr 
) const

Deprecated in 2018.0

Retrieve the value in the given context of the attribute this plug references.

Deprecated:
Use asMTime(MStatus*) instead. If needed, use MDGContextGuard to switch the context.
2018.0:
Deprecated in this version.
Note
Use this method only when you are deliberately evaluating at a different context, e.g. at a different time, otherwise use the overload with no context.
Parameters
[in]ctxContext in which to evaluate the plug
[out]ReturnStatusStatus Code
Returns
Value of plug as an MTime
Status Codes:
  • MS::kSuccess
  • MS::kFailure
char asChar ( const MDGContext ctx,
MStatus ReturnStatus = nullptr 
) const

Deprecated in 2018.0

Retrieve the value in the given context of the attribute this plug references.

Deprecated:
Use asChar(MStatus*) instead. If needed, use MDGContextGuard to switch the context.
2018.0:
Deprecated in this version.
Note
Use this method only when you are deliberately evaluating at a different context, e.g. at a different time, otherwise use the overload with no context.
Parameters
[in]ctxContext in which to evaluate the plug
[in]ReturnStatusStatus Code
Returns
Value of plug as a char
Status Codes:
  • MS::kSuccess
  • MS::kFailure
MString asString ( const MDGContext ctx,
MStatus ReturnStatus = nullptr 
) const

Deprecated in 2018.0

Retrieve the value in the given context of the attribute this plug references.

Deprecated:
Use asString(MStatus*) instead. If needed, use MDGContextGuard to switch the context.
2018.0:
Deprecated in this version.
Note
Use this method only when you are deliberately evaluating at a different context, e.g. at a different time, otherwise use the overload with no context.
Parameters
[in]ctxContext in which to evaluate the plug
[out]ReturnStatusStatus Code
Returns
Value of plug as an MString
Status Codes:
  • MS::kSuccess
  • MS::kFailure Object error or internal failure
MStatus getValue ( MObject val,
MDGContext ctx 
) const

Deprecated in 2018.0

Deprecated:
Use getValue(MObject&) to get the value in the current evaluation context. If needed, use MDGContextGuard to switch the context.
2018.0:
Deprecated in this version.
Parameters
[out]val
[in]ctx
MStatus getValue ( MDataHandle val,
MDGContext ctx 
) const

Deprecated in 2018.0

Deprecated:
Use getValue(MDataHandle&) to get the value in the current evaluation context. If needed, use MDGContextGuard to switch the context.
2018.0:
Deprecated in this version.
Parameters
[out]val
[in]ctx
MStatus getValue ( double &  val,
MDGContext ctx 
) const

Deprecated in 2018.0

Deprecated:
Use getValue(double&) to get the value in the current evaluation context. If needed, use MDGContextGuard to switch the context.
2018.0:
Deprecated in this version.
Parameters
[out]val
[in]ctx
MStatus getValue ( float &  val,
MDGContext ctx 
) const

Deprecated in 2018.0

Deprecated:
Use getValue(float&) to get the value in the current evaluation context. If needed, use MDGContextGuard to switch the context.
2018.0:
Deprecated in this version.
Parameters
[out]val
[in]ctx
MStatus getValue ( MInt64 &  val,
MDGContext ctx 
) const

Deprecated in 2018.0

Deprecated:
Use getValue(MInt64&) to get the value in the current evaluation context. If needed, use MDGContextGuard to switch the context.
2018.0:
Deprecated in this version.
Parameters
[out]val
[in]ctx
MStatus getValue ( int &  val,
MDGContext ctx 
) const

Deprecated in 2018.0

Deprecated:
Use getValue(int&) to get the value in the current evaluation context. If needed, use MDGContextGuard to switch the context.
2018.0:
Deprecated in this version.
Parameters
[out]val
[in]ctx
MStatus getValue ( short &  val,
MDGContext ctx 
) const

Deprecated in 2018.0

Deprecated:
Use getValue(short&) to get the value in the current evaluation context. If needed, use MDGContextGuard to switch the context.
2018.0:
Deprecated in this version.
Parameters
[out]val
[in]ctx
MStatus getValue ( bool &  val,
MDGContext ctx 
) const

Deprecated in 2018.0

Deprecated:
Use getValue(bool&) to get the value in the current evaluation context. If needed, use MDGContextGuard to switch the context.
2018.0:
Deprecated in this version.
Parameters
[out]val
[in]ctx
MStatus getValue ( MDistance val,
MDGContext ctx 
) const

Deprecated in 2018.0

Deprecated:
Use getValue(MDistance&) to get the value in the current evaluation context. If needed, use MDGContextGuard to switch the context.
2018.0:
Deprecated in this version.
Parameters
[out]val
[in]ctx
MStatus getValue ( MAngle val,
MDGContext ctx 
) const

Deprecated in 2018.0

Deprecated:
Use getValue(MAngle&) to get the value in the current evaluation context. If needed, use MDGContextGuard to switch the context.
2018.0:
Deprecated in this version.
Parameters
[out]val
[in]ctx
MStatus getValue ( MTime val,
MDGContext ctx 
) const

Deprecated in 2018.0

Deprecated:
Use getValue(MTime&) to get the value in the current evaluation context. If needed, use MDGContextGuard to switch the context.
2018.0:
Deprecated in this version.
Parameters
[out]val
[in]ctx
MStatus getValue ( char &  val,
MDGContext ctx 
) const

Deprecated in 2018.0

Deprecated:
Use getValue(char&) to get the value in the current evaluation context. If needed, use MDGContextGuard to switch the context.
2018.0:
Deprecated in this version.
Parameters
[out]val
[in]ctx
MStatus getValue ( MString val,
MDGContext ctx 
) const

Deprecated in 2018.0

Deprecated:
Use getValue(MString&) to get the value in the current evaluation context. If needed, use MDGContextGuard to switch the context.
2018.0:
Deprecated in this version.
Parameters
[out]val
[in]ctx

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