Repository navigation
Ariadne: prototypes: and a node's use: (DEF/USE) - #1509
Merged
Merged
Conversation
A document's `prototypes:` names node trees, and a node's `use: <name>`
stands for one, in any of its scenes: the prototype's node, its {name} args
filled in (its args: as defaults, then the node's), with the using node's keys
over it (material: merged key by key, children: after the prototype's). Gap
item 6 of the scene-format plan, after VRML/X3D's DEF/USE and USD's
prototypes.
Each mesh part (a file, a URI or a primitive with no {name} token in its
source or fit, and no body: or world:) becomes a hidden asset,
prototype:<name>/<path>, so it is read and fitted once for every instance and
drawn from one set of VTK arrays: the realizer is unchanged. Each instance is
its own node, with its own state, transform, material and tags. Nested
prototypes expand; a prototype within itself, or an unknown name, warns and
is parsed as written.
- loader.cpp: the prototypes block (kept raw, like units:), expand_use at the
top of parse_scene_node, share_proto_meshes, the hidden assets added to the
assets of scene: and every scenes: entry; use and args known node keys.
- docs/ARIADNE.md §5.18 "Prototypes".
- Tests: ariadne_loader_test PrototypesAndUse; cvcgl_ariadne_prototypes.
transfix
enabled auto-merge (squash)
November 23, 2026 23:42
loader.cpp conflicted where #1464 turned is_builtin_block into a table (kBuiltinBlocks): its table kept, with prototypes added to it. #1464 checks every load against the closed .ari schema, so it gains this branch's keys: - a top-level prototypes, a map of name to an object, checked only for its args: (a prototype's values may hold {name} tokens its instances fill in, as a unit's do); - use (string) and args (a map of scalars) on node_builtin and node_custom. docs/ARIADNE.md's Prototypes says what the schema checks.
known_scene_node_key conflicted where #1491 adds on_pick and this branch use and args: all three kept. With the validator: ariadne_schema_test 13 (one skip), ariadne_loader_test 264; cvcgl_ariadne_prototypes 14/14 and cvcgl_ariadne_node_pick 23/23 on the merge.
…ment, #1469 # Conflicts: # src/cvc/ariadne/loader.cpp # src/cvc/tests/ariadne_loader_test.cpp
…hers # Conflicts: # src/cvc/tests/ariadne_loader_test.cpp # src/cvcGL/CMakeLists.txt
transfix
added a commit
that referenced
this pull request
Nov 24, 2026
# Conflicts: # src/cvcGL/CMakeLists.txt
transfix
added a commit
that referenced
this pull request
Nov 24, 2026
Conflicts: src/cvcGL/CMakeLists.txt's 8 MB-stack list keeps both sides' tests; volume_grid, volume_grid_contours and volume_grid_quad take master's images (#1452 changed their documents) until CI's frames of the merge are taken.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A document can now declare a whole node tree once and place it many times.
assets:already shared a mesh between nodes, but a composite object, such as a lamp made of a pole and a bulb, each with its own material and transform, had to be copied out in full for every placement. This is item 6 of the Ariadne scene-format gap plan, after VRML/X3D's DEF/USE and USD's prototypes.How it works
transform:,tags:,visible:,repeat:, or asource:of its own.material:merges key by key, somaterial: { color }recolours one instance.children:the using node gives come after the prototype's.{name}tokens are filled from the prototype'sargs:(defaults), then the using node's. A token neither gives stays as written, souse:on arepeat:node makes one instance per{i}.prototype:<name>/<path>). The existing asset path then reads and fits it once for every instance, in every scene and everyrepeat:copy, and draws them all from one set of VTK arrays (GeometryNode::shareArraysFrom). The realizer is unchanged.{name}token, since instances may differ.body:orworld:, because physics takes a primitive's shape from its source.use:others. A prototype within itself, at any depth, is refused with a warning, and so is an unknown name; the node is then parsed as written.Changes
src/cvc/ariadne/loader.cpp):prototypes:block, kept raw likeunits:;expand_useat the top ofparse_scene_node;share_proto_meshes;scene:and of everyscenes:entry.useandargsare known node keys, andprototypesa known top-level block.Tests
ariadne_loader_testPrototypesAndUse:children:are appended andmaterial:merged;scenes:entry, and the asset holds the part's source;body:, with an arg in their source, or with the use site's ownsource:keep their own;cvcgl_ariadne_prototypes(headlessrealize_scene, 14 checks):repeat:makes three instances;visible:key from its args.Verified locally
Windows, MSVC, with cvcGL (no examples, no pycvc), on master 7f8326d: the full ctest suite, 8,540 tests at
-j 10.cvcgl_ariadne_repeat,cvcgl_ariadne_scenesand the loader's other scene tests.cvcgl_contour_labandcvcgl_volume_grid_contours(this build has nocvc::planar), andcvcgl_ari_golden. Its seven goldens have the same pixel counts as master without this change.cvcgl_tf_binding,DistributedStateSession.PumpThreadRunsandLocksStress.LT04_FuzzedProtocolPoints.No shipped document uses
use:orargs:on a scene node (the matches are widgetinclude:args and the document's ownargs:block), so making them known node keys changes none.Not verified: Linux, macOS, wasm and pycvc.
Schema
#1464 (the closed schema, which every load checks) merged first, so this PR carries its own keys (4ac6016, merging master):
prototypes: a map of name to an object, checked only for itsargs:. A prototype's values may hold{name}tokens its instances fill in, as a unit's do.use(string) andargs(a map of scalars) onnode_builtinandnode_custom.With the validator built in:
ariadne_schema_testpasses 13 (one skip, the without-validator case),ariadne_loader_testpasses 263 includingPrototypesAndUse, andcvcgl_ariadne_prototypespasses 14/14 on the merged code.Not yet: an instance checked against
$defs/nodeafter it is expanded, as an included unit is checked as a widget. That needs a third compiled validator beside the document's and the widget's.Not done
load:ed fragment.