Skip to content

Commit 9aab4ee

Browse files
committed
Move Properties section to re_selection_panel
1 parent a6c600b commit 9aab4ee

File tree

5 files changed

+39
-37
lines changed

5 files changed

+39
-37
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6078,7 +6078,6 @@ dependencies = [
60786078
"nohash-hasher",
60796079
"re_byte_size",
60806080
"re_capabilities",
6081-
"re_case",
60826081
"re_chunk_store",
60836082
"re_entity_db",
60846083
"re_format",
@@ -6630,6 +6629,7 @@ dependencies = [
66306629
"egui_tiles",
66316630
"itertools 0.14.0",
66326631
"nohash-hasher",
6632+
"re_case",
66336633
"re_chunk",
66346634
"re_chunk_store",
66356635
"re_context_menu",

crates/viewer/re_data_ui/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ all-features = true
2121
[dependencies]
2222
re_byte_size.workspace = true
2323
re_capabilities = { workspace = true, features = ["egui"] }
24-
re_case.workspace = true
2524
re_chunk_store.workspace = true
2625
re_entity_db.workspace = true
2726
re_format.workspace = true

crates/viewer/re_data_ui/src/entity_db.rs

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use re_byte_size::SizeBytes as _;
22
use re_chunk_store::ChunkStoreConfig;
33
use re_entity_db::EntityDb;
4-
use re_log_types::{EntityPath, StoreKind};
4+
use re_log_types::StoreKind;
55
use re_ui::UiExt as _;
66
use re_viewer_context::{UiLayout, ViewerContext};
77

@@ -13,8 +13,8 @@ impl crate::DataUi for EntityDb {
1313
ctx: &ViewerContext<'_>,
1414
ui: &mut egui::Ui,
1515
ui_layout: UiLayout,
16-
query: &re_chunk_store::LatestAtQuery,
17-
db: &re_entity_db::EntityDb,
16+
_query: &re_chunk_store::LatestAtQuery,
17+
_db: &re_entity_db::EntityDb,
1818
) {
1919
if ui_layout.is_single_line() {
2020
// TODO(emilk): standardize this formatting with that in `entity_db_button_ui`
@@ -213,32 +213,5 @@ impl crate::DataUi for EntityDb {
213213
}
214214
}
215215
}
216-
217-
ui.section_collapsing_header("Properties").show(ui, |ui| {
218-
let filtered = db
219-
.entity_paths()
220-
.into_iter()
221-
.filter(|entity_path| {
222-
// Only check for properties, but skip the recording properties,
223-
// because we display them already elsewhere in the UI.
224-
entity_path.is_descendant_of(&EntityPath::properties())
225-
})
226-
.collect::<Vec<_>>();
227-
228-
if filtered.is_empty() {
229-
ui.label("No properties found for this recording.");
230-
} else {
231-
for entity_path in filtered {
232-
// We strip the property part
233-
let name = entity_path
234-
.to_string()
235-
.strip_prefix(format!("{}/", EntityPath::properties()).as_str())
236-
.map(re_case::to_human_case)
237-
.unwrap_or("<unknown>".to_owned());
238-
ui.label(name);
239-
entity_path.data_ui(ctx, ui, ui_layout, query, db);
240-
}
241-
}
242-
});
243216
}
244217
}

crates/viewer/re_selection_panel/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ workspace = true
1919
all-features = true
2020

2121
[dependencies]
22+
re_case.workspace = true
2223
re_chunk_store.workspace = true
2324
re_chunk.workspace = true
2425
re_context_menu.workspace = true

crates/viewer/re_selection_panel/src/selection_panel.rs

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -281,17 +281,46 @@ impl SelectionPanel {
281281
_ => {}
282282
}
283283

284+
let (query, db) = if let Some(entity_path) = item.entity_path() {
285+
guess_query_and_db_for_selected_entity(ctx, entity_path)
286+
} else {
287+
(ctx.current_query(), ctx.recording())
288+
};
289+
284290
if let Some(data_ui_item) = data_section_ui(item) {
285291
ui.section_collapsing_header("Data").show(ui, |ui| {
286292
// TODO(#6075): Because `list_item_scope` changes it. Temporary until everything is `ListItem`.
287293
ui.spacing_mut().item_spacing.y = ui.ctx().style().spacing.item_spacing.y;
294+
data_ui_item.data_ui(ctx, ui, ui_layout, &query, db);
295+
});
296+
}
288297

289-
let (query, db) = if let Some(entity_path) = item.entity_path() {
290-
guess_query_and_db_for_selected_entity(ctx, entity_path)
298+
if let Item::StoreId(_) = item {
299+
ui.section_collapsing_header("Properties").show(ui, |ui| {
300+
let filtered = db
301+
.entity_paths()
302+
.into_iter()
303+
.filter(|entity_path| {
304+
// Only check for properties, but skip the recording properties,
305+
// because we display them already elsewhere in the UI.
306+
entity_path.is_descendant_of(&EntityPath::properties())
307+
})
308+
.collect::<Vec<_>>();
309+
310+
if filtered.is_empty() {
311+
ui.label("No properties found for this recording.");
291312
} else {
292-
(ctx.current_query(), ctx.recording())
293-
};
294-
data_ui_item.data_ui(ctx, ui, ui_layout, &query, db);
313+
for entity_path in filtered {
314+
// We strip the property part
315+
let name = entity_path
316+
.to_string()
317+
.strip_prefix(format!("{}/", EntityPath::properties()).as_str())
318+
.map(re_case::to_human_case)
319+
.unwrap_or("<unknown>".to_owned());
320+
ui.label(name);
321+
entity_path.data_ui(ctx, ui, ui_layout, &query, db);
322+
}
323+
}
295324
});
296325
}
297326

0 commit comments

Comments
 (0)