Skip to content

Commit

Permalink
New debug option to show the blueprint in the streams view (#4189)
Browse files Browse the repository at this point in the history
### What
It's much easier to debug the blueprint if we can see what's going on.
Since the blueprint is just another store, we already have decent
inspection tools for this.

This just adds a toggle to show the blueprint in the time panel and a
bit of extra handling to resolve blueprint entity paths in the
selection-panel.

This doesn't handle entity-path-collisions gracefully, but as a
debug-only tool that seems like an acceptable trade-off. Eventually we
are going to need to track the originating store as part of the
selection anyways so this constraint should get resolved at that point.

This will become even more valuable as we migrate from serde-style to
arrow-style blueprint components as the data UI will become much more
useful.


![image](https://github.com/rerun-io/rerun/assets/3312232/eb24fe2b-607e-4bff-b101-54cb5d0fd83f)


### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested [demo.rerun.io](https://demo.rerun.io/pr/4189) (if
applicable)
* [x] The PR title and labels are set such as to maximize their
usefulness for the next release's CHANGELOG

- [PR Build Summary](https://build.rerun.io/pr/4189)
- [Docs
preview](https://rerun.io/preview/9489a45868312d757373e8de23f933b74b331bcb/docs)
<!--DOCS-PREVIEW-->
- [Examples
preview](https://rerun.io/preview/9489a45868312d757373e8de23f933b74b331bcb/examples)
<!--EXAMPLES-PREVIEW-->
- [Recent benchmark results](https://ref.rerun.io/dev/bench/)
- [Wasm size tracking](https://ref.rerun.io/dev/sizes/)
  • Loading branch information
jleibs committed Nov 10, 2023
1 parent a4cf644 commit 9b9f800
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 3 deletions.
12 changes: 11 additions & 1 deletion crates/re_data_ui/src/component_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down
12 changes: 11 additions & 1 deletion crates/re_data_ui/src/instance_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
17 changes: 16 additions & 1 deletion crates/re_time_panel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ impl TimePanel {
None,
&ctx.store_db.entity_db().tree,
ui,
"/",
);
} else {
self.show_children(
Expand All @@ -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)",
);
}
});
}

Expand All @@ -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);

Expand All @@ -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);
Expand Down Expand Up @@ -531,6 +545,7 @@ impl TimePanel {
Some(last_component),
child,
ui,
"/",
);
}

Expand Down
6 changes: 6 additions & 0 deletions crates/re_viewer/src/ui/rerun_menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 Blueprint in the Time Panel",
)
.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)]
if ui.button("panic!").clicked() {
Expand Down
5 changes: 5 additions & 0 deletions crates/re_viewer_context/src/app_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand All @@ -46,6 +49,8 @@ impl Default for AppOptions {

show_picking_debug_overlay: false,

show_blueprint_in_timeline: false,

time_zone_for_timestamps: TimeZone::Utc,
}
}
Expand Down

1 comment on commit 9b9f800

@github-actions
Copy link

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Rust Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.25.

Benchmark suite Current: 9b9f800 Previous: a4cf644 Ratio
mono_points_arrow/generate_message_bundles 24249449 ns/iter (± 3101736) 18710574 ns/iter (± 248516) 1.30

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.