Animation data on Armatures exporting

Hey again everyone, hopfully someone can help me :slight_smile:

I am currently working on an animation exporter for blender 2.63 and have run into issues getting the proper rotation when exporting. The way my program is set up is:

X = Horizontal
Y = Vertical
Z = Depth

however as everyone knows blender does not follow these rules. As far as I can tell is it’s going to probably be altering the matrix in some form however I cannot figure out what I am to do. I am getting the incorrect values and unfortuently I cannot check the values with anything else since its a custom model/skeleton.

So what is happening with the model I am working with is a human and both his arms are animated within 3 keyframes moving forward and then back to where he began. When I export the model and import him into my game his arms just rotate along the y axis and twists a little. Not what we are going for now is it :confused:

So I hope this explains the issue I am having clearly enough! onto the fun stuff…

This is my code thus far. Essentially it takes the ARMATURE object and stores it in a variable called ‘obj’

I loop through the bones in pose within that object (obj.pose.bones)

for bone in obj.pose.bones:
				transbones =[i]
				transbones.transform(EXPORT_GLOBAL_MATRIX * obj.matrix_world)
' % i)
				i += 1
				for keys in keyframes:
					bone.bone.matrix_local *= EXPORT_GLOBAL_MATRIX
					rots = obj.pose.bones[i-1].rotation_quaternion
					fw('%i %.6f %.6f %.6f %.6f %.6f %.6f
' % (scene.frame_current, obj.pose.bones[i-1].location.x, obj.pose.bones[i-1].location.y, obj.pose.bones[i-1].location.z, rots.x, rots.y, rots.z))
				transbones.transform(matr * obj.matrix_world)

Granted I have a few funny looking things to grab index since it’s always going to be exporting in the same order.

So as this goes through each bone it grabs all the keyframes for that bone and exports the data. However like I said previously it almost appears as if its a matrix rotation issue before exporting.

Any help will be greatly appreciated :slight_smile: Thanks!

In bpy_extras.io_utils there is code for axis_conversion. Example of its usage can be found in the bvh import/export addon. It appears you want to convert from Z-Up to Y-Up when exporting.