Creating a python export script for Blender

Community Forums/General Help/Creating a python export script for Blender

ubergeek(Posted 2009) [#1]
Hi,

I am trying to use Blender as a tool for some custom animation with very specific requirements. None of the built in exporters quite work, and it would be much more convinent to use a custom format. Python isn't that hard for me, but Blender's API is a little strange.

Could someone please help me turn this pseudocode into working code? :-)

[edit]: Sorry, forgot a couple lines here. It was very late when I posted this!

get selected armature
  foreach animation in that armature
    write animation name
    foreach frame in animation
      foreach bone in armature
        write bone's name
        write bone's rotation matrix and/or XYZ rotation in that frame


Any help would be greatly appreciated!


D4NM4N(Posted 2009) [#2]
Cant you just look at the existing code for the exporters and work out the 'gist' of the IO from that?

I reccomend printing it and getting the ol pen out. :)


ubergeek(Posted 2009) [#3]
That's what I've been trying to do on and off for the past two weeks.

Blender's API has little to no documentation to speak of, and reverse engineering the exporters is proving to be very difficult as there is tons and tons of stuff specific to that exporter, and comments are few and far between.

I can get the selected armature and write info on it to a file, but I haven't a clue how it handles animation or getting the individual bones. And they're kinda important... If someone could help me with those two points I might be able to work out the rest.

I reccomend printing it and getting the ol pen out. :)

Pen? What's that? ;-)