Exporting keyframes

I’m trying to export animation from blender, heres what I’e done so far:
*** This is just to give you an idea of what I’m doing and I’ve left out a lot to keep it short.
*** If it’s too confusing or if it’s needed I could post the whole source.

# Get the armature
arm = ob.getData()
# Start at the root bone
for bone in bones:
        if not bone.parent:

def traceBone(bone):
  # Get the channel for this bone

  # Get the loc x, y, z channels

  # Write each location frame
  for frameIndex in  range(frameCount):
    writeFloats(frame_x[1], frame_z[1], frame_y[1])

  # Iv'e done the same for rotation
  writeFloats(frame_w[1], frame_x[1], frame_z[1], frame_y[1])

  # Go through the children
  for child in bone.children:

As far as I can tell this all works fine, the problem is that theses values are offsets,
representing change, but what I need is absolute values representing the location and rotation values of the bone relative to it’s parent.

How do I get the position and rotation relative to it’s parent?

I think instead of Ipo.OB_LOCX it should be Ipo.PO_LOCX. Hope that helps.

Thanks, that could have caused some problems later on,
but these values are still offsets, how much the bone has moved from it’s original position, and what I need is rotation and location relative to it’s parent.