Files
simian/docs/Editor.md
nick 36fd4047dc
Sync Docs to Gitea Wiki / Sync docs to Gitea wiki (push) Failing after 13m56s
CI / build-and-test (push) Failing after 14m19s
fix: scene scripts and asset restore
2026-03-10 20:03:44 +13:00

105 lines
3.0 KiB
Markdown

# Editor Overview
This document outlines the in-app editor UI, its panels, and common workflows.
## Launching the Editor
- Start the app with the editor flag enabled.
- The editor UI appears as dockable panels around the Game Window.
## Layout
- DockSpace host with a top menu bar.
- You can drag and drop to move panels around.
- Panels: Game Window, Scene, Assets, Inspector, Log Viewer.
## Menu Bar
### Game
- Quit: request a clean shutdown.
### Scene
- New: clear the current scene.
- Load: load a scene from a TOML-like file path.
- Save As: save the current scene to a file path.
### View
- Toggle Log Viewer, Scene, and Inspector panels.
- Toggle Assets panel.
## Game Window
- Renders the current scene view.
- Resizes with the available docked panel space.
## Scene Panel
- Displays the entity hierarchy as a tree.
- Drag and drop entities to re-parent.
- Drop on the bottom target to clear parent.
- Create Entity and Delete Selected controls.
## Inspector Panel
- Shows components for the selected entity.
- Add Component dropdown lists only components not yet on the entity.
- Remove buttons appear on removable components.
### Components
- Tag: rename the entity.
- Transform: position, scale, rotation (degrees in UI).
- Velocity: linear and angular velocity.
- Model Renderer: model id, shader id, color, outline.
- Texture: texture id.
- UV Transform: scale, offset, rotation (radians).
- Script: per-entity script path and enabled toggle.
- Camera: position, target, up, FOV, projection, helper actions.
- Light: direction, color, intensity, helper presets.
- Material: material id.
- Render Pass: order, depth flags, shader id.
- World Transform: read-only computed transform.
## Assets Panel
- Browse loaded textures, shaders, models, and materials.
- Load assets by key and path, or create primitive models.
- Unload assets by key.
## Log Viewer
- Shows engine log output in real time.
## Shortcuts
- Ctrl+Q: Quit
- Ctrl+L: Toggle Log Viewer
- Ctrl+N: New Scene
- Ctrl+O: Load Scene
- Ctrl+S: Save Scene
## Notes
- Scene Save and Load use file path text fields.
- Components can be assigned via asset keys in the inspector; numeric IDs remain as a fallback.
- World Transform is computed from hierarchy and local transforms and is read-only.
- UV Transform values are passed as shader uniforms `uvScale`, `uvOffset`, and `uvRotation` when present.
## Scene Scripts
- Scene scripts are loaded by the scene system and run once per scene.
- The editor lets you set a scene-level script path in the Scene panel.
- Preferred scene callbacks: `SceneInit()`, `SceneUpdate(float dt)`, `SceneShutdown()`.
- Legacy callbacks still work: `Init()`, `Update(float dt)`, `Shutdown()`.
## ScriptComponent
- ScriptComponent runs a per-entity script module.
- Set the script path in the Inspector and toggle enabled.
- Preferred callbacks: `EntityInit(uint entity)`, `EntityUpdate(uint entity, float dt)`, `EntityShutdown(uint entity)`.
- Legacy callbacks still work: `Init(uint entity)`, `Update(uint entity, float dt)`, `Shutdown(uint entity)`.
- Subject to change