Last active
December 17, 2015 06:28
-
-
Save nrtkbb/9bf77f9844c40261b498 to your computer and use it in GitHub Desktop.
シーン全体をトラバースしてオブジェクト名とapiTypeと親がいくつか(depthと言う)を出力する
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import maya.OpenMaya as om | |
def traverse_all(): | |
dag_iter = om.MItDag( om.MItDag.kDepthFirst, om.MFn.kInvalid) | |
dag_node_fn = om.MFnDagNode() | |
while not dag_iter.isDone(): | |
dag_object = dag_iter.currentItem() | |
depth = dag_iter.depth() | |
dag_node_fn.setObject( dag_object ) | |
name = dag_node_fn.name() | |
print '%s (%s) depth: %d'%(name, dag_object.apiTypeStr(), depth) | |
dag_iter.next() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment