Skip to content

Ariadne views: a viewport widget, and node tags: that pick what each view draws - #1005

Merged
transfix merged 3 commits into
masterfrom
feat/ariadne-views
Nov 3, 2026
Merged

transfix merged 3 commits into
masterfrom
feat/ariadne-views

Conversation

@transfix

@transfix transfix commented Nov 3, 2026

Copy link
Copy Markdown
Owner

A document can now show its scene in one of its own windows. The view has its own camera, and can draw the whole scene or just some of it, picked by a new tags: key on scene nodes. That covers an overview map, a second angle on the same scene, or one layer on its own, with no host code. This is the viewport work roadmap §9.5 described; until now it existed only as a design.

scene:
  nodes:
    - { node: city, type: geometry, source: { file: city.glb } }      # untagged: in every view
    - { node: agents, type: geometry, tags: [sim], source: { ... } }
windows:
  - window: Overview
    children:
      - type: viewport
        view: overview        # its camera: <prefix>.viewers.overview.camera
        show: [sim]           # the untagged nodes, and those tagged sim
        camera: map           # orbit | fly | map | track
        chrome: false
        width: 280
        height: 240

The reference is docs/ARIADNE.md §5.18.

What's in it

Node tags:

  • SceneNode::tags takes a list or a single name. It is a built-in key, so it is no longer left in a custom node type's props.
  • RealizedScene::tagged lists the tagged nodes at any depth, held weakly.
  • A node's tags apply to its whole subtree. A child under a tagged parent shows only where both are allowed.
  • An untagged node is in every view. The main view draws everything.

The viewport widget (SceneViews, scene_views.h)

  • Each view is a mirror viewport of the main one: the same props, drawn from its own camera.
  • A new Viewport::setMirrorFilter drops the props of the nodes a view's show: / hide: rule out. A new SceneNode::collectViewProps lists a node's 3-D props, including a bounding box and the grid's three planes.
  • The widget reserves its rect in the window, which then paints its own background around it. A window that cut a hole last frame paints around this frame's holes (ImGuiBackend::cut_window_background).
  • So a view moves and scrolls with its window. It hides on any frame its widget isn't drawn: a closed or collapsed window, another tab, or a hidden UI.
  • A view is framed on what it shows. Dragging orbits it (middle or right button pans) and the wheel zooms it. The main camera doesn't move.
  • bind: takes the tag list from a state key, for a layers menu. clear_color: sets the view's background, which otherwise copies the main view's.
  • AriRuntime owns the views, so arigl and pycvc_gl get the widget. A new document removes the last one's views.

Component: cvc://components/scene_view.ari is a window around one viewport, configured by args (view, show, hide, camera, chrome, width, height, title, id). It is listed in INDEX.ari.

Example: examples/ariadne/documents/scene_views.ari has an overview map of the buildings and agents, without the goal markers or the grid. It also has a Layers view whose combo picks its tags.

Tested (Windows, Release, cvcGL + arigl, cvcpkg prefix)

New tests

  • cvcgl_ariadne_views, 27 checks, offscreen through AriRuntime:
    • each widget makes a mirror viewport where it is drawn;
    • the props each view keeps and leaves out, including a tagged child under a parent the view hides;
    • the pixels: the [sim] view shows red and blue, with no yellow where the main view has 43k yellow pixels;
    • a drag turns the view's camera and not the main one, and the wheel zooms it;
    • closing the window and hiding the UI hide the view, and showing them again brings it back;
    • a new document removes the views.
  • AriadneScene.NodeTags.
  • AriadneComponents.SceneViewPassesItsArgsToTheViewport.

Existing suites: ariadne_loader_test 217 (with ShippedComponentsLoadClean and ShippedExamplesDeclareWhatTheyNeed over the new files), ariadne_runtime_test 250, ariadne_host_test 42, cvcgl_ari_golden 34 (the goldens unchanged), cvcgl_viewport, cvcgl_viewport_input, cvcgl_scene_renderer_facade and cvcgl_ariadne_realize.

Example: arigl snapshot of scene_views.ari draws both views as described, with no load warnings.

Not run locally: pycvc / pycvc_gl and the wasm build.

Not in this PR

  • Per-view restyling (the roadmap's override:).
  • A top-level views: block of full-window views.
  • The mask as a state_exec expression. A bound tag list does that job for now.
  • A view has no shadows of its own.
  • The view lies under the whole UI, so a window behind the viewport's window still draws over it.
  • The first frame a window shows a view, its background is still opaque.
  • ariadne_hello builds its own runtime, so it doesn't have the widget. arigl and pycvc_gl do.

…view draws

A `type: viewport` widget shows the document's scene in one of its windows,
from a camera of its own (<prefix>.viewers.<view>.camera). It draws the whole
scene, or the untagged nodes plus those its show: / hide: allow, by the
nodes' new `tags:` key (roadmap 9.5). A node's tags hold for its subtree.

- scene.h / loader: SceneNode::tags (a list or one name), a built-in key.
- RealizedScene::tagged: the tagged nodes at any depth, held weakly.
- SceneNode::collectViewProps: every 3-D prop a node (and its subtree) can put
  in a renderer; GraphicsNode adds its bounding box, GridNode its planes.
- Viewport::setMirrorFilter: which source props a mirror's re-sync copies.
- ImGuiBackend::cut_window_background: a window that cut a hole last frame
  paints its own background around this frame's holes.
- SceneViews (scene_views.h): the widget. Each view is a mirror viewport of the
  main one, placed in the widget's rect, hidden on frames the widget is not
  drawn (closed or collapsed window, hidden UI), framed on what it shows;
  drag orbits / pans, the wheel zooms. AriRuntime owns one, so arigl and
  pycvc_gl have it; a new document removes the last one's views.
- components/scene_view.ari: a window around one viewport, configured by args.
- examples/ariadne/documents/scene_views.ari: an overview map and a layers view.
- docs: ARIADNE.md 5.18 and the component table; roadmap 9.5 status.

Tests: cvcgl_ariadne_views (props per view, pixels, input, hiding, reload);
AriadneScene.NodeTags; AriadneComponents.SceneViewPassesItsArgsToTheViewport.
…nager

cvcgl_ari_switch (and arigl at exit) close the SceneRenderer before the
AriRuntime goes; ~AriRuntime's views_->clear() then asked the closed view for
its ViewportManager, which throws, and a throw from a destructor aborts. With
the view closed, clear() and update() drop the views: their viewports went
with the manager. cvcgl_ariadne_views now closes its view with views present.
@transfix
transfix enabled auto-merge (squash) November 3, 2026 18:47
@transfix
transfix merged commit 4bfb5b3 into master Nov 3, 2026
16 of 27 checks passed
@transfix
transfix deleted the feat/ariadne-views branch November 3, 2026 18:59
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