Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # scale tree
- from pymel.core import *
- #sl = selected()
- """
- def getTrunk(jnt):# gets all children joints
- jnt = jnt
- jntHi = []
- catcher = 100
- x = 1
- while jnt:
- jnt = listRelatives(jnt,c=1)[:1]
- branch = listRelatives(jnt,c=1)[:-1]
- #print "trunk: ",jnt,"branch: ",branch
- """
- if x:
- jntHi.append([jnt])
- x = 0
- else:
- if len(jnt)>1:
- jntHi.append(jnt[:-1])
- else:
- jntHi.append(jnt)
- jnt = listRelatives(jnt,c=1)
- if len(jnt)>1:
- jntHi.append([jnt[0]])
- jnt = listRelatives(jnt[0],c=1)
- """
- if catcher == 0:
- break
- catcher -= 1
- """
- def getBranch(jnt):# main recurser
- trunk = jnt
- trunkHi = []
- branches = []
- catcher = 100
- x = 1
- while trunk:
- trunk = listRelatives(trunk,c=1)[:1]
- branch = listRelatives(trunk,c=1)
- print branch
- if trunk:
- trunkHi.append(trunk)
- if branch:
- branches.append(branch)
- # just in case
- if catcher == 0:
- break
- catcher -= 1
- #------------
- return trunkHi, branches
- for s in sl:
- branch = s
- catcher = 100
- search = 1
- while search:
- trunk, branch = getBranch(branch)
- #print "trunk ", trunk, "branch ", branch
- if not branch:
- search = 0
- break
- # just in case
- if catcher == 0:
- break
- catcher -= 1
- #------------
- #trunk = getTrunk(s)
- #print branch
- """
- for t in trunk:
- l = spaceLocator(n=str(t)+"_save")
- pc = parentConstraint(t,l)
- delete(pc)
- """
Advertisement
Add Comment
Please, Sign In to add comment