1
$\begingroup$

Hi I would like to mirror the left hand's bones to the right hand's bones, I have constrained some of them and limit their rotation in one hand (I think I put the x-mirror too late, very late ) , however it seems x-mirror does not work, or not update ...so I have one hand with the constraint and the other have not any contraints. How can I mirror the constraint (location and rotacion ) from one hand to the other?

$\endgroup$
2
$\begingroup$

To do what you want it will be easier to use python. I wrote a script that copies constraint from bones with ".L" to corresponding bones with ".R"

import bpy
context = bpy.context
scene = context.scene
arm = bpy.data.objects["Armature"]
bpy.ops.object.select_all(action='DESELECT')
arm.select = True
bpy.context.scene.objects.active = arm
bpy.ops.object.posemode_toggle()
bpy.ops.pose.select_all(action='SELECT')
all_bones = bpy.context.selected_pose_bones
for bone in all_bones:
    bpy.ops.pose.select_all(action='DESELECT')
    if ".L" in bone.name:
        boneL = arm.data.bones[bone.name]
        boneR = arm.data.bones[bone.name.replace('.L','.R')]
        boneR.select = True
        boneL.select = True
        arm.data.bones.active = boneL
        bpy.ops.object.constraints_copy()
        bpy.ops.pose.constraints_copy()
        for con in arm.pose.bones[boneR.name].constraints:
           con.subtarget = con.subtarget.replace('.L','.R')

Another way to do it without Python is to use the Copy Constraint, which involves manual work to be done, you select an object then add a Copy Constraint, then select which other object you want to copy the property from (location, rotation). So no need for paste constraint.

$\endgroup$
  • $\begingroup$ another way? thanks by the way. $\endgroup$ – Reifus Rufus Feb 5 '17 at 3:54
  • $\begingroup$ @ReifusRufus answer updated. The good thing about the python way is that it's automatic, the other way involved doing everything manually. $\endgroup$ – Tak Feb 5 '17 at 3:59
  • $\begingroup$ I prefer manual for the rigging process, should I paste that code in the editor script? I do not a big fan of python . but I think I should paste the code and see what happened in an extra windows for the editor? $\endgroup$ – Reifus Rufus Feb 5 '17 at 4:38
  • $\begingroup$ @ReifusRufus It's up to you. To run the code, open a text editor, new, then paste the code and replace "Armature" with the name of your armature e.g "My_Armature" then run the script. This script will copy all constraints of bones ending with .L to bones with same name but .R $\endgroup$ – Tak Feb 5 '17 at 4:41
  • $\begingroup$ I converter my armature the "metarig" all the constraints that I need use the metarig as a target. so I need to put "metarig" instead ".armature" $\endgroup$ – Reifus Rufus Feb 5 '17 at 4:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.