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

More context menu 5: add context menu to streams tree #5422

Merged
merged 3 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/re_time_panel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ re_log_types.workspace = true
re_tracing.workspace = true
re_ui.workspace = true
re_viewer_context.workspace = true
re_viewport.workspace = true # TODO(#5421): remove this dependency in favor of re_viewport_blueprint when it exists

egui.workspace = true
itertools.workspace = true
Expand Down
33 changes: 32 additions & 1 deletion crates/re_time_panel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use re_ui::list_item::{ListItem, WidthAllocationMode};
use re_viewer_context::{
CollapseScope, HoverHighlight, Item, RecordingConfig, TimeControl, TimeView, ViewerContext,
};
use re_viewport::{context_menu_ui_for_item, SelectionUpdateBehavior, ViewportBlueprint};

use time_axis::TimelineAxis;
use time_control_ui::TimeControlUi;
Expand Down Expand Up @@ -133,6 +134,7 @@ impl TimePanel {
pub fn show_panel(
&mut self,
ctx: &ViewerContext<'_>,
viewport_blueprint: &ViewportBlueprint,
entity_db: &re_entity_db::EntityDb,
rec_cfg: &RecordingConfig,
ui: &mut egui::Ui,
Expand Down Expand Up @@ -223,7 +225,13 @@ impl TimePanel {
let mut streams_frame = egui::Frame::default();
streams_frame.inner_margin.left = margin.x;
streams_frame.show(ui, |ui| {
self.expanded_ui(ctx, entity_db, ui, &mut time_ctrl_after);
self.expanded_ui(
ctx,
viewport_blueprint,
entity_db,
ui,
&mut time_ctrl_after,
);
});
});
}
Expand Down Expand Up @@ -287,6 +295,7 @@ impl TimePanel {
fn expanded_ui(
&mut self,
ctx: &ViewerContext<'_>,
viewport_blueprint: &ViewportBlueprint,
entity_db: &re_entity_db::EntityDb,
ui: &mut egui::Ui,
time_ctrl: &mut TimeControl,
Expand Down Expand Up @@ -422,6 +431,7 @@ impl TimePanel {
// All the entity rows and their data density graphs:
self.tree_ui(
ctx,
viewport_blueprint,
entity_db,
time_ctrl,
&time_area_response,
Expand Down Expand Up @@ -473,6 +483,7 @@ impl TimePanel {
fn tree_ui(
&mut self,
ctx: &ViewerContext<'_>,
viewport_blueprint: &ViewportBlueprint,
entity_db: &re_entity_db::EntityDb,
time_ctrl: &mut TimeControl,
time_area_response: &egui::Response,
Expand Down Expand Up @@ -501,6 +512,7 @@ impl TimePanel {
if show_root {
self.show_tree(
ctx,
viewport_blueprint,
time_ctrl,
time_area_response,
time_area_painter,
Expand All @@ -513,6 +525,7 @@ impl TimePanel {
} else {
self.show_children(
ctx,
viewport_blueprint,
time_ctrl,
time_area_response,
time_area_painter,
Expand All @@ -528,6 +541,7 @@ impl TimePanel {
fn show_tree(
&mut self,
ctx: &ViewerContext<'_>,
viewport_blueprint: &ViewportBlueprint,
time_ctrl: &mut TimeControl,
time_area_response: &egui::Response,
time_area_painter: &egui::Painter,
Expand Down Expand Up @@ -588,6 +602,7 @@ impl TimePanel {
|_, ui| {
self.show_children(
ctx,
viewport_blueprint,
time_ctrl,
time_area_response,
time_area_painter,
Expand All @@ -610,6 +625,13 @@ impl TimePanel {
);
});

context_menu_ui_for_item(
ctx,
viewport_blueprint,
&item.to_item(),
&response,
SelectionUpdateBehavior::UseSelection,
);
ctx.select_hovered_on_click(&response, item.to_item());

let is_closed = body_response.is_none();
Expand Down Expand Up @@ -664,6 +686,7 @@ impl TimePanel {
fn show_children(
&mut self,
ctx: &ViewerContext<'_>,
viewport_blueprint: &ViewportBlueprint,
time_ctrl: &mut TimeControl,
time_area_response: &egui::Response,
time_area_painter: &egui::Painter,
Expand All @@ -674,6 +697,7 @@ impl TimePanel {
for (last_component, child) in &tree.children {
self.show_tree(
ctx,
viewport_blueprint,
time_ctrl,
time_area_response,
time_area_painter,
Expand Down Expand Up @@ -715,6 +739,13 @@ impl TimePanel {

ui.set_clip_rect(clip_rect_save);

context_menu_ui_for_item(
ctx,
viewport_blueprint,
&item.to_item(),
&response,
SelectionUpdateBehavior::UseSelection,
);
ctx.select_hovered_on_click(&response, item.to_item());

let response_rect = response.rect;
Expand Down
10 changes: 9 additions & 1 deletion crates/re_viewer/src/app_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,18 @@ impl AppState {
};

if app_options.inspect_blueprint_timeline {
blueprint_panel.show_panel(&ctx, ctx.store_context.blueprint, blueprint_cfg, ui, true);
blueprint_panel.show_panel(
&ctx,
&viewport_blueprint,
ctx.store_context.blueprint,
blueprint_cfg,
ui,
true,
);
}
time_panel.show_panel(
&ctx,
&viewport_blueprint,
ctx.entity_db,
ctx.rec_cfg,
ui,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,17 @@
README = """
# Context Menu - Add entity to new space view

## Blueprint tree

* Reset the blueprint.
* Expend all space views and data result.
* Right-click on the `boxes3d` entity and select "Add to new space view" -> "3D". Check a new space view is created _and selected_ with the boxes3d entity and origin set to root.
* In each space view, right-click on the leaf entity, and check that "Add to new space view" recommends at least space views of the same kind.
* Select both the `boxes3d` entity and the `text_logs` entity. Check no space view is recommended (except Dataframe if enabled).

## Streams tree

* Right-click on the `bars` entity and check that a Bar Plot space view can successfully be created.
"""


Expand Down