拷贝物体权重工具

拷贝物体权重工具

import maya.cmds as mc
import maya.mel as mm


def window_copy_skin():
            
    if mc.window("copy_skin",ex=True):
        mc.deleteUI("copy_skin")
    mc.window('copy_skin',title='拷贝权重到布料简模')
    mc.columnLayout(adjustableColumn=True)
    mc.text(label='先选择绑定模型,再加选目标物体,然后点击\'执行\'按钮')
    mc.button(label='执行',command='copy_skin_oto()')
    mc.showWindow()

def copy_skin_oto():

    one_one_list=mc.ls(sl=True)
    
    ss_skin = mm.eval("findRelatedSkinCluster "+one_one_list[0])
    
    
    for i in one_one_list[1:]:
        

    
        if ss_skin.split(":")[-1][:4]=="skin":
    
            get_joint_list=mc.listConnections('%s.matrix'%ss_skin)
            
            ds_skin=mc.skinCluster(get_joint_list,i,tsb=True)
            
            mc.copySkinWeights(ss=ss_skin,ds=ds_skin[0],noMirror=True,surfaceAssociation='closestPoint',ia='oneToOne')
            
        else:
                      
            skin_Cluster = mc.listConnections('%s.inputPolymesh'%ss_skin[0])
            
            get_joint_list=mc.listConnections('%s.matrix'%skin_Cluster[0])
            
            ds_skin=mc.skinCluster(get_joint_list,i,tsb=True)
            
            mc.copySkinWeights(ss=skin_Cluster[0],ds=ds_skin[0],noMirror=True,surfaceAssociation='closestPoint',ia='oneToOne')


window_copy_skin()






上一篇:Python Requests IP直连


下一篇:《吊打面试官》系列-Redis常见面试题