Page 1 of 1

2.5x PoseBone matrices

Posted: Wed Sep 05, 2012 6:10 pm
by GunHorse
Hello, I am trying to export the pose bone matrices from blender to use in my small application, and the problem is that my application uses absolute matrices. No matter how I try I end up either exporting matrices relative to parent bones or complete nonsense.

Can you explain how I can obtain absolute matrices of bones?

There are 5 different matrices in poseBone - matrix , matrix_basis, matrix_channel, bone.matrix, bone.matrix_local. There is no obvious way to know which space are any of them in. I managed to find out by trial and error that poseBone.matrix_basis gives exactly the type of data I need, but it seems to be relative to something(parent bone or itsellf). What operations should I do with this matrix in order to make it an absolute matrix(a matrix that is relative to the world)?

Posted: Thu Sep 06, 2012 7:17 pm
by CoDEmanX
bone matrices are tricky indeed, and i can't tell anything for sure, just some hints:

- explanation of posebone matrices: ... one.matrix

- bone matrices: ... one.matrix

you may try ArmatureObject.matrix_world * PoseBone.matrix

but you might have to do some fancy calculations, see mhx import / export scripts.

Posted: Tue Sep 11, 2012 2:28 pm
by GunHorse
Ok I've found a workaround. I switched to using a rotation_quaternion+ custom-made translation vector.

It is a stupid solution because all I need is already calculated by blender somewhere, waiting to be used, but it turns out it is easier to re-invent the wheel than figure out where blender hides its pot of gold.

The API documentation has very vague descriptions for struct components. It also occasionally refers to the same thing with different terms, and there is no definition for any of the terms whatsoever. Blender is a fine piece of software, but Lord knows it is documented in no friendly manner.

Posted: Sun Sep 08, 2013 9:57 am
by Deltakosh
I have the same issue.
COuld you share your solution?