Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # bake to world
- from pymel.core import *
- timeLine = [1,34]
- worldLocations = []
- sl = selected()
- for s in sl:
- doScale = listRelatives(s, p=1)[0].getScale()
- if doScale[2] < 1:
- doScale = 1
- else:
- doScale = 0
- saveL = spaceLocator(s, n = s+"_tempSave")
- parent(saveL, s)
- setAttr(saveL.translate, 0,0,0)
- setAttr(saveL.rotate, 0,0,0)
- parent(saveL, w=1)
- pc = parentConstraint(s,saveL, mo=1)
- add = s, saveL, doScale
- worldLocations.append(add)
- for i in range(timeLine[0],timeLine[1]):
- currentTime(i, u=1)
- for l in worldLocations:
- setKeyframe(str(l[1])+".translate")
- setKeyframe(str(l[1])+".rotate")
- setAttr(str(l[1])+".blendParent1", 1)
- for l in worldLocations:
- delete(l[1].listRelatives(c=1)[1])
- parent(l[0],w=1,r=1)
- pc = parentConstraint(l[1],l[0])
- for i in range(timeLine[0],timeLine[1]):
- currentTime(i, u=1)
- for l in worldLocations:
- setKeyframe(str(l[0])+".translate")
- setKeyframe(str(l[0])+".rotate")
- setAttr(str(l[0])+".blendParent1", 1)
- for l in worldLocations:
- delete(l[0].listRelatives(c=1))
- if l[2]:
- scale(l[0], 1,1,-1)
Advertisement
Add Comment
Please, Sign In to add comment