In Blender 2.6 API, PoseBone is used for animating a bone. PoseBone.matrix is one way to do that. API says PoseBone.matrix is in "object space".
PoseBone.matrix is nothing I've seen at all. I still can't get my animation importer working. What's the deal with PoseBone.matrix? In Blender 2.4 API there were two matrices: one in local space, one in armature space.
But the new PoseBone.matrix is neither! It's not a local matrix:
Position isn't local, it's global.
<Euler (x=1.5708, y=-0.7854, z=-0.0000), order='XYZ'>
So what is this "object space" that the API says PoseBone.matrix is in?
I'm trying to assign my armature-space matrices to a hierarchial armature and I can't get them right.
I tried decomposing the matrices I have, undoing parent rotations then recomposing the matrix again before setting it as "PoseBone.matrix". It just doesn't work.
oldmatrix = myMatrix loc, rot, scale = oldmatrix.decompose() #rot = rot * pose.bones[bonename].parent.rotation_quaternion.conjugated() for i in pose.bones[bonename].parent_recursive: rot = rot * i.conjugated() newmatrix = rot.to_matrix().to_4x4() newmatrix = loc.x newmatrix = loc.y newmatrix = loc.z pose.bones[bonename].matrix = newmatrix