有没有一种方法只列出outliner中的顶级节点,而不遍历所有深度?
import maya.cmds as cmds
cmds.listRelatives("master", noIntermediate=True)我有点期待会有一个像world这样的键来搜索出口线中的顶级节点。
出口项目实例:
#--- pSphere1
#---group1
------box1
#pSphere2我只想要pSphere1,pSphere2和group1,而不是他们的孩子。
发布于 2018-03-18 05:47:51
你要找的是:
cmds.ls(assemblies=True)
对于您的示例,它将返回以下内容:[u'persp', u'top', u'front', u'side', u'pSphere1', u'group1', u'pSphere2']
您可以通过名称、对象类型(摄像机)或使用cmds.camera来确定相机是否是默认摄像机,从而筛选出相机:
cmds.camera("front", q=True, startupCamera=True) # Would return True.
https://stackoverflow.com/questions/49328227
复制相似问题