Blender Python Export BHV Animation

I am trying to write an animation exporter for my engine from Blender, and I have the following code:



            obj = Blender.Object.Get( o )
    
            par = obj.getParent()
            
            
            # Get the armature
            if( par and par.getType() == "Armature" ):
            
                    a = par.getAction()
                    
                    # Get All IPOs
                    for i in a.getAllChannelIpos():
                    
                        # Get curves
                        c = a.getChannelIpo( i )

My questions are:

  1. How can I get the total amount of frame of the current Armature, as well as it’s speed (fps), cuz I can only get the one set for the current scene.

  2. How can I extract the IPO Curve for every actions? I need to extract ALL the LocXYZ, Quaternion WXYZ and SizeXYZ for every frame, in order to associate them to the object current bone.

I can’t figure out out to get theses informations… does someone have pieces of code that can help me…

Tks in advance,

Cheers!

I wrote a function that does exactly this.
it returns an array of IPO compat values for each bone in an armatures action for a range of frames.

see /scripts/bpymodules/BPyArmature.py in blender 2.45, see how /scripts/export_cal3d.py uses it.

Rom222, I hope you continue with this. I know several people that would be interested!

I know I’m interested in it. A BVH exporter is exactly what I’m looking for, and I’m rather ashamed that I don’t know Python nor the Blender API so I can’t make my own.

If you have success, please do share. The only thing I’ve found so far is an old exporter that Ideasman did: http://lists.blender.org/pipermail/bf-python/2004-June/001466.html
and it fails to find children properly for my armature (which was imported from a BVH).