MFnCompoundAttribute Class Reference
 
 
 
MFnCompoundAttribute Class Reference

This reference page is linked to from the following overview topics: Complex Attributes.


#include <MFnCompoundAttribute.h>


Class Description

Compound attribute function set.

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.

Examples:

cgfxAttrDef.cpp, clearcoat.cpp, geometrySurfaceConstraint/geometrySurfaceConstraint.cpp, maTranslator/maTranslator.cpp, sceneAssembly/assemblyDefinition.cpp, and weightListNode/weightListNode.cpp.

Inheritance diagram for MFnCompoundAttribute:
MFnAttribute MFnBase

List of all members.

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)
  Creates a new compound attribute.
MStatus  addChild (const MObject &child)
  Add a child attribute under this compound attribute.
MStatus  removeChild (const MObject &child)
  Remove a child attribute from this compound attribute.
unsigned int  numChildren (MStatus *ReturnStatus=NULL) const
  Returns the number of child attributes that this compound attribute has.
MObject  child (unsigned int index, MStatus *ReturnStatus=NULL) const
  Get a child of this compound attribute.
MStatus  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.
  MFnCompoundAttribute (const MObject &object, MStatus *ReturnStatus=NULL)
  NO SCRIPT SUPPORT.

Protected Member Functions

virtual const char *  className () const
  Class name.

Constructor & Destructor Documentation

MFnCompoundAttribute ( MObject object,
MStatus ReturnStatus = NULL 
)

Constructor.

Class constructor that initializes the function set to the given MObject.

Parameters:
[in] object The MObject to attach the function set to
[out] ReturnStatus the return status
Status Codes:
MFnCompoundAttribute ( const MObject object,
MStatus ReturnStatus = NULL 
)

NO SCRIPT SUPPORT.

Class constructor that initializes the function set to the given MObject.

Constructor

Parameters:
[in] object The MObject to attach the function set to
[out] ReturnStatus the return status
Status Codes:

Member Function Documentation

MFn::Type type ( ) const [virtual]

Function set type.

Return the class type : MFn::kCompoundAttribute.

Reimplemented from MFnAttribute.

const char * className ( ) const [protected, virtual]

Class name.

Return the class name : "MFnCompoundAttribute".

Reimplemented from MFnAttribute.

MObject 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.

Parameters:
[in] full Long name of the attribute.
[in] brief Short name of the attribute.
[out] ReturnStatus Status code.
Returns:
Return status
Status Codes:
Examples:
geometrySurfaceConstraint/geometrySurfaceConstraint.cpp, sceneAssembly/assemblyDefinition.cpp, and weightListNode/weightListNode.cpp.
MStatus addChild ( const MObject child )

Add a child attribute under this compound attribute.

Parameters:
[in] child new child attribute
Returns:
Return status
Status Codes:
Examples:
geometrySurfaceConstraint/geometrySurfaceConstraint.cpp, sceneAssembly/assemblyDefinition.cpp, and weightListNode/weightListNode.cpp.
MStatus removeChild ( const MObject child )

Remove a child attribute from this compound attribute.

Parameters:
[in] child child attribute to remove
Returns:
Return status
Status Codes:
unsigned int numChildren ( MStatus ReturnStatus = NULL ) const

Returns the number of child attributes that this compound attribute has.

Parameters:
[out] ReturnStatus return status
Returns:
The number of children
Status Codes:
Examples:
cgfxAttrDef.cpp.
MObject child ( unsigned int  index,
MStatus ReturnStatus = NULL 
) const

Get a child of this compound attribute.

Parameters:
[in] index index of child
[out] ReturnStatus return status
Returns:
The child attribute
Status Codes:
Examples:
cgfxAttrDef.cpp.
MStatus 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.

Parameters:
[out] cmds string array to receive the adAttr commands
[in] useLongNames if true, long attribute names are used rather than short
Returns:
Return status
Status Codes:

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