PDA

View Full Version : get skinCluster influence list on selected vertex


r4inm4ker
10-21-2010, 01:21 AM
Hi,
Is there any command to get the skinCluster influence list on selected vertex, like in component editor, when you select one or more vertices, it will display the influences and their weights on those vertices.

Thanks,
Jefri

NateH
10-21-2010, 01:35 AM
As far as I can tell, you can only get a list of influences for the skinCluster. Just get the weights for the vertex, and then filter the influence list by influences whos' weight value is larger than 0.

r4inm4ker
10-21-2010, 03:14 AM
yeah, it seems to be the only way to retrieve it. Thanks.
If anyone has better idea of how to do it, please share here.

musi
10-22-2010, 07:26 AM
There is a way to do it

mel:
skinPercent -q -transform "skinCluster5" "symetricalHead.vtx[35]";

Python:
mc.skinPercent('skinCluster5', 'symetricalHead.vtx[35]', query=True, transform=None)

Hope it is what you need.

r4inm4ker
10-27-2010, 06:16 AM
There is a way to do it

mel:
skinPercent -q -transform "skinCluster5" "symetricalHead.vtx[35]";

Python:
mc.skinPercent('skinCluster5', 'symetricalHead.vtx[35]', query=True, transform=None)

Hope it is what you need.

Yeah, I figured out it's one of the way to get all the influence of selected vertices, but it also lists influences with zero value, so I still need to remove the zero influences from the list. Thanks anyway :).

musi
10-27-2010, 07:14 AM
r4inm4ker, would you post it when you find the way of doing it?
I am looking for the same thing too...

Thanks

r4inm4ker
10-27-2010, 07:40 AM
well, In the end I just queried all the influences and the weight of each influence to that vertex, and then removed the zero ones, using codes similar to this: (it's taken from http://mayamel.tiddlyspot.com/ , slightly modified)


// get transforms (binding joints and influence object)
string $skinInfluences[]=`skinPercent -q -t $skinCluster $vtx`;
// get skin weight of selected vertex
float $sknVals[]=`skinPercent -q -v $skinCluster $vtx`;

// only print values that are greater than 0. If you want to know
// influence names even if they are zero, remove the 'if' line:
for($i=0;$i<size($skinInfluences);$i++)
{
if($sknVals[$i] > 0)
print ($skinTrans[$i] + "\t\t" + $sknVals[$i] + "\n");
}

musi
10-27-2010, 08:00 AM
Thank you,
That's what I am doing too... I was hoping you found an easier way of getting those influences without zero ones.

Well, we will have to leave with what we have :)

musi
11-09-2010, 09:07 AM
Hi,

I found a flag on skinCluster, that returns all weighted (non-zero) influences for the whole skinCluster, and it works both in Maya 2010 and 2011:

mc.skinCluster('skinCluster10', q=1, weightedInfluence=1) #Pyhon
skinCluster -q -weightedInfluence "skinCluster10"; //mel

And the skinPercent returns weighted (non-zero) influences for the given vertex in Maya 2011, but not in Maya 2010. They have changed the behavior of this command.

So, if you script for Maya 2011 - there is no need for looping through influences :)

CGTalk Moderation
11-09-2010, 09:07 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.