Skip to main content

Module walker

Module walker 

Source
Expand description

Generic JSON walker — single source of truth for “show a component”.

Dispatch by JSON shape:

ShapeWidget
Object { x, y, z }Vec3 with X/Y/Z badges
Object { x, y, z, w }Quaternion (4 drag values)
Object { r, g, b, a }colour swatch + RGBA dragvalues
Object { "Variant": <inner> }enum: variant title + recurse
Object { … } (other)indented row of children
NumberDragValue
Boolcheckbox
Stringtext input
Array<f64> (3 or 4)falls through to Vec3 / colour
Nulldim “null” label

Functions§

render_array 🔒
Generic array row. Numeric arrays of length 3 / 4 are treated like Vec3 / Vec4 with axis colours; everything else falls back to “[i] = …” rows.
render_field 🔒
Renders a single labelled row. Picks a widget by leaf type or recurses for nested structure.
render_object 🔒
Walks a JSON object, picking the right widget for each shape.
render_value
Renders a top-level component value. Returns true if the user mutated any leaf — the caller queues a SetComponentJson edit in that case.