1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
use re_data_store::InstancePath;
use re_log_types::ComponentPath;
use re_query::{get_component_with_instances, QueryError};
use crate::{misc::ViewerContext, ui::UiVerbosity};
use super::DataUi;
const HIDDEN_COMPONENTS_FOR_ALL_VERBOSITY: &[&str] = &["rerun.instance_key"];
const HIDDEN_COMPONENTS_FOR_LOW_VERBOSITY: &[&str] = &["rerun.msg_id"];
impl DataUi for InstancePath {
fn data_ui(
&self,
ctx: &mut ViewerContext<'_>,
ui: &mut egui::Ui,
verbosity: UiVerbosity,
query: &re_arrow_store::LatestAtQuery,
) {
let store = &ctx.log_db.entity_db.data_store;
let Some(mut components) = store.all_components(&query.timeline, &self.entity_path) else {
ui.label(format!("No components in entity {}", self.entity_path));
return;
};
components.sort();
egui::Grid::new("entity_instance")
.num_columns(2)
.show(ui, |ui| {
for component_name in components {
let component_data = get_component_with_instances(
store,
query,
&self.entity_path,
component_name,
);
if matches!(component_data, Err(QueryError::PrimaryNotFound)) {
continue; // no need to show components that are unset at this point in time
}
// Certain fields are hidden.
if HIDDEN_COMPONENTS_FOR_ALL_VERBOSITY.contains(&component_name.as_str()) {
continue;
}
match verbosity {
UiVerbosity::Small | UiVerbosity::MaxHeight(_) | UiVerbosity::Reduced => {
if HIDDEN_COMPONENTS_FOR_LOW_VERBOSITY
.contains(&component_name.as_str())
{
continue;
}
}
UiVerbosity::All => {}
}
ctx.component_path_button_to(
ui,
component_name.short_name(),
&ComponentPath::new(self.entity_path.clone(), component_name),
);
match component_data {
Err(err) => {
ui.label(ctx.re_ui.error_text(format!("Error: {err}")));
}
Ok(component_data) => {
if self.instance_key.is_splat() {
super::component::EntityComponentWithInstances {
entity_path: self.entity_path.clone(),
component_data,
}
.data_ui(
ctx,
ui,
UiVerbosity::Small,
query,
);
} else {
ctx.component_ui_registry.ui(
ctx,
ui,
UiVerbosity::Small,
query,
&component_data,
&self.instance_key,
);
}
}
}
ui.end_row();
}
Some(())
});
}
}