Import script and deviated animation

Hello there,

I decided to register here, so this is my first post, hoping that I can get some help in problem I have.
I have made one OpenGL program that animates some meshes I have.
After that I decided to go for Blender importer and after two weeks learning Python, and browsing through messy documentation I have finally succeeded to import vertex data, create vertex groups, rig character and make animation.

Everything is fine except that animation is “deformed”, I can recognize but it is weird. After searching through net I am totally confused and doesn’t have a clue what to do.
Some of my conclusions:

  • Open GL and Blender don’t have same coordinate system. One is left, other right handed, can be a problem
  • I am not sure how final matrices are calculated in Blender for bones, so there can be also a problem
  • Is there any chance that Pose bones are affected by Edit bones? Edit bones are imported as unit values. They have position only, but there is a possibility that Blender calculates something as difference between tail and head part. It shouldn’t be important but who knows.

And something about import process:
OpenGL calculates all bones and puts in file as raw transformations (not multiplied by parent): quaternions, scales and transposes. Every value is set on appropriate keyframe, hoping that Blender will transforms them appropriately.
Browsing these datas manually give exact values that I have passed to import script, I see them on GUI part in Pose Mode.

But again animation is not perfect. It’s twisted.

Any suggestion and help is welcome.

Thanks in advance