C++ API Reference

skinCluster function set More...

#include <MFnSkinCluster.h>

+ Inheritance diagram for MFnSkinCluster:

Public Member Functions

virtual MFn::Type type () const
 Function set type. More...
 
virtual ~MFnSkinCluster ()
 Destructor.
 
 MFnSkinCluster ()
 Default constructor.
 
 MFnSkinCluster (MObject &object, MStatus *ReturnStatus=NULL)
 Constructor. More...
 
MStatus 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. More...
 
MStatus 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. More...
 
MStatus 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. More...
 
MStatus setWeights (const MDagPath &path, const MObject &components, unsigned int jointIndex, 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. More...
 
MStatus 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. More...
 
MStatus 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. More...
 
unsigned int indexForInfluenceObject (const MDagPath &path, MStatus *ReturnStatus=NULL) const
 Returns the logical index of the matrix array attribute where the specified influence object is attached. More...
 
unsigned int influenceObjects (MDagPathArray &paths, MStatus *ReturnStatus=NULL) const
 Returns an array of paths to the influence objects for the skinCluster. More...
 
MStatus getWeights (const MDagPath &path, const MObject &components, unsigned int influenceIndex, MFloatArray &weights) const
 This method is obsolete. More...
 
MStatus getWeights (const MDagPath &path, const MObject &components, MFloatArray &weights, unsigned int &influenceCount) const
 This method is obsolete. More...
 
MStatus setWeights (const MDagPath &path, const MObject &components, unsigned int jointIndex, float value, bool normalize=true, MFloatArray *oldValues=NULL)
 This method is obsolete. More...
 
MStatus setWeights (const MDagPath &path, const MObject &components, MIntArray &influenceIndices, MFloatArray &values, bool normalize=true, MFloatArray *oldValues=NULL)
 This method is obsolete. More...
 
MStatus getPointsAffectedByInfluence (const MDagPath &path, MSelectionList &result, MFloatArray &weights)
 This method is obsolete. More...
 
MStatus getBlendWeights (const MDagPath &path, const MObject &components, MDoubleArray &weights) const
 This method returns weights from skinCluster's blend weight array. More...
 
MStatus setBlendWeights (const MDagPath &path, const MObject &components, const MDoubleArray &weights)
 This method sets weights in skinCluster's blend weight array. More...
 
 MFnSkinCluster (const MObject &object, MStatus *ReturnStatus=NULL)
 Constructor. More...
 
- Public Member Functions inherited from MFnGeometryFilter
virtual ~MFnGeometryFilter ()
 Destructor.
 
 MFnGeometryFilter ()
 Default constructor.
 
 MFnGeometryFilter (MObject &object, MStatus *ReturnStatus=NULL)
 Constructor. More...
 
MStatus getInputGeometry (MObjectArray &objects) const
 This method returns the input geometry for the deformer by traversing the graph to find upstream shape nodes. More...
 
MStatus getOutputGeometry (MObjectArray &objects) const
 The output geometry is packed into the provided list of MObjects. More...
 
MObject inputShapeAtIndex (unsigned int index, MStatus *ReturnStatus=NULL) const
 Returns the input shape corresponding to the plug index. More...
 
MObject outputShapeAtIndex (unsigned int index, MStatus *ReturnStatus=NULL) const
 Returns the output shape corresponding to the plug index. More...
 
unsigned int indexForOutputShape (const MObject &shape, MStatus *ReturnStatus=NULL) const
 Returns the plug index for the specified output shape. More...
 
MStatus getPathAtIndex (unsigned int index, MDagPath &path) const
 The DAG path of the output geometry at the specified plug index is put in the dagPath argument. More...
 
unsigned int indexForGroupId (unsigned int groupId, MStatus *ReturnStatus=NULL) const
 Returns the plug index corresponding to the groupId. More...
 
unsigned int groupIdAtIndex (unsigned int index, MStatus *ReturnStatus=NULL) const
 Returns the groupId at the specified plug index. More...
 
unsigned int numOutputConnections (MStatus *ReturnStatus=NULL) const
 Returns the number of output geometries connected to this node. More...
 
unsigned int indexForOutputConnection (unsigned int connectionIndex, MStatus *ReturnStatus=NULL) const
 Returns the plug index corresponding to the connection index. More...
 
MObject deformerSet (MStatus *ReturnStatus=NULL) const
 Returns the set containing the objects that are deformed. More...
 
float envelope (MStatus *ReturnStatus=NULL) const
 Returns the envelope value. More...
 
MStatus setEnvelope (float envelope)
 Sets the envelope value. More...
 
 MFnGeometryFilter (const MObject &object, MStatus *ReturnStatus=NULL)
 Constructor. More...
 
- Public Member Functions inherited from MFnDependencyNode
virtual ~MFnDependencyNode ()
 Destructor.
 
 MFnDependencyNode ()
 Default constructor.
 
 MFnDependencyNode (MObject &object, MStatus *ReturnStatus=NULL)
 Constructor. More...
 
MObject create (const MTypeId &typeId, MStatus *ReturnStatus=NULL)
 Creates a new dependency node with the given type tag. More...
 
MObject create (const MTypeId &typeId, const MString &name, MStatus *ReturnStatus=NULL)
 Creates a new dependency node with the given type tag. More...
 
MObject create (const MString &type, MStatus *ReturnStatus=NULL)
 Creates a new dependency node with the given type. More...
 
MObject create (const MString &type, const MString &name, MStatus *ReturnStatus=NULL)
 Creates a new dependency node with the given type. More...
 
MTypeId typeId (MStatus *ReturnStatus=NULL) const
 Returns the type id of this node. More...
 
MString typeName (MStatus *ReturnStatus=NULL) const
 Returns the type name of this node. More...
 
MString name (MStatus *ReturnStatus=NULL) const
 Returns the name of this node. More...
 
MString absoluteName (MStatus *ReturnStatus=NULL) const
 Returns the absolute name of this node. More...
 
MString pluginName (MStatus *ReturnStatus=NULL) const
 Returns the name of the plug-in this MFnDependendencyNode was defined in. More...
 
MString setName (const MString &name, bool createNamespace=false, MStatus *ReturnStatus=NULL)
 Sets the name of this node. More...
 
MUuid uuid (MStatus *ReturnStatus=NULL) const
 Returns the node's UUID. More...
 
void setUuid (const MUuid &uuid, MStatus *ReturnStatus=NULL)
 Sets the node's UUID. More...
 
MStatus getConnections (MPlugArray &array) const
 Get all of the current connections to this node as an array of plugs. More...
 
unsigned int attributeCount (MStatus *ReturnStatus=NULL) const
 Returns the number of attributes that this node has. More...
 
MObject attribute (unsigned int index, MStatus *ReturnStatus=NULL) const
 Finds the attribute of this node at the given index. More...
 
MObject reorderedAttribute (unsigned int index, MStatus *ReturnStatus=NULL) const
 Some nodes, such as the various animCurve nodes, require that their attributes be set in a specific order for proper operation. More...
 
MObject attribute (const MString &attrName, MStatus *ReturnStatus=NULL) const
 Finds the attribute of this node that has the given name. More...
 
MAttrClass attributeClass (const MObject &attr, MStatus *ReturnStatus=NULL) const
 Returns the class (normal, dynamic, extension) of the specified attribute. More...
 
MStatus getAffectedAttributes (const MObject &attr, MObjectArray &affectedAttributes) const
 Returns an array of attributes that are affected by the attribute passed in. More...
 
MStatus getAffectedByAttributes (const MObject &attr, MObjectArray &affectedByAttributes) const
 Returns an array of attributes that affect the attribute passed in, attr. More...
 
MPlug findPlug (const MObject &attr, bool wantNetworkedPlug, MStatus *ReturnStatus=NULL) const
 Attempt to find a plug for the given attribute. More...
 
MPlug findPlug (const MString &attrName, bool wantNetworkedPlug, MStatus *ReturnStatus=NULL) const
 Attempt to find a plug for the given attribute. More...
 
MPlug findPlug (const MObject &attr, MStatus *ReturnStatus=NULL) const
 This method is obsolete. More...
 
MPlug findPlug (const MString &attrName, MStatus *ReturnStatus=NULL) const
 This method is obsolete. More...
 
MStatus addAttribute (const MObject &attr)
 Add a new dynamic attibute to this node. More...
 
MStatus removeAttribute (const MObject &attr)
 Remove a dynamic attribute from a node. More...
 
MPxNodeuserNode (MStatus *ReturnStatus=NULL) const
 If the function set's node is a plug-in node, then this method will extract the MPxNode pointer from it. More...
 
bool isFromReferencedFile (MStatus *ReturnStatus=NULL) const
 Indicates whether or not this node came from a referenced file. More...
 
bool isShared (MStatus *ReturnStatus=NULL) const
 Indicates whether or not this node is shared. More...
 
bool isTrackingEdits (MStatus *ReturnStatus=NULL) const
 Returns whether or not edits on the given node are being tracked by the generalized edit system. More...
 
bool hasUniqueName (MStatus *ReturnStatus=NULL) const
 Indicates whether or not this node's name is unique within the scene. More...
 
MString parentNamespace (MStatus *ReturnStatus=NULL) const
 Returns the name of the namespace in which this node resides. More...
 
bool isLocked (MStatus *ReturnStatus=NULL) const
 Indicates whether or not this node is locked. More...
 
MStatus setLocked (bool locked)
 Locks or unlocks this node. More...
 
bool isNewAttribute (const MObject &attr, MStatus *ReturnStatus=NULL) const
 Indicates whether or not the specified attribute was added to this node within the current scene. More...
 
MStatus setFlag (unsigned int flag, bool state)
 Sets the state of the specified flag for the node. More...
 
bool isFlagSet (unsigned int flag, MStatus *ReturnStatus=NULL) const
 Retrieves the current state of the specified flag for a node. More...
 
bool isDefaultNode (MStatus *ReturnStatus=NULL) const
 Returns true if the node is a default node. More...
 
MStatus setDoNotWrite (bool flag)
 Use this method to mark the "do not write" state of this node. More...
 
bool canBeWritten (MStatus *ReturnStatus=NULL) const
 Returns the do not write state of the node. More...
 
bool hasAttribute (const MString &name, MStatus *ReturnStatus=NULL) const
 Returns true if the node already has an attribute with the given name. More...
 
MObject getAliasAttr (bool force, MStatus *ReturnStatus=NULL)
 Returns the node's alias attribute, which is a special attribute used to store information about the node's attribute aliases. More...
 
bool setAlias (const MString &alias, const MString &name, const MPlug &plug, bool add=true, MStatus *ReturnStatus=NULL)
 Sets or removes an alias (i.e. More...
 
bool findAlias (const MString &alias, MObject &attrObj, MStatus *ReturnStatus=NULL) const
 Retrieves the attribute with the given alias. More...
 
bool getAliasList (MStringArray &strArray, MStatus *ReturnStatus=NULL)
 Returns a list of all attribute aliases for this node. More...
 
MString plugsAlias (const MPlug &plug, MStatus *ReturnStatus=NULL)
 Returns the alias for the plug's attribute or the empty string if that attribute has no alias. More...
 
MStatus setIcon (const MString &filename)
 Associates a custom icon with the node for display in the Maya UI. More...
 
MString icon (MStatus *ReturnStatus=NULL) const
 Returns the custom icon filename associated with the node. More...
 
MStatus getExternalContent (MExternalContentInfoTable &table) const
 Returns the external content (files) that this node depends on. More...
 
MStatus addExternalContentForFileAttr (MExternalContentInfoTable &table, const MObject &attr) const
 Adds content info to the specified table from a file path attribute. More...
 
MStatus setExternalContentForFileAttr (const MObject &attr, const MExternalContentLocationTable &table)
 Sets content info in the specified attribute from the table. More...
 
MStatus setExternalContent (const MExternalContentLocationTable &table)
 Changes the location of external content. More...
 
bool affectsAnimation (MStatus *ReturnStatus=NULL) const
 Indicates whether or not this node is allowed to animate. More...
 
MStatus setAffectsAnimation ()
 Define a node can affect animation. More...
 
MString setName (const MString &name, MStatus *ReturnStatus)
 NO SCRIPT SUPPORT. More...
 
 MFnDependencyNode (const MObject &object, MStatus *ReturnStatus=NULL)
 NO SCRIPT SUPPORT. More...
 
bool getPlugsAlias (const MPlug &plug, MString &aliasName, MStatus *ReturnStatus=NULL)
 NO SCRIPT SUPPORT. More...
 
virtual const adsk::Data::Associationsmetadata (MStatus *ReturnStatus=NULL) const
 This method is not available in Python. More...
 
virtual MStatus setMetadata (const adsk::Data::Associations &)
 This method is not available in Python. More...
 
virtual MStatus deleteMetadata ()
 This method is not available in Python. More...
 
virtual MStatus validateMetadata (MString &errors) const
 This method is not available in Python. More...
 
MStatus dgTimerOn ()
 Indicates that this node should collect DG timing data whenever DG timing is enabled. More...
 
MStatus dgTimerOff ()
 Indicates that this node should no longer collect DG timing data when DG timing is enabled. More...
 
MdgTimerState dgTimerQueryState (MStatus *ReturnStatus=NULL)
 The function returns the current on/off state of the node's timer. More...
 
MStatus dgTimerReset ()
 The function resets the dependency graph timers and counters for this node to zero. More...
 
double dgTimer (const MdgTimerMetric timerMetric, const MdgTimerType timerType, MStatus *ReturnStatus=NULL) const
 The function returns the specified timer value for the current node. More...
 
MStatus dgCallbacks (const MdgTimerType type, MStringArray &callbackName, MDoubleArray &value)
 Node callbacks that occur when timing is enabled get logged with the node and can be queried via this method. More...
 
MStatus dgCallbackIds (const MdgTimerType type, const MString &callbackName, MCallbackIdArray &callbackId, MDoubleArray &value)
 This method provides a further breakdown of the per-callback time returned via dgCallbacks() by returning the data on a per-callbackId basis. More...
 
MStatus addAttribute (const MObject &attr, MAttrClass type)
 This method is obsolete. More...
 
MStatus removeAttribute (const MObject &attr, MAttrClass type)
 This method is obsolete. 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...
 

Static Public Member Functions

static const char * className ()
 Returns the name of this class. More...
 
- Static Public Member Functions inherited from MFnGeometryFilter
static const char * className ()
 Returns the name of this class. More...
 
- Static Public Member Functions inherited from MFnDependencyNode
static const char * className ()
 Returns the name of this class. More...
 
static MString classification (const MString &nodeTypeName)
 Retrieves the classification string for a node type. More...
 
static unsigned int allocateFlag (const MString pluginName, MStatus *ReturnStatus=NULL)
 Allocates a node flag for sole use by the caller. More...
 
static MStatus deallocateFlag (const MString pluginName, unsigned int flag)
 Deallocates a node flag which was previously allocated by a call to allocateFlag. More...
 
static MStatus deallocateAllFlags (const MString pluginName)
 Deallocates all of the node flags which are currently allocated to the specified plugin. More...
 
static void enableDGTiming (bool enable)
 Globally enables or disables the DG node timing mechanism. More...
 
- Static Public Member Functions inherited from MFnBase
static const char * className ()
 Returns the name of this class. More...
 
static const char * typeString (MFn::Type)
 Returns the type string for a given type. More...
 
static bool isValid (MFn::Type)
 Returns true if type is in the range of valid types. More...
 

Additional Inherited Members

- Public Types inherited from MFnDependencyNode
enum  MAttrClass { kLocalDynamicAttr = 1, kNormalAttr, kExtensionAttr, kInvalidAttr }
 Specifies the scope of the attribute. More...
 
enum  MdgTimerState { kTimerOff, kTimerOn, kTimerUninitialized, kTimerInvalidState }
 Possible states for the node's timer. More...
 
enum  MdgTimerMetric {
  kTimerMetric_callback, kTimerMetric_compute, kTimerMetric_dirty, kTimerMetric_draw,
  kTimerMetric_fetch, kTimerMetric_callbackViaAPI, kTimerMetric_callbackNotViaAPI, kTimerMetric_computeDuringCallback,
  kTimerMetric_computeNotDuringCallback, kTimerMetrics
}
 The different timer metrics which can be queried. More...
 
enum  MdgTimerType { kTimerType_self, kTimerType_inclusive, kTimerType_count, kTimerTypes }
 The types of timers which can be queried. More...
 

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/exportSkinClusterDataCmd.cpp, and skinClusterWeights/skinClusterWeights.cpp.

Constructor & Destructor Documentation

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

Returns
the class type.

Reimplemented from MFnGeometryFilter.

static const char* className ( )
static

Returns the name of this class.

Returns
Name of this class.
MStatus 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]pathpath to object deformed by the skinCluster
[in]componentscomponents to return weights for
[in]influenceIndexphysical index of influence object
[out]weightsweight 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 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]pathpath to object deformed by the skinCluster
[in]componentscomponents to return weights for
[out]weightsweight values returned (one per component, per influence)
[out]influenceCountcount 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 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]pathpath to object deformed by the skinCluster
[in]componentscomponents to return weights for
[in]influenceIndicesindices of influence objects to get
[out]weightsweight 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 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]pathpath to object deformed by the skinCluster
[in]componentscomponents to be weighted
[in]influenceIndexphysical index of influence object for the weight
[in]valueweight value
[in]normalizewhether or not to normalize weights on other influence objects
[in]oldValuesprevious 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 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]pathpath to object deformed by the skinCluster
[in]componentscomponents to be weighted
[in]influenceIndicesphysical indices of influence objects to set
[in]valuesweight values
[in]normalizewhether or not to normalize weights on other influence objects
[in]oldValuesprevious 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 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]pathpath of the influence object
[out]resultselection list of components affected by the influence object for this skinCluster (return)
[out]weightsweights for the affected components (return)
Returns
Return status
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure operation failed, or path is not an influence object
unsigned int 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]mpathpath of the influence object
[out]ReturnStatusreturn status
Returns
The logical index of the influence object
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure operation failed, or transform is not an influence object
Examples:
skinClusterWeights/skinClusterWeights.cpp.
unsigned int influenceObjects ( MDagPathArray paths,
MStatus ReturnStatus = NULL 
) const

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

