Project Session
The editor is a single binary that boots into a Hub screen
when no project is open and into the editor view once one is.
SafiProjectSession is that switch: hub_active decides which UI the
debug overlay draws, and project records the
currently-open project.
Opening a project re-roots the asset system, loads the default scene into the live world, and bumps the recents list. Closing clears the world and returns to the Hub. The same window, renderer, and world are reused throughout.
Struct
The component is declared and defined inside project_session.c rather than
in the central component registry, so worlds that never install a session
(such as the gltf_viewer sample) are unaffected — the accessors below guard
on the component id being zero and report "no Hub".
API
installregisters the singleton. Passstart_in_hub = truewhen the editor launched without a--projectargument.openre-roots assets toinfo->path, loads its default scene, touches recents, and switches to the editor view. Returnsfalse(and stays in the Hub) if the scene fails to load.closeclears the world and returns to the Hub.
Typical use
The editor binary wires it up in main:
The Hub UI calls open when a project is picked, and the
Scene panel's Close Project button calls close.
See also
- Project I/O — produces the
SafiProjectInfopassed toopen - Hub UI — the launcher screen this drives
- Scene Serialization —
safi_scene_load/_clear, used by open / close - Editor Hub guide