class MFnCompoundAttribute

Jump to documentation

: public MFnAttribute Compound attribute function set

Inheritance:

MFnCompoundAttribute < MFnAttribute < MFnBase

public members:

MFnCompoundAttribute ()
MFnCompoundAttribute ( MObject & object, MStatus * ReturnStatus = NULL )
MFnCompoundAttribute ( const MObject & object, MStatus * ReturnStatus = NULL )
virtual ~MFnCompoundAttribute ()
virtual MFn::Type type () const
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

Inherited from MFnAttribute:

public members:

virtual MFn::Type type () const
enum DisconnectBehavior
kDelete
delete array element on disconnect (array attributes only)
kReset
reset the attribute to its default on disconnect
kNothing
do nothing to the attribute's value on disconnect
bool isReadable ( MStatus * ReturnStatus=NULL ) const
bool isWritable ( MStatus * ReturnStatus=NULL ) const
bool isConnectable ( MStatus * ReturnStatus=NULL ) const
bool isStorable ( MStatus * ReturnStatus=NULL ) const
bool isCached ( MStatus * ReturnStatus=NULL ) const
bool isArray ( MStatus * ReturnStatus=NULL ) const
bool indexMatters ( MStatus * ReturnStatus=NULL ) const
bool isKeyable ( MStatus * ReturnStatus=NULL ) const
bool isChannelBoxFlagSet ( MStatus * ReturnStatus=NULL ) const
bool isHidden ( MStatus * ReturnStatus=NULL ) const
bool isUsedAsColor ( MStatus * ReturnStatus=NULL ) const
bool isIndeterminant ( MStatus * ReturnStatus=NULL ) const
bool isRenderSource ( MStatus * ReturnStatus=NULL ) const
bool isDynamic ( MStatus * ReturnStatus=NULL ) const
bool isWorldSpace ( MStatus * ReturnStatus=NULL ) const
bool isAffectsWorldSpace ( MStatus * ReturnStatus=NULL ) const
DisconnectBehavior disconnectBehavior ( MStatus * ReturnStatus=NULL ) const
bool usesArrayDataBuilder ( MStatus * ReturnStatus=NULL ) const
bool internal ( MStatus * ReturnStatus=NULL ) const
MStatus setReadable ( bool state )
MStatus setWritable ( bool state )
MStatus setConnectable ( bool state )
MStatus setStorable ( bool state )
MStatus setCached ( bool state )
MStatus setArray ( bool state )
MStatus setIndexMatters ( bool state )
MStatus setKeyable ( bool state )
MStatus setChannelBox ( bool state )
MStatus setHidden ( bool state )
MStatus setUsedAsColor ( bool state )
MStatus setIndeterminant ( bool state )
MStatus setRenderSource ( bool state )
MStatus setWorldSpace ( bool state )
MStatus setAffectsWorldSpace ( bool state )
MStatus setDisconnectBehavior ( DisconnectBehavior behavior )
MStatus setUsesArrayDataBuilder ( bool state )
MStatus setInternal ( bool state )
bool accepts ( MFnData::Type type , MStatus * ReturnStatus=NULL ) const
bool accepts ( const MTypeId & id, MStatus * ReturnStatus=NULL ) const
MObject parent ( MStatus * ReturnStatus=NULL) const
MStatus setParent ( const MObject & parent )
MString name ( MStatus * ReturnStatus=NULL ) const
MString shortName ( MStatus * ReturnStatus=NULL ) const
MString getAddAttrCmd ( bool useLongName = false, MStatus * status=NULL ) const

Inherited from MFnBase:

public members:

virtual MFn::Type type () const
bool hasObj ( MFn::Type ) const
bool hasObj ( const MObject & ) const
MObject object ( MStatus * ReturnStatus = NULL ) const
virtual MStatus setObject ( MObject & object )
virtual MStatus setObject ( const MObject & object )

Documentation

Function set for compound attributes of dependency nodes
Description

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.

Functions

MFnCompoundAttribute:: MFnCompoundAttribute ()

Description

Default class constructor. The function set is not attached to an MObject.

MFnCompoundAttribute:: MFnCompoundAttribute ( MObject & object, MStatus * ReturnStatus )

Description

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

Arguments

  • object the MObject to attach the function set to
  • ReturnStatus the return status
    • MS::kSuccess if the function set is successfully attached
    • MS::kInvalidParameter if the MObject does not represent a valid Maya object or if the function set is not allowed to attach to this MObject

MFnCompoundAttribute:: MFnCompoundAttribute ( const MObject & object, MStatus * ReturnStatus )

Description

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

Arguments

  • object the const MObject to attach the function set to
  • ReturnStatus the return status
    • MS::kSuccess if the function set is successfully attached
    • MS::kInvalidParameter if the MObject does not represent a valid Maya object or if the function set is not allowed to attach to this MObject

MFnCompoundAttribute:: ~MFnCompoundAttribute ()

Description

The class destructor.

MFn::Type MFnCompoundAttribute:: type () const

Description

Return the type of this function set.

Return Value

  • the constant MFn::kCompoundAttribute

MObject MFnCompoundAttribute:: create ( const MString & full, const MString & brief, MStatus * ReturnStatus )

Description

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.

Arguments

  • full long name of the attribute
  • short short name of the attribute

Return Value

  • return status

Status Codes

  • MS::kSuccess operation successful
  • MS::kInsufficientMemory out of memory

MStatus MFnCompoundAttribute:: addChild ( const MObject & child )

Description

Add a child attribute under this compound attribute.

Arguments

  • child new child attribute

Return Value

  • return status

Status Codes

  • MS::kSuccess operation successful
  • MS::kInvalidParameter argument is not a valid attribute, or has a larger alignment requirement than the first child in this compound attribute.
  • MS::kFailure adding child failed

MStatus MFnCompoundAttribute:: removeChild ( const MObject & child )

Description

Remove a child attribute from this compound attribute.

Arguments

  • child child attribute to remove

Return Value

  • return status

Status Codes

  • MS::kSuccess operation successful
  • MS::kInvalidParameter argument is not a valid attribute
  • MS::kFailure removing child failed

MObject MFnCompoundAttribute:: child ( unsigned int index, MStatus * ReturnStatus ) const

Description

Get a child of this compound attribute.

Arguments

  • index index of child
  • ReturnStatus return status

Return Value

  • the child attribute

Status Codes

  • MS::kSuccess operation successful
  • MS::kFailure function set does not have a valid object

unsigned int MFnCompoundAttribute:: numChildren ( MStatus * ReturnStatus ) const

Description

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

Arguments

  • ReturnStatus return status

Return Value

  • the number of children

Status Codes

  • MS::kSuccess operation successful
  • MS::kFailure function set does not have a valid object

MStatus MFnCompoundAttribute:: getAddAttrCmds ( MStringArray & cmds, bool useLongNames ) const

Description

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.

Arguments

  • useLongNames if true, long attribute names are used rather than short
  • cmds string array to receive the adAttr commands

Return Value

  • return status

Status Codes

  • MS::kSuccess operation successful
  • MS::kFailure operation failed
  • MS::kInvalidParameter function set is not bound to an attribute

This class has no child classes.


Autodesk® Maya® 8.0 © 1997-2006 Autodesk, Inc. All rights reserved. doc++ Copyright