MFnComponent Class Reference

#include <MFnComponent.h>

Class Description

Base class for component function sets.

This is the base class for all function sets which deal with component objects.

Components are MObjects which hold index information for shapes. The component object does not contain any information about the shape, it just contains index values and type information.

Components can be marked as complete meaning that the component represents a complete set of indices from 0 to numElements-1;

Components come is 3 varieties based upon the dimensions of the index. The types are single, double, and triple indexed. Examples of these types are mesh vertices (single indexed), nurbs surface CVs (double indexed), and lattice points (triple indexed).

To create, edit, or query a specific type of component, use the derived classes MFnSingleIndexedComponent, MFnDoubleIndexedComponent, and MFnTripleIndexedComponent.

+ Examples:
+ Inheritance diagram for MFnComponent:

Public Member Functions

virtual MFn::Type type () const
 Function set type. More...
 
virtual ~MFnComponent ()
 Destructor.
 
 MFnComponent (MObject &object, MStatus *ReturnStatus=NULL)
 Constructor. More...
 
 MFnComponent ()
 Default class constructor.
 
int elementCount (MStatus *ReturnStatus=NULL) const
 Returns the number of elements that this component contains. More...
 
MFn::Type componentType (MStatus *ReturnStatus=NULL) const
 Returns the MFn type of the component. More...
 
bool isEmpty (MStatus *ReturnStatus=NULL) const
 Determines if this component is empty, i.e. More...
 
bool isEqual (MObject &, MStatus *ReturnStatus=NULL) const
 Compares this component with the given component. More...
 
bool isComplete (MStatus *ReturnStatus=NULL) const
 Returns the complete state of the component. More...
 
MStatus setComplete (bool)
 Sets the complete state of the component. More...
 
bool hasWeights () const
 Query this component for the existance of attached weight data. More...
 
MWeight weight (int index, MStatus *ReturnStatus=NULL) const
 Return the weight data for a given element within this component. More...
 
MStatus setWeight (int index, const MWeight &weight)
 Set the weight data for a given element within this component. More...
 
MStatus setWeights (const MWeight &weight)
 Set the weight data for all elements within this component. More...
 
 MFnComponent (const MObject &object, MStatus *ReturnStatus=NULL)
 Constructor. More...
 
MFn::Type type (MStatus *ReturnStatus=NULL)
 Obsolete & no script support. More...
 
- Public Member Functions inherited from MFnBase
virtual ~MFnBase ()
 Class Destructor. More...
 
bool hasObj (MFn::Type) const
 Determines whether or not the Function Set is compatible with the specified Maya Object within the API RTTI system. More...
 
bool hasObj (const MObject &) const
 Determines whether or not the Function Set is compatible with the specified Maya Object within the API RTTI system. More...
 
MObject object (MStatus *ReturnStatus=NULL) const
 Returns the MObject that is attached to the Function Set. More...
 
virtual MStatus setObject (MObject &object)
 Attaches the Function Set to the specified Maya Object. More...
 
virtual MStatus setObject (const MObject &object)
 NO SCRIPT SUPPORT. More...
 

Protected Member Functions

virtual const char * className () const
 Class name. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from MFnBase
static const char * className ()
 Returns the name of this class. More...
 

Constructor & Destructor Documentation

MFnComponent ( MObject object,
MStatus ReturnStatus = NULL 
)

Constructor.

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

Parameters
[in]objectThe MObject to attach the function set to
[out]ReturnStatusthe return status
Status Codes:
  • 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
MFnComponent ( const MObject object,
MStatus ReturnStatus = NULL 
)

Constructor.

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

Parameters
[in]objectThe MObject to attach the function set to
[out]ReturnStatusthe return status
Status Codes:
  • 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

Member Function Documentation

MFn::Type type ( ) const
virtual

Function set type.

Return the class type : MFn::kComponent.

Reimplemented from MFnBase.

Reimplemented in MFnDoubleIndexedComponent, MFnSingleIndexedComponent, MFnTripleIndexedComponent, and MFnUint64SingleIndexedComponent.

OPENMAYA_MAJOR_NAMESPACE_OPEN const char * className ( ) const
protectedvirtual

Class name.

