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

Add selection hierarchy breadcrumbs #8319

Merged
merged 42 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
dffaeb1
Always show an item, even if it is not found
emilk Dec 3, 2024
ef61c69
Refactor `ItemTitle`
emilk Dec 3, 2024
3fa7e02
Do not use Debug-formatting in user-facing strings
emilk Dec 4, 2024
8406c68
Fix: make sure selected list items show up as such
emilk Dec 4, 2024
3436f82
Implement selection heading contents manuallt
emilk Dec 4, 2024
7e8886a
Better titles on hover
emilk Dec 4, 2024
482d77b
Add breadcrumbs for containers and views
emilk Dec 4, 2024
18a6983
Better file naming
emilk Dec 4, 2024
f593c82
Breadcrumbs for component paths
emilk Dec 4, 2024
a925b3f
Add bread crumbs for component paths and instance paths from streams
emilk Dec 4, 2024
5d79a96
Better parenting
emilk Dec 4, 2024
5e4c2d3
Break up long functions
emilk Dec 4, 2024
509e058
Fix warnings
emilk Dec 4, 2024
093f8f1
More niceties
emilk Dec 4, 2024
671906b
Dimmer breadcrumb colors
emilk Dec 4, 2024
9276e85
Move `DataResultNodeOrPath` into its own file
emilk Dec 4, 2024
238d353
MOAR CRUMBS
emilk Dec 4, 2024
ad865bf
Fix origin-relative space view paths
emilk Dec 4, 2024
c56d4b1
Handle projections
emilk Dec 5, 2024
5c21dfa
Cleanup
emilk Dec 5, 2024
a73f012
Cleanup
emilk Dec 5, 2024
ddd3ff4
fix spacing and add a TODO
emilk Dec 5, 2024
6fd2d5a
Remove icon from final item
emilk Dec 5, 2024
86c1ed8
Same separator icon for all crumbs
emilk Dec 5, 2024
4744d65
Remove "in view" from data results (you can see it from the crumbs)
emilk Dec 5, 2024
75bf9e6
Color tweaks
emilk Dec 5, 2024
d53baa2
Nicer tooltip
emilk Dec 5, 2024
79bcc4e
Better tooltips
emilk Dec 5, 2024
8b2ec7c
Make instance number clickable
emilk Dec 5, 2024
60fcb3e
Show icons sometimes
emilk Dec 5, 2024
c558169
Fix extra indentation
emilk Dec 5, 2024
06ed243
Change TODO
emilk Dec 5, 2024
9b4998c
Update Cargo.lock
emilk Dec 5, 2024
16635df
Merge branch 'main' into emilk/breadcrumbs
emilk Dec 5, 2024
87964e3
Fix some TODOs
emilk Dec 5, 2024
73a2bfe
Add incstance number to selected instance path
emilk Dec 5, 2024
70b30da
Fix ListItem jitter when we change selections
emilk Dec 5, 2024
3b0e7cc
Merge branch 'main' into emilk/breadcrumbs
emilk Dec 5, 2024
ab4c9bb
Merge branch 'main' into emilk/breadcrumbs
emilk Dec 6, 2024
2b8ecb2
Remove ItemTitle re-export
emilk Dec 6, 2024
da81026
Better fix for selected listitem color
emilk Dec 6, 2024
53b5687
Add TODO
emilk Dec 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1923,7 +1923,7 @@ checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125"
[[package]]
name = "ecolor"
version = "0.29.1"
source = "git+https://github.com/emilk/egui.git?rev=c5ac7d301a90afbaec843ee04fb43d8a0956cc90#c5ac7d301a90afbaec843ee04fb43d8a0956cc90"
source = "git+https://github.com/emilk/egui.git?rev=577ee8d22810752540636febac5660a5119c6550#577ee8d22810752540636febac5660a5119c6550"
dependencies = [
"bytemuck",
"color-hex",
Expand All @@ -1940,7 +1940,7 @@ checksum = "18aade80d5e09429040243ce1143ddc08a92d7a22820ac512610410a4dd5214f"
[[package]]
name = "eframe"
version = "0.29.1"
source = "git+https://github.com/emilk/egui.git?rev=c5ac7d301a90afbaec843ee04fb43d8a0956cc90#c5ac7d301a90afbaec843ee04fb43d8a0956cc90"
source = "git+https://github.com/emilk/egui.git?rev=577ee8d22810752540636febac5660a5119c6550#577ee8d22810752540636febac5660a5119c6550"
dependencies = [
"ahash",
"bytemuck",
Expand Down Expand Up @@ -1979,7 +1979,7 @@ dependencies = [
[[package]]
name = "egui"
version = "0.29.1"
source = "git+https://github.com/emilk/egui.git?rev=c5ac7d301a90afbaec843ee04fb43d8a0956cc90#c5ac7d301a90afbaec843ee04fb43d8a0956cc90"
source = "git+https://github.com/emilk/egui.git?rev=577ee8d22810752540636febac5660a5119c6550#577ee8d22810752540636febac5660a5119c6550"
dependencies = [
"accesskit",
"ahash",
Expand All @@ -1996,7 +1996,7 @@ dependencies = [
[[package]]
name = "egui-wgpu"
version = "0.29.1"
source = "git+https://github.com/emilk/egui.git?rev=c5ac7d301a90afbaec843ee04fb43d8a0956cc90#c5ac7d301a90afbaec843ee04fb43d8a0956cc90"
source = "git+https://github.com/emilk/egui.git?rev=577ee8d22810752540636febac5660a5119c6550#577ee8d22810752540636febac5660a5119c6550"
dependencies = [
"ahash",
"bytemuck",
Expand All @@ -2015,7 +2015,7 @@ dependencies = [
[[package]]
name = "egui-winit"
version = "0.29.1"
source = "git+https://github.com/emilk/egui.git?rev=c5ac7d301a90afbaec843ee04fb43d8a0956cc90#c5ac7d301a90afbaec843ee04fb43d8a0956cc90"
source = "git+https://github.com/emilk/egui.git?rev=577ee8d22810752540636febac5660a5119c6550#577ee8d22810752540636febac5660a5119c6550"
dependencies = [
"accesskit_winit",
"ahash",
Expand Down Expand Up @@ -2057,7 +2057,7 @@ dependencies = [
[[package]]
name = "egui_extras"
version = "0.29.1"
source = "git+https://github.com/emilk/egui.git?rev=c5ac7d301a90afbaec843ee04fb43d8a0956cc90#c5ac7d301a90afbaec843ee04fb43d8a0956cc90"
source = "git+https://github.com/emilk/egui.git?rev=577ee8d22810752540636febac5660a5119c6550#577ee8d22810752540636febac5660a5119c6550"
dependencies = [
"ahash",
"egui",
Expand All @@ -2074,7 +2074,7 @@ dependencies = [
[[package]]
name = "egui_glow"
version = "0.29.1"
source = "git+https://github.com/emilk/egui.git?rev=c5ac7d301a90afbaec843ee04fb43d8a0956cc90#c5ac7d301a90afbaec843ee04fb43d8a0956cc90"
source = "git+https://github.com/emilk/egui.git?rev=577ee8d22810752540636febac5660a5119c6550#577ee8d22810752540636febac5660a5119c6550"
dependencies = [
"ahash",
"bytemuck",
Expand All @@ -2092,7 +2092,7 @@ dependencies = [
[[package]]
name = "egui_kittest"
version = "0.29.1"
source = "git+https://github.com/emilk/egui.git?rev=c5ac7d301a90afbaec843ee04fb43d8a0956cc90#c5ac7d301a90afbaec843ee04fb43d8a0956cc90"
source = "git+https://github.com/emilk/egui.git?rev=577ee8d22810752540636febac5660a5119c6550#577ee8d22810752540636febac5660a5119c6550"
dependencies = [
"dify",
"egui",
Expand Down Expand Up @@ -2161,7 +2161,7 @@ checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
[[package]]
name = "emath"
version = "0.29.1"
source = "git+https://github.com/emilk/egui.git?rev=c5ac7d301a90afbaec843ee04fb43d8a0956cc90#c5ac7d301a90afbaec843ee04fb43d8a0956cc90"
source = "git+https://github.com/emilk/egui.git?rev=577ee8d22810752540636febac5660a5119c6550#577ee8d22810752540636febac5660a5119c6550"
dependencies = [
"bytemuck",
"serde",
Expand Down Expand Up @@ -2277,7 +2277,7 @@ dependencies = [
[[package]]
name = "epaint"
version = "0.29.1"
source = "git+https://github.com/emilk/egui.git?rev=c5ac7d301a90afbaec843ee04fb43d8a0956cc90#c5ac7d301a90afbaec843ee04fb43d8a0956cc90"
source = "git+https://github.com/emilk/egui.git?rev=577ee8d22810752540636febac5660a5119c6550#577ee8d22810752540636febac5660a5119c6550"
dependencies = [
"ab_glyph",
"ahash",
Expand All @@ -2296,7 +2296,7 @@ dependencies = [
[[package]]
name = "epaint_default_fonts"
version = "0.29.1"
source = "git+https://github.com/emilk/egui.git?rev=c5ac7d301a90afbaec843ee04fb43d8a0956cc90#c5ac7d301a90afbaec843ee04fb43d8a0956cc90"
source = "git+https://github.com/emilk/egui.git?rev=577ee8d22810752540636febac5660a5119c6550#577ee8d22810752540636febac5660a5119c6550"

[[package]]
name = "equivalent"
Expand Down
14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -559,13 +559,13 @@ significant_drop_tightening = "allow" # An update of parking_lot made this trigg
# As a last resport, patch with a commit to our own repository.
# ALWAYS document what PR the commit hash is part of, or when it was merged into the upstream trunk.

ecolor = { git = "https://github.com/emilk/egui.git", rev = "c5ac7d301a90afbaec843ee04fb43d8a0956cc90" } # egui master 2024-12-03
eframe = { git = "https://github.com/emilk/egui.git", rev = "c5ac7d301a90afbaec843ee04fb43d8a0956cc90" } # egui master 2024-12-03
egui = { git = "https://github.com/emilk/egui.git", rev = "c5ac7d301a90afbaec843ee04fb43d8a0956cc90" } # egui master 2024-12-03
egui_extras = { git = "https://github.com/emilk/egui.git", rev = "c5ac7d301a90afbaec843ee04fb43d8a0956cc90" } # egui master 2024-12-03
egui_kittest = { git = "https://github.com/emilk/egui.git", rev = "c5ac7d301a90afbaec843ee04fb43d8a0956cc90" } # egui master 2024-12-03
egui-wgpu = { git = "https://github.com/emilk/egui.git", rev = "c5ac7d301a90afbaec843ee04fb43d8a0956cc90" } # egui master 2024-12-03
emath = { git = "https://github.com/emilk/egui.git", rev = "c5ac7d301a90afbaec843ee04fb43d8a0956cc90" } # egui master 2024-12-03
ecolor = { git = "https://github.com/emilk/egui.git", rev = "577ee8d22810752540636febac5660a5119c6550" } # egui master 2024-12-04
eframe = { git = "https://github.com/emilk/egui.git", rev = "577ee8d22810752540636febac5660a5119c6550" } # egui master 2024-12-04
egui = { git = "https://github.com/emilk/egui.git", rev = "577ee8d22810752540636febac5660a5119c6550" } # egui master 2024-12-04
egui_extras = { git = "https://github.com/emilk/egui.git", rev = "577ee8d22810752540636febac5660a5119c6550" } # egui master 2024-12-04
egui_kittest = { git = "https://github.com/emilk/egui.git", rev = "577ee8d22810752540636febac5660a5119c6550" } # egui master 2024-12-04
egui-wgpu = { git = "https://github.com/emilk/egui.git", rev = "577ee8d22810752540636febac5660a5119c6550" } # egui master 2024-12-04
emath = { git = "https://github.com/emilk/egui.git", rev = "577ee8d22810752540636febac5660a5119c6550" } # egui master 2024-12-04

# Useful while developing:
# ecolor = { path = "../../egui/crates/ecolor" }
Expand Down
9 changes: 9 additions & 0 deletions crates/store/re_entity_db/src/instance_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ impl InstancePath {
instance: self.instance,
}
}

/// Human-readable description of the kind
pub fn kind(&self) -> &'static str {
if self.instance.is_specific() {
"Entity instance"
} else {
"Entity"
}
}
}

impl std::fmt::Display for InstancePath {
Expand Down
31 changes: 1 addition & 30 deletions crates/viewer/re_blueprint_tree/src/blueprint_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use re_log_types::EntityPath;
use re_types::blueprint::components::Visible;
use re_ui::{drag_and_drop::DropTarget, list_item, ContextExt as _, DesignTokens, UiExt as _};
use re_viewer_context::{
contents_name_style, icon_for_container_kind, CollapseScope, Contents, DataResultTree,
contents_name_style, icon_for_container_kind, CollapseScope, Contents, DataResultNodeOrPath,
SystemCommandSender,
};
use re_viewer_context::{
Expand All @@ -18,35 +18,6 @@ use re_viewer_context::{
use re_viewport_blueprint::ui::show_add_space_view_or_container_modal;
use re_viewport_blueprint::{SpaceViewBlueprint, ViewportBlueprint};

enum DataResultNodeOrPath<'a> {
Path(&'a EntityPath),
DataResultNode(&'a DataResultNode),
}

impl<'a> DataResultNodeOrPath<'a> {
fn from_path_lookup(result_tree: &'a DataResultTree, path: &'a EntityPath) -> Self {
result_tree
.lookup_node_by_path(path)
.map_or(DataResultNodeOrPath::Path(path), |node| {
DataResultNodeOrPath::DataResultNode(node)
})
}

fn path(&self) -> &'a EntityPath {
match self {
DataResultNodeOrPath::Path(path) => path,
DataResultNodeOrPath::DataResultNode(node) => &node.data_result.entity_path,
}
}

fn data_result_node(&self) -> Option<&'a DataResultNode> {
match self {
DataResultNodeOrPath::Path(_) => None,
DataResultNodeOrPath::DataResultNode(node) => Some(node),
}
}
}

/// Holds the state of the blueprint tree UI.
#[derive(Default)]
pub struct BlueprintTree {
Expand Down
49 changes: 31 additions & 18 deletions crates/viewer/re_data_ui/src/item_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,30 +62,43 @@ pub fn entity_path_parts_buttons(
space_view_id: Option<SpaceViewId>,
entity_path: &EntityPath,
) -> egui::Response {
let with_icon = false; // too much noise with icons in a path
let with_individual_icons = false; // too much noise with icons in a path

ui.horizontal(|ui| {
ui.spacing_mut().item_spacing.x = 2.0;
{
ui.spacing_mut().item_spacing.x = 2.0;

// Show one single icon up-front instead:
let instance_path = InstancePath::entity_all(entity_path.clone());
ui.add(instance_path_icon(&query.timeline(), db, &instance_path).as_image());
// The last part points to the selected entity, but that's ugly, so remove the highlight:
let visuals = ui.visuals_mut();
visuals.selection.bg_fill = egui::Color32::TRANSPARENT;
visuals.selection.stroke = visuals.widgets.inactive.fg_stroke;
}
Comment on lines +68 to +75
Copy link
Member

Choose a reason for hiding this comment

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

does this scope serve a purpose?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not really - it is just a logical grouping, and reducing the scope of variables, thus lessoning the mental overhead


let mut accumulated = Vec::new();
for part in entity_path.iter() {
accumulated.push(part.clone());
if !with_individual_icons {
// Show one single icon up-front instead:
let instance_path = InstancePath::entity_all(entity_path.clone());
ui.add(instance_path_icon(&query.timeline(), db, &instance_path).as_image());
}

if entity_path.is_root() {
ui.strong("/");
Comment on lines +83 to 84
Copy link
Member Author

Choose a reason for hiding this comment

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

We used to show nothing if the root was selected

instance_path_button_to_ex(
ctx,
query,
db,
ui,
space_view_id,
&InstancePath::entity_all(accumulated.clone().into()),
part.syntax_highlighted(ui.style()),
with_icon,
);
} else {
let mut accumulated = Vec::new();
for part in entity_path.iter() {
accumulated.push(part.clone());

ui.strong("/");
instance_path_button_to_ex(
ctx,
query,
db,
ui,
space_view_id,
&InstancePath::entity_all(accumulated.clone().into()),
part.syntax_highlighted(ui.style()),
with_individual_icons,
);
}
}
})
.response
Expand Down
Loading
Loading