Last active
June 19, 2018 09:05
-
-
Save tpoveda/536c577c34202d6940f62e94052a7e56 to your computer and use it in GitHub Desktop.
MaxPlus - Get all scene nodes
This file contains 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
import MaxPlus | |
def get_scene_nodes(): | |
""" | |
Return all nodes in current scene | |
:return: generator<INode> | |
""" | |
stack = [MaxPlus.Core.GetRootNode()] | |
while stack: | |
node = stack.pop() | |
if node != MaxPlus.Core.GetRootNode(): | |
yield node | |
if len(list(node.Children)) > 0: | |
for child in node.Children: | |
stack.append(child) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment