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)?
bone matrices are tricky indeed, and i can't tell anything for sure, just some hints:
- explanation of posebone matrices:
- bone matrices:
you may try ArmatureObject.matrix_world * PoseBone.matrix
but you might have to do some fancy calculations, see mhx import / export scripts.
I'm sitting, waiting, wishing, building Blender in superstition...
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.