Little story about blend files

synopia

Member
Contributor
Architecture
GUI
Hi,

as some of you already know from IRC, I am playing around with blend files (blender saves). This may be totally worthless, but at least I had some exercise with groovy :)

So blend files are somehow interesting. What blender does is just serializing its memory and internal state of all relevant objects into a binary form. In addition (and thats the cool thing), they store the structure of the serialized objects right in the file, too. So its just some lines of groovy code to access all the objects from the blend file.

Extracting the mesh data and bone structure is not that difficult. You may compare the md5mesh exporter python script [1] with the relevant code using the blender importer [2].

The result is much the same in both cases, but my solution creates much more vertices. This is because the py export script uses a triangle tesselator (built in in blender) while my script doesnt. The tesselator outputs triangles, that use shared vertices for connected triangles.

Now the real problem are animations. What the export script does, is playing the animation and capture the bone positions every step. This way, the export script works with every animation feature, blender offers. In contrast, using my blender loader, you can access the actions that lead to a specific animation, but not the actual positions.

However, this may be useful some day or for someone.

[1] http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Import-Export/IdTech4_md5
[2] https://github.com/synopia/blenderloader/tree/master/src/main/groovy/org/terasology/blender/mesh
 
Top