C++ API Reference
|
The pattern of an attribute tree that can be applied to nodes or node classes. More...
#include <MAttributePattern.h>
Public Member Functions | |
MAttributePattern () | |
Default MAttributePattern object has no internal Maya object. | |
MAttributePattern (const MString &name) | |
Construct an MAttributePattern object with the given name. More... | |
MAttributePattern (const MAttributePattern &rhs) | |
Construct an MAttributePattern object from another pattern. More... | |
MAttributePattern & | operator= (const MAttributePattern &rhs) |
Copy an MAttributePattern object from another pattern. More... | |
bool | operator== (const MAttributePattern &rhs) const |
Determine equality between two attribute patterns. More... | |
~MAttributePattern () | |
Destructor, doesn't do much. | |
MString | name (MStatus *ReturnStatus=NULL) const |
Get the name of this pattern. More... | |
unsigned int | rootAttrCount (MStatus *ReturnStatus=NULL) const |
Get the number of top level attributes present in this pattern. More... | |
MObject | rootAttr (unsigned int idx, MStatus *ReturnStatus=NULL) const |
Get a single root-level attribute from this pattern. More... | |
MStatus | removeRootAttr (unsigned int idx) |
Remove a single root attribute and its children from the pattern by index. More... | |
MStatus | removeRootAttr (const MObject &attr) |
Remove a single root attribute and its children from the pattern by attribute. More... | |
MStatus | addRootAttr (const MObject &attr) |
Add a new root attribute to the pattern. More... | |
Static Public Member Functions | |
static MAttributePattern * | findPattern (const MString &name) |
Look up an existing pattern by name. More... | |
static unsigned int | attrPatternCount () |
Get the number of patterns currently known. More... | |
static MAttributePattern * | attrPattern (unsigned int n) |
Look up an existing pattern by index value. More... | |
static const char * | className () |
Returns the name of this class. More... | |
The pattern of an attribute tree that can be applied to nodes or node classes.
Class that provides a pattern of attributes to be applied to nodes as dynamic attributes or to node classes as extension attributes.
An attribute pattern is a pattern describing an attribute tree. In the simplest implementation it can just store an internal copy of the tree to be applied. The code to apply the attribute patterns will use the rootAttr() and rootAttrCount() methods to iterate through the list of top level attributes to be applied. It presumes that if they are compounds then their children will already be parented properly.
When creating the pattern from inside MPxAttributePatternFactory you add only the root level attributes, i.e. the attributes without parents. As a simple example if your pattern factory has data that specifies creating a pattern with one integer attribute and one compound with three float children the code would like something like this.
OPENMAYA_MAJOR_NAMESPACE_OPEN MAttributePattern | ( | const MString & | name | ) |
Construct an MAttributePattern object with the given name.
It can then be populated with the information required for it to be able to appy a set of attributes to a node or node class.
[in] | name | Name of the pattern |
MAttributePattern | ( | const MAttributePattern & | rhs | ) |
Construct an MAttributePattern object from another pattern.
The internal Maya object is shared between the two MAttributePatterns.
[in] | rhs | Pattern to be copied |
MAttributePattern & operator= | ( | const MAttributePattern & | rhs | ) |
Copy an MAttributePattern object from another pattern.
[in] | rhs | Pattern to be copied |
bool operator== | ( | const MAttributePattern & | rhs | ) | const |
Determine equality between two attribute patterns.
[in] | rhs | Pattern to be compared |
|
static |
Look up an existing pattern by name.
[in] | name | The name of the pattern to be found |
|
static |
Get the number of patterns currently known.
|
static |
Look up an existing pattern by index value.
[in] | n | The index in the global list of the pattern to be found |
Get the name of this pattern.
[out] | ReturnStatus | Did the operation return valid data? |
unsigned int rootAttrCount | ( | MStatus * | ReturnStatus = NULL | ) | const |
Get the number of top level attributes present in this pattern.
[out] | ReturnStatus | Did the operation return valid data? |
Get a single root-level attribute from this pattern.
[in] | idx | Index of the root-level attribute in the pattern's list. |
[out] | ReturnStatus | Did the operation return valid data? |
MStatus removeRootAttr | ( | unsigned int | idx | ) |
Remove a single root attribute and its children from the pattern by index.
[in] | idx | Index of the root attribute to be removed |
Remove a single root attribute and its children from the pattern by attribute.
[in] | attr | The attribute to be removed |
Add a new root attribute to the pattern.
[in] | attr | Attribute to be added to this pattern. |
|
static |
Returns the name of this class.