you have to pass the name of influence object you want to query as the transform arg, like t=‘joint2’. I have had issues with this too, in fact in order to get a list of influence items that was specific to the selected verts I had to use mel cause I couldn’t get pymel or cmds modules to give me anything but the list of all influence transforms on the skin cluster
from the docs:
# Get the weight of vtx[100] corresponding to joint1
#
cmds.skinPercent( 'skinCluster1', 'pPlane1.vtx[100]', transform='joint1', query=True )
[QUOTE=mattanimation;16575]you have to pass the name of influence object you want to query as the transform arg, like t=‘joint2’. I have had issues with this too, in fact in order to get a list of influence items that was specific to the selected verts I had to use mel cause I couldn’t get pymel or cmds modules to give me anything but the list of all influence transforms on the skin cluster
from the docs:
# Get the weight of vtx[100] corresponding to joint1
#
cmds.skinPercent( 'skinCluster1', 'pPlane1.vtx[100]', transform='joint1', query=True )
[/QUOTE]
Thanks Matt, but what if we want to find the joints that affect a particular vertex?
I needed to find all joints and their weight on a skinCluster, which I already found a work around. But, I still really want to know how to translate such Mel script to python:
import pymel.core as pm
oObj = pm.selected()[0] # start by selecting the geometry with the skinCluster.
influences = []
try: oColl = pm.skinCluster(oObj, query=True, influence=True)
except: print "Exception: it doesn't appear to have a skinCluster."
for each in oColl:
shoot = mc.skinPercent( "skinCluster1", "pSphere1.vtx[20]", transform=each.name(), q=True )
if shoot > 0:
influences.append(each)
print influences
inf_jnts = [] #joints of influence
list_of_names = maya.mel('skinPercent "skinCluster1" -q -t;') #those joints as a unicode string list
for n in list_of_names:
inf_jnts.append(pm.PyNode(n)) #make strings pyNodes
running the code as mel works even though it doesn’t as python or pymel but you can still get pyNodes from it. This DOES return the list of ONLY transforms that are influencing the selected vertices.