User Interface¶
| Type | Component |
| Implementation | conjure::editor_core, conjure::editor_ui |
| Namespace | conjure::editor |
| Include Folder Path | engine/include/conjure/editor |
| Source Folder Path | engine/src/editor |
The editor's graphical interface: the workspace that conjure_editor_ui draws in the editor window (the menus, the
toolbar, the docked panels, the status bar and the start screen), the Scene and Game pictures, play-mode persist and
themes as the panels show them, and the editor_core services the panels work with: selection, the editor camera,
picking, screenshots, the console buffer and property editing. Everything here draws with the
Widget Kit, which has a page of its own; Editor Architecture places the component in
the application.
Headers¶
| File | Description | Provides |
|---|---|---|
| ai_session_panel.h | The AI session panel, drawn with the widget kit alone: an in-process agent session through the protocol server's loopback transport, for trying the protocol from inside the editor. | ui::ai_session_panelui::transcript_line |
| asset_browser_panel.h | The asset browser (a table now, tiles once a thumbnail source exists), drawn with the widget kit: the database's primary assets in a kit::table_view sorted by path (Path in the code font, Type, Status; Type and Status resizable by the grips after them, a double click on one giving it its width back), under a tool strip with the filter, the file to import and Import; all through asset.* and prefab.instantiate, and scenes opened through the workspace (scene.open behind its unsaved-changes question). |
ui::asset_browser_panelui::asset_browser_panel::asset_rowui::asset_browser_panel::worded_title |
| console_buffer.h | The console ring: 65,536 entries and 16 MiB of text fed by a log sink that may be called from any thread, read on the main thread by the console panel, the log event and the console.read command. The mutex is never held across an allocation: the text ring is preallocated. |
console_bufferconsole_buffer::entryconsole_queryconsole_record |
| console_panel.h | The console, drawn with the widget kit alone: a tool strip (the least level shown, a category filter, Auto-scroll, Clear and the ring's entry count) over a kit::list_view of the console_buffer's lines in the LOG look (the local time each was logged at, "12:02:41.118", its level, category and message). The panel keeps the sequence numbers of the lines its filter matches, adds those of the lines pushed since the last frame and drops those the ring let go, and reads only the lines it shows, by number, into one reused record: a frame's work follows the new lines and the visible ones, never the ring, and steady frames allocate nothing. Every matching line the ring holds is listed. Its tab's badge counts the warnings and errors since the last clear, in the play tone. |
ui::console_panel |
| editor_camera.h | The editor viewport camera: lives in core so view.pick, view.set_camera and view.focus work headless. An orbit camera (position, target, up) with perspective or orthographic projection; the reverse-Z convention of the renderer is used for the projection matrix so gizmos and picking agree with what the renderer draws. |
editor_camera |
| editor_icon.h | The editor's window icon (docs/handbook/brand.md): the official Conjure logo in the Midnight accent, compiled into editor_ui as one PNG per size by tools/generate_brand_icons.py. On Windows the executable also carries the icon as its GLFW_ICON resource, so Explorer, the taskbar and the first frame show it before the layer attaches. |
|
| editor_layer.h | The engine layer that draws the editor: on_update refreshes the panels' caches, on_imgui draws the workspace inside the frame the engine's imgui_layer opened. It is pushed after imgui_layer by the executable through editor_application's layer factory, and a project.open restart brings a new one over a new ImGui context. |
ui::editor_layer |
| editor_panel.h | Panels: one ImGui window each, drawn by the workspace every frame while open. Panels own only UI state and submit command_requests through the context's dispatcher. The registry lists the built-in panels and the ones loaded modules provide: a kit_panel_desc's draws with the kit through the panel's shell, inside a stock_canary_scope as every migrated panel; a legacy panel_desc's receives the raw ImGui context and draws in COMPAT, its stock widgets in the kit's nearest look. Around either draw the stock items the module submits are counted and noted in the module consumer (module.list). |
ui::editor_panelui::panel_descriptorui::panel_registry |
| editor_ui_host.h | The UI side of the editor, registered on the editor_context by the attached UI layer. |
editor_ui_host |
| editor_workspace.h | The workspace: what the editor window shows. | ui::editor_workspaceui::editor_workspace::panel_instanceui::editor_workspace::pending_actionui::menu_request |
| export_dialog.h | The export dialog: the output directory, the project.export command and the progress events it emits. An export is always a Distribution export, so there is no configuration to choose. Each dialog owns its export's state; the event client and response sink it registers are released when the export completes or the dialog is destroyed, whichever comes first. It is drawn with the widget kit alone: the directory field, the Export button, a progress bar while the export runs and the status line. |
ui::export_dialog |
| game_panel.h | The Game panel (registry name "game"), drawn with the widget kit: what the player would see. Every frame the panel is visible it draws the camera the engine shows first (the camera engine::find_main_camera names: an enabled camera, a main one before any other, then the highest priority, then world order; view.screenshot's camera "game") into a render target of its own at the panel's size, with that camera's post-processing and the debug lines the game draws, as the runtime presents it, and shows it as a kit::picture over black, the colour of game pixels nothing was drawn into, from edge to edge of the panel, which never scrolls. No gizmo, no picking, no editor overlays. Playing or paused, the picture has the play border. Without a scene or an enabled camera the panel shows an empty state that says why, on the panel's own background. |
ui::game_panel |
| gizmo_controller.h | Transform gizmos over ImGuizmo: the first manipulated frame opens a transaction and caches the selected entities' world matrices; every frame with a delta dispatches component.set_many on the local transforms (through the parents' inverse world matrices, pivoting at the centroid) with the drag session as coalesce key; the release ends the transaction. Descendants of selected entities follow their ancestor instead of receiving the delta themselves. A drag keeps the operation it began with; a tool chosen meanwhile applies from the next drag. |
ui::gizmo_controllerui::gizmo_controller::dragged_entity |
| hierarchy_cache.h | The hierarchy panel's flat row list: one pre-order walk per structural change, expansion state (by scene guid) and name filter, drawn with a list clipper so 10,000 entities cost O(visible rows). Each row knows its parent's row (where the tree's Left key goes) and its entity's child count. Names, enabled state, prefab-instance state and the selection, which change without a structural change, are refreshed for the visible rows only (refresh_labels), so no frame's work grows with the rows outside the view (the hierarchy under 0.15 ms at any entity count). During play the rows also carry the play-mode markers: PINNED for an entity a pin names (with how many FIELD and COMPONENT pins, and whether an ENTITY pin keeps it whole), TOUCHED for one an editor command changed; the rows are rebuilt when play_controller::marker_version() moves, and the hierarchy never diffs the scene for them. |
ui::hierarchy_cacheui::hierarchy_row |
| hierarchy_panel.h | The scene tree, drawn with the widget kit alone: the header's Add action (an entity under the primary selection, or a root; disabled without a scene), a filter field in a band of its own as the mockup draws it (28 px tall, 8 below the header and 6 above the tree, no rule under it), a keyed kit::tree_view of hierarchy_cache's rows under the scene's own heading row, and a footer counting the scene's entities and the selection. |
ui::hierarchy_panelui::hierarchy_panel::icon_components |
| history_panel.h | The undo history, drawn with the widget kit alone: a tool strip with Clear over a kit::list_view in the HISTORY look of a leading Start row (the state before every entry) and the undo stack's entries, oldest first, and a footer with the entry count and the bytes the stack holds. |
ui::history_panel |
| imgui_frame_scope.h | A self-contained ImGui frame for code that runs without the engine's imgui_layer: the UI tests construct every panel against the null RHI and draw one frame inside this scope. When an ImGui context already exists (the engine's), the scope only brackets frames on it; otherwise it creates and later destroys one with the default font atlas built and docking enabled. Nothing is rendered. |
ui::imgui_frame_scope |
| inspector_panel.h | The inspector, drawn with the widget kit alone: one component.get document per component of the primary selection per frame, drawn through the property drawers in a kit::property_grid; edits go back through component.set with a coalesce key per component, so a drag is one undo entry. |
ui::inspector_panelui::inspector_panel::component_marker |
| kit_panel_desc.h | A panel drawn with the widget kit. The editor registers it as "<module>.<name>", the identity of its window and its key in the saved layout, so a new title keeps its place; the Window menu lists it by its title. | kit_drawer_desckit_icon_desckit_panel_desc |
| panel_desc.h | Module-provided panels: a trivially copyable extension record. The editor's panel registry wraps the draw function into an editor_panel drawn inside the workspace with the one ImGui context the engine exports; the runtime ignores the record. |
panel_desc |
| persist_panel.h | Declarations for persist_panel.h. |
ui::persist_panel |
| picker.h | CPU picking: a slab test over every candidate's world bounds sorted by entry distance, then, for mode MESH, the triangles of the mesh asset's CPU geometry (sprites test their quad) until a hit is closer than the next candidate's entry distance. Ties between bounds-only hits go to the smaller volume so a child inside its parent stays selectable. Mode PHYSICS delegates to Jolt. |
pick_candidatepick_componentspick_contextpick_result |
| profiler_panel.h | The profiler, drawn with the widget kit alone: a tool row with Pause, then a property grid of the engine's frame_stats: the Frame section's plot of the frame times (the kit's sparkline, 80 px across) over the latest frame's time, the average over the last 60 frames, its fixed steps, jobs and whether it dropped fixed time; the Phases section's time of each system phase, the submit and the pacer's sleep in the latest frame; the World section's entities and the frame memory's high water; and, only in an editor with a script runtime (not --no-scripting, not a build without scripting), the Scripts section's managed figures of the latest frame: the bytes the main thread allocated on the managed heap, the heap's size and the collections (all 0 while no script host is ready). Pause holds the plot on the frames it showed (the numbers stay live). |
ui::profiler_panel |
| project_settings_panel.h | The Project settings panel (registry name "project_settings"), drawn with the widget kit alone: the open project's project.json, as project.info and the file describe it, in a kit::property_grid. The first section, Project, is the project itself (its folder, name, version, engine version, startup scene, asset and cooked roots, under a note, wrapped to the panel's width, that says when a change applies), then one section per settings object of the file (window, time, physics, rendering, audio, assets, scripting, modules, extensions) and one for the scene's layer names. Sections and rows read as people read them, in sentence words (display_text.h: "Window", "Max fixed steps per frame"), a label its slot would cut wrapped onto lines of its own (kit::property_row_props::wrapLabel), and a row's tooltip names its member in the file ("time.max_fixed_steps_per_frame in project.json"). A section without a member (no layer named, no module's extension) says "None", as an empty list does. The body runs from edge to edge (kit::panel_shell::set_flush), as the Inspector's in the same dock node. |
ui::project_settings_panelui::project_settings_panel::defaults_problem |
| property_drawer.h | Property drawers (drawn with the widget kit): one kit field per reflection field kind. The inspector reads a component as JSON, hands each field's value to the drawer for its kind inside the property row the registry opens for it (kit::property_row: the change dot, the label, the values, the pin) and, when the value changed, writes it back through component.set. Modules may replace the drawer of a kind for their own tooling; a drawer draws the value's fields with the kit alone, in the row's values slot (the kit's layout host while the row lives) or on the row's value lines (property_row::line). |
ui::property_draw_contextui::property_drawer_registryui::property_drawer_registry::field_walkui::property_fieldui::property_field_marksui::property_marksui::property_row_replyui::property_walk |
| screenshot_service.h | Screenshots: view.screenshot parks its request, the service waits the asked number of frames, captures an RGBA8 image through its backend on the main thread, then hands the image to a core::jobs job that encodes the file (PNG, or lossless JPEG XL through the renderer's encoder) and writes it (a 16384 x 16384 capture must not stall the frame); the job posts the completion back to the main thread, which answers {path, width, height, frame, format}. Without a job system the encode runs inline. The renderer backend draws the scene through the requested camera ("editor", "game" or a camera entity), in the requested shading (debugView), into a render target of the requested size and captures it through renderer::read_back once a frame has been rendered into it; on the null RHI (every headless run) there is no backend and the request fails with NOT_AVAILABLE. Tests install a memory backend that paints a solid colour. |
memory_screenshot_backendscreenshot_backendscreenshot_requestscreenshot_servicescreenshot_service::pending |
| selection_set.h | The selection: UI state, never undoable. A sorted guid list plus a dense bit set by entity index so the hierarchy panel asks "is this row selected" in O(1), and the primary (active) entity: the one named last, as the inspector and the hierarchy's "Add" parent use it. |
selection_set |
| start_screen.h | The start screen: what the workspace shows instead of the dockspace and the panels while no project is open (an editor started without --project, or a windowed one whose --project could not be opened: the first draw shows why, editor_host::startup_problem, as the Open problem). It lists the recent projects of the user configuration (editor_user_settings::recentProjects, most recent first; a project whose folder no longer holds a project.json is marked missing and can be removed from the list) and offers Open (a folder path, project.open) and New (a name and the folder to create it in, project.create then project.open). Opening restarts the engine at the end of the frame (editor_application), which brings a new UI layer, a new workspace and a new start screen. It is drawn with the widget kit, in a column centred in the work area: the version, Open, New, then the recent projects, each with Open and Remove under its index (the keys below) and its folder shown in the column's width with its end, which tells projects apart, kept (the start gives way to an ellipsis). Main thread only. |
ui::start_screenui::start_screen_entry |
| status_bar.h | The status bar (drawn with the widget kit): a fixed bar along the bottom of the editor window, not a dock node. It is the mockup's status strip (24 px on the theme's status fill, no separators): the leading segments from the left, the trailing ones from the right, 16 px apart. | ui::status_bar |
| theme.h | A complete theme: after parse_theme every role holds a value, from the file or from the base. |
builtin_theme_filethemetheme_chrometheme_colourtheme_colour_roletheme_colourstheme_derived_rolestheme_filltheme_fontstheme_gradient_stoptheme_metricstheme_parse_resulttheme_problem |
| theme_applier.h | The theme applier: what a theme looks like in the editor. A theme names roles, not widgets; the widget kit turns them into tokens and the ImGui style, and this applier keeps the editor showing the right theme: | ui::theme_applier |
| theme_editor_panel.h | The Theme editor, opened from Edit > Preferences > Themes: a closed-by-default panel drawn with the widget kit alone (the last surface) that lists every theme (built-ins marked, user themes that cannot be applied in the error tone with their problems), chooses the active one, and edits a working copy. | ui::theme_editor_panel |
| theme_library.h | The themes the editor offers and the one it shows. The library lists the built-in themes (read-only, always valid) and the user themes of <user config>/themes/*.conjure-theme.json. A user theme that cannot be read, parsed or validated, or that takes the name of a built-in or of another user theme, is listed with its problems and never applied. Names compare without ASCII case. | theme_entrytheme_librarytheme_library::file_stamp |
| toolbar_panel.h | The toolbar (drawn with the widget kit): a fixed bar under the main menu bar, not a dock node and not a panel, so it cannot be closed, undocked or lost. It is the mockup's toolbar strip (40 px, the theme's toolbar fill, a line2 edge below), left to right: | ui::toolbar_panelui::toolbar_panel::pinned_pin |
| viewport_panel.h | The Scene panel (registry name "viewport", so a saved layout keeps it), drawn with the widget kit alone (the "View-options strip" and "Scene overlays" rows): the 32 px options strip, then the scene through the editor camera, drawn into an off-screen target the size of the picture and shown with kit::picture, with the input surface over it: the gizmo for the selection, click picking through view.pick, right-drag orbit, middle-drag pan and wheel zoom of the editor camera. The picture, the pick ray and the gizmo all use the editor camera and the picture's rectangle, so what is clicked is what is seen. The gizmo's tools (operation, space, snapping) are driven from the workspace's toolbar through gizmo(); W, E and R pick the operation while the panel is focused or hovered, no text field has the keyboard and no gizmo drag is open. Over a gizmo handle the left button is the gizmo's, while the wheel, F and a right or middle drag still move the camera; a camera drag goes on from its press over the picture until its release, wherever the cursor goes. |
ui::viewport_panel |
| widget_gallery_panel.h | The Widget gallery: a closed-by-default panel, opened from the Window menu, that shows every widget of the kit in every state the kit derives, in the current theme, so the states the mockup does not draw can be reviewed. | ui::widget_gallery_panelui::widget_gallery_panel::section_desc |
Breakdown¶
Workspace¶
conjure_editor_ui (alias conjure::editor_ui) holds the workspace, the panels, the property drawers and the
ImGuizmo gizmos. It depends publicly on conjure::editor_core and conjure::editor_kit, and privately on ImGui, the
bundled fonts (conjure::thirdparty::editor_fonts, whose copy installs them into <bin>/fonts before anything that
links the UI is built), the renderer when it is built, and the scripting module when it is built (for the class
defaults the inspector's change markers compare with). The services the panels use without ImGui
(editor_camera, selection_set, picker, screenshot_service, console_buffer) live in editor_core, so
view.pick, view.set_camera and view.focus work headless.
editor_layer (conjure/editor/ui/editor_layer.h) is the engine layer editor-ui, pushed after the engine's
imgui_layer through editor_application's layer factory. It owns, in this order, the kit context, the
theme_applier (which holds pointers into the kit context) and the editor_workspace, so the panels go first.
| Hook | What editor_layer does |
|---|---|
on_attach |
sets the window icon, makes the workspace and its default panels, loads the project's layout (the layer attaches between two engine frames, so no ImGui frame is open), applies the theme's colours, metrics and fonts, and registers itself as the context's editor_ui_host |
on_update |
updates the workspace: the panels' caches, the module panels and the module icons after a module came, went or was reloaded |
on_imgui |
applies the theme again when something changed (theme_applier::apply_style), makes the kit context current, and draws the workspace between kit_context::begin_frame and end_frame |
on_frame_end |
reloads the fonts when they are due (theme_applier::load_fonts), outside the ImGui frame |
on_close_request |
asks the workspace (editor_workspace::request_close), which may hold the close behind the unsaved-changes question |
on_detach |
unregisters the host, removes the module icons, ends a theme preview and saves the layout unless the context moved on to another project |
While attached, the layer is the editor_ui_host (conjure/editor/editor_ui_host.h) through which core commands
reach the UI: request_layout_reset (from editor.layout.reset) and request_theme_refresh (from the theme
library). Each call only records a request, which the UI acts on at its next safe point. A project.open restart
brings a new ImGui context, a new layer, a new workspace and a new kit context.
editor_workspace (conjure/editor/ui/editor_workspace.h) is what the window shows: the menu bar, the toolbar,
the dockspace with a pass-through central node, and the status bar, described in The shell.
property_drawer_registry draws a component's fields with the kit, gizmo_controller drives ImGuizmo for the
selection, and hierarchy_cache keeps the hierarchy's flat rows.
Panels¶
Panels are editor_panel subclasses in ui/panels/. Each owns only UI state, draws with the kit inside the
kit::panel_shell its base class opens, and submits every edit through the dispatcher as the UI client (client 0)
with support::run_command (ui/ui_common.h), so it is validated, recorded for undo and announced like a protocol
request. Selection, camera and view toggles are UI state written directly. A panel's window is
<spacers>###<registry name>: the registry name is its identity and its key in the saved layout, so a title change
keeps its place. The built-in panels, in the Window menu's order:
| Panel | Registry name | Open by default | Shows |
|---|---|---|---|
| Scene | viewport |
yes | the scene through the editor camera, the gizmo, picking and the editor's overlays |
| Game | game |
yes | what the player would see |
| Hierarchy | hierarchy |
yes | the scene tree, in a keyed kit::tree_view over hierarchy_cache's rows |
| Inspector | inspector |
yes | the primary selection's components through the property drawers, in a kit::property_grid |
| Project settings | project_settings |
yes | the open project's project.json, member by member |
| Assets | assets |
yes | the asset database's primary assets in a kit::table_view |
| Persist | persist |
yes | the pins of the play session |
| Console | console |
yes | the console ring's lines in a kit::list_view |
| History | history |
no | the undo stack |
| Profiler | profiler |
no | the engine's frame statistics |
| AI session | ai_session |
no | an in-process protocol session over the loopback transport |
| Export | export |
no | the export dialog |
| Themes | theme_editor |
no | the Theme editor |
| Widget gallery | widget_gallery |
no | every kit widget in every state, described in The Widget gallery |
Module panels join the same registry. A kit_panel_desc panel is registered as <module>.<name> and draws with the
kit through its panel's shell; a legacy panel_desc panel receives the raw ImGui context and draws in the kit's
COMPAT look. When a module comes, goes or reloads, the workspace removes every module panel's descriptor and
instance and makes them again from the module consumer's records (sync_module_panels), because a reload attaches a
new binary under the same owner and title; the open state a panel had is kept for the next load.
Important
Route undoable edits through the editor command model so validation, history, and notifications stay consistent.
The shell¶
The shell spans three files. ui/editor_workspace.cpp holds the built-in panel table (BUILTIN_PANELS, one entry
and factory per panel), the instances and draw(); ui/editor_workspace_layout.cpp the layout file, the default
layout and the open-panel section of the layout file; ui/editor_workspace_menus.cpp the menu bar, the global
shortcuts, Save scene as, the unsaved-changes question and the dialogs the menus open. The toolbar
(ui/panels/toolbar_panel), the status bar (ui/status_bar), the start screen (ui/start_screen) and the private
ui/project_flow complete it. The menus, dialogs, bars and the start screen draw with the kit alone; the form
helpers they share are in the private ui/ui_forms.h.
A frame of editor_workspace::draw with a project open runs in this order:
- load the layout if the layer has not (a workspace drawn without a layer), consume a layout reset, and build the default layout when it is due;
- submit the dockspace, inside a
kit::dockspace_scope, under a fixed id; - draw the menu bar, the toolbar and the status bar; the toolbar's pinned list may bring the Inspector forward and send it to a pin;
- handle the global shortcuts;
- draw the panels by index, never by iterator, because a panel may open another one while it draws;
- take a scene the Assets panel asked to open through the unsaved-changes question, hide the panels the Window menu closed, and settle the default layout's front tabs;
- draw the tab's context menu, Save scene as, the dialogs and the project trust question;
- paint the dock chrome over every tab bar ImGui laid out this frame, and retire the tabs of panels hidden in it;
- write the layout when a default was just built, or when ImGui reports a change (
io.WantSaveIniSettings).
Menus and shortcuts. The menu bar holds File, Edit, Assets, Entity, Play, Window and Help, drawn with
kit::menu_bar, kit::menu and kit::menu_item. A menu's or item's key is its label, so ids are the ones ImGui's
BeginMenu and MenuItem give the same labels, and tests activate items by id. A disabled kit item never presses,
not even through ActivateItemByID, and a menu whose items are all disabled shows its title disabled. Edit >
Preferences holds Themes, which opens the Theme editor, and Code ligatures, which sends editor.preferences.set
from the UI client. The global shortcuts (Ctrl+Z, Ctrl+Y, Ctrl+S, F5, Shift+F5) are kit::shortcuts on ImGui's
global route, submitted every frame so the route stays claimed. A modal popup does not block a global route, so the
shortcuts wait while a workspace dialog, Save scene as or the trust question is up. play_action(state, hasScene)
in editor_workspace_menus.cpp is the one rule for Play: play.start while editing with a scene, play.resume
while paused, and nothing while playing; F5, the Play menu and the toolbar's Play button follow it.
Unsaved changes. Opening a project or a scene, New scene, Quit and closing the window ask first while the scene
has unsaved changes: Save, Discard or Cancel. The workspace holds a pending_action meanwhile and performs it after
the answer. Saving while playing sends play.stop first, because saving is an editing-state command and the scene
to keep is the edited one with the pins applied; a scene without a file goes through Save scene as, which carries
the pending action.
The toolbar and the status bar are fixed bars, not dock nodes: each opens a kit::viewport_bar (a borderless
window across the main viewport that reserves its strip of the work area from the next frame on) inside a
kit::stock_canary_scope and fills it with a kit strip. toolbar_panel::height() is the main strip plus its line
(41 px at 100 %) and status_bar::height() is 24 px at 100 %; both are 0 without a current kit context.
- The toolbar holds, left to right, the gizmo tools, Pivot, Snap with its step field, a spacer, the play group and
the Persist pill, a second spacer, and Layout. The equal spacers centre the play group between Snap and Layout.
The tools, Pivot and Snap drive the Scene panel's gizmo, which the workspace passes in, and are disabled without
that panel. Snap's step field sets
joinedLeft, so Snap draws the column they share. Step sendsplay.stepwithout a count. Layout opens a menu with Reset layout (editor.layout.reset). Undo and Redo live in the Edit menu and on Ctrl+Z and Ctrl+Y only, and no text repeats the play state: the lit play controls show it. - The status bar's segments are the AI state, the scene and its unsaved mark, the pins (only while playing or paused
with something pinned), the AI port and its clients led by the online dot, the build, backend and GPU, and the
frame rate. The AI state is "Ready" while the AI port listens and no agent is connected and "Connected" while one
is, from
protocol_server::agent_count(): TCP and stdio clients, counted once theirsession.hellopassed where a token is required, never the in-process AI session panel. While the port is off and no agent is connected, neither AI segment exists. The texts are rebuilt into the same strings every frame, so steady frames allocate nothing.
The layout file. The layout is kept in project://.conjure/editor_layout.ini (LAYOUT_FILE), read with
LoadIniSettingsFromMemory and written with SaveIniSettingsToMemory and the virtual file system's
write_file_atomic; io.IniFilename stays null, so ImGui never touches a file itself. ImGui's ini keeps where a
window is, not whether it is open, so the workspace registers an ImGuiSettingsHandler of type ConjurePanels whose
[ConjurePanels][Open] section holds one <name>=0|1 line per panel. The handler is registered with an
ImGuiContextHookType_Shutdown hook, so a workspace that outlives its ImGui context never touches it again. A project
without the file, or whose file holds no dock state for the dockspace, gets the default layout, built with ImGui's
DockBuilder on the first draw whose display is not degenerate; nothing is saved until then, because an empty
dockspace node in the file would stop every later session from building it. The default layout docks Scene and Game
in the centre, Hierarchy on the left, Inspector and Project settings on the right, and along the bottom Assets,
Persist, Profiler and History beside Console and AI session. Its regions are 262 px (left), 340 px (right) and 236 px
(bottom) wide or tall at 100 %, grown with the kit's scale, and computed for the work area the bars will leave,
because this frame's bars are not submitted yet. Window > Reset layout and editor.layout.reset rebuild it.
The tab's context menu. Panel tabs have no close button. A right click on a panel's tab (its header when it is alone in its node, its title bar while it floats) opens a kit menu with Close, Close others, Undock and Reset layout, each disabled where it cannot act.
The start screen. Without a project, draw() shows the menu bar, the status bar and the start_screen in place
of the dockspace and the panels; the Theme editor can still be opened, since themes belong to the user. The start
screen (conjure/editor/ui/start_screen.h) lists the recent projects of the user settings, most recent first, marks
one whose folder no longer holds a project.json as missing, and offers Open (project.open) and New
(project.create, then project.open). ui/project_flow checks a typed path first, so a typo gets a sentence
instead of a command error, and accepts a path pasted with quotes around it. A windowed editor whose --project
could not be opened also starts here, and the first draw shows editor_host::startup_problem() as the Open
problem. An open or a create that the trust question now asks about (PROJECT_NOT_TRUSTED while
editor_context::trust_prompt() names that folder) is no failure: no problem line is shown, and Trust and open
completes the open.
The project trust question is a kit modal dialog drawn by editor_workspace::draw_trust_prompt while
editor_context::trust_prompt() names a project, over the start screen or the panels. It asks "Do you trust the
authors of this project?", shows the folder and offers Trust and open, which sends project.trust and then
project.open, and Don't open, which dismisses the question. Escape answers Don't open, and Enter never trusts. The
dialog closes by itself when somebody else answers, for example a protocol client sending project.trust.
The Scene and Game pictures¶
The Scene and Game panels share the private ui/scene_picture: a scene_view (core/scene_view.h, private)
whose render target is kept at the panel's rectangle in framebuffer pixels, the view queued for the frame with
renderer::submit_view, and the target's colour texture registered with the renderer's imgui_renderer. The three
steps run at different points of a frame: set_rectangle() while the panel draws, render() to size the target and
queue the view, and shown_texture() for the texture to draw. The rules every owner gets from it:
- the target keeps its size while the left mouse button is down, because a resize waits for the GPU and dragging a splitter would otherwise stall every frame;
- no texture is handed out for a target that does not exist or a texture that was never registered, because the ImGui renderer draws an unknown texture with its font atlas;
- a target made again has a new colour texture, so the old handle is let go and the new one registered;
- the destructor unregisters the texture only while the renderer that owns the target still has the ImGui renderer it was registered with, since an engine restart replaces both.
Without the renderer compiled in, render() queues nothing. Without a window there is no ImGui renderer: the view is
still drawn when a renderer exists (tests on the null device), and nothing is shown.
View order. The renderer keeps per-view state by view index (auto-exposure history, the shadow atlas's
importance). The Scene panel queues the editor camera in update() every frame it is open, its hidden tab included,
and the Game panel queues resolve_camera_view(context, "game", ...) while it draws, so the editor camera is always
the first view and the game camera the second, whichever tab is in front.
The Scene picture. The Scene panel (viewport_panel) queues make_editor_camera_view with
renderer::view_flags::KEEP_COVERAGE_ALPHA, so the picture keeps the scene's coverage as alpha and is transparent
where the scene drew nothing; the view's opaque background grey (SCENE_VIEW_BACKGROUND) is not composited. While it
draws, the panel paints the theme's viewport backdrop (kit::fill_token::VIEWPORT) and the Grid first, then the
picture with kit::picture, so the backdrop and the Grid show only where nothing drew and the Grid lies behind the
scene. A view.screenshot of the "editor" camera keeps the opaque grey instead, so it and the window differ where
nothing drew, by design. Grid, Bounds and Physics are the editor's own overlays, painted with the kit into this panel
alone and never into the renderer's debug draw, so the Game view, screenshots and exported games never show them;
ui/scene_overlays computes their geometry as pure functions of matrices, cameras and rectangles.
The overlays stack in the options strip's order. The Grid lies under the scene. Over the picture, the bounds (muted, a
selected entity's in the accent) come first and the colliders over them, so a collider as large as its entity's bounds
stays visible where the two lines meet. The frame of an orthographic game camera (while Gizmos is on) and the
selection outline follow, all clipped to the picture, inside the play border while playing. The gizmo is drawn next;
over a gizmo handle the panel submits no input surface, because ImGuizmo starts a drag only when no item is hovered,
and the wheel, F and the camera drags stay the panel's. A camera drag keeps the input surface from its press to its
release, and a gizmo drag keeps the operation it began with. update() ends a gizmo drag whose window was not drawn
in the last frame, so a switched tab cannot leave the undo transaction open.
The Game picture is drawn over black, the colour of game pixels nothing was drawn into, with the play border
while playing or paused, and without a scene or an enabled camera the panel shows an empty state that says why.
While playing, the game gets the input the panel receives: the mouse while the cursor is over the picture (or a
press that began there is held) and the keyboard while the panel has focus. kit::leave_input_to_engine tells
ImGui to leave those events to the engine from the next frame on. Mouse positions reach the game in window
coordinates, because platform input knows nothing of the panel's place in the window. A cursor mode the game sets
applies to the editor's window too, so the panel puts the cursor back to NORMAL when play stops or pauses and when
the game stops getting the panel's input.
The editor presents no scene camera to the back buffer: the window shows the back-buffer clear, which the theme applier sets to the theme's panel colour, behind the panels.
Play-mode persist in the UI¶
Play-mode persist is owned by play_controller and its persist_list (see Applications). The UI
works on play_controller directly as the UI client (0): pin, unpin, persisted(), snapshot_component_json,
marker_version(), simulation_frame(), changed_by and last_persist_report(). Pins are UI state, not commands,
so the inspector and the Persist panel never send them through the dispatcher and never move the scene revision.
The toolbar's pill, the status bar and the Persist panel all count the same list.
- The Inspector shows the pins through the kit's row marks while playing or paused: a pin on the Entity button
(its menu pins with children, unpins the entity or everything on it), one on each component's header beside a
"changed in play" dot, and one on each field's row, which also shows a change dot when play changed the value and
the persisted mark when a pin keeps it. The dots compare the live component with
snapshot_component_jsonthroughsame_as_editedandchanged_from_edited, for the selected entity only, collapsed components included. A running script'sstartedandcreatedflags are runtime state and never count, and a script field its edited form leaves out compares with the class default from the script runtime. The results are cached until the scene revision,marker_version()orsimulation_frame()moves: a running game changes values without a command, so the key moves every simulated frame, and a paused session reads nothing until a command or a pin. - The Hierarchy marks rows
PINNEDfor an entity a pin names andTOUCHEDfor one an editor command changed during play.hierarchy_cacherebuilds its rows whenmarker_version()moves, so it never diffs the scene. - The Persist panel (
ui/panels/persist_panel) lists every pin in akit::table_view: the entity, what the pin keeps in the inspector's names, the value when play started and now (before_summary,value_summary), who changed it last in play (changed_by_textofplay_controller::changed_by, read from the play edit log) and an unpin button. Unpin all sits in its tool row. While editing it shows what the last stop did with the pins (last_persist_report()) until the nextplay.start. - The toolbar's Persist pill opens the pinned list under it, one row per pin; a row selects its entity with
selection.setfrom the UI client, brings the Inspector forward and sends it to the pin (reveal_pin), which opens the section, scrolls to the row and lights it.
Themes in the UI¶
The theme data model, the library and the theme commands are in editor_core (see
Editor Architecture); theme_applier (conjure/editor/ui/theme_applier.h) keeps one ImGui
context showing the theme the editor shows: the active theme, or the Theme editor's working copy while it previews
one. editor_layer owns it, next to its kit context.
- Applying.
apply_style()runs before the workspace draws each frame. It writes the shown theme into the context's style through the attached kit context (kit_context::apply_theme, which also resolves the kit's tokens) when a refresh was requested, the library'srevision()moved, the preview changed, the ImGui context is another one, oreditor_ui_scale()differs from the scale it last applied. Each application also colours ImGuizmo (apply_gizmo_style) and sets the renderer's back-buffer clear to the theme's panel colour (back_buffer_colour). The applier follows the ImGui context it styled through anImGuiContextHookType_Shutdownhook, so a dead context, or another one at the same address, is never mistaken for it, and the hook also releases the typography's fonts. - The UI scale.
editor_ui_scale(context)iseditor_ui_scale_for(uiScale, monitorScale, density):uiScale / 100(the user setting, clamped toMIN_UI_SCALEtoMAX_UI_SCALE) times the OS UI scale of the monitor under the window's centre (engine::monitor_ui_scale) over the window's rasterizer density (editor_rasterizer_density: framebuffer width over window width). ImGui works in window coordinates, so a display whose framebuffer is finer than its window (a Retina screen) gets a finer raster rather than larger sizes, while a Windows display at 150 % gets sizes 1.5 times larger. The window's owncontent_scale()is the framebuffer to window ratio, not the OS scale. The scale is read again every frame, because Windows raises no event when a window moves to a monitor with another scale; without a window both factors are 1. - Fonts.
load_fonts()runs when the layer attaches and at the end of every frame, outside the ImGui frame. Whenfonts_due()(another context, other families or size, another UI scale, framebuffer scale or texture limit, another typography, orreload_fonts()), it rebuilds the atlas through the typography the applier uses (set_typography's, else the attached kit context's, else its own) ateditor_ui_scale(),editor_rasterizer_density()andfont_texture_limit(), then callsimgui_renderer::invalidate_font_atlas()so the backend uploads it. The limit iseditor_max_texture_size(), the RHI device'smaxTextureDimension2d(16384 without a device), lowered byset_font_texture_cap. The font folders are<user config>/fontsand then<executable>/fonts, unlessset_font_foldersreplaced them. The applier hands thecodeLigaturessetting to the typography every frame. How the atlas is baked is on Typography. - Reaching the shown theme. Panels call
support::shown_theme(context)ortheme_roles(context)(ui/ui_common.h): the attached layer's applier'sshown(), or the library's active theme without a layer. The Theme editor reaches the applier to preview through withsupport::theme_applier_of(context). - ImGuizmo. Its state and style are one per process.
gizmo_controllerremembers the ImGui context ImGuizmo last ran in (cleared by that context's shutdown hook) and, in another one, ends any interaction and clears the old context's hover before drawing; each draw sets the style from the shown theme in the highlight's role: accent while editing, and play or persist while playing or paused, persist when every dragged entity has an entity pin of its own. - The Theme editor (
ui/panels/theme_editor_panel, opened from Edit > Preferences > Themes) lists every theme, sets the active one, and edits a working copy: Duplicate makes a copy under a new name, and changing a built-in makes a duplicate, since built-ins are read-only. While it has a copy, the whole editor previews the last version of it that passesvalidate_theme, so a value typed half-way never makes the editor unreadable. Everything that lasts goes through theeditor.theme.*commands; Export writes a theme file atomically to a typed path.
Threading Model¶
The workspace, the panels, the theme applier and every UI helper run on the main thread. editor_layer draws inside
the ImGui frame the engine's imgui_layer opened, in the one ImGui context that layer owns, with its kit context
current; the font atlas is rebuilt only in on_attach and on_frame_end, outside that frame. The layout file is
read and written on the main thread through the project's virtual file system.
Per-context state (the layout handler, the theme applier, ImGuizmo's context, the edit session) follows its ImGui context through shutdown hooks, so the UI tests can make and destroy contexts in one process.
Extension Points¶
- Built-in panels. An
editor_panelsubclass inui/panels/, drawn with the kit alone, and an entry inBUILTIN_PANELS(registry name, title, open by default, factory). Add it to a region of the default layout ineditor_workspace_layout.cppwhen it belongs there, and give it atest_<panel>.cppwith a[kit_conformance]sweep. - Module panels. A module registers a
kit_panel_desc(conjure/editor/kit_panel_desc.h); see Extension Points of the widget kit. - Property drawers.
property_drawer_registry::set(kind, drawer)replaces the drawer of a reflection field kind; a module'skit_drawer_descdraws the values of one reflected type. - Menus and shortcuts. A menu item that sends a fixed command is a row of the menu-command table in
editor_workspace_menus.cpp, so the menus, the shortcuts andmenu_requests()cannot disagree.
Testing¶
The UI tests are in tests/editor/ui/ and tests/editor/ui/panels/, one test_<header>.cpp per public header of
conjure/editor/ui/, in conjure_editor_tests. They draw every panel inside imgui_frame_scope on the null RHI,
without the engine's imgui_layer; the folders and labels are described in
Editor and widget kit tests.
| Support | Gives |
|---|---|
draw_test_support.h |
ui_kit (a current kit context with the canary on, and fixed text metrics until fonts load) and kit_frame (one kit frame, the shown theme applied when it changed), the vertices of a window's draw list in a theme colour, and two test fonts told apart by their glyphs |
font_test_support.h |
a TrueType font built in memory, with the tables ImGui's rasteriser reads |
panel_test_support.h |
one frame of a panel in a window at the origin, a widget's ImGui id from the scopes the panel pushes, a click through ImGui::ActivateItemByID, and the text a frame showed |
picture_test_support.h |
an editor_context over an engine rendering on the null device, plus a second renderer with a null swapchain, so an ImGui renderer exists as in a windowed editor |
module_test_support.h |
a static module with a kit panel, a legacy panel, a kit icon and a kit drawer |
test_editor_workspace.cpp draws the workspace in a ui_kit frame, as the layer brackets it, and sweeps every menu
and dialog for canary ink and stock items in six themes at 100 and 150 %. test_default_layout.cpp builds the default
layout over the Grid Sweeper fixture and compares it with the mockup's structural references.
test_theme_applier.cpp drives the UI scale with editor_ui_scale_for, the texture limit with a null device
created with a smaller maxTextureDimension2d, and the font folders with set_font_folders.