Skip to content

Ariadne: repeat: on scene nodes, copies that follow a live count (§5.4) - #1230

Merged
transfix merged 1 commit into
masterfrom
feat/ariadne-scene-repeat
Nov 15, 2026
Merged

transfix merged 1 commit into
masterfrom
feat/ariadne-scene-repeat

Conversation

@transfix

@transfix transfix commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

Widgets take repeat:; scene nodes did not, so a pool of markers sized by a list in state had to be
a fixed pool of hidden nodes. This gives a scene node repeat:: the node is a template, drawn as
copies beside one another, and the copies follow the count while the scene runs.

The document

scene:
  nodes:
    - node: marker_{i}
      repeat: markers            # a number, a state key, or a read-lane expression
      source: { sphere: 0.5 }
      tags: [markers]
      visible: markers.{i}.on
      children:
        - node: ring
          source: { box: 0.2 }
  • The count is a whole number, a state key holding one (a list's node holds its length, as
    state-set-tree and host.set_table write it), or a read-lane expression counted as a widget's
    is (Runtime::eval_count: clamped to 0..4096, last good count on a budget skip). A key that holds
    no number counts 0.
  • Each copy is the template with {i} filled in: its id, visible: bind, tags, source:
    (file, asset, data and item), material: { texture }, clip offset binds, every string in its
    props, and its children's (cvc::ariadne::scene_node_instance). An id without {i} gets
    _{i}. Copies keep the template's transform:, tags:, visible: and children.
  • Live. tick_scene counts each repeated node every frame (sync_scene_repeats) and adds or
    removes copies, the last ones first, with no reload. A copy takes with it what it brought to the
    RealizedScene: its node and created entry, its nodes tag entries, its visibility and clip
    bindings, its tickers and data bindings, its height fields, and its range of custom_ticks
    (later ranges move down; what those closures held is released).
  • Placing copies. A copy is a node, so a program moves it through its own position,
    rotation and scale keys. A copy made when the count grows starts at the pose those keys
    already hold, so a program can write a new marker's count and position in one step. Before
    copies go, the scene's publisher is flushed, so a leaving copy's queued pose can't land on top of
    the next write.
  • Nesting. Copies under a group are its children. A repeat: inside a repeated node counts its
    own copies in each copy and goes with it; its {i} is its own (the loader warns, as for widgets).
  • Not on copies: body: and world:. The physics world and the worlds are built once from the
    declared nodes, so the loader drops them from a repeated subtree, with a warning.

Hosts. AppRuntime hands its SceneAdapter the document's read lane
(SceneAdapter::set_count_fn, cleared when the runtime goes). AriRuntime's adapter (so arigl,
arigl-web, ariglx and pycvc_gl's Host) and TerminalScene pass it to realize_scene as
RealizeOptions::count. A host calling realize_scene itself without one still counts numbers and
keys; an expression there draws no copies and warns.

Tests

  • ariadne_loader_test: RepeatParsedOntoNode, RepeatCountKinds,
    RepeatInstanceSubstitutesIndex, RepeatDropsBodiesAndWarnsNested,
    RepeatThatIsNotAScalarWarns.
  • ariadne_runtime_test: AriadneAppRuntime.SceneRepeatCountsOnTheReadLane (the count function
    AppRuntime gives its adapter, and that it is cleared when the runtime goes).
  • cvcgl_ariadne_repeat (new): a key's count growing and shrinking with created, nodes and
    visibility kept in step; a kept pose; a custom type's ticks coming and going (and released)
    with a later node's tick still running; copies under a group by an expression; a nested repeat;
    an expression with no read lane; then a repeat: (int (state-get "n")) document in AriRuntime.
    38 checks, 32 of 32 parallel runs pass locally.

Locally (Linux, Release): ariadne_loader_test, ariadne_runtime_test, ariadne_requires_test,
ariadne_server_document_test, ariadne_ftxui_test, cvcgl_ariadne_realize,
cvcgl_ariadne_physics, cvcgl_ariadne_data, cvcgl_ari_switch and the cvcGL scene / stream /
terminal ctest entries all pass, with pycvc built. Rebased 2026-11-14 onto master f8863fd (after
#1225 fixed master's build); the one conflict was the core source list.

Docs: docs/ARIADNE.md §5.4, "Repeated nodes".

A scene node with `repeat:` is a template drawn as copies beside one another, as a widget's
repeat: draws its instances. The count is a whole number, a state key holding one (a list's
node holds its length), or a read-lane expression, counted as a widget's is.

- Copy k is the template with {i} = k in its id, visible: and material: { opacity } binds,
  tags, sources, texture, clip offset binds, props and children (scene_node_instance). An id
  without {i} gets _{i}.
- tick_scene counts every repeated node each frame (sync_scene_repeats) and adds or removes
  copies to match, without a reload. A copy takes what it brought to the RealizedScene with it:
  its node, created entry, tagged nodes, visibility, clip and opacity bindings, tickers, data
  bindings (the data indices a bound opacity holds move down with them), height fields and its
  custom_ticks range, whose later ranges move down.
- A copy made when the count grows starts at the pose its node's position, rotation and scale
  keys hold, so a program can write a new copy's count and position in one step. The scene's
  publisher is flushed before copies go, so a leaving copy's queued pose cannot land over that.
- Under a group the copies are its children. A repeat: inside a repeated node counts its own
  copies in each and goes with its outer copy.
- body: and world: are dropped from a repeated subtree with a warning: the physics world and
  the worlds are built once from the declared nodes.
- Expressions are counted on the document's read lane: Runtime::eval_count, which AppRuntime
  hands its SceneAdapter (SceneAdapter::set_count_fn) and takes back when it goes. AriRuntime's
  adapter and TerminalScene pass it to realize_scene as RealizeOptions::count. Without one a
  number or a key still counts, and an expression draws none and warns.

Tests: ariadne_loader_test (RepeatParsedOntoNode, RepeatCountKinds,
RepeatInstanceSubstitutesIndex, RepeatInstanceBindsItsOwnOpacity,
RepeatDropsBodiesAndWarnsNested, RepeatThatIsNotAScalarWarns), ariadne_runtime_test
(AriadneAppRuntime.SceneRepeatCountsOnTheReadLane) and a new cvcgl_ariadne_repeat
(realize_scene + tick_scene over a key, an expression, a custom type's ticks, a nested repeat
and per-copy bound opacity, then a document in AriRuntime). docs/ARIADNE.md §5.4.
@transfix
transfix force-pushed the feat/ariadne-scene-repeat branch from f0bdadc to 01fc177 Compare November 15, 2026 02:20
@transfix
transfix merged commit f805c65 into master Nov 15, 2026
28 checks passed
@transfix
transfix deleted the feat/ariadne-scene-repeat branch November 15, 2026 08:36
transfix added a commit that referenced this pull request Nov 15, 2026
- app_runtime.cpp: the constructor hands the scene its repeat: count function (#1230), then
  takes the verb table's lock as before.
- e2ee_intrinsics.cpp (#1191): the e2ee-* provider registers its async functions on the calling
  program's host (*ictx.host, else the app's), as every provider on this branch does (B30), so an
  isolated document's e2ee-backup and e2ee-restore park on its own group.
- STATE_EXEC_THREADED.md: the e2ee provider in the provider table and the file list.
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