01/12/2016

BroTools Snippets #02

Saving another couple of clicks in routine work, simple script to select joints influencing skinned mesh. Could not find a 1-click solution for this in Maya. Maybe I just missed something? Anyway, maybe this will be useful for someone. Will just leave it here.

It will select joints influencing all shapes of all selected objects.

In a form that can be used in a shelf:

import maya.cmds as cmds
def selectInfluenceJoints (meshes=None):
    if meshes == None:
        meshes = cmds.ls(sl=1)
    if not isinstance(meshes, list):
        meshes = [meshes]
    cmds.select (cl=True)

    for mesh in meshes:
        shapes = cmds.listRelatives(mesh, c=True, s=True)
        for shape in shapes:
            sk = cmds.listConnections(shape, et=True, t='skinCluster')
            if sk != None:
                for s in sk:
                    influences = cmds.skinCluster (s, q=True, inf=True)
                    cmds.select (influences, add=True)
selectInfluenceJoints()


Copied from my site's blog: http://nixes.ru/?p=639

No comments:

Post a Comment