Editor Hub

The Hub is the first screen the editor shows. It lists your recent projects and lets you create a new one or open an existing folder. Picking a project loads it into the same window — the editor re-roots its asset system and opens the project's default scene in place. There is no second process and no inter-process handoff.

This is milestone M0 of the Editor roadmap.

Why one process? MicroUI rendering is bound to the GPU renderer, so a "lean launcher with no rendering" isn't possible — any Hub that draws UI stands up the full GPU stack anyway. Folding the Hub into the editor binary as a view removes all IPC and makes switching projects instant.

Launching

# Show the Hub
./build/editor/safi_editor

# Skip the Hub and open a project straight away
./build/editor/safi_editor --project /path/to/MyGame

Running with --project jumps straight into the editor. If that project fails to load, the editor falls back to the Hub so you can pick another.

The three tabs

  • Projects — your recent projects, newest first. Click a row to open it; the x button removes a stale entry from the list. A project whose folder was deleted shows an error toast instead of opening.
  • New — enter a name, choose a parent folder, pick a template, and Create. The project is scaffolded on disk and opened immediately.
  • Open — browse to an existing folder. It must contain a project.safi.json, otherwise the Hub reports it is not a SafiEngine project.

Once a project is open, < Close Project at the top of the Scene panel clears the world and returns to the Hub.

The recent-projects list is stored per-user at SDL_GetPrefPath("SafiEngine", "Hub")/recents.json (on macOS, ~/Library/Application Support/SafiEngine/Hub/recents.json), capped at 32 entries and tolerant of a corrupt file — a bad store is treated as empty.

Project structure on disk

safi_project_create scaffolds this layout by copying a template directory verbatim, then stamping the project's name and engine version into the descriptor:

MyGame/
├── project.safi.json          # name, engine version, default scene
├── assets/                    # models / textures / audio
│   ├── models/
│   ├── textures/
│   └── audio/
└── scenes/
    └── main.scene.json        # the default scene the editor opens

project.safi.json (schema v1):

{
  "version": 1,
  "name": "MyGame",
  "engine_version": "0.3.0",
  "default_scene": "scenes/main.scene.json",
  "asset_root": "assets",
  "shader_root": null
}

shader_root: null means the project uses the engine's built-in shaders. Asset paths inside scene files are relative to the project root, so a project folder is portable across machines.

Templates

New projects start from a bundled template under SafiEngine/templates/:

TemplateContents
emptyA camera and a directional light. A blank canvas.
3d_starterCamera, sun + sky light, and four procedural primitives (floor plane, box, sphere, capsule). No external asset files.

Both templates are authored entirely as scene JSON with no binary assets, so they stay small and copy instantly.

Under the hood

The Hub is implemented across a few engine modules:

  • Project I/Oproject.safi.json read / write / scaffold, plus the recents list.
  • Project Session — the runtime singleton that switches between the Hub view and the editor view and performs open / close.
  • Hub UI — the MicroUI launcher screen itself.

The debug overlay draws the Hub in place of the Scene/Inspector panels while no project is open, and the gltf_viewer sample — which never installs a session — is unaffected.

See also