1
$\begingroup$

For understanding Blender better, I'd like to decode what's in a .blend file.

If the output were usable as input to a text-based diff program, that would be perfect (allowing to compare different files).

I'm aware that these .blend files may contain binary data, and I saw unanswered question "Compare two blender files".

If there'd be a mapping of ".blend -> text representation -> .blend" (re-creating the original file from the text representation), I could even version-control .blend files (a real-life requirement IMHO).

Update 1:

After many hours of programming I'm closer to a solution, but I'm having trouble with some "pointers", having many diffs like this:

-Bone.Bone DATA.*parent 29ce15fe9788
+Bone.Bone DATA.*parent 29cd1e23ad88

I did already try to convert absolute pointers to relative ones, but I'm unsure where pointers actually point to: Inside file-blocks only, or even across file-blocks? (I did not resolve pointers yet)

The other thing is how to interpret pointers. For example right at the start of a file I have:

# First line is the whole Link struct, then a relative dump for each component
# The decoding is "types names" where each is hierarchic, not actual C syntax
0024:  01 00 00 00  fa 00 00 00  53 63 65 6e  65 00 00 00  |........ Scene...|
0000:  01 00 00 00  fa 00 00 00                            |........ |
Link.Link REND.*next fa00000001
0008:  53 63 65 6e  65 00 00 00                            |Scene... |
Link.Link REND.*prev 656e656353

So there are (unless my decoding is wrong) two pointers, *next, and *prev; the first looks more or less OK (despite of being unaligned), but the second looks very much like a text string. So what is the magic with these pointers?
Other pointers look different:

# the pointers below are decoded relative to some base address...
0008:  48 64 f8 05  cf 7f 00 00  28 66 f8 05  cf 7f 00 00  |Hd...... (f......|
0000:  48 64 f8 05  cf 7f 00 00                            |Hd...... |
IDProperty.IDPropertyData.ListBase.void DATA.data.group.*first 29cd1f16e8c8
0008:  28 66 f8 05  cf 7f 00 00                            |(f...... |
IDProperty.IDPropertyData.ListBase.void DATA.data.group.*last 29cd1f16eaa8
$\endgroup$
  • $\begingroup$ As far as I know, that's impossible. $\endgroup$ – Sava Dec 31 '18 at 3:51
  • $\begingroup$ @Sava Why? Please explain! $\endgroup$ – U. Windl Jan 2 at 18:20
  • $\begingroup$ I don't know. I would advise you to take that question to the blender developers list directly and see what they tell you. Then give us the reply here. $\endgroup$ – Sava Jan 3 at 1:05
  • $\begingroup$ @Sava If you don't know, please don't say "It's impossible". $\endgroup$ – U. Windl Jan 4 at 22:55
  • $\begingroup$ I found some description of the file format as a starting point for writing a tool: [ en.blender.org/index.php/Dev:Source/Architecture/File_Format ] (The blend-file-format) $\endgroup$ – U. Windl Jan 5 at 1:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.