Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from pymel.core import *
- def grpr(name):
- g = ls(name)
- if g:
- delete(g)
- g = group(n=name,em=1)
- return g
- def getBranches(branches):
- branches = [branches]
- lctList = []# list to save the locations
- catcher = 1000
- while branches:
- # In case I suck
- if catcher == 0:
- break
- catcher -= 1
- source = branches[0]# source starts as root branch
- children = listRelatives(branches[0],c=1)# check for branches
- if children:# if it has children
- if len(children) > 1: # if it has multiple children loop though and add to branching array
- for c in children:
- branches.append(c)
- else: #if only one child
- branches.append(children[0])
- else:# if no children then END
- pass
- lctList.append(source)
- branches.remove(source)# remove finished branch from branching list
- return lctList
- sl = selected()
- grp = grpr("jntLocators")
- for s in sl:
- branches = getBranches(s)
- for b in branches:
- l = spaceLocator()
- pc = parentConstraint(b,l)
- delete(pc)
- parent(l,grp)
Advertisement
Add Comment
Please, Sign In to add comment