次级骨骼生成

#
#此脚本在python中运行
#
#选择所需要的面,执行脚本即可生成次级控制骨骼
#
#对话框中输入角色名字 如:“xr_JYB_L_brown_”,"xr_JYB_mouth_"
#
#如遇到旋转,可将locator属性 fixPolyFlip 打开。

import maya.cmds as mc
import maya.mel as mm
jntg = []
aShape = []

selFace = mc.filterExpand( ex=1, sm=34 )

for h in selFace:
    mm.eval('cMuscleSurfAttachSetup()')
    a = mc.ls(sl=1)
for p in range(len(selFace)):
    mc.select(cl=1)
    jnt = mc.joint(n="jnt_%d_ctrl"%p)
    jntg.append(jnt)
    mc.select(cl=1)
   
for (w,e) in zip(a,jntg):
    mc.parent(e,w)
    mc.setAttr("%s.t"%e,0,0,0)

for j in jntg:
    mc.setAttr('%s.sx'%j,cb=0,l=1,k=0)
    mc.setAttr('%s.sy'%j,cb=0,l=1,k=0)
    mc.setAttr('%s.sz'%j,cb=0,l=1,k=0)
    mc.setAttr('%s.rx'%j,cb=0,l=1,k=0)
    mc.setAttr('%s.ry'%j,cb=0,l=1,k=0)
    mc.setAttr('%s.rz'%j,cb=0,l=1,k=0)
    mc.setAttr('%s.visibility'%j,cb=0,l=1,k=0)
    mc.setAttr('%s.radius'%j,cb=0,l=1,k=0)
for q in a:
    c = mc.listRelatives(q,s=1)
    aShape.append(c[0])
   
for r in aShape:
    mc.setAttr("%s.overrideEnabled"%r,1)
    mc.setAttr("%s.overrideVisibility"%r,0)

def reNa(name):
    mc.select(jntg,a)
    objects = mc.ls(sl=1)
    [mc.rename(k,"%s%s"%(name,k))for k in objects]
   
mc.window()
mc.columnLayout(adj=1)
mc.textFieldButtonGrp("nameFTG",l="name",bl="doIt",bc="doIt()")
mc.showWindow()

def doIt():
    text = mc.textFieldButtonGrp("nameFTG",q=1,tx=1)
    reNa(text)

你可能感兴趣的:(C++,c,python,脚本,J#)