Public Member Functions | Protected Member Functions

MFnWeightGeometryFilter Class Reference

This reference page is linked to from the following overview topics: Skinning, Overview of example plug-ins, Example C++ plug-in descriptions.


Search for all occurrences

Detailed Description

Weight geometry filter function set.

MFnWeightGeometryFilter is the function set for weight geometry filters. Weight geometry filter nodes include clusters, cluster flexors, and user-defined deformers derived from MPxDeformerNode. The purpose of the weight geometry filter is to store the weights for each component of each geometry that is deformed. The weight geometry filter is independent of any algorithm that calculates a deformation based on the component weight values. Clusters, cluster flexors, and user-defined deformers each have their own algorithm to determine the deformation based on the component weights.

This function set provides methods for getting and setting weights on weight geometry filter nodes. In addition to getting and settings weights on components, this class provides methods for accessing the weight geometry filter's input and output geometry through its parent class, MFnGeometryFilter.

When getting and setting weights on components, it is more efficient to use the methods that take a plug index. The plug index is a sparse array index, and is the same index used in MEL scripts to index into an array of plugs.

Examples:

clusterWeightFunction.cpp, and exportJointClusterDataCmd.cpp.

#include <MFnWeightGeometryFilter.h>

Inheritance diagram for MFnWeightGeometryFilter:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual MFn::Type type () const
 Function set type.
virtual ~MFnWeightGeometryFilter ()
 Destructor.
 MFnWeightGeometryFilter ()
 Default constructor.
 MFnWeightGeometryFilter (MObject &object, MStatus *ReturnStatus=NULL)
 Constructor.
MStatus getWeights (unsigned int index, const MObject &components, MFloatArray &weights) const
 Gets the weights of the components that correspond to the geometry at the specified plug index.
MStatus getWeights (const MDagPath &path, const MObject &components, MFloatArray &weights) const
 Gets the weights of the components that correspond to the geometry whose DAG path is specified.
MStatus setWeight (const MDagPath &path, unsigned int index, const MObject &components, float weight, MFloatArray *oldValues=NULL)
 Sets the weights of the specified components of the object whose DAG path is specified.
MStatus setWeight (const MDagPath &path, const MObject &components, float weight, MFloatArray *oldValues=NULL)
 Sets the weights of the specified components of the object whose DAG path is specified.
MStatus setWeight (const MDagPath &path, unsigned int index, const MObject &components, MFloatArray &values)
 Sets the weights of the specified components of the object whose DAG path is specified.
MStatus setWeight (const MDagPath &path, const MObject &components, MFloatArray &values)
 Sets the weights of the specified components of the object whose DAG path is specified.
MString weightPlugStrings (const MSelectionList &list, MStatus *ReturnStatus=NULL) const
 Sets the plugStrings argument to be a string (separated by spaces) containing the names of the plugs on this node that correspond to the components in the selection list.
MStatus getWeightPlugStrings (const MSelectionList &list, MStringArray &plugStringArray) const
 Set the plugStringArray argument to contain the names of the plugs on this node that correspond to the components in the selection list.
 MFnWeightGeometryFilter (const MObject &object, MStatus *ReturnStatus=NULL)
 Constructor.
MStatus getWeightPlugStrings (const MSelectionList &list, MString &plugStrings) const
 NO SCRIPT SUPPORT.

Protected Member Functions

virtual const char * className () const
 Class name.

Constructor & Destructor Documentation

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

Member Function Documentation

MFn::Type type ( ) const [virtual]

Function set type.

Return the class type : MFn::kWeightGeometryFilt.

Reimplemented from MFnGeometryFilter.

MStatus getWeights ( unsigned int  index,
const MObject components,
MFloatArray weights 
) const

Gets the weights of the components that correspond to the geometry at the specified plug index.

The relationship between the weights and the components can be determined by iterating through the components using the MItGeometry iterator. The iterator iterates through the components in the same order as the weights array.

Parameters:
[in]indexthe plug index corresponding to the shape that has the components
[out]componentsthe components whose weights are requested
[out]weightsthe weight values of the components
Returns:
MStatus getWeights ( const MDagPath path,
const MObject components,
MFloatArray weights 
) const

Gets the weights of the components that correspond to the geometry whose DAG path is specified.

If the plug index is already known, it is more efficient to call the other getWeights method than this one. This getWeights method calls indexForOutputShape internally to find the plug index.

The relationship between the weights and the components can be determined by iterating through the components using the MItGeometry iterator. The iterator iterates through the components in the same order as the weights array.

