Skip to content

Instantly share code, notes, and snippets.

@tpoveda
Last active June 19, 2018 08:59
Show Gist options
  • Save tpoveda/2335391db8d01bff9ae294f337736600 to your computer and use it in GitHub Desktop.
Save tpoveda/2335391db8d01bff9ae294f337736600 to your computer and use it in GitHub Desktop.
MaxPlus - Get modifier dependant 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)
def find_modifier_dependants(modifier):
"""
Return dependants nodes of a given modifier
:param modifier: MaxPlus.Modifier
:return: generator<INode>
"""
objs = list()
mod_handle = modifier.GetAnimHandle()
scene_node = node.get_scene_nodes()
for n in scene_node:
for m in n.Modifiers:
if m.GetAnimHandle() == mod_handle:
yield n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment