Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Batch aim
- # Select objects, then target
- from pymel.core import *
- def getPiv(s):
- currentSceneScale = currentUnit(q=1, l=1)
- tempSceneScale = currentUnit(l = "cm")
- select(s)
- setToolTo('Move')
- piv = manipMoveContext('Move', q=True, p=True,m=2)
- return piv
- currentUnit(l = currentSceneScale)
- def makeBufferGrp(s):
- cl = getPiv(s)
- p = listRelatives(s,p=1)
- g = group(n="{0}_bufferGrp".format(s),em=1)
- move(g, cl)
- oc = orientConstraint(s,g)
- delete(oc)
- if p:
- parent(g, p)
- parent(s, g)
- return g
- sl = selected()
- aimList = sl[:-1]
- aimer = sl[-1]
- for s in aimList:
- g = makeBufferGrp(s)
- ac = aimConstraint(aimer, g,weight=1 ,aimVector =[0 ,0, -1], upVector= [0, 1, 0], worldUpType="scene")
Advertisement
Add Comment
Please, Sign In to add comment