1
$\begingroup$

I just am just working on a model with a loot of bones. Now I want to lock the bones location of multiple Bones at once. How could I do that?

Thanks in Advance.

$\endgroup$
1
$\begingroup$

With the armature selected and in pose mode this will set the location lock for every bone. You may also want to lock the rotation by setting lock_rotation

import bpy
for b in bpy.context.active_object.pose.bones:
    b.lock_location[0] = True # x
    b.lock_location[1] = True # y
    b.lock_location[2] = True # z

If you want to do it using a preset list of bone names -

bone_list = ['upper_arm.L','upper_arm.R','thigh.L','thigh.R']
for bn in bone_list:
    bone = bpy.context.active_object.pose.bones[bn]
    bone.lock_location[0] = True # x
    bone.lock_location[1] = True # y
    bone.lock_location[2] = True # z
$\endgroup$
  • $\begingroup$ sounds good, I will try it out as soon as possible $\endgroup$ – Marten Zander Oct 6 '15 at 7:42
0
$\begingroup$

You could

  • add in pose mode a bone location constraint to one of those bones,
  • then deselect that bone,
  • select all the others you need to have the same constraint
  • only then select also the bone with the constraint (it must be the last selected - ie it must be the active one)
  • then press the spacebar to bring the search menu and search "copy constraint", and then select "copy constraints to selected BONES" (there is another entry for copying to selected objects, you don't need objects but bones, obviously).
$\endgroup$
  • $\begingroup$ thank you, I wil also give it a shot as soon as possible $\endgroup$ – Marten Zander Oct 6 '15 at 7:43

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.