There were other problems, like inability to assign matrices from file to EditBones for some reason, but you could at least generate bone head, tail and roll and assign those instead (heavy math).

But 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.

But rotation

Code: Select all

`<Euler (x=1.5708, y=-0.7854, z=-0.0000), order='XYZ'>`

is.

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.

Code: Select all

`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[0][3] = loc.x

newmatrix[1][3] = loc.y

newmatrix[2][3] = loc.z

pose.bones[bonename].matrix = newmatrix