Combining multiple rigs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey,
I need a little help if possible,
Currently have 4 pieces to my model (head, arms, torso, legs)
Trying to combine them all together onto one rig and then copy the weights over
A lot of the joints in one rig are in another, so there's multiple occurrences of each.
I've tried to make it as simple as possible but it's quite complex, I'm not absolutely terrible at scripting but can't figure this one out so thought I'd turn here for help.
I need to make a script as I'd like to be able to do these characters in batches and make it as quick as possible. Combining the rigs together was the easy part. Just having trouble with the weights
They all get copied over but a couple of them end up really screwed.
Any help is highly appreciated 🙂
Thank you
Here's the script:
#Lock all weights so new joints being added to skinClusters don't effect current weights
for joint in cmds.ls(type="joint"):
if cmds.objExists(joint+".lockInfluenceWeights"):
cmds.setAttr(joint+".lockInfluenceWeights", 1)
#Move new joints to skinClusters
for joint in cmds.ls(type="joint"):
for skinCluster in cmds.ls(type="skinCluster"):
if("COMBINED" not in joint and joint in cmds.skinCluster(skinCluster, query=True, influence=True)):
if("|" in joint):
cmds.skinCluster(skinCluster, edit=True, addInfluence="COMBINED:"+joint.split("|")[-1])
else:
cmds.skinCluster(skinCluster, edit=True, addInfluence="COMBINED:"+joint)
#Unlock all weights
for joint in cmds.ls(type="joint"):
if cmds.objExists(joint+".lockInfluenceWeights"):
cmds.setAttr(joint+".lockInfluenceWeights", 0)
#Transfer weights from old rigs to new rig
for joint in cmds.ls(type="joint"):
for skinCluster in cmds.ls(type="skinCluster"):
if("COMBINED" not in joint and joint in cmds.skinCluster(skinCluster, query=True, influence=True)):
if("|" in joint):
cmds.skinCluster(skinCluster, edit=True, selectInfluenceVerts=joint)
cmds.skinPercent(skinCluster, transformMoveWeights=[joint, "COMBINED:"+joint.split("|")[-1]])
cmds.select(deselect=True)
else:
cmds.skinCluster(skinCluster, edit=True, selectInfluenceVerts=joint)
cmds.skinPercent(skinCluster, transformMoveWeights=[joint, "COMBINED:"+joint])
cmds.select(deselect=True)