Add "Show/Hide in all views" entity context menu actions#12799
Open
ollema wants to merge 3 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
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.
Author
|
Demo: Screen.Recording.2026-05-22.at.15.34.07.mov |
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.
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.
Related
What
Two new entity context-menu actions, additive to the existing per-view
Show/Hide:visible=trueon every view whoseViewContentsincludes the clicked entity.visible=falseon every view whoseViewContentsincludes the clicked entity.The two new items follow the existing
Show/Hidegating convention inre_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 regularShow/Hidewhen 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 existingDataResult::save_visible(...).Implementation lives in four
pubfree functions inre_viewer_context::view::visibility_actions:entity_visibility_in_view(ctx, view_id, entity_path) -> Option<bool>andset_entity_visibility_in_view(ctx, view_id, entity_path, visible)— the single-view read/write helpers. The existing per-viewShow/Hideactions inre_context_menu::actions::show_hideare 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 twoContextMenuActionshims inre_context_menu::actions::show_hide_in_all_views.The latter two share a private iterator over
ctx.query_resultsso 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.rspin 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.