cwisbg

#makeBufferGrp

Aug 28th, 2014
419
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.79 KB | None | 0 0
  1. #makeBufferGrp
  2. from pymel.core import *
  3. def makeBufferGrp():
  4.     sl = selected()
  5.     for s in sl:    
  6.         print s
  7.         name = s.split("|")[-1]
  8.         grpCheck = ls("{0}_bufferGrp".format(name))
  9.         if grpCheck:
  10.             p = listRelatives(grpCheck,p=1)
  11.             c = listRelatives(grpCheck,c=1)
  12.             if p:
  13.                 parent(c,p)
  14.             else:
  15.                 parent(c, w=1)
  16.             delete(grpCheck)
  17.         pap = listRelatives(s,p=1)
  18.         if pap:
  19.             g = group(n="{0}_bufferGrp".format(name),em=1,p = pap[0])
  20.         else:
  21.             g = group(n="{0}_bufferGrp".format(name),em=1,w=1)
  22.         pc = parentConstraint(s,g)
  23.         delete(pc)
  24.         makeIdentity( g, a=1,t=1,r=1,s=1, n=0)
  25.         parent(s, g)
  26. makeBufferGrp()
Advertisement
Add Comment
Please, Sign In to add comment