Previous Thread  Next Thread

chat icon 2.5x PoseBone matrices

GunHorse

Posted: Wed Sep 05, 2012 5:10 pm
Joined: 05 Sep 2012
Posts: 2
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)?
Reply with quote


CoDEmanX

Posted: Thu Sep 06, 2012 6:17 pm
Joined: 05 Apr 2009
Posts: 680
bone matrices are tricky indeed, and i can't tell anything for sure, just some hints:

- explanation of posebone matrices:
http://www.blender.org/documentation/blender_python_api_2_63_17/bpy.types.PoseBone.html#bpy.types.PoseBone.matrix

- bone matrices:
http://www.blender.org/documentation/blender_python_api_2_63_17/bpy.types.Bone.html#bpy.types.Bone.matrix

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...
Reply with quote


GunHorse

Posted: Tue Sep 11, 2012 1:28 pm
Joined: 05 Sep 2012
Posts: 2
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.
Reply with quote


 
Jump to:  
Powered by phpBB © 2001, 2005 phpBB Group