Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a canonical way to recurse up the hierarchy or the history #10

Open
theodox opened this issue Jun 26, 2018 · 0 comments
Open

add a canonical way to recurse up the hierarchy or the history #10

theodox opened this issue Jun 26, 2018 · 0 comments

Comments

@theodox
Copy link
Owner

theodox commented Jun 26, 2018

it's pretty simple do to this upstream -- but not downstream because of possible branching.

Here;s an example for the hierarchy; the history would be similar.

def joint_parent(target):
    # walk up to the first joint parent of <target> or None
    def recurse_up(m):
        upstream = cmds.listRelatives(m, p=True)
        if upstream:
            yield upstream[0]
            for item in recurse_up(upstream[0]):
                yield item   

    return Stream( (i for i in recurse_up(target)) )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant