Starter Blender Exporter

I’ve settled on using Blender 2.6 both as a level editor and modeller for my next game (code name BBM). BBM is a 2D game but modelling the characters and rendering the sprites will save a lot of time. Blender isn’t the best level editor but it’s pretty close and suits my needs.

Test Level in Blender

The ability to add arbitrary properties to an object in Blender 2.6 makes Blender a “good enough” fit for me. Certainly it’s flexible enough that it’s usable and will save a lot of time over writing my own stand alone or in game editor.

Editting properties in blender

I had written an export plugin for Blender < 2.6 (many years ago) but the whole python interface has changed so I needed to write a new one. I decided to just export the scene to an XML file which I can post process in to a binary file for loading in to the engine. While this adds a step between the editor and the game it does make the process of writing the exporter and understanding the data a lot more simple. Blender doesn’t offer the perfect environment for writing python plugins so keeping them simple is a good idea.

The exporter is pretty simple. I’m releasing the code under a BSD license. It comes in two parts, export26.py which exports an xml file of the scene and load.py which loads the XML file creating a dictionary of the ‘types’ that the exporter exports.

The loader and exporter are a great starting point to a custom exporter of your own. They are pretty generic at the moment and pretty untested!

export26.py load.py