在控制器上添加屬性鏈接到模型shape的display type

# -*- coding:utf-8 -*-
# Author:RDS
#在控制器上添加屬性鏈接到模型shape的display type
import maya.cmds as mc
#cmds.ls(nt=True)
lsall = mc.ls(sl=True)
lsobjshape = mc.listRelatives(lsall , type = 'mesh' )
lscvshape = mc.listRelatives(lsall , type = 'curveShape')
lscv = mc.listRelatives(lscvshape[0] , parent = True , type = 'transform')
mc.addAttr(lscv[0] , ln = 'display_type' , at = 'enum' , en = 'Normal:Template:Reference' , k = True)

for i,data in enumerate(lsobjshape):#用for in循環索引值
    mc.setAttr(data+'.overrideEnabled' , 1)
    mc.connectAttr(lscv[0]+'.display_type' , data+'.drawOverride.overrideDisplayType')
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章