WidgetDesigner class
#include <Editor/Public/WidgetDesigner.h>
The widget designer: widget assets edited as their files, shown as they will look, and saved back as an outline (docs/ui/Widgets.md, The Designer). Its parts are dock panels that follow the asset whose tab is in front. Used on the UI update thread, and on Encoder only while no document is updating (saving, opening, recovery).
Base classes
- class EditorDocuments
Public static functions
-
static auto Reader(const GGUI::
BindingReader& next) -> GGUI:: BindingReader - Reads the values Details shows; anything else goes to
next. -
static auto IdOf(std::string_view name) -> GGUI::
ItemID - The item an element of that name is, in the hierarchy and the selection.
Constructors, destructors, conversion operators
- WidgetDesigner()
- ~WidgetDesigner() override
Public functions
- void Initialize(EditorContext& editor, UIHost& host)
- void RefreshPlay(EditorContext& editor)
- void Open(const std::string& path, EditorState& state)
- Open
path, or bring its tab to the front. -
void BuildCanvas(GGUI::
UI& ui) - The designer panel: a tab per open asset, its screen, and the canvas.
-
void BuildProblems(GGUI::
UI& ui) - The problems with the asset in front.
-
void BuildHierarchy(GGUI::
UI& ui) - The asset in front's elements as a tree, selected with the canvas.
-
void BuildPalette(GGUI::
UI& ui) - What can be added: element types and widget assets, dragged in or clicked to add.
-
void BuildDetails(GGUI::
UI& ui) - The selected elements' properties, from the widget registry (WidgetDesignerDetails.cpp).
-
void BuildPreview(GGUI::
UI& ui) - What the asset is given: its inputs and contexts, and their preview values (WidgetDesignerPreview.cpp).
-
void BuildStyles(GGUI::
UI& ui) - The asset's tokens, style rules, and sheets, and where the selected element's look comes from (WidgetDesignerStyles.cpp).
-
void BuildCost(GGUI::
UI& ui) - What one instance of the asset takes.
-
void BuildAnimation(GGUI::
UI& ui) - The asset's clips on a timeline, and its triggers (WidgetDesignerAnimation.cpp).
- auto Active() -> DesignerDoc*
- The asset in front; null if none is open.
- void Select(std::string_view element)
- Select the element of that name in the asset in front.
- void ZoomActive(float zoom)
- Zoom the canvas of the asset in front, from its top left corner.
- auto SelfTest(const std::string& path, EditorState& state) -> bool
- auto CanvasSelfTest(uint32_t id) -> bool
- The canvas checks, which need it laid out: run once it is, after SelfTest.
-
auto Changed() const -> const GGUI::
GGRevision& - Moves when anything the panels show changes.
-
template<typename TFn>void Change(uint32_t id, uint64_t merge, TFn change)
- auto Kind() const -> const char* override
- What its documents are called in the autosave list ("prefab", "widget"). Never changes.
- void ForEachUnsaved(const std::function<void(uint32_t id, const std::string&name, const std::string&path)>& visit) const override
- Each open document with unsaved changes: its ID, name, and file.
- auto Save(uint32_t id) -> bool override
- Save open document
id. False if it isn't open or couldn't be written. - auto TextOf(uint32_t id) const -> std::string override
- Open document
idas it stands, saved or not. - void OpenRecovered(const std::string& path, const std::string& text, EditorState& state) override
- Open
pathwithtextin place of what the file has: recovered work, unsaved.
Public variables
- uint32_t CanvasTestPending
- bool bShowAsked
- Open was asked: the shell brings the designer's panels to the front.
Function documentation
void WidgetDesigner:: RefreshPlay(EditorContext& editor)
Look for what preview contexts can follow in a play session: the contexts the game gave its HUDs, and the live entities of the types open assets' contexts are. Encoder, each frame.
bool WidgetDesigner:: SelfTest(const std::string& path,
EditorState& state)
Open path (a copy: it is changed and saved) and work the designer's edits, undo, and saving through it, logging each check. True if all passed (WidgetDesignerSelfTest.cpp).
template<typename TFn>
void WidgetDesigner:: Change(uint32_t id,
uint64_t merge,
TFn change)
Change open asset id, if it still is: remembered for undo (a non-zero merge joins the last step), then shown.
Variable documentation
uint32_t WidgetDesigner:: CanvasTestPending
the asset whose canvas checks wait for its layout