Whenever you create a rigidly skinned
mesh within maya, you will end up adding in a number of MFn::kJointCluster
nodes into the scene. In essence a joint cluster, simply maintains
a list of vertices from a number of shapes that are directly influenced
by that joints transformation. ie, rather than parenting an entire
geometry object to a specific bone, we are parenting groups of
vertices under individual bones.
Finding all Joint Clusters
in the Scene
When retrieving mesh data, you will need to use an MItDependencyNodes
in order to loop through a list of clusters.
// attach
a function set to the cluster MFnDependencyNode fnNode(jointCluster);
// get a plug to the matrix attribute MPlug plug = fnNode.findPlug("matrix");
MPlugArray conns;
// if the attribute is connected to a transform if (plug.connectedTo(conns,true,false))
{
Each joint cluster may influence more than one
geometry object. Each object will then have a variable number
of it's control points influenced by the actual influencing
joint for this cluster.
// get a path to the i'th shape
affected
SetList.getDagPath(i,skinpath,components);
// get the weights and vertex
indices for
// the points that are influenced. // Usually you can ignore
the weight values
// since they all tend to be 1.
fn.getWeights(skinpath,components,weights);
// attach a function set to
the shape so that
// we can access it's name.
MFnDependencyNode fnShape(skinpath);