Skip to content

Instantly share code, notes, and snippets.

@Roumenov
Last active September 28, 2019 16:49
Show Gist options
  • Save Roumenov/e38b4d18fb3c644e348fed476985744a to your computer and use it in GitHub Desktop.
Save Roumenov/e38b4d18fb3c644e348fed476985744a to your computer and use it in GitHub Desktop.
move skinCluster weight values from one influence to another
import pymel.core as pm
#select the mesh, the source influence, and the target influence you want to move weights to
target_mesh, source_influence, target_influence = pm.ls(sl=1)[0:3]# unpack selection
target_skinCluster = target_mesh.listHistory(type='skinCluster')[0] # pm.mel.findRelatedSkinCluster(target_mesh) should also work
#verts = target_mesh.select("pSphere1.vtx[*]")
target_skinCluster.addInfluence(target_influence, weight = 0.0)
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