1. Object Categories & Material Slots
When generated, the addon creates separate objects based on your merge configuration. Each object carries a fire_maze custom property tag for reliable cleanup.
| Object Name | Material Slot | Description |
|---|---|---|
FireMaze_Floor | FireMaze_Floor (Dark gray) | All floor tiles. |
FireMaze_Walls | FireMaze_Walls (Mid-gray) | Side faces of walls, optimized to remove hidden internal faces. |
FireMaze_Roof | FireMaze_Roof (Medium gray) | All roof/ceiling tiles. |
FireMaze_WallEndCaps | FireMaze_WallEndCaps (Reddish) | Caps on wall endpoints in Thin Wall mode. Merged into FireMaze_Walls when Single Wall Object is enabled. |
FireMaze_Stairs | FireMaze_Walls (Mid-gray) | Generated staircase or ramp geometry. |
FireMaze_Guide | FireMaze_Guide (Neon green) | Neon emissive path curve, tube, or ribbon showing the shortest route. |
Material Notes
- All materials are auto-generated with a simple principled BSDF shader using a unique color per category.
- You can replace or modify materials after generation — the addon does not overwrite existing materials on rebuild.
2. Collection Structure
Maze Collection
Each maze generation creates a new top-level collection (e.g. FireMaze, FireMaze.001, FireMaze.002, etc.) containing all generated objects. The naming auto-increments to avoid conflicts.
The collection stores a serialized JSON custom property named fire_maze_data containing:
- Grid dimensions (width, depth, rings)
- 3D cell states (wall flags, mesh indices per direction, floor/roof/stair indices)
- Entrance and exit coordinates with side orientations
- Wall mode and grid type
- Shape boundary and smooth edge settings
- Schema version
This data property is the single source of truth for interactive editing and session management. The viewport editor and rebuild operators read it directly, ensuring seamless operation across file loads and session restores.
Prop Sub-Collections
Prop and decor objects are grouped under a scoped sub-collection named FireMaze_Props_{parent_name} (e.g. FireMaze_Props_FireMaze). This sub-collection is:
- Linked as a child of the main maze collection.
- Tagged with a
fire_maze_datacustom property so it is included in Clear Maze operations.
Active Collection Detection
The addon resolves the active maze collection through _get_active_maze_collection():
- First checks
scene.fire_maze.fire_maze_collection_namefor a stored collection name. - Falls back to scanning
bpy.data.collectionsfor any collection with afire_maze_datacustom property. - If exactly one candidate is found, it is used as the active collection.
3. Session Management
FireMaze supports full session serialization to .json files, allowing you to save and reload complete maze configurations.
Save Session
Operator: MAZE_OT_save_session — fire_maze.save_session (ExportHelper, .json extension)
Exports the following to a JSON file via a file dialog:
- All scalar properties — Every property in
PROP_NAMES(integers, floats, strings, booleans, and vector tuples) is serialized by value. - Pointer references — Mesh, collection, image, and object pointers are stored by name (not packed into the JSON). This includes:
custom_floor_mesh,custom_wall_mesh,custom_roof_mesh(Mesh datablocks)custom_floor_collection,custom_wall_collection,custom_roof_collection(Collections)custom_stair_mesh,custom_ramp_mesh(Object pointers)prop_torch_mesh,prop_chest_mesh,prop_door_mesh(Object pointers)mask_image(Image datablock)
- Full maze layout data — The serialized cell grid (
fire_maze_dataJSON from the maze collection).
.blend file, matching datablocks must already exist in the scene. External custom assets are not packed or recreated.Load Session
Operator: MAZE_OT_load_session — fire_maze.load_session (ImportHelper, .json extension)
Opens a .json session file and:
- Reads the schema version for forward-compatibility handling.
- Restores all scalar properties from the
propertiesdict. - Re-links pointer references by looking up datablock names with
bpy.data.images.get(),bpy.data.collections.get(),bpy.data.meshes.get(), andbpy.data.objects.get(). - Recreates the maze collection, applies the serialized cell data, and triggers a full rebuild of all mesh objects.
- Clears the autosave recovery warning if one was present.
If a referenced datablock no longer exists, the corresponding property is set to None rather than failing the entire load.
Serialization Format
{
"schema_version": 1,
"properties": {
"width": 10,
"depth": 10,
"algorithm": "dfs",
"custom_wall_collection": "MyWalls",
"mask_image": "my_mask.png",
...
},
"maze_data": "{...serialized cell JSON...}"
}
4. Autosave & Crash Recovery
The addon automatically saves the current session to a temporary file every time a maze is generated, providing crash recovery.
Autosave File
- Location: System temp directory —
{tempdir}/firemaze_autosave.json - Trigger: Written at the end of every successful maze generation.
- Content: Same format as a manual session save (all properties + cell data).
- Threading: Written on a background thread using atomic file replacement to avoid corruption.
Recovery Flow
- On addon registration,
has_autosave()checks for the existence offiremaze_autosave.jsonin the temp directory. - If found, a warning box appears in the Session & Image Management panel with two buttons:
- Restore Session — Loads the autosave file, deserializes all properties and cell data, rebuilds the maze, and writes an acknowledgement file.
- Discard — Deletes the autosave file and acknowledgement file from disk.
- An acknowledgement sidecar file (
firemaze_autosave_ack.json) is written on successful restore to prevent the recovery prompt from reappearing on subsequent Blender restarts.
Acknowledgement File
- Location:
{tempdir}/firemaze_autosave_ack.json - Purpose: Persists the fact that the user has acknowledged/restored the autosave. On addon startup, if this file exists, the recovery warning is suppressed.
5. Image Export
Export the maze layout as a black-and-white image showing walls as black and walkable cells as white.
Create Blender Image
Operator: MAZE_OT_save_as_image — fire_maze.save_as_image
Generates an in-memory Blender Image datablock named FireMaze_Layout. Useful as a reference minimap or for external editing in the Image Editor.
- Cube Mode: 1 pixel per cell (width × depth resolution).
- Thin Mode: 3× upscaled (width × 3 by depth × 3 resolution) to render individual wall segments at pixel resolution.
- Only available for Rectangular grids. Returns an error for Polar grids.
Save PNG to Disk
Operator: MAZE_OT_save_image_file — fire_maze.save_image_file (ExportHelper, .png extension)
Same rendering logic as Create Blender Image, but saves directly to a PNG file on disk via a file dialog. A temporary Image datablock is created, saved, and immediately removed from the database.
6. Clear Maze
Operator: MAZE_OT_clear — fire_maze.clear
Completely removes all maze-generated content from the scene:
- Object removal — Scans
bpy.data.objectsfor any object with afire_mazecustom property tag, removes each object, and cleans up orphaned mesh and curve datablocks (those with zero users whose name starts withFireMaze). - Collection removal — Iterates
bpy.data.collectionsand removes any collection that carries afire_maze_datacustom property. Handles parent-child unlinking to avoid RuntimeErrors. - State reset — Clears
fire_maze_collection_nameon the scene properties. - Memory sweep — Orphaned datablocks (meshes, curves) that were left with zero users are purged from the database to prevent memory leaks.
7. Session & Image Management Panel
UI Location: VIEW3D_PT_fire_maze_session — Session & Image Management
The panel is divided into two sections:
Session Management Box
- Save Session... / Load Session... — Side-by-side buttons for manual session file operations.
- Conditional Crash Recovery — Only visible when a leftover autosave file exists:
- Warning alert box with info icon.
- Restore Session button — Triggers
fire_maze.restore_autosave. - Discard button — Triggers
fire_maze.discard_autosave.
Masking & Image Export Box
- Load Mask from Disk... — Opens file browser for PNG, JPG, BMP, or TGA images. Assigns the loaded image to the mask property.
- Selected Mask — Dropdown to pick an existing Blender Image datablock.
- Invert Mask Colors — Toggle.
- (Masking controls are hidden when grid type is Polar, with a label explaining the restriction.)
- Save PNG to Disk... — Exports layout to
.png. - Create Blender Image — Creates
FireMaze_Layoutdatablock.
8. Best Practices
Custom Assets Across Machines
Pointer references (meshes, collections, images) are stored by name only. To reliably share sessions:
- Use consistent datablock naming across
.blendfiles. - Consider appending or linking common asset libraries before loading a session.
- External image files for masking should be available at the same relative paths or re-assigned after loading.
Scene Cleanup
- Use Clear Maze before generating a new maze in the same scene to prevent collection name collisions.
- The
fire_mazeobject tag andfire_maze_datacollection property are the authoritative markers. Manually renaming maze collections or objects may cause the addon to lose track of them.
Autosave
- The autosave file is stored in the system temp directory — it may be cleared by temporary file cleanup utilities or disk space management. Save important work as a named
.jsonsession file. - Only the most recent generation is autosaved. Each generation overwrites the previous autosave.