[maya][python] Selecting Influenced Verts by Influence

Hi,

I’m trying to select the affected verts for a particular influence. I think I’m just missing something silly using the siv flag for skinCluster.

Using the below command, I’m not getting what I would expect, the verts selected for this particular influence:

cmds.skinCluster( ‘skinCluster1’ , siv = ‘Hips’ )

Error: RuntimeError: No suitable object or more than one objects were selected for the skin cluster.

Anyone have any suggestions?

Thanks !

Oh that is weird. Now I want to know how to get that to work too. That’s the same error skinCluster gives when you try to make a skinCluster without the right selection. You can always test the weight of each vert, it would be slower than the command, but if no one knows how to use it or if it really is broken, it might be your only choice

import maya.cmds as cmd
import maya.mel as mel

def selectInfluenceVerts():
    # Select joint then mesh

    objs = cmd.ls(sl = 1)
    if objs and len(objs) == 2:
        jnt, mesh = objs
        if not cmd.ls(mesh, s = 1):
            mesh = cmd.listRelatives(s = 1, ni = 1)[0]
        skinCluster = mel.eval('findRelatedSkinCluster %s' % mesh)
        
        if jnt in cmd.skinCluster(skinCluster, q = 1, inf = 1):
            verts = []
            for x in range(cmd.polyEvaluate( mesh, v = 1)):
                v = cmd.skinPercent(skinCluster, '%s.vtx[%d]' % (mesh, x), transform = jnt, q = 1)
                if v > 0.0:
                    verts.append('%s.vtx[%d]' % (mesh, x))
            cmd.select(verts)

But I really want to know how to get that command to work now.

;p

OK guys, I got it to work. I was missing the edit flag.

use:

skinCluster( ‘skinCluster1’ , e=True , siv=‘Hips’ )

Like magic, it selects verts affected by an influence w/ out scrubbing through each vert. Thanks for the reply, assumptionsoup!