标签:遇见 clu cluster print node else val port find
你是否在做项目的时候经常会遇见一个物体带权重需要拷贝给其他物体,这时候其他物体多的数不胜数 你怎么办呢?
举例:假如一头狮子 身体你已经做好了,但是模型师把半个身体都做满了垂落的实体模型毛发,你是否感到头疼?,一个个点击拷贝是否会手疼,
别慌,下面的脚本帮你,这是我们在生产中常遇到的问题,这种家常小脚本随手而来,别客气,拿走,不谢
#----------------------------------------------------------------------------------------------------------------------------------------
import maya.cmds as mc
import maya.mel as mel
#选中被拷贝的无权重模型一大堆 最后加选 最终带权重的参考模型执行
mySelect=mc.ls(sl=True)
for a in range( 0,(len(mySelect)-1) ):
SkinNode=mel.eval(‘findRelatedSkinCluster "%s" ‘%mySelect[-1])
SkinNodeTarget=mel.eval(‘findRelatedSkinCluster "%s" ‘%mySelect[a])
if SkinNodeTarget:
pass
else:
allJnt=mc.skinCluster(SkinNode,q=1,inf=1)
mc.skinCluster ( allJnt, mySelect[a], toSelectedBones=1 ,bindMethod =0 ,normalizeWeights =1,weightDistribution= 0 ,mi =5 ,dr= 4 ,rui=0)
mc.select(cl=1)
mc.select(mySelect[-1],mySelect[a])
mel.eval (‘ copySkinWeights -noMirror -surfaceAssociation closestPoint -influenceAssociation oneToOne -influenceAssociation oneToOne -influenceAssociation oneToOne ‘)
mc.setAttr( mySelect[a]+‘.v‘,0 )
print (‘已经拷贝模型>>>>>>>>>>>>>>>>>>: ‘,mySelect[a])
#-------------------------------------------------------------------------------
VX:27971533
欢迎交流
一个权重的物体拷贝权重给多个(oneWeightToMany)
标签:遇见 clu cluster print node else val port find
原文地址:https://www.cnblogs.com/liubingdong/p/9404746.html