Created
May 28, 2012 10:17
-
-
Save KelSolaar/2818351 to your computer and use it in GitHub Desktop.
Maya Ascendants Walker
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 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