Thanks for the replies! I ended up coming up with an iffy workaround by writing a script that takes two joint lists as input and transfers the skinCluster connections of a mesh from one skeleton to the other. So if you have a rigged mesh called Body and one called Shirt, and each one is skinned to a separate (but duplicate) skeleton, it disconnects the Shirt’s skinClusters from its skeleton, and reconnects it to the Body’s skeleton. Surprisingly, it works, but after running it (in Maya 2014 64bit) the resultant mesh will be kinda messed up. Selecting the root bone and moving it a little fixes it so I’m thinking it’s just a viewport display issue.
def connectJointToSkinCluster(old_source_joints, new_source_joints):
i = 0
for old_joint in old_source_joints:
if cmds.listConnections(old_joint, s=0, p=1, type='skinCluster'):
for dest_conn in cmds.listConnections(old_joint, s=0, p=1, type='skinCluster'):
attr = cmds.listConnections(dest_conn, d=0, p=1)[0].split('.')[1]
cmds.disconnectAttr(cmds.listConnections(dest_conn, d=0, p=1)[0] , dest_conn )
new_joint = new_source_joints[i]
cmds.connectAttr("{0}.{1}".format(new_joint, attr), dest_conn )
i+=1
Now I have a different issue. After successfully running this in a scene where I have a Body, Shirt, Pants, and Hair mesh piece all under a transform node called NewMesh, I need to transfer those weights to a similar mesh created from the same assets, but merged into one simplified (via Simplygon) mesh that’s under a transform called OldMesh.
When I select NewMesh, then OldMesh, and run Skin > Edit Smooth Skin > Copy Skin Weights, it also works surprisingly well and the vert weights from the individual meshes under NewMesh successfully transfer over to the verts in the mesh under OldMesh. However, it fails when I try to do it in script. I even tried selecting the two transforms first, and then running the exact same line of code the command uses.
cmds.copySkinWeights(ss=NewMesh, ds=OldMesh, nm=1, sa='closestPoint', ia=['closestJoint', 'closestBone', 'oneToOne'])
Any ideas? Thanks!