Editor Settings Registry And Workspace Presets
Purpose
Use the settings registry to expose typed, searchable editor, project, export, and preview values with stable paths, defaults, validation, and explicit apply policy. Use workspace presets to switch the main dock to a task-focused tool arrangement without discarding tools the author already opened.
These systems have separate ownership and persistence boundaries. EditorSettingsRegistry owns setting metadata and typed bindings into EditorShellState; export_settings.rs owns the shipped config/exported_game.json; standalone_preview_preferences.rs owns editor-local preview overrides. EditorWorkspacePresetRegistry owns preset metadata, default selection, dock regions, and tab order from assets/editor/workspaces.json; EditorDockLayoutPreset remains a compatibility request key. Dock layout and general workspace UI posture are saved as separate local documents.
Steps
Edit Settings Safely
-
Open Engine Settings from the main toolbar and use search, scope filters, and Modified only to locate a descriptor. Search matches the stable path, label, summary, category, scope, value type, and apply-policy label.
-
Identify the setting by its stable path, not its display label. Current path families are:
editor/viewport/...for live editor overlay posture;project/authoring/...for project authoring detail;export/...for shipped standalone defaults; andeditor/preview/...for local standalone-preview overrides.
Paths must be globally unique in
EDITOR_SETTING_DESCRIPTORS. They are lookup and automation contracts and should not be renamed merely to improve UI wording. -
Check the scope and apply policy shown beside the setting. The current descriptors use:
- Live (
Immediate) for viewport posture and authoring density; - Save required (
SaveRequired) for values bound toconfig/exported_game.json; and - Apply preview (
PreviewApply) for values bound to the editor-local preview document.
RestartRequiredexists in the policy type for future descriptors but is not currently assigned to a setting. - Live (
-
Enter a value within the descriptor's type and bounds. Integer and float controls enforce ranges, choices must be one of the registered options, required text must be non-empty, and HTTP URLs must start with
http://orhttps://. The UI usesset_draft_value, so a temporarily invalid text draft remains visible with its validation error;set_valuerejects semantic invalidity before mutation and is the appropriate API for non-UI callers. -
Persist according to the binding owner.
- Live editor/project values update shell state immediately. Workspace posture, including authoring density and viewport overlay state, is captured into local workspace UI state on the editor's throttled persistence pass.
- Export values remain an in-memory form until Save Export Settings succeeds. Saving normalizes and validates the full exported settings document before atomically writing the authoring asset
config/exported_game.json. - Preview values remain separate from export defaults. Apply Preview Only saves
editor_standalone_preview_settings.jsonunder the local config root and queues a preview-only apply. Sync Preview From Export Defaults intentionally replaces the preview draft from export defaults, saves it, and queues apply.
-
Use the per-setting Reset to restore that descriptor's registered default. For export or preview settings, follow the normal save/apply action afterward. Reset Saved Defaults rewrites shipped export defaults but deliberately leaves preview overrides untouched. Reset UI Posture resets workspace UI state, not the dock layout and not either standalone settings document.
Apply Or Extend A Workspace Preset
-
Choose a preset from the dock/workspace controls or Scene Command Center. The shipped stable IDs are
worldbuilding,scene_wiring,characters, andatmosphere. Labels and summaries come fromassets/editor/workspaces.json; the enum keeps matching fallback strings for recovery. -
When applied, the request reattaches detached dock tabs, builds the preset from manifest dock regions, tab order, and split ratios, and preserves every enabled, already-open or previously detached tab as an extra tab. Tool IDs resolve through
EditorToolRegistry; disabled extension tools are omitted. The manifest'sdefault_presetalso drives the initial registry-built layout. -
Let the editor persist the result. Dock topology is stored under the local config root as
aether_editor_dock_layout.jsonwith schema version 14. Workspace UI posture is independently stored asaether_editor_workspace_ui_state.jsonwith schema version 4 and includes active workbench, authoring density, collapsed lanes, event filters and incident state, Engine Settings sections, viewport overlay posture, per-scene UI state, surface mementos, and route history. Both use atomic writes and a 0.75-second minimum auto-persist interval. -
To add a setting, add a typed binding read/write path, a default function, and one
EditorSettingDescriptor. Keep the descriptor path unique; choose the real scope, type validation, apply policy, and persistence target. If a new value belongs to shipped export or local preview state, extend that schema and its validation/migration tests instead of storing it generically in the registry. -
To add a preset, update the
EditorDockLayoutPresetcompatibility enum,ALL, stableid()mapping, and fallback label/summary. Add a version-1 manifest descriptor with a unique non-empty ID, label, summary, at least one tool placed underdock, unique tool IDs across every region, and each ratio in0.1..=0.9. Every tool must be registered and owned by an editor extension. Change top-leveldefault_presetwhen the new preset should become the startup layout. -
Verify settings, presets, persistence, and documentation:
cargo test -p aether registry_paths_are_unique_and_cover_all_scopes cargo test -p aether typed_validation_rejects_invalid_values_before_mutation cargo test -p aether shipped_workspace_manifest_exposes_four_complete_presets cargo test -p aether workspace_manifest_drives_preset_tools_and_split_ratios cargo test -p aether editor_dock_layout_preset_preserves_user_opened_tabs cargo run -p xtask -- docs-check --root .
Expected Outputs
- A searchable descriptor for every exposed setting, with one stable path, typed value, default, scope, validation rule, apply policy, and concrete binding.
- Invalid drafts displayed for correction, while validated programmatic writes reject invalid values without changing state.
- Shipped export settings and local preview overrides persisted to different documents with explicit save/apply actions.
- A valid version-1 workspace manifest whose stable tool IDs resolve to registered, extension-owned tools and whose dock regions own placement and tab order.
- Preset application that changes the intended arrangement while preserving user-opened tabs.
- Independently recoverable dock-layout and workspace-posture documents under the local config root.
Common Mistakes
- Using a display label as a setting or preset key. Labels can change; descriptor paths, preset IDs, and tool IDs are compatibility contracts.
- Adding registry metadata without a binding or persistence owner.
EditorSettingsRegistrydoes not provide generic storage. - Calling
set_draft_valuefrom automation and assuming the value is valid. Draft writes enforce the runtime variant only so the UI can show semantic errors. - Editing export settings and expecting them to persist without Save Export Settings, or editing preview values and expecting the shipped export asset to change.
- Resetting an export descriptor but forgetting to save, or using Reset Saved Defaults when the intended target was the local preview override.
- Adding a tool to
workspaces.jsonwithout registering it inEditorToolRegistryand claiming it inassets/editor/extensions.json. - Placing one tool in multiple dock regions or relying on a dock descriptor anchor to override manifest placement.
- Treating workspace presets, dock persistence, and workspace UI posture as one document. They recover and reset independently.
Recovery Paths
If a setting is missing, search by its exact path with scope All and Modified only disabled, then verify it is in EDITOR_SETTING_DESCRIPTORS and included by the active Engine Settings surface. A Type mismatch row means the descriptor kind and binding value variant disagree. A validation message should be corrected before save/apply; use per-setting Reset to return to the registered default.
If export saving fails, inspect the status text, validate the full ExportedGameSettings, and verify the authoring asset path for config/exported_game.json is writable. If preview load is corrupt or unsupported, the client-local preference recovery path migrates supported older versions and otherwise recovers to defaults; resync from export defaults only when that replacement is intentional.
If a preset is incomplete, verify its manifest ID matches EditorDockLayoutPreset::id(), every tool resolves through EditorToolRegistry, every tool has an extension owner, and every split ratio is in range. A disk manifest load failure uses the compile-time shipped manifest and records EditorWorkspacePresetRegistry::load_warning(); restart after repairing the asset because the process-wide registry is lazy-initialized once.
If the dock layout cannot be parsed, the editor records a persistence error and starts from the default layout; supported older schemas migrate through version 14. Use the dock reset action when the saved topology is no longer useful. If only workbench posture, filters, overlays, or mementos are wrong, use Reset UI Posture instead. Persistence errors are retained for the editor's status/notification surfaces until a successful atomic save clears them.