Skip to content

Instantly share code, notes, and snippets.

@sanfx
Created July 27, 2013 03:12
Show Gist options
  • Save sanfx/6093531 to your computer and use it in GitHub Desktop.
Save sanfx/6093531 to your computer and use it in GitHub Desktop.
Set the node order in list same as order in DAG
def orderSelectionToList():
""" Set the node order in list same as order in DAG
Returns:
selNodes(List): sorted node order in list as in DAG
"""
selNodes = nuke.selectedNodes()
lastNode = nuke.selectedNode()
if lastNode.dependencies()[0] in selNodes:
return list(reversed(selNodes))
else:
return selNodes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment