FMiriGraphicsWidgetFactory
Turns a serialized .ui tree into a live Miri widget tree. The widget class name on each node keys a small construction table; named nodes are collected so a game can resolve them for script binding after instantiate.
- Module
- MiriGraphics
- Header
#include "MiriGraphics/FMiriGraphicsWidgetFactory.h"- Namespace
Mowo
Properties
| Type | Name | Description |
|---|---|---|
static constexpr int32_t | MaxUserWidgetDepth | How deep UserWidget composition may nest before the factory refuses. Default 8. |
Public functions
| Returns | Name | Description |
|---|---|---|
FBuildResult | Build | |
FBuildResult | Build | |
FBuildResult | Build | |
void | ApplyBindingValue | Writes one resolved binding value onto a live widget. |
std::string | FormatBindingNumber | |
void | ParseFormatSources | |
FMiriGraphicsBindingValue | EvaluateBinding | |
Miri::CBrush | ResolveBrush | A brush description resolved against the active theme: a field naming a token of the matching kind takes it, a colour field next tries colour tokens, and what is left is a literal. |
Miri::MiriColor | ReadNodeColor | |
void | SetImageDecoder | Forwards to Miri::Mowo::CMiriImageCache, which owns the process-wide image decode hook + GPU texture cache. |
void | ClearImageCache | |
Miri::Ref<Miri::IMiriRHITexture> | GetOrLoadImage | |
Miri::Ref<Miri::IMiriRHITexture> | GetOrLoadImageAsync | The non-blocking twin: returns the texture when it is cached, otherwise queues a decode on the worker and returns null (the caller keeps its placeholder). |
void | PumpAsyncImages | |
size_t | PendingAsyncImages | |
Miri::Ref<Miri::IMiriRHITexture> | GetOrLoadSizedImage | One image exported at several pixel sizes ("<stem>-<N>.png"): picks the smallest export that still covers the on-screen size, because a 512 px source sampled down to 16 px without mips shimmers and a 16 px one stretched up blurs. |
void | SetMediaSourceFactory | Process-wide clip decoder for VideoPlayer nodes, injected by the host for the same reason the image decoder is: playback lives in Game. |
bool | HasMediaSourceFactory | |
std::unique_ptr<IMiriGraphicsMediaSource> | CreateMediaSource | |
void | SetStateSoundHook | Plays the sound a style state names when a widget enters that state. |
void | PlayStateSound | |
void | SetMaterialResolver | |
std::shared_ptr<const Miri::FMiriCustomMaterial> | ResolveMaterial | |
void | NotifyMaterialsChanged | |
uint64_t | GetMaterialGeneration | |
void | SetRenderTargetResolver | |
FMiriGraphicsRenderTarget | ResolveRenderTarget | |
bool | IsKnownType | |
std::vector<std::string> | RegisteredTypes | |
void | SetActiveTheme | Process-wide theme every build falls back to when neither the screen nor the build context names one. |
const FMiriGraphicsTheme& | ActiveTheme | |
Miri::MiriColor | ResolveColorToken | Token → colour through the active theme, then the default theme. |
FMiriGraphicsNode | ComposeUserWidget | Composes a referenced widget asset's tree with the overrides an embedding UserWidget node supplies: every exposed variable writes its value (or its default) onto the target node named by the referenced asset. |
bool | ResolveRightToLeft | Resolves a node's flow_direction ("inherit", "ltr", "rtl") against the parent's. |
FMiriGraphicsCanvasSlot | MirrorCanvasSlot | A canvas slot mirrored about the canvas's vertical centre line, which is what a right-to-left canvas places its children by. |
Miri::TSharedPtr<Miri::MWidget> | BuildDetachedRow | Builds one ListView row from a template node with the item's data substituted in. |
Function details
Build
static FBuildResult Build(const FMiriGraphicsAsset& asset)Build
static FBuildResult Build(const FMiriGraphicsAsset& asset, const FMiriGraphicsBindingResolver& resolver)Build
static FBuildResult Build(const FMiriGraphicsAsset& asset, const FBuildContext& context)ApplyBindingValue
static void ApplyBindingValue(const std::string& property, const FMiriGraphicsBindingValue& value, const Miri::TSharedPtr<Miri::MWidget>& widget)Writes one resolved binding value onto a live widget. Shared between the build-time application and the screen stack's per-frame binding pump.
FormatBindingNumber
static std::string FormatBindingNumber(double number)ParseFormatSources
static void ParseFormatSources(const std::string& format, std::vector<std::string>& outSources)EvaluateBinding
static FMiriGraphicsBindingValue EvaluateBinding(const std::string& source, const std::string& format, const std::string& converter, const std::function<FMiriGraphicsBindingValue(const std::string&)>& resolve)ResolveBrush
static Miri::CBrush ResolveBrush(const FMiriGraphicsBrushDesc& desc)A brush description resolved against the active theme: a field naming a token of the matching kind takes it, a colour field next tries colour tokens, and what is left is a literal.
ReadNodeColor
static Miri::MiriColor ReadNodeColor(const FMiriGraphicsNode& node, const std::string& key, const Miri::MiriColor& fallback)SetImageDecoder
static void SetImageDecoder(FMiriGraphicsImageDecoder decoder)Forwards to Miri::Mowo::CMiriImageCache, which owns the process-wide image decode hook + GPU texture cache. The cache must be cleared before the Miri bridge/device shuts down.
ClearImageCache
static void ClearImageCache()GetOrLoadImage
static Miri::Ref<Miri::IMiriRHITexture> GetOrLoadImage(const std::string& path)GetOrLoadImageAsync
static Miri::Ref<Miri::IMiriRHITexture> GetOrLoadImageAsync(const std::string& path)The non-blocking twin: returns the texture when it is cached, otherwise queues a decode on the worker and returns null (the caller keeps its placeholder). PumpAsyncImages uploads finished decodes and swaps them into the widgets that asked, once a frame, on the main thread.
PumpAsyncImages
static void PumpAsyncImages()PendingAsyncImages
static size_t PendingAsyncImages()GetOrLoadSizedImage
static Miri::Ref<Miri::IMiriRHITexture> GetOrLoadSizedImage(const std::string& stem, const std::vector<int32_t>& exportedSizes, float physicalPixels)One image exported at several pixel sizes ("<stem>-<N>.png"): picks the smallest export that still covers the on-screen size, because a 512 px source sampled down to 16 px without mips shimmers and a 16 px one stretched up blurs.
SetMediaSourceFactory
static void SetMediaSourceFactory(FMiriGraphicsMediaSourceFactory factory)Process-wide clip decoder for VideoPlayer nodes, injected by the host for the same reason the image decoder is: playback lives in Game. Null (the default) builds every VideoPlayer as a settings-only node.
HasMediaSourceFactory
static bool HasMediaSourceFactory()CreateMediaSource
static std::unique_ptr<IMiriGraphicsMediaSource> CreateMediaSource()SetStateSoundHook
static void SetStateSoundHook(FMiriGraphicsStateSoundHook hook)Plays the sound a style state names when a widget enters that state. The host installs it (MiriGraphics has no audio dependency); null mutes them.
PlayStateSound
static void PlayStateSound(const std::string& sound)SetMaterialResolver
static void SetMaterialResolver(FMiriGraphicsMaterialResolver resolver)ResolveMaterial
static std::shared_ptr<const Miri::FMiriCustomMaterial> ResolveMaterial(const std::string& path)NotifyMaterialsChanged
static void NotifyMaterialsChanged()GetMaterialGeneration
static uint64_t GetMaterialGeneration()SetRenderTargetResolver
static void SetRenderTargetResolver(FMiriGraphicsRenderTargetResolver resolver)ResolveRenderTarget
static FMiriGraphicsRenderTarget ResolveRenderTarget(const std::string& path)IsKnownType
static bool IsKnownType(const std::string& type)RegisteredTypes
static std::vector<std::string> RegisteredTypes()SetActiveTheme
static void SetActiveTheme(const FMiriGraphicsTheme* theme)Process-wide theme every build falls back to when neither the screen nor the build context names one. Hosts point this at the project theme; the pointer is borrowed, so the owner must outlive the last build.
ActiveTheme
static const FMiriGraphicsTheme& ActiveTheme()ResolveColorToken
static Miri::MiriColor ResolveColorToken(const std::string& token, const Miri::MiriColor& fallback)Token → colour through the active theme, then the default theme. Public because the designer resolves the same tokens for its swatches and its token picker, and the two must never drift apart.
ComposeUserWidget
static FMiriGraphicsNode ComposeUserWidget(const FMiriGraphicsNode& instance, const FMiriGraphicsAsset& referenced)Composes a referenced widget asset's tree with the overrides an embedding UserWidget node supplies: every exposed variable writes its value (or its default) onto the target node named by the referenced asset.
ResolveRightToLeft
static bool ResolveRightToLeft(const FMiriGraphicsNode& node, bool inherited)Resolves a node's flow_direction ("inherit", "ltr", "rtl") against the parent's.
MirrorCanvasSlot
static FMiriGraphicsCanvasSlot MirrorCanvasSlot(const FMiriGraphicsCanvasSlot& slot)A canvas slot mirrored about the canvas's vertical centre line, which is what a right-to-left canvas places its children by.
BuildDetachedRow
static Miri::TSharedPtr<Miri::MWidget> BuildDetachedRow(const FMiriGraphicsNode& templateNode, const MDF::MdfValue& item, uint32_t index, const FBuildContext& context, const std::vector<std::string>* fieldNames = nullptr)Builds one ListView row from a template node with the item's data substituted in. Runs lazily whenever the virtualized list realizes a row, so it takes a self-contained context copy rather than the live build state.