def combinClusters(): clusterHandles = cmds.ls(sl=True) for cluster in clusterHandles: clusterTransform = cluster clusterDeformer = cmds.connectionInfo('%s.worldMatrix[0]' % clusterTransform, dfs=True)[0].split('.')[0] if cmds.nodeType(clusterDeformer) == 'cluster': DeformerLib.combineCluster(clusterHandles, True)
def transferReversedWeights(fromMesh, toMesh, fromDeformer, toDeformer): deformerTool = DeformerLib.WeightListTool(fromMesh, fromDeformer) weightList = deformerTool.reverseWeightList() deformerTool.__init__(toMesh, toDeformer) 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 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 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
def meshToCluster(): fromMesh = cmds.ls(sl=True)[0] toMesh = cmds.ls(sl=True)[1] DeformerLib.createClusterFromMesh(fromMesh, toMesh)
def combinClusters(): clusterHandles = cmds.ls(sl=True) DeformerLib.combineCluster(clusterHandles, True)
def softSelToCluster(): DeformerLib.createClusterFromSoftSelection('SoftSelection_CL')
def extrapToExistingDeformer(deformer): sel = cmds.ls(sl=True) transform = sel[0] meshes = sel[1:] DeformerLib.extrapWeightsToExistingDeformer(transform, meshes, deformer)
def extrapToCluster(sel): transform = sel[0] meshes = sel[1:] DeformerLib.extrapToCluster(transform, meshes)
def flipClusterWeights(deformer, prefix, oppPrefix, direction, axis, table): DeformerLib.flipDeformerWeights(deformer, prefix, oppPrefix, direction, axis, table)
def extrapToCluster(sel): transform = sel[0] meshes = sel[1:] DeformerLib.extrapToCluster(transform,meshes)
def mirrorDeformerWeights(deformerName,prefix,oppPrefix,direction ,axis, table): DeformerLib.mirrorDeformerWeights(deformerName, prefix, oppPrefix, axis,direction, table )
def flipClusterWeights(deformer,prefix,oppPrefix,direction ,axis, table): DeformerLib.flipDeformerWeights(deformer, prefix, oppPrefix, direction, axis, table)
def mirrorDeformer(transform,deformerName,prefix,oppPrefix,direction ,axis, table): DeformerLib.mirrorCluster(transform, deformerName, prefix, oppPrefix,direction,axis, table )
def meshToCluster(): fromMesh = cmds.ls(sl = True)[0] toMesh = cmds.ls(sl = True)[1] DeformerLib.createClusterFromMesh(fromMesh, toMesh)
def combinClusters(): clusterHandles = cmds.ls(sl = True) DeformerLib.combineCluster(clusterHandles,True)
def mirrorDeformer(transform, deformerName, prefix, oppPrefix, direction, axis, table): DeformerLib.mirrorCluster(transform, deformerName, prefix, oppPrefix, direction, axis, table)
def loadClusters(): filePath = cmds.fileDialog2(dialogStyle = 4,okc = 'Open', cap = 'Open') clusterDict = DeformerLib.WeightListTool.readWeights(filePath[0]) DeformerLib.loadClusters(clusterDict)
def mirrorDeformerWeights(deformerName, prefix, oppPrefix, direction, axis, table): DeformerLib.mirrorDeformerWeights(deformerName, prefix, oppPrefix, axis, direction, table)
def loadClusters(): filePath = cmds.fileDialog2(dialogStyle=4, okc='Open', cap='Open') clusterDict = DeformerLib.WeightListTool.readWeights(filePath[0]) DeformerLib.loadClusters(clusterDict)
def softSelToCluster(): try: DeformerLib.createClusterFromSoftSelection('SoftSelection_CL') except: pass
def extrapToExistingDeformer(deformer): sel = cmds.ls(sl = True) transform = sel[0] meshes = sel[1:] DeformerLib.extrapWeightsToExistingDeformer(transform,meshes,deformer)