Parameters:
[in]paththe path of the DAG object that has the components
[in]componentsthe components whose weights are requested
[out]weightsthe weight values of the components
Returns:
MStatus setWeight ( const MDagPath path,
unsigned int  index,
const MObject components,
float  weight,
MFloatArray oldValues = NULL 
)

Sets the weights of the specified components of the object whose DAG path is specified.

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.

Parameters:
[in]paththe DAG path for the object whose components' weights are being set
[in]indexthe plug index for the specified shape
[in]componentsthe components of the object
[in]weightweight value for the components
[in]oldValuesan array of old values for the components
Returns:
Examples:
clusterWeightFunction.cpp.
MStatus setWeight ( const MDagPath path,
const MObject components,
float  weight,
MFloatArray oldValues = NULL 
)

Sets the weights of the specified components of the object whose DAG path is specified.

If the plug index is already known, it is more efficient to call the corresponding setWeight method that takes a plugIndex. This setWeight method is a convenience method which calls indexForOutputShape internally to find the plug index.

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.

Parameters:
[in]paththe DAG path for the object whose components' weights are being set
[in]componentsthe components of the object
[in]weightweight value for the components
[in]oldValuesan array of old values for the components
Returns:
MStatus setWeight ( const MDagPath path,
unsigned int  index,
const MObject components,
MFloatArray values 
)

Sets the weights of the specified components of the object whose DAG path is specified.

This method is useful in conjunction with the setWeight methods that return an oldValues array. This method can be called with those oldValues to restore the weights to the previous values.

Parameters:
[in]paththe DAG path for the object whose components' weights are being set
[in]indexthe plug index for the specified shape
[in]componentsthe components of the object
[in]valuesthe value array of the components
Returns:
MStatus setWeight ( const MDagPath path,
const MObject components,
MFloatArray values 
)

Sets the weights of the specified components of the object whose DAG path is specified.

This method is useful in conjunction with the setWeight methods that return an oldValues array. This method can be called with those oldValues to restore the weights to the previous values.

If the plug index is already known, it is more efficient to call the corresponding setWeight method that takes a plugIndex. This setWeight method is a convenience method which calls indexForOutputShape internally to find the plug index.

Parameters:
[in]paththe DAG path for the object whose components' weights are being set
[in]componentsthe components of the object
[in]valuesthe value array of the components
Returns:
MString weightPlugStrings ( const MSelectionList list,
MStatus ReturnStatus = NULL 
) const

Sets the plugStrings argument to be a string (separated by spaces) containing the names of the plugs on this node that correspond to the components in the selection list.

The method can be useful in conjunction with setting keys on a number of plugs. The operation will fail if none of the items in the selection list correspond to components weighted by this cluster.

Parameters:
[in]listselection list that contains components
[out]ReturnStatusStatus code
Returns:
A string containing the names of the plugs on this node that correspond to the components in the selection list
Status Codes:
MStatus getWeightPlugStrings ( const MSelectionList list,
MStringArray plugStringArray 
) const

Set the plugStringArray argument to contain the names of the plugs on this node that correspond to the components in the selection list.

The operation will fail if none of the items in the selection list correspond to components weighted by this cluster.

Parameters:
[in]listselection list that contains components
[out]plugStringArraystring array containing the names of the plugs on this node that correspond to the components in the selection list; each of the plugs is put in a separate string
Returns:
MStatus getWeightPlugStrings ( const MSelectionList list,
MString plugStrings 
) const

NO SCRIPT SUPPORT.

Sets the plugStrings argument to be a string (separated by spaces) containing the names of the plugs on this node that correspond to the components in the selection list.

The method can be useful in conjunction with setting keys on a number of plugs. The operation will fail if none of the items in the selection list correspond to components weighted by this cluster.

Python Notes

This method is not supported in Python. See the version which returns a string.

Parameters:
[in]listselection list that contains components
[in]plugStringsstring containing the names of the plugs on this node that correspond to the components in the selection list
Returns:

MFnWeightGeometryFilter MFnWeightGeometryFilter MFnWeightGeometryFilter MFnWeightGeometryFilter MFnWeightGeometryFilter MFnWeightGeometryFilter MFnWeightGeometryFilter MFnWeightGeometryFilter MFnWeightGeometryFilter MFnWeightGeometryFilter
MFnWeightGeometryFilter MFnWeightGeometryFilter MFnWeightGeometryFilter MFnWeightGeometryFilter MFnWeightGeometryFilter MFnWeightGeometryFilter MFnWeightGeometryFilter MFnWeightGeometryFilter MFnWeightGeometryFilter MFnWeightGeometryFilter