Skip to content

Instantly share code, notes, and snippets.

@KelSolaar
Created May 28, 2012 10:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KelSolaar/2818351 to your computer and use it in GitHub Desktop.
Save KelSolaar/2818351 to your computer and use it in GitHub Desktop.
Maya Ascendants Walker
import maya.cmds as cmds
def ascendantsWalker(path, visitor=None):
parents = cmds.listRelatives(path, allParents=True, fullPath=True)
if not parents:
return
for parent in parents:
visitor and visitor(parent)
yield parent
for value in ascendantsWalker(parent):
yield value
for parent in ascendantsWalker("cornerPanels_001_null__uid07952"):
print parent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment