In version 2.77a; the docs show that the edit_bone.matrix is no longer read only, but a note warns "does not include bone length". Luckily, edit_bones also have a property length you can set:


The distance from head to tail, when set the head is moved to fit the length.

With that in mind, I tried assigning the matrix, then setting the bone's length:

bone.matrix = bone_imatrix[0:16]
bone.length = 0.1

But when I check the transform of the bone, the bone.length = 0.1 doesn't reflect what the docs said: "head is moved to fit length". (Hopefully they'll allow moving the tail to fit instead of the head.)

enter image description here

Head and tail are still the same, making it invalid, and disappears as soon as I change the mode back to OBJECT.

I tried using bone.transform(bone_imatrix, True, True) but it does nothing (Odd):

print( bone_imatrix )
>> <Matrix 4x4 ( 0.0000, -0.0000, -1.0000, -0.0000)
               (-0.0000,  1.0000, -0.0000,  0.0000)
               ( 1.0000, -0.0000,  0.0000, -0.0000)
               (-0.0000,  1.9815, -0.5483,  1.0000)>

Here are the values I was expecting:

enter image description here

Question: Why is the matrix getting set but not the length? Is there a better way of assigning the bone matrix?


1 Answer 1


I am looking for a similar answer, but I may be able to help.

The "forward" (or "backward" if you see moving from head to tail as moving backward) vector direction is +Z (0,0,1), try setting head to (0,0,0), tail to (0,0,1) and then set length and matrix in that specific order.

The problem I am having is that the custom matrix I set, does not remain the same:

IOW: bone.matrix = custom.matrix, bone.matrix ~= custom.matrix BUT bone.matrix != custom.matrix

my current guess is that my custom matrix coming from a left hand coordinate system is something Blender "fixes" behind the scenes to an equivalent matrix, this however makes it hard to import a model and export to the exact same file that was imported on the first place.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .