7
$\begingroup$

So, I'm well aware you can export a .blend file to a .obj and read that with pretty standard file i/o in c++.

What I want to know is how to un-obfuscate a .blend file AND

read in the information in the file as text or python code if possible OR just know how a .blend file is structured or how blender stores data and compiles the .blend, and in what order like the data types and data structures stored

because I want to access the information for the materials used, the animations key frames, the composition of the scene, etc.

EDIT: well so far I've found these useful sources

Parsing a blend file by Raging Gazebo

The mystery of the blend file by Jeroen Bakker

plus, his breakdown of the SDNA for v2.56

And this from github for blender file reading linked by user2859

haven't found everything i'm looking but this was a lot of help so far.

edit: there may have been important information one here, but now it's gone anyone know where the blender team moved it to?

edit: i gave up trying to parse the file just did an exporter in blender's python script, i got it to export the mesh data so far in an obj like format, now working on extracting the animation data. i'm using the api ref in mike's answer.

$\endgroup$
13
  • 1
    $\begingroup$ This is what I've been able to find The mystery of the blend $\endgroup$
    – user7952
    Jan 21, 2015 at 23:49
  • $\begingroup$ it's for 2.4 which i know doesn't store its animation the same way as the new versions, anything more updated? $\endgroup$
    – jape670
    Jan 21, 2015 at 23:58
  • 3
    $\begingroup$ of course, that's common courtesy $\endgroup$
    – jape670
    Jan 22, 2015 at 0:16
  • 2
    $\begingroup$ The whole stuff is no mystery. After all it is open source. It's also off topic here. $\endgroup$
    – user2859
    Jan 22, 2015 at 0:48
  • 1
    $\begingroup$ @U.Windl The thing about .blend is, it is more or less a memory dump of blenders internal state and data. Unlike a well defined exchange format it changes with every blender version. So documenting everything is not only pointless but impossible. Pointless, because it is not really intended for exchange or parsing outside of blender. Impossible, because of time constraints and limited team size. $\endgroup$
    – user2859
    Feb 21, 2019 at 14:14

1 Answer 1

8
$\begingroup$

One way is to use Blender's bpy python module.

import bpy
dir(bpy.data)

As you will see from the output, you can access everything from object data to materials to screen layout. Here is the API for BPY.

The bpy module is typically built into Blender, but there are ways to compile it into a standalone Python module that you can load from a regular python file.


Someone has also taken the effort to write and open source a .blend reader in Java here http://homac.cakelab.org/projects/JavaBlend/index.html.

$\endgroup$
2
  • 1
    $\begingroup$ thanks, does this basically show me all the data structs in a blend file in order? edit: it's not the full answer i'm looking for but it helps. $\endgroup$
    – jape670
    Jan 22, 2015 at 6:57
  • 2
    $\begingroup$ Yes, it shows you all the data structs in a blender file. It's by far the easiest/most supported way of accessing a Blend file. $\endgroup$
    – Mike Pan
    Jan 25, 2015 at 2:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .