Skip to content

Ariadne settings: an editor for every key under a state subtree, from its metadata - #1372

Merged
transfix merged 2 commits into
masterfrom
feat/ariadne-settings-editor
Nov 20, 2026
Merged

transfix merged 2 commits into
masterfrom
feat/ariadne-settings-editor

Conversation

@transfix

Copy link
Copy Markdown
Owner

A new Ariadne widget, settings: (or type: settings): an editor for every key under a state subtree, each key's editor chosen from its metadata. A settings panel no longer needs one widget per key, as cars_settings (bindings/pycvc/pymod_gl/cars_panels.ari) lists them today. A document checks for it with (has? "settings").

- settings: Tuning
  root: sim                    # a state path, or a list of them
  filter: ["nav.*", "-nav.debug*"]
  groups:
    - nav: Navigation
    - world: {title: The world, help: what it is made of, open: true}
  search: true                 # its text kept at tree.<id>.search
  readouts: false              # leave out the read-only keys
  commit: release
  on: tuned

What each key gets

The editor comes from the metadata bindings already write: cvc/state/state_key_meta.h's access / unit / min / max, cvc/core/param_table.h's type / choices / default, and an optional scale (log | linear).

  • Read-out: a read-only node, or access: telemetry.
  • Combo: a key with choices.
  • Typed keys: a checkbox, an integer or a number for type bool / int / number.
  • Untyped keys with a unit or a range are numbers:
    • with no unit (state_key_meta's ""), a flag over 0..1 and a count otherwise;
    • tick is a count.
  • Text field: anything else, applied on Enter.
  • Sliders: a number with a range is a slider. It moves by ratio when the range is positive and spans 100x, unless scale says otherwise.
  • Groups: every branch is a group, with the keys before the branches at each level. groups: orders, renames and opens them.
  • Reset:
    • each changed key has one, and each group has a "reset all";
    • the default is the default property, else the value first seen.
  • Tooltip: the path, description, unit, range, default, and when a change applies.

How it works

  • Backend API: Backend::settings(label, id, SettingsSpec) -> SettingsEdit in backend.h.
  • Core (settings_emit.{h,cpp}):
    • It walks the subtree and writes edits and resets through the usual committed-write path: live while a slider moves, then on: after the commit.
    • It refuses a value the key's kind does not take, with a warning.
    • It rebuilds the spec only after a write under one of its roots, or a search change. Writes count as a value, a comment, a property, or a key added or removed; they are counted per root from the tree root's childChanged. At rest it reads no state.
    • It lists at most 2000 keys and 32 levels.
    • {i} works in root: and filter: under repeat:.
  • Terminals (FTXUI, tvision, and any backend without its own) get the default: a flat list of the backend's own widgets, with [title] lines, each key labelled with its path, and reset buttons.
  • ImGui (settings_imgui.cpp):
    • a collapsing header for each branch under the root, and tree nodes below it;
    • rows of name / editor / reset, plus the search box;
    • a protected settings_row_drawn hook that reports each row's rects to tests.
  • Docs: docs/ARIADNE.md §4.

Terminal (FTXUI), from the new golden:

name: [alpha]
speed: 3 m/s
[Navigation]
[ reset all ]
nav.mode: < b >
[x] nav.on
nav.vmax ██████▏              12.5 m/s
[ reset ]
[world]
world.seed █▎                   7

I also checked it by hand in arigl. I rendered examples/ariadne/documents/orthoslicer.ari with one extra window, a settings editor over the three volume_slice nodes' slice keys (which VolumeSliceNode describes with params_describe_state), using arigl snapshot --png. Each plane got a header and the right editors (a combo for axis and filter, a voxel slider for index, a checkbox for opaque), with resets where the values differ from the params defaults. That document is not part of this PR.

Tests

  • ariadne_settings_test (new):
    • editors from metadata, groups and their order, filter and search;
    • writes and on:, commit: release, key and group resets;
    • re-read only after a change under the root;
    • several roots, repeat:, and the flat default.
  • ariadne_loader_test: SettingsWidget.
  • ariadne_ftxui_test: SettingsDrawsAFlatList, the golden above plus a reset and a checkbox clicked.
  • cvcgl_imgui_settings (new):
    • a dragged slider writes live and runs on: once, at the release;
    • its reset writes the default;
    • a text field applies on Enter only.

Local results

Linux Release build. All Ariadne and ImGui ctest entries pass except three world/vehicle tests that need Jolt, which this local build lacks. Those tests don't involve this change.

@transfix
transfix enabled auto-merge (squash) November 19, 2026 21:05
… its metadata

A new widget, `settings:` (or `type: settings`), so a settings panel no longer lists a widget per
key. `(has? "settings")` finds it.

- .ari:
  - `root:` is a state path or a list of them;
  - `filter:` patterns (a substring or a glob, a leading '-' leaves out);
  - `groups:` orders, renames and opens branches (a key, {key: title} or {key: {title, help,
    open}});
  - `search: true` adds a search box, its text at tree.<id>.search;
  - `readouts: false` leaves out the read-only keys;
  - `open:`, `commit: release` and `on:` as elsewhere.
- Each key's editor comes from its metadata: state_key_meta's access / unit / min / max,
  param_table's type / choices / default, and an optional `scale` (log | linear).
  - A read-only node or `access: telemetry` is a read-out.
  - `choices` is a combo.
  - bool / int / number is a checkbox, an integer or a number.
  - An untyped key with a unit, or with a range, is a number:
    - no unit (state_key_meta's "") is a flag over 0..1, else a count;
    - `tick` is a count.
  - Anything else is a text field, applied on Enter.
  - A number with a range is a slider, by ratio when the range is positive and spans 100x.
- Groups: each branch is a group, keys first at each level.
- Reset: per key, and "reset all" per group. The default is the key's `default` property, else
  the value first seen.
- Each row's tooltip has the path, the description, unit, range, default and when it applies.
- Writes go through the committed-write path (live while a slider moves, `on:` after the
  commit). A value the key's kind does not take is refused with a warning.
- Backend::settings(label, id, SettingsSpec) -> SettingsEdit. The core (settings_emit.{h,cpp})
  walks the subtree and rebuilds the spec only after a write under a root (a value, a comment, a
  property, a key added or removed), counted per root from the tree root's childChanged, or when
  the search moves. At rest it reads no state.
  - It lists at most 2000 keys and 32 levels.
  - {i} works in root: and filter: under repeat:.
- The default for backends without their own (FTXUI, tvision) is a flat list of the backend's
  widgets: "[title]" lines, each key labelled with its path, reset buttons.
- ImGui (settings_imgui.cpp):
  - a collapsing header per branch under the root and a tree node below;
  - a row of name / editor / reset;
  - the search box;
  - a protected settings_row_drawn hook with each row's rects, for tests.

Tests:
- ariadne_settings_test (new): kinds from metadata, groups, filter and search, writes and on:,
  commit: release, resets, re-read only on change, several roots, repeat, the flat default.
- ariadne_loader_test SettingsWidget.
- The ariadne_ftxui_test flat-list golden, plus a reset and a checkbox clicked.
- cvcgl_imgui_settings (new): a slider dragged writes live and runs on: once at release; its
  reset writes the default; a text field applies on Enter only.
Windows' terminal draws no partial-block glyphs (U+2589..U+258F), so SettingsDrawsAFlatList's golden
failed there on the slider rows. The golden now reads that cell as a space and still checks the full
cells and everything else.
@transfix
transfix force-pushed the feat/ariadne-settings-editor branch from 607503a to d7ba8e3 Compare November 20, 2026 01:35
@transfix
transfix merged commit 3cdf2d3 into master Nov 20, 2026
29 checks passed
@transfix
transfix deleted the feat/ariadne-settings-editor branch November 20, 2026 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant