# Transferring skinning weights between 2 joints

#1

Does someone know how to transfer the skinning weights between 2 joints?

I thought what I want to do is simple but it seems that transferring skin is actually complicated and slow. Now I don’t mind it being slow that much I think I won’t need to use to use it all that much, but I’m in quite the pickle because I need to get this function to work asap because it’s blocking me in creating my game.

The script attached does not work, it’s only an attempt to show what I’m trying to do.

``````def transfer_skin_to_new_joint(oldJoint, newJoint):
clusters = get_skin_clusters(oldJoint);
for skin in clusters:
print("==> Transferring in cluster: " + skin + " | jnt1: " + oldJoint + " to jnt2: " + newJoint)
#if (cmds.skinCluster(influence=True, query=True)) #get the joints in the cluster, if not in, add it
#cmds.skinCluster(skin, edit=True, addInfluence=joint2, wt = 0);
transfer_skin_between_joints(skin, oldJoint, newJoint);
#cmds.skinCluster(skin, edit=True, removeInfluence=joint1)

def transfer_skin_between_joints(skinCluster, joint1, joint2):
vertices = cmds.skinCluster(skinCluster, selectInfluenceVerts=joint1)
for v in vertices:
print (v)
# joints = cmds.skinCluster(skinCluster, query=True, inf=True)
# for j in joints:
#     print(j)
cmds.select(vertices, r=True)
cmds.skinPercent(skinCluster, transformValue=[(joint1, 0), (joint2, 1)])

def get_skin_clusters(joint):
all_skins = []
skins = list(set(cmds.listConnections(joint, type="skinCluster")))
for skin in skins:
print(skin)
all_skins.append(skin)
return list(set(all_skins))``````

#2

#3

This might help you out, if you are trying to switch skinning between skin clusters on diffrent meshes, make sure both are skinned to the same joints and then use the maya copy weights tool, but to just move skinning from one joint to another this will work for you.

#4

If all you’re trying to do is take the joint influence from “LeftArm” to “Arm_L” this shouldn’t be too hard.
I’ve done something similar like so:
Save the skins with Brave Rabbit transferSkinCluster
Search and replace names
Import weights

This of course only works if the skeletons are the same aside from naming.

#5

You can do that with the built in export skin weights as well, it saves an XML file you can edit. But to just swap weights from one joint to the other, the built in Maya tool I show in the video works quick and well enough.

#6

Hi
I have put up a script on Highend3D.com Hope it helps you
Regards,
Prem