Community
Maya Animation and Rigging
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya animation topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Symmetrize skeleton already bound to mesh? Or easier way to transfer skeleton/weights to another mesh?

4 REPLIES 4
Reply
Message 1 of 5
brandon.feist
376 Views, 4 Replies

Symmetrize skeleton already bound to mesh? Or easier way to transfer skeleton/weights to another mesh?

Hi, apologies if this is a really obvious question. I've spent a couple hours scouring through google and the Autodesk forums with not much luck on a solution.

 

I'm trying to change the position of a skeleton that is currently bound to an existing mesh (with the end results being that it matches another mesh I made so I can transfer the weights and bind the skeleton to that mesh). My previous solution was that I would create a copy of the skeleton and then delete the limbs that weren't moved into position and then mirror the limbs that were in the correct position. I would then create an animation key for that limb and copy it. I would go back to the original skeleton and paste the animation key for that skeleton causing it to go into the right place without me having to manually edit the transforms for each joint. I am having an issue now where this method does not work very well anymore as the hand joints get messed up when pasting the animation key on to the other limb.

 

I was wondering if I'm missing something or if there's an easier way to match a skeleton to another mesh to transfer the weights, etc?

 

I've posted a video showing how I went about it down below!

Labels (1)
4 REPLIES 4
Message 2 of 5
mcw0
in reply to: brandon.feist

I'm assuming you created the skeleton symmetry by mirroring the joints along with behavior.  Meaning that if you grabbed both shoulder joints and rotated on the Y axis, you would end up with a mirrored pose.  If that is the case, all you have to do is write yourself a little script that grabs the rotation values of the left side joints and apply those values to the right side joints.  No duplicating or mirroring of joints needed.  Or setting keyframes.  Much cleaner way to go.

Message 3 of 5
mcw0
in reply to: brandon.feist

I noted your naming convention.  So first, grab all left side joints from the clavicle down.  Select the left clavicle joint.  (Hopefully, all of your joints are uniquely named).

 

string $jts[] = stringArrayCatenate(`listRelatives -ad -pa -type "joint"`, `ls -sl`);

for($jt in $jts)

{

    string $mirror = `substitute "_l_" $jt "_r_"`;

    float $rot[] = `getAttr ($jt+".r")`;

    setAttr -type double3 ($mirror+".r") $rot[0] $rot[1] $rot[2];

}

Message 4 of 5
brandon.feist
in reply to: mcw0

Hey this was really helpful, I still need to figure out how to mirror transformations. I tried multiplying the transformation by -1 but that didn't work as I expected because it looks like the transformation value being negative or positive is relative to the parent or something.

This is what I had made, made some modifications to account for locked joints. Thinking I might just have to make a custom script that changes the XYZ coords to negative or positive depending on where it is in the joint hierarchy.

string $jts[] = stringArrayCatenate(`listRelatives -ad -pa -type "joint"`, `ls -sl`);
for($jt in $jts)
{
string $mirror = `substitute "_l_" $jt "_r_"`;

float $rot[] = `getAttr ($jt+".r")`;
float $translate[] = `getAttr($jt+".translate")`;

if (catch(`setAttr -type double3 ($mirror + ".r") $rot[0] $rot[1] $rot[2]`))
{
print ("Could not set " + $mirror + ".r");
}

// Multiplying by -1 doesn't work due to the comment I made above
if (catch(`setAttr -type double3 ($mirror + ".translate") ($translate[0]*-1) ($translate[1]*-1) ($translate[2]*-1)`))
{
print ("Could not set " + $mirror + ".translate");
}
};

// I could make a separate transform script that I can change the XYZ negative/positive values depending on the joints
Message 5 of 5
mcw0
in reply to: brandon.feist

How did you initially mirror your joints?  Did you use mirror behavior function?  If you did, then both left and right sides would have the exact same rotation values for a mirrored pose.  No negating needed.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report