Get all skinned mesh and/or all skinClusters in a scene


#1

Hey guys,

i’m trying to find a way to get all the skinned meshes in a scene (and also how to get all the skinClusters in a scene) in python, without hardcoding the name of any geo or skincluster.

I’m clueless right now, help! :banghead:

Thanks!


#2

pymel

import pymel.core as pm
 
 skinClusters = pm.ls(typ='skinCluster')
 
 skinnedMeshes = []
 
 for node in skinClusters:
 	skinnedMeshes.append( node.outputGeometry.connections() )
 
 
 # or as a list comprehension
 skinnedMeshes = [a for b in [node.outputGeometry.connections() for node in skinClusters] for a in b]

#3
import maya.cmds as cmds
clusters = cmds.ls(type='skinCluster')
meshes = set(sum([cmds.skinCluster(c, q=1, g=1) for c in clusters], []))