From 44846046cf6413521db3193c5c64e9238bc89049 Mon Sep 17 00:00:00 2001 From: Antoine Beyeler Date: Thu, 27 Jun 2024 16:22:42 +0200 Subject: [PATCH 1/3] Add help to several sections in the Selection Panel --- crates/re_selection_panel/src/defaults_ui.rs | 7 ++++ .../re_selection_panel/src/selection_panel.rs | 10 ++--- .../src/visible_time_range_ui.rs | 41 ++++++++++--------- .../re_selection_panel/src/visualizer_ui.rs | 19 +++++++++ crates/re_ui/src/section_collapsing_header.rs | 11 +++++ 5 files changed, 61 insertions(+), 27 deletions(-) diff --git a/crates/re_selection_panel/src/defaults_ui.rs b/crates/re_selection_panel/src/defaults_ui.rs index 152bce4db3fe..7c8ce6e5a34a 100644 --- a/crates/re_selection_panel/src/defaults_ui.rs +++ b/crates/re_selection_panel/src/defaults_ui.rs @@ -45,6 +45,12 @@ pub fn view_components_defaults_section_ui( add_button = add_button.enabled(false).disabled_hover_text(reason); } + let markdown = "# Component defaults\n +This section lists default values for components in the scope of the present view. The visualizers \ +corresponding to this view's entities use these defaults when no per-entity \ +override is specified.\n +Click on the `+` button to add a new default value."; + let body = |ui: &mut egui::Ui| { active_default_ui( ctx, @@ -58,6 +64,7 @@ pub fn view_components_defaults_section_ui( }; ui.section_collapsing_header("Component defaults") .button(add_button) + .help_markdown(markdown) .show(ui, body); } diff --git a/crates/re_selection_panel/src/selection_panel.rs b/crates/re_selection_panel/src/selection_panel.rs index c271e6520697..26c5affa30e7 100644 --- a/crates/re_selection_panel/src/selection_panel.rs +++ b/crates/re_selection_panel/src/selection_panel.rs @@ -319,8 +319,7 @@ impl SelectionPanel { view_id: &SpaceViewId, view_states: &mut ViewStates, ) { - fn entity_path_filter_help_ui(ui: &mut egui::Ui) { - let markdown = r#" + let markdown = r#" # Entity path query syntax Entity path queries are described as a list of include/exclude rules that act on paths: @@ -355,10 +354,7 @@ The last rule matching `/world/car/hood` is `- /world/car/**`, so it is excluded The last rule matching `/world` is `- /world`, so it is excluded. The last rule matching `/world/house` is `+ /world/**`, so it is included. "# - .trim(); - - ui.markdown_ui(egui::Id::new("entity_path_filter_help_ui"), markdown); - } + .trim(); clone_space_view_button_ui(ctx, ui, blueprint, *view_id); @@ -370,7 +366,7 @@ The last rule matching `/world/house` is `+ /world/**`, so it is included. }) .hover_text("Modify the entity query using the editor"), ) - .help_ui(entity_path_filter_help_ui) + .help_markdown(markdown) .show(ui, |ui| { // TODO(#6075): Because `list_item_scope` changes it. Temporary until everything is `ListItem`. ui.spacing_mut().item_spacing.y = ui.ctx().style().spacing.item_spacing.y; diff --git a/crates/re_selection_panel/src/visible_time_range_ui.rs b/crates/re_selection_panel/src/visible_time_range_ui.rs index 7ec06697cb0d..a4bae7254810 100644 --- a/crates/re_selection_panel/src/visible_time_range_ui.rs +++ b/crates/re_selection_panel/src/visible_time_range_ui.rs @@ -149,7 +149,10 @@ fn save_visible_time_ranges( let time_range = match query_range { QueryRange::TimeRange(time_range) => time_range, QueryRange::LatestAt => { - re_log::error!("Latest-at queries can't be used as an override yet. They can only come from defaults."); + re_log::error!( + "Latest-at queries can't be used as an override yet. They can only \ + come from defaults." + ); return; } }; @@ -173,10 +176,27 @@ fn query_range_ui( let time_type = time_ctrl.timeline().typ(); let mut interacting_with_controls = false; + let markdown = format!( + "# Visible time range\n +This feature controls the time range used to display data in the space view. + +The settings are inherited from the parent entity or enclosing space view if not overridden. + +Visible time range properties are stored separately for each _type_ of timelines. They may differ \ +depending on whether the current timeline is temporal or a sequence. The current settings apply to \ +all _{}_ timelines. + +Notes that the data current as of the time range starting time is included.", + match time_type { + TimeType::Time => "temporal", + TimeType::Sequence => "sequence", + } + ); let collapsing_response = ui .section_collapsing_header("Visible time range") .default_open(false) + .help_markdown(&markdown) .show(ui, |ui| { ui.horizontal(|ui| { ui.re_radio_value(has_individual_time_range, false, "Default") @@ -264,25 +284,6 @@ fn query_range_ui( } } } - - let markdown = format!("# Visible time range\n -This feature controls the time range used to display data in the space view. - -The settings are inherited from the parent entity or enclosing space view if not overridden. - -Visible time range properties are stored separately for each _type_ of timelines. They may differ depending on \ -whether the current timeline is temporal or a sequence. The current settings apply to all _{}_ timelines. - -Notes that the data current as of the time range starting time is included.", - match time_type { - TimeType::Time => "temporal", - TimeType::Sequence => "sequence", - } - ); - - collapsing_response.header_response.on_hover_ui(|ui| { - ui.markdown_ui(egui::Id::new(markdown.as_str()), &markdown); - }); } fn time_range_editor( diff --git a/crates/re_selection_panel/src/visualizer_ui.rs b/crates/re_selection_panel/src/visualizer_ui.rs index fe58eea259f6..7ce641d3f82c 100644 --- a/crates/re_selection_panel/src/visualizer_ui.rs +++ b/crates/re_selection_panel/src/visualizer_ui.rs @@ -50,8 +50,27 @@ pub fn visualizer_ui( .hover_text("Add additional visualizers") .disabled_hover_text("No additional visualizers available"); + let markdown = "# Visualizers + +This section lists the active visualizers for the selected entity. Visualizers use an entity's \ +components to display it in the current view. + +Each visualizer lists the components it uses and their values. The component values may come from \ +a variety of sources and can be overridden in place. + +The final component value is determined using the following priority order: +- **Override**: A value set from the UI and/or the blueprint. It has the highest precedence and is \ +always used if set. +- **Store**: If any, the value logged to the data store for this entity, e.g. via the SDK's `log` \ +function. +- **Default**: If set, the default value for this component in the current view, which can be set \ +in the blueprint or in the UI by selecting the view. +- **Fallback**: A context-sensitive value that is used if no other value is available. It is \ +specific to the visualizer and the current view type."; + ui.section_collapsing_header("Visualizers") .button(button) + .help_markdown(markdown) .show(ui, |ui| { visualizer_ui_impl(ctx, ui, &data_result, &active_visualizers); }); diff --git a/crates/re_ui/src/section_collapsing_header.rs b/crates/re_ui/src/section_collapsing_header.rs index 61ef24326a97..ceec68ad217a 100644 --- a/crates/re_ui/src/section_collapsing_header.rs +++ b/crates/re_ui/src/section_collapsing_header.rs @@ -49,7 +49,18 @@ impl<'a> SectionCollapsingHeader<'a> { self } + /// Set the help markdown tooltip to be shown in the header. + //TODO(#6191): the help button should be just another `impl ItemButton`. + #[inline] + pub fn help_markdown(mut self, help: &'a str) -> Self { + self.help = Some(Box::new(move |ui| { + ui.markdown_ui(egui::Id::new(help), help); + })); + self + } + /// Set the help UI closure to be shown in the header. + //TODO(#6191): the help button should be just another `impl ItemButton`. #[inline] pub fn help_ui(mut self, help: impl FnOnce(&mut egui::Ui) + 'a) -> Self { self.help = Some(Box::new(help)); From 3612da26f64fcfe5d50dd8ea3387406dbf080441 Mon Sep 17 00:00:00 2001 From: Antoine Beyeler <49431240+abey79@users.noreply.github.com> Date: Thu, 27 Jun 2024 18:12:40 +0200 Subject: [PATCH 2/3] Update crates/re_selection_panel/src/defaults_ui.rs Co-authored-by: Andreas Reich --- crates/re_selection_panel/src/defaults_ui.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/re_selection_panel/src/defaults_ui.rs b/crates/re_selection_panel/src/defaults_ui.rs index 7c8ce6e5a34a..e79648da4c0a 100644 --- a/crates/re_selection_panel/src/defaults_ui.rs +++ b/crates/re_selection_panel/src/defaults_ui.rs @@ -47,7 +47,7 @@ pub fn view_components_defaults_section_ui( let markdown = "# Component defaults\n This section lists default values for components in the scope of the present view. The visualizers \ -corresponding to this view's entities use these defaults when no per-entity \ +corresponding to this view's entities use these defaults when no per-entity store value or \ override is specified.\n Click on the `+` button to add a new default value."; From 23894e5fe44fbb10d06d5f7a03cdd12b91c4ccec Mon Sep 17 00:00:00 2001 From: Antoine Beyeler Date: Thu, 27 Jun 2024 18:22:45 +0200 Subject: [PATCH 3/3] Fix visible time range help string --- crates/re_selection_panel/src/defaults_ui.rs | 3 ++- .../src/visible_time_range_ui.rs | 21 ++++++------------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/crates/re_selection_panel/src/defaults_ui.rs b/crates/re_selection_panel/src/defaults_ui.rs index e79648da4c0a..4b10e4629221 100644 --- a/crates/re_selection_panel/src/defaults_ui.rs +++ b/crates/re_selection_panel/src/defaults_ui.rs @@ -104,7 +104,8 @@ fn active_default_ui( .get_by_identifier(*visualizer_identifier) else { re_log::warn!( - "Failed to resolve visualizer identifier {visualizer_identifier}, to a visualizer implementation" + "Failed to resolve visualizer identifier {visualizer_identifier}, to a \ + visualizer implementation" ); continue; }; diff --git a/crates/re_selection_panel/src/visible_time_range_ui.rs b/crates/re_selection_panel/src/visible_time_range_ui.rs index a4bae7254810..746149462b3a 100644 --- a/crates/re_selection_panel/src/visible_time_range_ui.rs +++ b/crates/re_selection_panel/src/visible_time_range_ui.rs @@ -176,27 +176,18 @@ fn query_range_ui( let time_type = time_ctrl.timeline().typ(); let mut interacting_with_controls = false; - let markdown = format!( - "# Visible time range\n + let markdown = "# Visible time range\n This feature controls the time range used to display data in the space view. -The settings are inherited from the parent entity or enclosing space view if not overridden. - -Visible time range properties are stored separately for each _type_ of timelines. They may differ \ -depending on whether the current timeline is temporal or a sequence. The current settings apply to \ -all _{}_ timelines. - -Notes that the data current as of the time range starting time is included.", - match time_type { - TimeType::Time => "temporal", - TimeType::Sequence => "sequence", - } - ); +Notes: +- The settings are inherited from the parent entity or enclosing space view if not overridden. +- Visible time range properties are stored on a per-timeline basis. +- The data current as of the time range starting time is included."; let collapsing_response = ui .section_collapsing_header("Visible time range") .default_open(false) - .help_markdown(&markdown) + .help_markdown(markdown) .show(ui, |ui| { ui.horizontal(|ui| { ui.re_radio_value(has_individual_time_range, false, "Default")