BroTools Snippets #02 - Select joints influencing mesh
2016-12-01
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. Simple, but useful.
It will select joints influencing all shapes of all selected objects. In a form that can be used in a shelf:
Python:
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()
*”BroTools Snippets” section of the blog is about different small parts of my collection of Maya tools and scripts. It is a relatively big Python project, all tools integrate into Maya’s top menu into a new section for ease of use. Tools range from small handy scripts to large auto-rigging and simulation systems, like BroDynamics and BroRig.