Skip to content

cvcGL: a hidden scene node hides its whole subtree, and generated_world's parts follow it - #1037

Merged
transfix merged 1 commit into
masterfrom
fix/cvcgl-visible-subtree
Nov 7, 2026
Merged

transfix merged 1 commit into
masterfrom
fix/cvcgl-visible-subtree

Conversation

@transfix

@transfix transfix commented Nov 7, 2026

Copy link
Copy Markdown
Owner

Why

docs/ARIADNE.md says a scene node hidden with visible: "is gone from every view". cvcGL didn't hold to that in two cases:

  • A source: { data } node. It draws its dataset's items as children when the dataset arrives. Those children were added under the hidden node and drew anyway. SceneNode::setVisible pushes a change down to the children it has, but a child attached later kept its own true, and an ordinary node drew by that flag alone. Only LodGraphicsNode looked up the hierarchy.
  • A generated_world node. Its meshes and water are top-level nodes beside it (<id>_props, _foliage, _needles, _buildings, _roads, _water), so hiding the node hid only its ground.

Found while building the multi-car template (#1035). Its document holds a data-sourced city and a generated world, shown one at a time. Both drew at once, so the template works around it in show_world(): it clears data.city, and hides gen_* by name.

What

  • Every node now draws by its flag and its ancestors (the rule LodGraphicsNode already had). A node's prop is in the renderer only while its own flag is set and every ancestor is visible:
    • SceneNode::syncProp() puts the prop in or takes it out, idempotently. setVisible(), addToRenderer() (attaching under a hidden parent included) and the default ancestorVisibilityChanged() all use it.
    • ancestorsVisible() is virtual: SceneNode says yes, since it has no parent link, and GraphicsNode walks its parents.
    • No flag changes. A child attached under a hidden parent keeps its own true and draws once the parent is shown. A node hidden on its own stays hidden when an ancestor is shown. The existing LOD tests pin exactly that, and pass unchanged.
  • LOD rungs stay registered. GraphicsNode::drawsChildrenItself(), true for LodGraphicsNode, keeps its rungs in the renderer whatever is above. It shows the active one by actor visibility, as before.
  • The label follows too. GraphicsNode's label goes by the hierarchy as well.
  • generated_world's parts follow their node. In its tick, when the node's isVisibleInHierarchy() changes, its meshes and water beside it get the same visibility. That's the push a child gets from its parent.
  • Docs. docs/ARIADNE.md and world_nodes.h say so.

Tests

  • cvcgl_ariadne_data, new test test_a_hidden_data_node_draws_nothing (headless, with a bare vtkRenderer):
    • a hidden data node's drawn city terrain and mesh stay out of the renderer, with their own flags still set;
    • showing the node puts them in, and hiding it takes them out;
    • a dataset that replaces the old one while the node is hidden arrives hidden.
  • cvcgl_ariadne_realize, generated_world block:
    • hiding the node hides its ground's chunks at once;
    • at the next tick, its meshes, trees and water are hidden too;
    • showing it brings the whole world back.
  • They fail without the fix: 3 checks in the data test, and the meshes check in the realize test.
  • Locally (Windows, MSVC 14.44): these two pass, and so do cvcgl_lod_node, cvcgl_bounds_walk, cvcgl_camera_idle, cvcgl_light_node, cvcgl_ari_switch, cvcgl_ari_golden, cvcgl_ariadne_views and cvcgl_ariadne_scenes. Every cvcgl_ test passes: 96 of 96, after a full build.
  • clang-format: no changes.

After this

#1035's show_world() workaround can then be dropped; its known-limits note in docs/CARS.md says so.

…ld's parts follow it

docs/ARIADNE.md says a node hidden with visible: is gone from every view, but a
source: { data } node's items, attached as children when the dataset arrives, drew
under it anyway (a child attached under a hidden parent kept its own true, and an
ordinary node drew by its flag alone), and a generated_world node's meshes and water
are top-level nodes beside it, so hiding it hid only its ground.

Every node now draws by its flag AND its ancestors, the rule LodGraphicsNode already
followed: SceneNode::syncProp puts the prop in the renderer only while the node's flag
is set and ancestorsVisible() (GraphicsNode walks its parents); setVisible,
addToRenderer and the default ancestorVisibilityChanged use it. No flag changes: a
child attached under a hidden parent keeps its own true and draws once the parent is
shown, and the existing LOD tests pass unchanged. drawsChildrenItself() keeps an LOD
node's rungs registered whatever is above. The label follows the hierarchy too.
generated_world's tick pushes the node's visibility to its parts beside it when it
changes.

Tests: cvcgl_ariadne_data's test_a_hidden_data_node_draws_nothing and the
generated_world block of cvcgl_ariadne_realize; both fail without the fix.
@transfix
transfix merged commit 2172222 into master Nov 7, 2026
25 of 27 checks passed
@transfix
transfix deleted the fix/cvcgl-visible-subtree branch November 7, 2026 02:01
transfix added a commit that referenced this pull request Nov 7, 2026
Bumps the project version and every recipe's upstream_version from 3.7.11 to 3.7.12. The v3.7.12 tag on this commit is the first release with the multi-car controller template (pycvc_gl.cars, #1031 #1035 #1040), the hidden-subtree fix in cvcGL (#1037), the discrete-gradient dyn_bike step (#978), semi-implicit Euler by default in the nav rollout (#981), the implicit contact damper (#1004, #1038), and generated_world's roads and water (#1032, #1034).
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