Editor architecture — the data-flow spine
The editor is small and deliberately one-directional: user input mutates a single store, and everything downstream rebuilds from it. Knowing these modules is enough to find your way around the editor source (which the engine philosophy expects you to read). This is a terminal tour of that spine (real captured output below).
Editor architecture — the data-flow spine
# transcript pending capture — run: node site/media/capture-cli.mjs site/media/capture-cli.mjs -
The core modules. The
lsshows the data-flow spine:editor-store.ts— central state: entity tree, selection, tools, undo stack.scene-sync.ts— converts store entities → Three.js objects (prefab resolution, shading).entity-factory.ts— creates the actualObject3Ds from entity descriptors.editor-viewport.ts— the renderer, OrbitControls, TransformControls, raycast selection.main.tsx— the entry point (mounts<AppRoot />). The RAF render loop and global keyboard shortcuts (registerEditorHotkeys) actually live incomponents/ViewportPanel.tsx.action-registry.ts/command-listener.ts— named editor actions and the command bus the palette / CLI / SDK drive.play-mode.ts— runs the real engine loop inside the editor for play-testing.
-
State is one reactive source. The
grepconfirmseditor-storeexposes its state throughuseSyncExternalStore— React’s official external-store hook. The UI subscribes to it, and so does scene-sync; a store mutation is the only thing that triggers a rebuild.
Recap
New functionality
- Listed the editor's core modules and what each owns
- Confirmed state is a single useSyncExternalStore source
New concepts & skills
- One-way flow: store mutation → scene-sync rebuild → viewport render
- entity-factory builds Object3Ds from descriptors; scene-sync orchestrates it
- the action-registry/command-listener bus is what the palette, CLI, and SDK drive
Next lesson → Scene I/O