2.5x PoseBone matrices

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

GunHorse
Posts: 2
Joined: Wed Sep 05, 2012 5:39 pm

2.5x PoseBone matrices

Postby GunHorse » Wed Sep 05, 2012 6:10 pm

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)?

CoDEmanX
Posts: 894
Joined: Sun Apr 05, 2009 7:42 pm
Location: Germany

Postby CoDEmanX » Thu Sep 06, 2012 7:17 pm

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/bl ... one.matrix

- bone matrices:
http://www.blender.org/documentation/bl ... one.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...

GunHorse
Posts: 2
Joined: Wed Sep 05, 2012 5:39 pm

Postby GunHorse » Tue Sep 11, 2012 2:28 pm

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.

Deltakosh
Posts: 3
Joined: Sun Sep 08, 2013 9:56 am
Location: Paris

Postby Deltakosh » Sun Sep 08, 2013 9:57 am

I have the same issue.
COuld you share your solution?
Creator of babylon.js - www.babylonjs.com


Return to “Python”

Who is online

Users browsing this forum: No registered users and 1 guest