Return the class name : "MFnComponent".

Reimplemented in MFnDoubleIndexedComponent, MFnSingleIndexedComponent, MFnTripleIndexedComponent, and MFnUint64SingleIndexedComponent.

int elementCount ( MStatus ReturnStatus = NULL) const

Returns the number of elements that this component contains.

Parameters
[out]ReturnStatusStatus code
Returns
The number of elements
Status Codes:
  • MS::kSuccess The operation succeeded
  • MS::kFailure Object error
+ Examples:
MFn::Type componentType ( MStatus ReturnStatus = NULL) const

Returns the MFn type of the component.

Parameters
[out]ReturnStatusStatus code
Returns
The type
Status Codes:
  • MS::kSuccess The operation succeeded
  • MS::kFailure Object error
+ Examples:
bool isEmpty ( MStatus ReturnStatus = NULL) const

Determines if this component is empty, i.e.

there are no index elements.

Parameters
[out]ReturnStatusStatus code
Returns
True if empty, false otherwise
Status Codes:
  • MS::kSuccess The operation succeeded
  • MS::kFailure Object error
bool isEqual ( MObject component,
MStatus ReturnStatus = NULL 
) const

Compares this component with the given component.

Parameters
[in]componentcomponent to compare
[out]ReturnStatusStatus code
Returns
True if the components are equal, false otherwise
Status Codes:
  • MS::kSuccess The operation succeeded
  • MS::kFailure Object error
bool isComplete ( MStatus ReturnStatus = NULL) const

Returns the complete state of the component.

Components can be marked as complete meaning that the component represents a complete set of indices from 0 to numElements-1;

Parameters
[out]ReturnStatusStatus code
Returns
True if this component is complete, false otherwise
Status Codes:
  • MS::kSuccess The operation succeeded
  • MS::kFailure Object error
MStatus setComplete ( bool  complete)

Sets the complete state of the component.

Components can be marked as complete meaning that the component represents a complete set of indices from 0 to numElements-1;

Important: if the component is set as complete, setCompleteData must also be called with the appropriate parameter (the total number of elements in the object). Note that setCompleteData(...) also sets the component as complete, thus 'setComplete(true)' may never need to appear in your code.

setCompleteData(...) is defined in derived classes.

Parameters
[in]completetrue sets the component as complete
Returns
Status code
Status Codes:
  • MS::kSuccess The operation succeeded
  • MS::kFailure Object error
bool hasWeights ( ) const

Query this component for the existance of attached weight data.

Weight data will be added to a component as part of soft selection and/or symmetry. Note that this method does not test for the existance of external weight information (e.g. deformer weights stored in separate attributes).

Returns
True if the component includes weight data, false otherwise
+ Examples:
MWeight weight ( int  index,
MStatus ReturnStatus = NULL 
) const

Return the weight data for a given element within this component.

Note that this method does not return external weight data (e.g. deformer weights stored in separate attributes).

Parameters
[in]indexThe element to return weight data for (note that this is the linear index between 0 and elementCount()-1)
[out]ReturnStatusStatus code
Returns
The element weight data.
Status Codes:
  • MS::kSuccess The operation succeeded
  • MS::kFailure Object error
+ Examples:
MStatus setWeight ( int  index,
const MWeight weight 
)

Set the weight data for a given element within this component.

Parameters
[in]indexThe element to set weight data for (note that this is the linear index between 0 and elementCount()-1)
[in]weightThe new weight for the element
Returns
Status code
Status Codes:
  • MS::kSuccess The operation succeeded
  • MS::kInvalidParameter index out of range
  • MS::kFailure Object error
MStatus setWeights ( const MWeight weight)

Set the weight data for all elements within this component.

Parameters
[in]weightThe new weight for all element
Returns
Status code
Status Codes:
  • MS::kSuccess The operation succeeded
  • MS::kFailure Object error
MFn::Type type ( MStatus ReturnStatus = NULL)

Obsolete & no script support.

This method is obsolete. This method is not available in Python.

Deprecated:
Use the MFnComponent::componentType method instead.
Parameters
[out]ReturnStatusReturn status.

The documentation for this class was generated from the following files:
  • MFnComponent.h
  • MFnComponent.cpp