MFnSkinCluster Class Reference
[OpenMayaAnim - API module for animationFunctionSet classes]

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

List of all members.


Detailed Description

skinCluster function set

MFnSkinCluster is the function set for skinClusters. SkinCluster nodes are created during a smooth bindSkin. The purpose of the skinCluster is to store a weight per influence object for each component of each geometry that is deformed. Influence objects can be joints or any transform.

Note that unlike most deformers, a skinCluster node can deform only a single geometry. Therefore, if additional geometries are added to the skinCluster set, they will be ignored.

This function set provides methods for getting and setting weights on skin cluster nodes. It parent class, MFnGeometryFilter provides methods for accessing the skin cluster's input and output geometry.

Examples:

exportSkinClusterDataCmd.cpp.


Public Member Functions

virtual MFn::Type  type () const
  Function set type.
virtual  ~MFnSkinCluster ()
  Destructor.
  MFnSkinCluster ()
  Default constructor.
  MFnSkinCluster (MObject &object, MStatus *ReturnStatus=NULL)
  Constructor.
MStatus  getWeights (const MDagPath &path, const MObject &components, unsigned int influenceIndex, MDoubleArray &weights) const
MStatus  getWeights (const MDagPath &path, const MObject &components, MDoubleArray &weights, unsigned int &influenceCount) const
MStatus  getWeights (const MDagPath &path, const MObject &components, MIntArray &influenceIndices, MDoubleArray &weights) const
MStatus  setWeights (const MDagPath &path, const MObject &components, unsigned int jointIndex, double value, bool normalize=true, MDoubleArray *oldValues=NULL)
MStatus  setWeights (const MDagPath &path, const MObject &components, MIntArray &influenceIndices, MDoubleArray &values, bool normalize=true, MDoubleArray *oldValues=NULL)
MStatus  getPointsAffectedByInfluence (const MDagPath &path, MSelectionList &result, MDoubleArray &weights)
unsigned int  indexForInfluenceObject (const MDagPath &path, MStatus *ReturnStatus=NULL) const
unsigned int  influenceObjects (MDagPathArray &paths, MStatus *ReturnStatus=NULL) const
MStatus  getWeights (const MDagPath &path, const MObject &components, unsigned int influenceIndex, MFloatArray &weights) const
MStatus  getWeights (const MDagPath &path, const MObject &components, MFloatArray &weights, unsigned int &influenceCount) const
MStatus  setWeights (const MDagPath &path, const MObject &components, unsigned int jointIndex, float value, bool normalize=true, MFloatArray *oldValues=NULL)
MStatus  setWeights (const MDagPath &path, const MObject &components, MIntArray &influenceIndices, MFloatArray &values, bool normalize=true, MFloatArray *oldValues=NULL)
MStatus  getPointsAffectedByInfluence (const MDagPath &path, MSelectionList &result, MFloatArray &weights)
MStatus  getBlendWeights (const MDagPath &path, const MObject &components, MDoubleArray &weights) const
MStatus  setBlendWeights (const MDagPath &path, const MObject &components, const MDoubleArray &weights)
  MFnSkinCluster (const MObject &object, MStatus *ReturnStatus=NULL)
  Constructor.

Protected Member Functions

virtual const char *  className () const
  Class name.

Constructor & Destructor Documentation

