After the header, a .blend
file is a run of blocks, each a header and a body of bytes, up to an
ENDB block. A body is usually an array of C structures exactly as they
were in Blender’s memory, and the SDNA says
what each structure looks like. This page follows Blender’s
BLO_core_bhead.hh. Numbers use the byte order the header gives.
Block headers
There are three layouts. Files with the 12-byte header use the first or second, by their pointer size; files with the 17-byte header always use the third.
| Field | BHead4 (4-byte pointers) | SmallBHead8 (8-byte pointers) | LargeBHead8 (Blender 5.0) |
|---|---|---|---|
code | 0, 4 bytes | 0, 4 bytes | 0, 4 bytes |
len | 4, i32 | 4, i32 | 16, i64 |
old | 8, u32 | 8, u64 | 8, u64 |
SDNAnr | 12, i32 | 16, i32 | 4, i32 |
nr | 16, i32 | 20, i32 | 24, i64 |
| size | 20 bytes | 24 bytes | 32 bytes |
| Field | Meaning |
|---|---|
code | what the block is: a block code or an ID code (below) |
len | the length of the body in bytes |
old | the address the data had in memory when it was saved; it serves as the block’s identifier |
SDNAnr | which SDNA structure the body holds |
nr | how many of those structures the body holds, 1 for a single one |
A pointer inside a structure holds the old address of the block it
points to, or 0. A reader keeps a map from old addresses to the blocks it
has loaded and uses it to rebuild the pointers.
4F 42 00 00 58 05 00 00 08 F2 4A 1C 01 00 00 00 9C 00 00 00 01 00 00 00
OB, a 1,368-byte body, old
address 0x11C4AF208, structure 156, one of itBlock codes
| Code | Holds |
|---|---|
REND | render information for each scene: the start and end frame and the scene name, so other programs can read them without parsing the whole file |
TEST | the thumbnail preview: width and height as two 32-bit integers, then the RGBA pixels; written between REND and GLOB and ignored when the file is loaded |
GLOB | the FileGlobal structure: the current scene and screen, file flags, the build of Blender that saved it, and similar |
USER | the user preferences (UserDef), in the preferences file |
DATA | data owned by the data-block before it, such as a mesh’s vertex arrays or an object’s modifiers |
DNA1 | the SDNA, near the end of the file |
ENDB | the end of the file: a block header with no body |
ID codes
A data-block (an object, a mesh, a material…) starts with a block whose code is
two letters followed by two zero bytes, as in OB for an object. Its
body begins with the ID structure, which holds the name; the name’s
first two characters repeat the code, as in OBCube. DATA
blocks with its parts follow it.
| Code | Data-block | Code | Data-block | Code | Data-block |
|---|---|---|---|---|---|
SC | scene | KE | shape key | WM | window manager |
LI | library (linked file) | WO | world | MC | movie clip |
OB | object | SR | screen | MS | mask |
ME | mesh | VF | vector font | LS | Freestyle line style |
CU | curve (legacy) | TX | text | PL | palette |
MB | metaball | SK | speaker | PC | paint curve |
MA | material | SO | sound | CF | cache file |
TE | texture | GR | collection | WS | workspace |
IM | image | AR | armature | LP | light probe |
LT | lattice | AC | action | CV | curves (hair) |
LA | light | NT | node tree | PT | point cloud |
CA | camera | BR | brush | VO | volume |
PA | particle settings | GD | Grease Pencil (legacy) | GP | Grease Pencil |
Files from Blender 2.4x and earlier can also hold IP blocks (IPO
animation curves), which later versions convert on loading.
Order of a file
RENDblocks, one per scene.- The
TESTthumbnail, when there is one. GLOB.USER, in the preferences file only.- The data-blocks, each an ID-code block followed by its
DATAblocks. DNA1.ENDB.
Readers should not rely on this order beyond the header coming first and
ENDB last: they find the SDNA by its code and the blocks by their
addresses.