MFnCompoundAttribute Class Reference
[OpenMaya - API module for common classesFunctionSet classes]

#include <MFnCompoundAttribute.h>
Inheritance diagram for MFnCompoundAttribute:
Inheritance graph
[legend]
Collaboration diagram for MFnCompoundAttribute:
Collaboration graph
[legend]

List of all members.


Detailed 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.cpp, maTranslator.cpp, and weightListNode.cpp.


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 & Destructor Documentation

MFnCompoundAttribute::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::MFnCompoundAttribute ( const MObject object,
MStatus ReturnStatus = NULL  
)

NO SCRIPT SUPPORT.

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:

Member Function Documentation

MFn::Type MFnCompoundAttribute::type (  )  const [virtual]

Function set type.

Return the class type : MFn::kCompoundAttribute

Reimplemented from MFnAttribute.

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

Class name.

Return the class name : "MFnCompoundAttribute"

Reimplemented from MFnAttribute.

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.

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:

MStatus MFnCompoundAttribute::addChild ( const MObject child  ) 

Add a child attribute under this compound attribute.

Parameters:
[in]  child  new child attribute
Returns:
Return status
Status Codes:
Examples:

MStatus MFnCompoundAttribute::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 MFnCompoundAttribute::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:

MObject MFnCompoundAttribute::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:

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.

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:

Autodesk® Maya® 2011 © 1997-2010 Autodesk, Inc. All rights reserved. Generated with doxygen 1.5.6