Created
September 19, 2017 03:46
-
-
Save gabosalinas/1ac35d407398232a327e50b12f43b6a2 to your computer and use it in GitHub Desktop.
ZTR,OFFSET,TRF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import maya.cmds as cmds | |
def extraControl(objs=[],nameSuf='ZTR' , nameOffset='OFS', nameTrf='TRF' , nameCNT='CNT' , rad = 14 ) : | |
for obj in objs: | |
print obj | |
if '|' in obj: | |
obj=obj.split('|')[-1] | |
if '_' in obj: | |
newName=obj.split(obj.split('_')[-1:][0])[0] | |
else: | |
newName=obj | |
ztr=cmds.group(em=True,n=str(newName + '_' + nameSuf)) | |
pcns=cmds.parentConstraint(obj,ztr)[0] | |
scns=cmds.scaleConstraint(obj,ztr)[0] | |
cmds.delete(pcns,scns) | |
trf = cmds.duplicate(ztr,n=str(newName + '_' + nameTrf))[0] | |
off = cmds.duplicate(ztr,n=str(newName + '_' + nameOffset))[0] | |
cmds.parent(off,ztr) | |
cmds.parent(trf,off) | |
cmds.parent(obj,trf) | |
sel=cmds.ls(sl=1) | |
cnts=extraControl(sel) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment