def get_skin_clusters(nodes):
"""Get the skinClusters attached to the specified node and all nodes in descendents.
:param nodes: List of dag nodes.
@return A list of the skinClusters in the hierarchy of the specified root node.
"""
if isinstance(nodes, basestring):
nodes = [nodes, ]
all_skins = []
for node in nodes:
relatives = cmds.listRelatives(node, ad=True, path=True) or []
relatives.insert(0, node)
relatives = [shortcuts.get_shape(node) for node in relatives]
for relative in relatives:
history = cmds.listHistory(relative, pruneDagObjects=True, il=2) or []
skins = [x for x in history if cmds.nodeType(x) == 'skinCluster']
if skins:
all_skins.append(skins[0])
return list(set(all_skins))
评论列表
文章目录