列出玛雅大纲中的顶级节点/兄弟姐妹
List top Nodes / siblings in maya outliner
有没有办法只列出 outliner
中的顶部节点,而无需遍历所有深度?
import maya.cmds as cmds
cmds.listRelatives("master", noIntermediate=True)
我有点期待会有像 world
这样的键来搜索大纲中的顶级节点。
示例大纲:
#--- pSphere1
#---group1
------box1
#pSphere2
我只想要 pSphere1
、pSphere2
和 group1
而不是其中的 children。
你要找的是这个:
cmds.ls(assemblies=True)
对于您的示例,它将 return 以下内容:
[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.
有没有办法只列出 outliner
中的顶部节点,而无需遍历所有深度?
import maya.cmds as cmds
cmds.listRelatives("master", noIntermediate=True)
我有点期待会有像 world
这样的键来搜索大纲中的顶级节点。
示例大纲:
#--- pSphere1
#---group1
------box1
#pSphere2
我只想要 pSphere1
、pSphere2
和 group1
而不是其中的 children。
你要找的是这个:
cmds.ls(assemblies=True)
对于您的示例,它将 return 以下内容:
[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.