def transferReversedWeights(fromMesh, toMesh, fromDeformer, toDeformer): deformerTool = DeformerLib.WeightListTool(fromMesh, fromDeformer) weightList = deformerTool.reverseWeightList() deformerTool.__init__(toMesh, toDeformer) deformerTool.setWeightList(weightList)
def transferWeights(fromMesh, toMesh, fromDeformer, toDeformer): deformerTool = DeformerLib.WeightListTool(fromMesh, fromDeformer) membershipList = deformerTool.getMembershipList() weightList = deformerTool.getWeightList() deformerTool.__init__(toMesh, toDeformer) deformerTool.setMembershipList(membershipList) deformerTool.setWeightList(weightList)
def transferMirroredWeights(fromMesh, toMesh, fromDeformer, toDeformer, axis, direction, table): deformerTool = DeformerLib.WeightListTool(fromMesh, fromDeformer) weightList = deformerTool.mirrorWeightList(axis, direction, table) deformerTool.__init__(toMesh, toDeformer) deformerTool.setMembershipList(weightList[1]) deformerTool.setWeightList(weightList[0])
def clusterWeightToJoints(geo,cluster,jointFrom,jointTo): weightTool = DeformerLib.WeightListTool(geo,cluster) weightList = weightTool.getWeightList() print weightList skincluster = SkinningTool.getSkinCluster(geo)[1] print skincluster skinningTool = SkinningTool(skincluster,geo) influences = skinningTool.getInfluencesFromSkincluster() for i in range(influences.length()): cmds.setAttr('%s.liw'%influences[i].fullPathName(), 1) cmds.setAttr('%s.liw'%jointFrom, 0) cmds.setAttr('%s.liw'%jointTo, 0) skinningTool.setWeights(GenAPI.getDagPath(jointTo), weightList) print jointFrom,jointTo