MPlug () | |||||||||
MPlug ( const MPlug & in ) | |||||||||
MPlug ( const MObject & node , const MObject & attribute ) | |||||||||
~MPlug () | |||||||||
MStatus | setAttribute ( MObject & attribute ) | ||||||||
MObject | attribute ( MStatus * ReturnStatus = NULL ) const | ||||||||
MObject | node ( MStatus * ReturnStatus = NULL ) const | ||||||||
MString | name ( MStatus * ReturnStatus = NULL ) const | ||||||||
MString | partialName ( bool includeNodeName = false, bool includeNonMandatoryIndices = false, bool includeInstancedIndices = false, bool useAlias = false, bool useFullAttributePath = false, bool useLongNames = false, MStatus * ReturnStatus = NULL ) const | ||||||||
enum | MValueSelector
| ||||||||
MStatus | getSetAttrCmds ( MStringArray & cmds, MValueSelector valueSelector = kAll , bool useLongNames = false ) | ||||||||
bool | isNetworked ( MStatus * ReturnStatus = NULL ) const | ||||||||
bool | isArray ( MStatus * ReturnStatus = NULL ) const | ||||||||
bool | isElement ( MStatus * ReturnStatus = NULL) const | ||||||||
bool | isCompound ( MStatus * ReturnStatus = NULL ) const | ||||||||
bool | isChild ( MStatus * ReturnStatus = NULL ) const | ||||||||
bool | isProcedural ( MStatus * ReturnStatus = NULL ) const | ||||||||
unsigned int | logicalIndex ( MStatus * ReturnStatus = NULL ) const | ||||||||
MStatus | selectAncestorLogicalIndex ( unsigned int index, const MObject & attribute = MObject::kNullObj ) | ||||||||
unsigned int | getExistingArrayAttributeIndices ( MIntArray & indices, MStatus * ReturnStatus = NULL) | ||||||||
unsigned int | numElements ( MStatus * ReturnStatus = NULL ) const | ||||||||
unsigned int | evaluateNumElements ( MStatus * ReturnStatus = NULL ) | ||||||||
unsigned int | numChildren ( MStatus * ReturnStatus = NULL ) const | ||||||||
unsigned int | numConnectedElements ( MStatus * ReturnStatus = NULL ) const | ||||||||
unsigned int | numConnectedChildren ( MStatus * ReturnStatus = NULL ) const | ||||||||
MPlug | child ( MObject & attr, MStatus * ReturnStatus = NULL ) const | ||||||||
MPlug | child ( unsigned int index, MStatus * ReturnStatus = NULL ) const | ||||||||
MPlug | parent ( MStatus * ReturnStatus = NULL ) const | ||||||||
MPlug | array ( MStatus * ReturnStatus = NULL ) const | ||||||||
MPlug | elementByLogicalIndex ( unsigned int logicalIndex , MStatus * ReturnStatus = NULL) const | ||||||||
MPlug | elementByPhysicalIndex ( unsigned int physicalIndex, MStatus * ReturnStatus = NULL) const | ||||||||
MPlug | connectionByPhysicalIndex ( unsigned int physicalIndex, MStatus * ReturnStatus = NULL) const | ||||||||
bool | connectedTo ( MPlugArray & array , bool asDst, bool asSrc, MStatus * ReturnStatus = NULL ) const | ||||||||
bool | isConnected ( MStatus * ReturnStatus = NULL ) const | ||||||||
bool | isKeyable ( MStatus * ReturnStatus = NULL ) const | ||||||||
MStatus | setKeyable ( bool keyable ) | ||||||||
bool | isLocked ( MStatus * ReturnStatus = NULL ) const | ||||||||
MStatus | setLocked ( bool locked ) | ||||||||
bool | isChannelBoxFlagSet ( MStatus * ReturnStatus = NULL ) const | ||||||||
MStatus | setChannelBox ( bool channelBox ) | ||||||||
bool | isCachingFlagSet ( MStatus * ReturnStatus = NULL ) const | ||||||||
MStatus | setCaching ( bool caching ) | ||||||||
bool | isNull ( MStatus * ReturnStatus = NULL ) const | ||||||||
MString | info ( MStatus * ReturnStatus = NULL ) const | ||||||||
bool | isFromReferencedFile ( MStatus * ReturnStatus = NULL ) const | ||||||||
bool | isDynamic ( MStatus * ReturnStatus = NULL ) const | ||||||||
bool | isIgnoredWhenRendering ( MStatus * ReturnStatus = NULL ) const | ||||||||
enum | FreeToChangeState
| ||||||||
MPlug::FreeToChangeState | isFreeToChange (bool checkParents = true, bool checkChildren = true, MStatus * ReturnStatus = NULL ) const | ||||||||
MDataHandle | constructHandle ( MDataBlock &) const | ||||||||
void | destructHandle ( MDataHandle &) const | ||||||||
MStatus | getValue ( MObject &val, MDGContext & ctx= MDGContext::fsNormal ) const NO SCRIPT SUPPORT | ||||||||
MStatus | getValue ( double&, MDGContext & ctx= MDGContext::fsNormal ) const NO SCRIPT SUPPORT | ||||||||
MStatus | getValue ( float&, MDGContext & ctx= MDGContext::fsNormal ) const NO SCRIPT SUPPORT | ||||||||
MStatus | getValue ( int&, MDGContext & ctx= MDGContext::fsNormal ) const NO SCRIPT SUPPORT | ||||||||
MStatus | getValue ( short&, MDGContext & ctx= MDGContext::fsNormal ) const NO SCRIPT SUPPORT | ||||||||
MStatus | getValue ( bool&, MDGContext & ctx= MDGContext::fsNormal ) const NO SCRIPT SUPPORT | ||||||||
MStatus | getValue ( MDistance &, MDGContext & ctx= MDGContext::fsNormal ) const NO SCRIPT SUPPORT | ||||||||
MStatus | getValue ( MAngle &, MDGContext & ctx= MDGContext::fsNormal ) const NO SCRIPT SUPPORT | ||||||||
MStatus | getValue ( MTime &, MDGContext & ctx= MDGContext::fsNormal ) const NO SCRIPT SUPPORT | ||||||||
MStatus | getValue ( char&, MDGContext & ctx= MDGContext::fsNormal ) const NO SCRIPT SUPPORT | ||||||||
MStatus | getValue ( MString &, MDGContext & ctx= MDGContext::fsNormal ) const NO SCRIPT SUPPORT | ||||||||
MStatus | setValue ( MObject & val ) NO SCRIPT SUPPORT | ||||||||
MStatus | setValue ( MPxData * data ) NO SCRIPT SUPPORT | ||||||||
MStatus | setValue ( MDataHandle & handle ) NO SCRIPT SUPPORT | ||||||||
MStatus | setValue ( double ) NO SCRIPT SUPPORT | ||||||||
MStatus | setValue ( float ) NO SCRIPT SUPPORT | ||||||||
MStatus | setValue ( int ) NO SCRIPT SUPPORT | ||||||||
MStatus | setValue ( short ) NO SCRIPT SUPPORT | ||||||||
MStatus | setValue ( bool ) NO SCRIPT SUPPORT | ||||||||
MStatus | setValue ( MDistance & ) NO SCRIPT SUPPORT | ||||||||
MStatus | setValue ( MAngle & ) NO SCRIPT SUPPORT | ||||||||
MStatus | setValue ( MTime & ) NO SCRIPT SUPPORT | ||||||||
MStatus | setValue ( char ) NO SCRIPT SUPPORT | ||||||||
MStatus | setValue ( const MString & ) NO SCRIPT SUPPORT | ||||||||
MStatus | setValue ( const char* ) NO SCRIPT SUPPORT | ||||||||
MObject | asMObject ( MDGContext & ctx= MDGContext::fsNormal , MStatus * ReturnStatus = NULL ) const | ||||||||
double | asDouble ( MDGContext & ctx= MDGContext::fsNormal , MStatus * ReturnStatus = NULL ) const | ||||||||
float | asFloat ( MDGContext & ctx= MDGContext::fsNormal , MStatus * ReturnStatus = NULL ) const | ||||||||
int | asInt ( MDGContext & ctx= MDGContext::fsNormal , MStatus * ReturnStatus = NULL ) const | ||||||||
short | asShort ( MDGContext & ctx= MDGContext::fsNormal , MStatus * ReturnStatus = NULL ) const | ||||||||
bool | asBool ( MDGContext & ctx= MDGContext::fsNormal , MStatus * ReturnStatus = NULL ) const | ||||||||
MDistance | asMDistance ( MDGContext & ctx= MDGContext::fsNormal , MStatus * ReturnStatus = NULL ) const | ||||||||
MAngle | asMAngle ( MDGContext & ctx= MDGContext::fsNormal , MStatus * ReturnStatus = NULL ) const | ||||||||
MTime | asMTime ( MDGContext & ctx= MDGContext::fsNormal , MStatus * ReturnStatus = NULL ) const | ||||||||
char | asChar ( MDGContext & ctx= MDGContext::fsNormal , MStatus * ReturnStatus = NULL ) const | ||||||||
MString | asString ( MDGContext & ctx= MDGContext::fsNormal , MStatus * ReturnStatus = NULL ) const | ||||||||
MStatus | setMObject ( MObject & val ) | ||||||||
MStatus | setMPxData ( MPxData * data ) | ||||||||
MStatus | setMDataHandle ( MDataHandle & handle ) | ||||||||
MStatus | setDouble ( double ) | ||||||||
MStatus | setFloat ( float ) | ||||||||
MStatus | setInt ( int ) | ||||||||
MStatus | setShort ( short ) | ||||||||
MStatus | setBool ( bool ) | ||||||||
MStatus | setMDistance ( MDistance & ) | ||||||||
MStatus | setMAngle ( MAngle & ) | ||||||||
MStatus | setMTime ( MTime & ) | ||||||||
MStatus | setChar ( char ) | ||||||||
MStatus | setString ( const MString & ) | ||||||||
MPlug & | operator = ( const MPlug & other ) | ||||||||
MPlug | operator[] ( unsigned int physicalIndex ) const | ||||||||
bool | operator == ( const MPlug &other ) const | ||||||||
bool | operator == ( const MObject &other ) const | ||||||||
bool | operator != ( const MPlug &other ) const | ||||||||
bool | operator != ( const MObject &other ) const | ||||||||
MStatus | setNumElements ( unsigned int ) | ||||||||
MPlug | operator[] ( MObject & attr ) const NO SCRIPT SUPPORT | ||||||||
operator | MObject () const NO SCRIPT SUPPORT | ||||||||
bool | operator! () const NO SCRIPT SUPPORT |
// 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 selectByLogicalIndex, 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:
MPlug plug(node,attribute); // See note below on numElements() method unsigned int count = plug.numElements(); if (0 == count) { plug.selectAncestorLogicalIndex(0,attribute); plug.setValue(setVal); count = plug.numElements(); // count will now be 1 since we added a value plug.selectAncestorLogicalIndex(10,attribute); 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 ::compute() method of a node.
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. Arguments
Autodesk® Maya® 2008 © 1997-2007 Autodesk, Inc. All rights reserved. | doc++ Copyright |