MFnSkinCluster::MFnSkinCluster ( 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:

MFnSkinCluster::MFnSkinCluster ( const 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:

Member Function Documentation

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

Function set type.

Return the class type : MFn::kSkinClusterFilter

Reimplemented from MFnGeometryFilter.

MStatus MFnSkinCluster::getWeights ( const MDagPath path,
const MObject components,
unsigned int  influenceIndex,
MDoubleArray weights  
) const

Gets the skinCluster weights for the influence object for the specified components of the object whose dagPath is specified. Note that if some of components are not deformed by the skinCluster, zeros will be returned as the weights. For example, on periodic nurbs surfaces, some of the cvs enforce the periodicity of the surface. There is no weight data for these components. They do not get deformed since their position is automatically maintained by the nurb so that the periodicity of the surface will not be lost. Zeros will be returned for such components.

The influence object is specified using the physical (non-sparse) index of the influence object. This corresponds to the order the influences are returned by the influenceObjects method.

The length of the returned array will be equal to the number of specified components. The values in the returned array will be ordered in the same order as the input components.

Parameters:
[in]  path  path to object deformed by the skinCluster
[in]  components  components to return weights for
[in]  influenceIndex  physical index of influence object
[out]  weights  weight values
Returns:
The status
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure operation failed
  • MS::kInvalidObjectType component was invalid, shape was not attached to skinCluster, or invalid influenceIndex was specified

MStatus MFnSkinCluster::getWeights ( const MDagPath path,
const MObject components,
MDoubleArray weights,
unsigned int &  influenceCount  
) const

Gets the skinCluster weights for all influenceObjects for the specified components of the object whose dagPath is specified. Returns the weights in an array of size number of components x number of influenceObjects. The array elements are ordered by components: i.e. all of the weight values for the first component first, followed by all the weight values for the next component, and so on. For the first component, the weights are ordered by influence object in the same order that is returned by the MFnSkinCluster::influenceObjects method.

The number of influence objects is returned in influenceCount.

Parameters:
[in]  path  path to object deformed by the skinCluster
[in]  components  components to return weights for
[out]  weights  weight values returned (one per component, per influence)
[out]  influenceCount  count of influence objects
Returns:
The status
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure operation failed
  • MS::kInvalidObjectType component was invalid, shape was not attached to skinCluster, or invalid influenceIndex was specified

MStatus MFnSkinCluster::getWeights ( const MDagPath path,
const MObject components,
MIntArray influenceIndices,
MDoubleArray weights  
) const

Gets the skinCluster weights for the influence objects for the specified components of the object whose dagPath is specified. Returns the weights in an array of size number of components x number of influence objects. The array elements are ordered by components: i.e. all of the weight values for the first component first, followed by all the weight values for the next component, and so on. For the first component, the weights are ordered by influence object in the same order as in influenceIndices.

Parameters:
[in]  path  path to object deformed by the skinCluster
[in]  components  components to return weights for
[in]  influenceIndices  indices of influence objects to get
[out]  weights  weight values returned (one per component, per influence)
Returns:
The status
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure operation failed
  • MS::kInvalidObjectType component was invalid, shape was not attached to skinCluster, or invalid influenceIndex was specified

MStatus MFnSkinCluster::setWeights ( const MDagPath path,
const MObject components,
unsigned int  influenceIndex,
double  value,
bool  normalize = true,
MDoubleArray oldValues = NULL  
)

Sets the skinCluster weight for the influence object on the specified components of the object whose dagPath is specified. The influence is specified using the physical (non-sparse) index of the influence object. This corresponds to the order the influences are returned by the influenceObjects method.

In order to undo the setWeight operation, it is necessary to save the oldValues array and call setWeight with the oldValues array at the time of undo. The number of oldValues returned will be of size number of specified components x the total number of influence objects. The values in the oldValues array will be ordered with first the all the values for the first component, then all the values for the next, and so on.

Note that unlike most deformers, a skinCluster node can deform only a single geometry. Therefore, if additional geometries are added to the skinCluster set, they will be ignored, and weights cannot be set for the additional geometry.

Parameters:
[in]  path  path to object deformed by the skinCluster
[in]  components  components to be weighted
[in]  influenceIndex  physical index of influence object for the weight
[in]  value  weight value
[in]  normalize  whether or not to normalize weights on other influence objects
[in]  oldValues  previous weight values, for undo
Returns:
The status
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure operation failed
  • MS::kInvalidObjectType component or influence index was invalid, or shape was not attached to skinCluster

MStatus MFnSkinCluster::setWeights ( const MDagPath path,
const MObject components,
MIntArray influenceIndices,
MDoubleArray values,
bool  normalize = true,
MDoubleArray oldValues = NULL  
)

Sets the skinCluster weight on the specified components of the object whose dagPath is specified for the influence objects corresponding to the specified influence indices. The influence is specified using the physical (non-sparse) index of the influence object. This corresponds to the order the influences are returned by the influenceObjects method.

If you want to set the same values on all of the specified components, the number of values in the values array should equal the number of indices in the influence indices array. If you want to specify a unique value for each component, the number of values in the values array should equal the number of components x the number of indices in the influence indices array. The ordering of the values array should be such that first all the values for the first component are listed, then the second, and so on. For example, if you want to set the weights for three components for influences 7 and 10, the influence array would contain [7,10], and the values array would contain: [component#1 weight for influence 7, component #1 weight for influence 10, component#2 weight for influence 7, component#2 weight for influence 10, ...].

In order to undo the setWeights operation, it is necessary to save the oldValues array and call setWeights with the oldValues array at the time of undo. The number of oldValues returned will be of size number of components x total number of influence objects. The values in the oldValues array will be ordered with first the all the values for the first component, then all the values for the next, and so on.

Note that unlike most deformers, a skinCluster node can deform only a single geometry. Therefore, if additional geometries are added to the skinCluster set, they will be ignored, and weights cannot be set for the additional geometry.

Parameters:
[in]  path  path to object deformed by the skinCluster
[in]  components  components to be weighted
[in]  influenceIndices  physical indices of influence objects to set
[in]  values  weight values
[in]  normalize  whether or not to normalize weights on other influence objects
[in]  oldValues  previous weight values, for undo
Returns:
The status
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure operation failed
  • MS::kInvalidObjectType component was invalid, or shape was not attached to skinCluster, or invalid influenceIndices were specified

MStatus MFnSkinCluster::getPointsAffectedByInfluence ( const MDagPath path,
MSelectionList result,
MDoubleArray weights  
)

During deformation, the skinCluster algorithm is applied for a given influence object on all points in the deformer's set whose weights are non-zero. This method allows the user to query the non-zero weights for a particular influence object.

Returns a selection list containing the dag path and the components that are affected by the specified influence object. To retrieve the components from the returned MSelectionList, use MSelectionList::getDagPath. Also returns the corresponding weights for the components. If no components are weighted for a specified influence, the resulting selection list will be empty.

Parameters:
[in]  path  path of the influence object
[out]  result  selection list of components affected by the influence object for this skinCluster (return)
[out]  weights  weights for the affected components (return)
Returns:
Return status
Status Codes:

unsigned int MFnSkinCluster::indexForInfluenceObject ( const MDagPath mpath,
MStatus ReturnStatus = NULL  
) const

Returns the logical index of the matrix array attribute where the specified influence object is attached.

Parameters:
[in]  mpath  path of the influence object
[out]  ReturnStatus  return status
Returns:
The logical index of the influence object
Status Codes:

unsigned int MFnSkinCluster::influenceObjects ( MDagPathArray paths,
MStatus ReturnStatus = NULL  
) const

Returns an array of paths to the influence objects for the skinCluster.

Parameters:
[in]  paths  influence objects
[out]  ReturnStatus  return status
Returns:
The number of influence objects
Status Codes:

MStatus MFnSkinCluster::getWeights ( const MDagPath path,
const MObject components,
unsigned int  influenceIndex,
MFloatArray weights  
) const

This method is obsolete. Maya's skinCluster nodes store their weights as doubles. This method has been replaced by one which uses doubles instead of floats. This method only exists for backwards-compilability of old plug-in code.

Parameters:
[in]  path  path to object deformed by the skinCluster
[in]  components  components to return weights for
[in]  influenceIndex  index of influence object
[out]  weights  weight values
Returns:
The status
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure operation failed
  • MS::kInvalidObjectType component was invalid, shape was not attached to skinCluster, or invalid influenceIndex was specified

MStatus MFnSkinCluster::getWeights ( const MDagPath path,
const MObject components,
MFloatArray weights,
unsigned int &  influenceCount  
) const

This method is obsolete. Maya's skinCluster nodes store their weights as doubles. This method has been replaced by one which uses doubles instead of floats. This method only exists for backwards-compilability of old plug-in code.

Parameters:
[in]  path  path to object deformed by the skinCluster
[in]  components  components to return weights for
[out]  weights  weight values returned (one per component, per influence)
[out]  influenceCount  count of influence objects
Returns:
The status
Status Codes:

MStatus MFnSkinCluster::setWeights ( const MDagPath path,
const MObject components,
unsigned int  influenceIndex,
float  value,
bool  normalize = true,
MFloatArray oldValues = NULL  
)

This method is obsolete. Maya's skinCluster nodes store their weights as doubles. This method has been replaced by one which uses doubles instead of floats. This method only exists for backwards-compilability of old plug-in code.

Parameters:
[in]  path  path to object deformed by the skinCluster
[in]  components  components to be weighted
[in]  influenceIndex  index of influence object for the weight
[in]  value  weight value
[in]  normalize  whether or not to normalize weights on other influence objects
[in]  oldValues  previous weight values, for undo
Returns:
The status
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure operation failed
  • MS::kInvalidObjectType component was invalid, or shape was not attached to skinCluster, or invalid influenceIndex was specified

MStatus MFnSkinCluster::setWeights ( const MDagPath path,
const MObject components,
MIntArray influenceIndices,
MFloatArray values,
bool  normalize = true,
MFloatArray oldValues = NULL  
)

This method is obsolete. Maya's skinCluster nodes store their weights as doubles. This method has been replaced by one which uses doubles instead of floats. This method only exists for backwards-compilability of old plug-in code.

Parameters:
[in]  path  path to object deformed by the skinCluster
[in]  components  components to be weighted
[in]  influenceIndices  indices of influence objects to set
[in]  values  weight values
[in]  normalize  whether or not to normalize weights on other influence objects
[in]  oldValues  previous weight values, for undo
Returns:
The status
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure operation failed
  • MS::kInvalidObjectType component was invalid, or shape was not attached to skinCluster, or invalid influenceIndices was specified

MStatus MFnSkinCluster::getPointsAffectedByInfluence ( const MDagPath path,
MSelectionList result,
MFloatArray weights  
)

This method is obsolete. Maya's skinCluster nodes store their weights as doubles. This method has been replaced by one which uses doubles instead of floats. This method only exists for backwards-compilability of old plug-in code.

Parameters:
[in]  path  path of the influence object
[out]  result  selection list of components affected by the influence object for this skinCluster (return)
[out]  weights  weights for the affected components (return)
Returns:
Return status
Status Codes:

MStatus MFnSkinCluster::getBlendWeights ( const MDagPath path,
const MObject components,
MDoubleArray weights  
) const

This method returns weights from skinCluster's blend weight array. These weights are used to determine the blending between classical linear skinning and dual quaternion bases skinning on a per vertex basis. The function returns the weights associated with the components passed. The components are defined on the object whose dagPath is specified.

Parameters:
[in]  path  path to object deformed by the skinCluster
[in]  components  the components to return weights for
[out]  weights  the weight values returned (one per component in the order given)
Returns:
The status
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure operation failed
  • MS::kInvalidObjectType component was invalid, shape was not attached to skinCluster.

MStatus MFnSkinCluster::setBlendWeights ( const MDagPath path,
const MObject components,
const MDoubleArray weights  
)

This method sets weights in skinCluster's blend weight array. These weights are used to determine the blending between classical linear skinning and dual quaternion bases skinning on a per vertex basis. The function sets the weights for the given components of the object whose dagPath is specified. The array size should match the number of components passed. Failing this, it will set the smaller of the two.

Parameters:
[in]  path  path to object deformed by the skinCluster
[in]  components  the components list for the new weight values
[out]  weights  the weight values (one per component in the order given)
Returns:
The status
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure operation failed
  • MS::kInvalidObjectType component was invalid, shape was not attached to skinCluster.

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