def meshesFromHistory(control):
'''
Return all visible meshes downstream from a given control.
'''
#try searching backward first for speed
meshes = []
allMeshes = mc.ls(type='mesh')
for mesh in allMeshes:
hist = mc.listHistory(mesh, allConnections=True)
if control in hist:
if isNodeVisible(mesh):
meshes.append(mesh)
if meshes:
return meshes
#if we didn't find any, search forward from control
#this takes a bit longer
hier = mc.listRelatives(control, ad=True, pa=True)
if not hier:
hier = [control]
else:
hier.append(control)
hist = mc.listHistory(hier, future=True, allFuture=True, allConnections=True)
hist = list(set(hist))
meshes = mc.ls(hist, type='mesh')
meshes = [x for x in meshes if isNodeVisible(x)]
return meshes
评论列表
文章目录