Last active
June 19, 2018 08:59
-
-
Save tpoveda/2335391db8d01bff9ae294f337736600 to your computer and use it in GitHub Desktop.
MaxPlus - Get modifier dependant 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) | |
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