Expand description
Registry of inspector-editable enum variants.
The JSON-driven inspector walks serde_json::Values and renders widgets
by shape. Single-key objects are typically serde-tagged enum variants:
e.g. {"Directional": {...}} for LightType::Directional(_). To let
the user switch the variant from the inspector, we need (1) the list
of valid variant names and (2) a default-serialized payload for each.
That information cannot be reliably derived from the JSON alone (the
type information is lost once we serialize to serde_json::Value), so
this module hard-codes the small set of enums the inspector currently
knows how to switch. It is opt-in: enums not registered here keep
the previous read-only Variant: <key> label.
A future iteration could move this generation into the #[derive(Component)]
macro itself (emit enum_variants_for(field_path) per field whose type
is an enum). For now, the registry is the smallest honest fix.
Structs§
Functions§
- build_
registry 🔒 - editable_
variants - Returns the editable variant set for a single-key JSON object whose key
matches a known enum variant, or
Noneif the key isn’t recognised.