From 2a6df1856ffb1a8bbc9451398fd15e17f43c5fc2 Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Thu, 9 Nov 2023 17:21:08 +0100 Subject: [PATCH 1/2] New debug option to show the blueprint in the streams view --- crates/re_data_ui/src/component_path.rs | 12 +++++++++++- crates/re_data_ui/src/instance_path.rs | 12 +++++++++++- crates/re_time_panel/src/lib.rs | 17 ++++++++++++++++- crates/re_viewer/src/ui/rerun_menu.rs | 6 ++++++ crates/re_viewer_context/src/app_options.rs | 5 +++++ 5 files changed, 49 insertions(+), 3 deletions(-) diff --git a/crates/re_data_ui/src/component_path.rs b/crates/re_data_ui/src/component_path.rs index 518a8fc69777..b8d020e3805d 100644 --- a/crates/re_data_ui/src/component_path.rs +++ b/crates/re_data_ui/src/component_path.rs @@ -16,7 +16,17 @@ impl DataUi for ComponentPath { component_name, } = self; - let store = ctx.store_db.store(); + let store = if ctx.app_options.show_blueprint_in_timeline + && ctx + .store_context + .blueprint + .entity_db() + .is_logged_entity(entity_path) + { + ctx.store_context.blueprint.store() + } else { + ctx.store_db.store() + }; if let Some(archetype_name) = component_name.indicator_component_archetype() { ui.label(format!( diff --git a/crates/re_data_ui/src/instance_path.rs b/crates/re_data_ui/src/instance_path.rs index 8b92e1b2a6a7..db2d4432ac92 100644 --- a/crates/re_data_ui/src/instance_path.rs +++ b/crates/re_data_ui/src/instance_path.rs @@ -19,7 +19,17 @@ impl DataUi for InstancePath { instance_key, } = self; - let store = ctx.store_db.store(); + let store = if ctx.app_options.show_blueprint_in_timeline + && ctx + .store_context + .blueprint + .entity_db() + .is_logged_entity(entity_path) + { + ctx.store_context.blueprint.store() + } else { + ctx.store_db.store() + }; let Some(components) = store.all_components(&query.timeline, entity_path) else { if ctx.store_db.entity_db().is_known_entity(entity_path) { diff --git a/crates/re_time_panel/src/lib.rs b/crates/re_time_panel/src/lib.rs index 4a47ac9e2aed..3e0cbc38060f 100644 --- a/crates/re_time_panel/src/lib.rs +++ b/crates/re_time_panel/src/lib.rs @@ -392,6 +392,7 @@ impl TimePanel { None, &ctx.store_db.entity_db().tree, ui, + "/", ); } else { self.show_children( @@ -403,6 +404,18 @@ impl TimePanel { ui, ); } + if ctx.app_options.show_blueprint_in_timeline { + self.show_tree( + ctx, + time_area_response, + time_area_painter, + tree_max_y, + None, + &ctx.store_context.blueprint.entity_db().tree, + ui, + "/ (blueprint)", + ); + } }); } @@ -416,6 +429,7 @@ impl TimePanel { last_path_part: Option<&EntityPathPart>, tree: &EntityTree, ui: &mut egui::Ui, + show_root_as: &str, ) { let tree_has_data_in_current_timeline = ctx.tree_has_data_in_current_timeline(tree); @@ -427,7 +441,7 @@ impl TimePanel { format!("{last_path_part}/") // show we have children with a / } } else { - "/".to_owned() + show_root_as.to_owned() }; let collapsing_header_id = ui.make_persistent_id(&tree.path); @@ -531,6 +545,7 @@ impl TimePanel { Some(last_component), child, ui, + "/", ); } diff --git a/crates/re_viewer/src/ui/rerun_menu.rs b/crates/re_viewer/src/ui/rerun_menu.rs index 21d6953bd50a..b0b01558859d 100644 --- a/crates/re_viewer/src/ui/rerun_menu.rs +++ b/crates/re_viewer/src/ui/rerun_menu.rs @@ -338,6 +338,12 @@ impl App { ) .on_hover_text("Show a debug overlay that renders the picking layer information using the `debug_overlay.wgsl` shader."); + self.re_ui.checkbox(ui, + &mut self.state.app_options.show_blueprint_in_timeline, + "Show the blueprint in the timeline", + ) + .on_hover_text("Show the blueprint data in the timeline tree view. This is useful for debugging the blueprint."); + ui.menu_button("Crash", |ui| { #[allow(clippy::manual_assert)] if ui.button("panic!").clicked() { diff --git a/crates/re_viewer_context/src/app_options.rs b/crates/re_viewer_context/src/app_options.rs index 6bb41c34ac07..98ed2df2aa0f 100644 --- a/crates/re_viewer_context/src/app_options.rs +++ b/crates/re_viewer_context/src/app_options.rs @@ -26,6 +26,9 @@ pub struct AppOptions { /// Displays an overlay for debugging picking. pub show_picking_debug_overlay: bool, + /// Includes the blueprint in the timeline view. + pub show_blueprint_in_timeline: bool, + /// What time zone to display timestamps in. pub time_zone_for_timestamps: TimeZone, } @@ -46,6 +49,8 @@ impl Default for AppOptions { show_picking_debug_overlay: false, + show_blueprint_in_timeline: false, + time_zone_for_timestamps: TimeZone::Utc, } } From 9489a45868312d757373e8de23f933b74b331bcb Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Thu, 9 Nov 2023 17:43:08 +0100 Subject: [PATCH 2/2] Clean up menu text --- crates/re_viewer/src/ui/rerun_menu.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/re_viewer/src/ui/rerun_menu.rs b/crates/re_viewer/src/ui/rerun_menu.rs index b0b01558859d..10143522ebd0 100644 --- a/crates/re_viewer/src/ui/rerun_menu.rs +++ b/crates/re_viewer/src/ui/rerun_menu.rs @@ -340,9 +340,9 @@ impl App { self.re_ui.checkbox(ui, &mut self.state.app_options.show_blueprint_in_timeline, - "Show the blueprint in the timeline", + "Show Blueprint in the Time Panel", ) - .on_hover_text("Show the blueprint data in the timeline tree view. This is useful for debugging the blueprint."); + .on_hover_text("Show the Blueprint data in the Time Panel tree view. This is useful for debugging the internal blueprint state."); ui.menu_button("Crash", |ui| { #[allow(clippy::manual_assert)]