EntityFields struct

An entity's reflected components as a field source, for property grids and bindings.

EntityFields fields(world, entity);   // reads the published frame
ui.Properties(fields);                // or ui.Properties({ a, b }) for several

One category per component, one field per reflected field, in declaration order. Values are read through the host's binding reader (Reader()), at the world's published read frame. An edit is a FieldEdit the Brain applies: through the edit sink when one is set (the editor's, so a drag or a typed entry is one undo step), otherwise submitted to the world.

It holds no pointer to itself, so the grid can keep copies. A binding target is the entity's handle with the world's slot in its spare top byte.

Base classes

struct GGUI::FieldSource
An object with fields to show: how to enumerate them, read them, and report edits.

Public types

struct EditSink
Where edits go.

Public static functions

static auto Reader(const GGUI::BindingReader& next) -> GGUI::BindingReader
Reads entity targets; anything else goes to next (the engine statistics, a game's own).
static void SetEditSink(const EditSink& sink)
Set before any document edits. Empty: edits are submitted to the world, with no undo.
static void Remember(WorldBase& world)
A new world: its entities can be bound from its registry alone. World setup calls it.
static void Forget(const WorldBase& world)
The world is going away: targets naming it read as gone. World teardown calls it.
static auto BindingTarget(WorldBase& world, EntityHandle entity) -> GGUI::BindTarget
The binding target for entity in world. For TnxBind.
static auto BindingTarget(const Registry* registry, EntityHandle entity) -> GGUI::BindTarget
The binding target for entity in the remembered world that owns registry; 0, which reads as nothing, if none does.
static auto EntityOf(GGUI::BindTarget target, WorldBase*& world, EntityHandle& entity) -> bool
The world and entity a binding target names. False if it isn't an entity's, or its world is gone.
static auto BindingField(uint32_t componentType, uint32_t index) -> GGUI::FieldID
The FieldID of a component's field, by its index in the component's field list.
static auto AssetItems(AssetType type, GGUI::GGDataSource& out) -> bool
The loaded assets of type as an item picker's choices: an asset's item is its slot plus one. For any source with asset references. False for a type that has none.

Constructors, destructors, conversion operators

EntityFields(WorldBase& world, EntityHandle entity)
The fields of entity in world.