Parameters
[in]pathsinfluence objects
[out]ReturnStatusreturn status
Returns
The number of influence objects
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure operation failed
Examples:
skinClusterWeights/skinClusterWeights.cpp.
MStatus 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]pathpath to object deformed by the skinCluster
[in]componentscomponents to return weights for
[in]influenceIndexindex of influence object
[out]weightsweight 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 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]pathpath to object deformed by the skinCluster
[in]componentscomponents to return weights for
[out]weightsweight values returned (one per component, per influence)
[out]influenceCountcount 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
  • MS::kInvalidParameter operation failed, nullptr MObject passed or the MObject does not support components
MStatus 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]pathpath to object deformed by the skinCluster
[in]componentscomponents to be weighted
[in]influenceIndexindex of influence object for the weight
[in]valueweight value
[in]normalizewhether or not to normalize weights on other influence objects
[in]oldValuesprevious 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 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]pathpath to object deformed by the skinCluster
[in]componentscomponents to be weighted
[in]influenceIndicesindices of influence objects to set
[in]valuesweight values
[in]normalizewhether or not to normalize weights on other influence objects
[in]oldValuesprevious 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 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]pathpath of the influence object
[out]resultselection list of components affected by the influence object for this skinCluster (return)
[out]weightsweights for the affected components (return)
Returns
Return status
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure operation failed, or path is not an influence object
MStatus 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]pathpath to object deformed by the skinCluster
[in]componentsthe components to return weights for
[out]weightsthe 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 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]pathpath to object deformed by the skinCluster
[in]componentsthe components list for the new weight values
[out]weightsthe 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.

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