Skip to content

Commit 97e8ed9

Browse files
authored
Improve the unknown view class text (#8302)
1 parent 9562cea commit 97e8ed9

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

crates/viewer/re_viewer_context/src/space_view/space_view_class_placeholder.rs

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
use re_types::SpaceViewClassIdentifier;
2+
use re_ui::UiExt;
3+
14
use crate::{
25
SpaceViewClass, SpaceViewClassRegistryError, SpaceViewSpawnHeuristics, SpaceViewState,
36
SpaceViewSystemExecutionError, SpaceViewSystemRegistrator, SystemExecutionOutput, ViewQuery,
47
ViewerContext,
58
};
6-
use re_types::SpaceViewClassIdentifier;
7-
use re_ui::UiExt;
89

910
/// A placeholder space view class that can be used when the actual class is not registered.
1011
#[derive(Default)]
@@ -24,7 +25,7 @@ impl SpaceViewClass for SpaceViewClassPlaceholder {
2425
}
2526

2627
fn help_markdown(&self, _egui_ctx: &egui::Context) -> String {
27-
"The space view class was not recognized.\n\nThis happens if either the blueprint specifies an invalid space view class or this version of the viewer does not know about this type.".to_owned()
28+
"Placeholder view for unknown space view class".to_owned()
2829
}
2930

3031
fn on_register(
@@ -48,13 +49,27 @@ impl SpaceViewClass for SpaceViewClassPlaceholder {
4849

4950
fn ui(
5051
&self,
51-
ctx: &ViewerContext<'_>,
52+
_ctx: &ViewerContext<'_>,
5253
ui: &mut egui::Ui,
5354
_state: &mut dyn SpaceViewState,
5455
_query: &ViewQuery<'_>,
5556
_system_output: SystemExecutionOutput,
5657
) -> Result<(), SpaceViewSystemExecutionError> {
57-
ui.markdown_ui(&self.help_markdown(ctx.egui_ctx));
58+
egui::Frame {
59+
inner_margin: egui::Margin::same(re_ui::DesignTokens::view_padding()),
60+
..Default::default()
61+
}
62+
.show(ui, |ui| {
63+
ui.warning_label("Unknown space view class");
64+
65+
ui.markdown_ui(
66+
"This happens if either the blueprint specifies an invalid space view class or \
67+
this version of the viewer does not know about this type.\n\n\
68+
\
69+
**Note**: some views may require a specific Cargo feature to be enabled. In \
70+
particular, the map view requires the `map_view` feature.",
71+
);
72+
});
5873

5974
Ok(())
6075
}

0 commit comments

Comments
 (0)