No. I wanted the rotational result in the local space of the bone compared to it’s rest position after channels and constraints applied. The problem here is that we have two kind of Bones. The “normal Bones” (Bone struct) and “posed Bones” (PoseBone struct).

The matrix (.matrix_local) from the Bone struct gives you the position/rotation/scale of the bone in armature/object space.

The matrix (.matrix) from the PoseBone struct gives you the position/rotation/scale of the bone in armature/object space after channels and constraints applied.

What i did to get the difference between the bones rest pose and its current pose in local space was the following:

At first i computed the “difference” between the child and the parent in rest pose. (the transform from parent-space to child-space)

**Mr = Mrp^-1 * Mrc** (rp = rest pose parent, rc = rest pose child)

At second i computed the difference between the child and the parent in transformed pose. (channels + constraints applied)

**Mt = Mtp^-1 * Mtc** (same schematic)

Now i have two new matrices/transforms. Both contain the “offset” between child and parent, while **Mt** also contains the movement in local space in which I’m interested. So i compute a third difference to eliminate the “offset” (contains location/rotation/scale difference in rest pose as well as the parents transform):

**M = Mp^-1 * Mt**

**M** is now a matrix that describes the transform in local space between the childs rest pose and it’s current pose. The rest should be straight forward as described in Conversion between quaternions and Euler angles.

PS: In my example i used a bone with a damped-track constraint as the source. This should probably be eliminated. That means that i should compute this transform as well, because it gives the results i wanted. xrot would be then the difference between local restpose of the child and this “imaginary” bone. Same would go for zrot. yrot would be instead the rotational difference between both bones. (in the example it would be rotational difference between “child” and “damp”, but signed!)

PPS: The *matrix_basis* and *matrix_channel* from PoseBones where useless to me. The first does not respect constraints (but is local). The second is only the animation before constraints are applied.