#include <MFnCompoundAttribute.h>
MFnCompoundAttribute is the function set for compound dependency node attributes.
Compound attributes allow the grouping of related attributes into a larger unit. It is possible to connect to a compound attribute as a whole, or to any of the individual children.
For example, the three attributes RED, GREEN, and BLUE could be grouped into a compound attribute of type COLOR. It is then possible to connect two COLOR attributes together. This removes the need to connect each child explicitly.
A second use for compound attributes is when there are multi attributes that relate to each other on an element-by-element basis. An example of this is the weighted matrix node that has a multi attribute with matrices that must be matched with the multi attribute that provides the weights for each matrix.
Public Member Functions | |
virtual MFn::Type | type () const |
Function set type. | |
virtual | ~MFnCompoundAttribute () |
Destructor. | |
MFnCompoundAttribute () | |
Default constructor. | |
MFnCompoundAttribute (MObject &object, MStatus *ReturnStatus=NULL) | |
Constructor. | |
MObject | create (const MString &full, const MString &brief, MStatus *ReturnStatus=NULL) |
MStatus | addChild (const MObject &child) |
MStatus | removeChild (const MObject &child) |
unsigned int | numChildren (MStatus *ReturnStatus=NULL) const |
MObject | child (unsigned int index, MStatus *ReturnStatus=NULL) const |
MStatus | getAddAttrCmds (MStringArray &cmds, bool useLongNames=false) const |
MFnCompoundAttribute (const MObject &object, MStatus *ReturnStatus=NULL) | |
NO SCRIPT SUPPORT. | |
Protected Member Functions | |
virtual const char * | className () const |
Class name. |
Constructor.
Class constructor that initializes the function set to the given MObject.
[in] | object | The MObject to attach the function set to |
[out] | ReturnStatus | the return status |
MFnCompoundAttribute::MFnCompoundAttribute | ( | const MObject & | object, | |
MStatus * | ReturnStatus = NULL | |||
) |
NO SCRIPT SUPPORT.
Constructor
Class constructor that initializes the function set to the given MObject.
[in] | object | The MObject to attach the function set to |
[out] | ReturnStatus | the return status |
MFn::Type MFnCompoundAttribute::type | ( | ) | const [virtual] |
const char * MFnCompoundAttribute::className | ( | ) | const [protected, virtual] |
MObject MFnCompoundAttribute::create | ( | const MString & | full, | |
const MString & | brief, | |||
MStatus * | ReturnStatus = NULL | |||
) |
Creates a new compound attribute.
The create method needs to be called on a per node basis. That means if you want to create and add the same attribute to multiple nodes, you need to call the create method for each node to get a unique MObject back. If you call create just once and add the attribute to multiple nodes, Maya will encounter a fatal error.
[in] | full | long name of the attribute |
[in] | brief | short name of the attribute |
Add a child attribute under this compound attribute.
[in] | child | new child attribute |
Remove a child attribute from this compound attribute.
[in] | child | child attribute to remove |
unsigned int MFnCompoundAttribute::numChildren | ( | MStatus * | ReturnStatus = NULL |
) | const |
Returns the number of child attributes that this compound attribute has.
[out] | ReturnStatus | return status |
Get a child of this compound attribute.
[in] | index | index of child |
[out] | ReturnStatus | return status |
MStatus MFnCompoundAttribute::getAddAttrCmds | ( | MStringArray & | cmds, | |
bool | useLongNames = false | |||
) | const |
Returns a string array containing the addAttr commands which would be required to recreate the attribute and all of its descendents on a node.
The attributes are returned in depth-first order, meaning that element 0 of the array will contain this attribute's addAttr command, element 1 will contain the command for its first child, element 2 will contain the command for its first child's child, if one exists, and so on.
Each command is returned with the terminating semicolon and is formatted as if for use with a selected node, meaning that no node name is supplied.
[out] | cmds | string array to receive the adAttr commands |
[in] | useLongNames | if true, long attribute names are used rather than short |
Autodesk® Maya® 2009 © 1997-2008 Autodesk, Inc. All rights reserved. | Generated with 1.5.6 |