MPlug is a part of Maya API, a C++ library used for building plugins for Autodesk Maya software. It represents a connection between two attributes in Maya. A plug is used to retrieve or set the value of an attribute and it has a name that identifies it.
Here are some code examples using MPlug:
```cpp
// Example 1: Create an MPlug object from the name of an attribute
MFnDependencyNode nodeFn(thisMObject());
MPlug attrPlug = nodeFn.findPlug("attributeName", false);
// Example 2: Get the value of a float attribute using an MPlug object
float attrValue;
attrPlug.getValue(attrValue);
// Example 3: Set the value of a bool attribute using an MPlug object
bool newValue = true;
attrPlug.setValue(newValue);
// Example 4: Get the name of the other end of a connection from an MPlug object
MPlugArray connections;
attrPlug.connectedTo(connections, true, false);
MString otherEndName = connections[0].name();
// Example 5: Get the type of data stored in an attribute from an MPlug object
MObject attrObj = attrPlug.attribute();
MFnData::Type attrType = attrObj.apiType();
// Example 6: Get the parent attribute of an MPlug object
MPlug parentPlug = attrPlug.parent();
These examples are using the Maya API library that is provided by Autodesk.
C++ (Cpp) MPlug::name - 30 examples found. These are the top rated real world C++ (Cpp) examples of MPlug::name extracted from open source projects. You can rate examples to help us improve the quality of examples.