theodox/minq

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

Opened this issue · 0 comments

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)) )