Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter entities in the UI (part 2): Introduce entity filtering in the time panel #8654

Merged
merged 10 commits into from
Jan 13, 2025
1 change: 0 additions & 1 deletion Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6428,7 +6428,6 @@ dependencies = [
"anyhow",
"criterion",
"egui",
"egui_kittest",
"itertools 0.13.0",
"nohash-hasher",
"once_cell",
Expand Down
27 changes: 23 additions & 4 deletions crates/viewer/re_context_menu/src/actions/collapse_expand_all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,24 +100,43 @@ impl ContextMenuAction for CollapseExpandAllAction {
}

fn process_instance_path(&self, ctx: &ContextMenuContext<'_>, instance_path: &InstancePath) {
#[expect(clippy::match_same_arms)]
let (db, scope) = match ctx
.selection
.context_for_item(&Item::InstancePath(instance_path.clone()))
{
Some(&ItemContext::StreamsTree {
store_kind: StoreKind::Recording,
filter_session_id: None,
}) => (ctx.viewer_context.recording(), CollapseScope::StreamsTree),

Some(&ItemContext::StreamsTree {
store_kind: StoreKind::Recording,
filter_session_id: Some(session_id),
}) => (
ctx.viewer_context.recording(),
CollapseScope::StreamsTreeFiltered { session_id },
),

Some(&ItemContext::StreamsTree {
store_kind: StoreKind::Blueprint,
filter_session_id: None,
}) => (
ctx.viewer_context.blueprint_db(),
CollapseScope::BlueprintStreamsTree,
),

Some(&ItemContext::StreamsTree {
store_kind: StoreKind::Recording,
}) => (ctx.viewer_context.recording(), CollapseScope::StreamsTree),
store_kind: StoreKind::Blueprint,
filter_session_id: Some(session_id),
}) => (
ctx.viewer_context.blueprint_db(),
CollapseScope::BlueprintStreamsTreeFiltered { session_id },
),

// default to recording if we don't have more specific information
_ => (ctx.viewer_context.recording(), CollapseScope::StreamsTree),
Some(&ItemContext::TwoD { .. } | &ItemContext::ThreeD { .. }) | None => {
(ctx.viewer_context.recording(), CollapseScope::StreamsTree)
}
};

let Some(subtree) = db.tree().subtree(&instance_path.entity_path) else {
Expand Down
3 changes: 2 additions & 1 deletion crates/viewer/re_time_panel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ serde.workspace = true
vec1.workspace = true

[dev-dependencies]
re_viewer_context = { workspace = true, features = ["testing"] }

anyhow.workspace = true
criterion.workspace = true
egui_kittest.workspace = true
rand.workspace = true

[lib]
Expand Down
Loading
Loading