Skip to main content

Module ui

Module ui 

Source

Structs§

UiRequests
Requests raised by the UI that need something draw doesn’t have access to (a live &mut Renderer for loading assets, or EditorScene’s ability to replace its whole World when a project is opened) — consumed by EditorScene::update right after draw runs, while the renderer is still in scope for that frame.

Constants§

ASSET_PREVIEW_SIZE 🔒
Side length, in points, of an asset tile’s preview image in the Assets panel.

Functions§

asset_file_name 🔒
draw
Top menu bar (project New/Open/Save) + bottom assets panel (collapsible; import/preview project assets) + left hierarchy panel (add/remove/rename/select entities) + right inspector panel for the selected entity’s Transform and Renderable (attach/replace/remove), editable live.
draw_assets_panel 🔒
draw_camera_editor 🔒
The selected entity’s camera lens, if it has one: a checkbox to attach/detach a [CameraComponent] (mirrors draw_renderable_editor’s Remove button), then FOV/near/far fields and an “Active Camera” checkbox once attached. No GPU-load UiRequests indirection is needed here like draw_renderable_editor’s attach flow — requests is only used to flag edited.
draw_export_status_overlay 🔒
A small transient toast reporting the outcome of the last Export (see EditorScene’s export_status), success or failure — mirrors draw_script_error_overlay’s shape, just for one message instead of a list.
draw_group_header 🔒
draw_hierarchy 🔒
draw_inspector 🔒
draw_menu_bar 🔒
draw_model_group 🔒
draw_model_tile 🔒
A model has no cheap thumbnail to render (that would need an offscreen 3D render pass per asset), so its tile is a plain placeholder icon instead, sized to match a texture tile.
draw_renderable_editor 🔒
draw_scene_group 🔒
Mirrors draw_script_group’s shape: a project can hold several scene .ron files (see Project::list_scenes), listed here with a way to create new ones from scratch (a scene, like a script, has nothing to import from outside the project) and switch which one is currently open for editing.
draw_scene_tabs 🔒
Tab strip for the project’s open scenes (EditorScene::open_scenes), one tab per scene kept loaded in memory — clicking a tab switches to it instantly (no reload: unlike the old single-scene behavior, an opened scene stays fully loaded until its tab is closed). Each tab’s bool marks it dirty (unsaved edits — see EditorScene::OpenScene::dirty), shown as a trailing * on its label. The close button (“x”) removes a tab (autosaving it first, handled by EditorScene::close_scene_tab), except when it’s the only one open — closing while Playing (if it’s the active tab) stops Play first, same as switching does, so no separate disabled state is needed here.
draw_scene_tile 🔒
One tile: a placeholder icon (see draw_model_tile’s doc comment — no cheap thumbnail for a scene either), highlighted if it’s the scene currently open for editing and starred if it’s the project’s start scene. Double-click switches to it (opening a new tab if it isn’t already open — see EditorScene::switch_or_open_scene — or just activating its existing tab, no reload, if it is); the context menu offers Rename (inline, like the Scripts section’s) and “Set as Start Scene”. Renaming only touches the file on disk, ProjectManifest.start_scene, and any open tab’s identity — unlike a ScriptAttachment path (structured ECS data rename_script can fix up everywhere it’s referenced), a scene.change("path") call is a free-text string literal inside .rhai source that can’t be auto-fixed, so a renamed scene’s incoming scene.change(...) calls (if any) are left dangling and need updating by hand.
draw_script_editor 🔒
The selected entity’s stacked .rhai scripts: a reorderable/removable list of what’s attached (execution order top-to-bottom), plus a picker to attach more from the project’s scripts/ folder. Unlike draw_renderable_editor, attaching/detaching/reordering needs no GPU load step, so this mutates world.scripts directly rather than going through UiRequests (beyond flagging edited).
draw_script_error_overlay 🔒
A small transient toast listing recent script compile/runtime errors (see EditorScene’s script_errors), so a broken script fails loudly without a full log panel.
draw_script_group 🔒
draw_script_tile 🔒
A script has no thumbnail either (see draw_model_tile’s doc comment for the same reasoning), so its tile is a plain placeholder icon, sized to match a texture/model tile. Unlike the other asset tiles, this one is interactive: click opens path in an external text editor (see open_script_in_editor) and the right-click context menu offers Rename (inline, like the Hierarchy panel’s entity rename) and a way to change the remembered editor.
draw_texture_group 🔒
draw_texture_tile 🔒
One tile: the texture’s own thumbnail (loaded through egui’s own texture manager, and cached in previews so it’s decoded from disk once rather than every frame) with the file name below it.
draw_transform_editor 🔒
fit_within_square 🔒
Scales size down (never up) to fit within a max_side-by-max_side square, preserving its aspect ratio.
load_texture_preview 🔒
open_script_in_editor 🔒
Opens path (project-relative) in EditorSettings::preferred_editor, prompting for one first (and remembering the choice — see pick_and_save_editor) if none is set yet.
pick_and_save_editor 🔒
Prompts for an executable via a native file picker and, if one is chosen, saves it as the remembered editor (persisted next to the editor executable — see EditorSettings::save) so future script clicks don’t need to ask again.