PDA

View Full Version : Can you query a list of vertices weighted to a given joint?


russ_c
04-27-2006, 10:37 PM
Hey everyone,

I was hoping to find a way with mel to query vertices that have a weight value associated with a joint. It would be even better if I could only return vertices for a given joint that are within a certain weight value, but if I could just return all the vertices that have a value for a given joint that would be awesome.

Thanks for the help,

Russell

michaelcomet
04-27-2006, 11:34 PM
see the skinPercent command. You may also want to download my cometSkinWeight tool which uses this sort of thing as a user feature, some of the code is in the libSkin.mel...all that's available on my website in my script zip file....

comet

john_homer
04-28-2006, 01:31 AM
i had this lying around...

// select a joint and jun this script,
// it will select all the verts that are weighted to the joint.

//get selection
string $sel[] = `ls -sl -type joint` ;

// if there is one joint in the selection, do it.
if (`size($sel)` == 1)
{
// get the skinCluster and surface names.
string $clusterName[] = `listConnections -type skinCluster` ;
string $surface[] = `skinCluster -q -g $clusterName[0]` ;
select -cl;

// go through all the verts, and see if they have
// a weighting over 0 on the selected joint
int $vertCount[] = `polyEvaluate -v $surface`;
for ( $i = 0 ; $i < $vertCount[0] ; $i++ )
{
// get the weight of current vert on the joint
float $jointsWeights = `skinPercent -t $sel[0] -q $clusterName[0] ($surface[0] + ".vtx[" + $i + "]")`;

// if its > 0 add it to the selection
if ($jointsWeights > 0.001)
select -add ($surface[0] + ".vtx[" + $i + "]");
}
}
else
error ("select one joint");


.j

CGTalk Moderation
04-28-2006, 01:31 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.