Why are bone pose matrices always orthogonal?

Here’s the thing: skewed bones are very useful when scripting advanced muscleatures. Unfortunately, as far as I know, Blender orthogonalizes all bone pose transforms, always.

After adding a single bone to an empty scene:

>>> bpy.data.objects['Armature'].pose.bones['Bone'].matrix
Matrix(((1.0, 0.0, 0.0, 0.0),
        (0.0, 0.0, -1.0, 0.0),
        (0.0, 1.0, 0.0, 0.0),
        (0.0, 0.0, 0.0, 1.0)))

>>> bpy.data.objects['Armature'].pose.bones['Bone'].matrix[0][1] = 1
>>> bpy.data.objects['Armature'].pose.bones['Bone'].matrix

Matrix(((0.9297882318496704, 0.520564615726471, 0.0, 0.0),
        (0.0, 0.0, -1.0, 0.0),
        (-0.3680947422981262, 1.3149192333221436, 0.0, 0.0),
        (0.0, 0.0, 0.0, 1.0)))

(rounding errors removed for easier reading)

The resulting matrix is not useful to me. What I was hoping for would look like this:

Matrix(((1.0, 1.0, 0.0, 0.0),
        (0.0, 0.0, -1.0, 0.0),
        (0.0, 1.0, 0.0, 0.0),
        (0.0, 0.0, 0.0, 1.0)))

Does anyone know why Blender’s bones need to be orthogonal at all times?

I’ve noticed it’s not limited to bone transforms. Every object’s world matrix will always be orthogonal, and an object’s local matrix will lose its shear as soon as you interact with said object. Right now I’m pretty sure that it has to do with the 4×4 matrices being converted to translation, rotation and scale elements and back again, losing all other information in the process. This is actually a pretty big limitation that will need fixing at some time.

Anywho, I’ll consider this one [SOLVED] until proven wrong. :yes:

Have a good one!