Skip to content

Add "Show/Hide in all views" entity context menu actions#12799

Open
ollema wants to merge 3 commits into
rerun-io:mainfrom
ollema:hide-in-all-views
Open

Add "Show/Hide in all views" entity context menu actions#12799
ollema wants to merge 3 commits into
rerun-io:mainfrom
ollema:hide-in-all-views

Conversation

@ollema
Copy link
Copy Markdown

@ollema ollema commented May 22, 2026

Related

What

Two new entity context-menu actions, additive to the existing per-view Show / Hide:

  • Show in all viewsvisible=true on every view whose ViewContents includes the clicked entity.
  • Hide in all viewsvisible=false on every view whose ViewContents includes the clicked entity.

The two new items follow the existing Show / Hide gating convention in re_context_menu::actions::show_hide, meaning that they only appear in the menu when at least one other view (excluding the clicked view itself) has the opposite visibility. The menu stays clean when there's nothing to do, and doesn't appear redundantly alongside the regular Show / Hide when the clicked view is the only outlier.

Per-peer smart-clear is also preserved. Each peer's override is cleared when the new value matches that view's parent default, not written as a redundant Some(true) / Some(false). This comes for free because the implementation just calls each peer's existing DataResult::save_visible(...).

Implementation lives in four pub free functions in re_viewer_context::view::visibility_actions:

  • entity_visibility_in_view(ctx, view_id, entity_path) -> Option<bool> and set_entity_visibility_in_view(ctx, view_id, entity_path, visible) — the single-view read/write helpers. The existing per-view Show / Hide actions in re_context_menu::actions::show_hide are migrated onto these so all four actions read and write visibility through one place.
  • set_entity_visibility_in_all_views(ctx, entity_path, visible) — applies the new value, skipping views that don't contain the entity, views where it appears only as a synthesized tree-prefix ancestor, and views whose resolved visibility already matches.
  • any_other_view_has_entity_visibility(ctx, excluded_view_id, entity_path, visibility) — the menu-gating companion used by the two ContextMenuAction shims in re_context_menu::actions::show_hide_in_all_views.

The latter two share a private iterator over ctx.query_results so the read-side and write-side filters can't drift apart.

Five blueprint-store integration tests in crates/viewer/re_test_viewport/tests/show_hide_in_all_views.rs pin propagation, smart-clear on toggle-back, the scope filter, that the helper does not write a redundant override on a view already inheriting the desired visibility from a parent, and that it skips views where the entity exists only as a synthesized tree-prefix ancestor.

Manually smoke-tested as well.

This PR has been authored with the help of Claude Code, but I have reviewed the code to the best of my ability.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! Thanks for opening this pull request.

Because this is your first time contributing to this repository, make sure you've read our Contributor Guide and Code of Conduct.

@ollema ollema force-pushed the hide-in-all-views branch from 2e1ee90 to 308ded5 Compare May 22, 2026 13:12
@ollema
Copy link
Copy Markdown
Author

ollema commented May 22, 2026

Demo:

Screen.Recording.2026-05-22.at.15.34.07.mov

ollema added 3 commits May 23, 2026 17:11
Empty no-op helper in re_viewer_context::view::visibility_actions,
re-exported from view/mod.rs.  Body is intentionally left empty —
a failing test in re_test_viewport will pin the behavior before
the real implementation lands.
`visibility_actions` now holds four helpers shared between callers that
need to read or write per-view visibility overrides:

- `entity_visibility_in_view` — single-view read,
- `set_entity_visibility_in_view` — single-view write,
- `set_entity_visibility_in_all_views` — write across every view whose
  `ViewContents` contains the entity, skipping views whose resolved
  visibility already matches to preserve parent-to-child inheritance,
- `any_other_view_has_entity_visibility` — gating predicate for the
  in-all-views actions, built on the same private iterator.

Tests in re_test_viewport pin:
- propagation to every containing view,
- smart-clear when toggling back to the parent default,
- skip of views whose `ViewContents` does not include the entity.
Two new ContextMenuActions next to the existing per-view Show / Hide.
They appear only when at least one peer view has the opposite visibility
state for the entity (gated via `any_other_view_has_entity_visibility`,
mirroring the gating convention of the per-view actions), and delegate
to `set_entity_visibility_in_all_views`.

The existing per-view Show / Hide actions in `show_hide.rs` are migrated
onto the shared `entity_visibility_in_view` / `set_entity_visibility_in_view`
helpers so the four actions read and write visibility through one place.
@ollema ollema force-pushed the hide-in-all-views branch from 308ded5 to d7258c8 Compare May 23, 2026 15:11
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.

Add "Show/Hide in all views" entity context menu actions

1 participant