Skip to content

Instantly share code, notes, and snippets.

@tpoveda
Last active June 19, 2018 09:05
Show Gist options
  • Save tpoveda/536c577c34202d6940f62e94052a7e56 to your computer and use it in GitHub Desktop.
Save tpoveda/536c577c34202d6940f62e94052a7e56 to your computer and use it in GitHub Desktop.
MaxPlus - Get all scene nodes
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