Last active
September 28, 2019 22:57
-
-
Save Roumenov/8b6602d58bfea23a440c021335ce5fdb to your computer and use it in GitHub Desktop.
bunch of messy procs for moving skinweights to bind joints and then contraining them to the prior
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#bunch of messy procs for moving skinweights to bind joints and then contraining them to the prior | |
import pymel.core as pm | |
target_mesh = pm.ls(sl=1)[0]# unpack selection | |
target_skinCluster = target_mesh.listHistory(type='skinCluster')[0] # pm.mel.findRelatedSkinCluster(target_mesh) should also work | |
source_influence, target_influence = pm.ls(sl=1)[0:2]# unpack selection | |
target_skinCluster.addInfluence(target_influence, weight = 0.0) | |
constraint = pm.parentConstraint (source_influence, target_influence, mo = 1, weight = 1) | |
constraint.setAttr('interpType', 2) | |
pm.scaleConstraint(source_influence, target_influence, mo = True) | |
uf.meta_make_child(source_influence, target_influence) # TODO: replace this with the red9 version | |
pm.select(target_mesh+".vtx[*]") | |
pm.skinPercent(target_skinCluster, tmw=[source_influence, target_influence]) # the data from the first will be written to the second | |
pm.select(cl=1) | |
target_skinCluster.removeInfluence(source_influence) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this is limited to 1:1 mapping between influences
should query existing influences, then add the new value to any existing value