Skip to content

Commit

Permalink
- Restored title
Browse files Browse the repository at this point in the history
- added path to parent entity in the top-level context
- removed redundant blueprint section for non-splat instance
- adjusted spacing in `{instance|entity_path}_parts_button`
  • Loading branch information
abey79 committed Feb 19, 2024
1 parent 45766c5 commit 20ff5fb
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 34 deletions.
4 changes: 4 additions & 0 deletions crates/re_data_ui/src/item_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ pub fn entity_path_parts_buttons(
entity_path: &EntityPath,
) -> egui::Response {
ui.horizontal(|ui| {
ui.spacing_mut().item_spacing.x = 4.0;

let mut accumulated = Vec::new();
for part in entity_path.iter() {
accumulated.push(part.clone());
Expand Down Expand Up @@ -158,6 +160,8 @@ pub fn instance_path_parts_buttons(
instance_path: &InstancePath,
) -> egui::Response {
ui.horizontal(|ui| {
ui.spacing_mut().item_spacing.x = 4.0;

let mut accumulated = Vec::new();
for part in instance_path.entity_path.iter() {
accumulated.push(part.clone());
Expand Down
88 changes: 54 additions & 34 deletions crates/re_viewer/src/ui/selection_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use re_types::{
};
use re_types_core::components::InstanceKey;
use re_ui::list_item::ListItem;
use re_ui::ReUi;
use re_ui::{ReUi, SyntaxHighlighting as _};
use re_viewer_context::{
blueprint_timepoint_for_writes, gpu_bridge::colormap_dropdown_button_ui, ContainerId,
DataQueryId, HoverHighlight, Item, SpaceViewClass, SpaceViewClassIdentifier, SpaceViewId,
Expand Down Expand Up @@ -409,38 +409,71 @@ fn what_is_selected_ui(
}
}
Item::InstancePath(space_view_id, instance_path) => {
let typ = if instance_path.instance_key.is_splat() {
"Entity"
} else {
let is_instance = !instance_path.instance_key.is_splat();

let typ = if is_instance {
"Entity instance"
} else {
"Entity"
};

let (query, store) =
guess_query_and_store_for_selected_entity(ctx, &instance_path.entity_path);

let name = instance_path.syntax_highlighted(ui.style());
let parent = if is_instance {
Some(instance_path.entity_path.clone())
} else {
instance_path.entity_path.parent()
};

if let Some(space_view_id) = space_view_id {
if let Some(space_view) = viewport.space_view(space_view_id) {
item_ui::instance_path_parts_buttons(
ctx,
&query,
store,
item_title_ui(
ctx.re_ui,
ui,
Some(*space_view_id),
instance_path,
)
.on_hover_text(format!(
"{typ} '{instance_path}' as shown in Space View {:?}",
space_view.display_name
));
name,
None,
&format!(
"{typ} '{instance_path}' as shown in Space View {:?}",
space_view.display_name
),
);

if let Some(parent) = parent {
ui.horizontal(|ui| {
ui.label("path");
item_ui::entity_path_parts_buttons(
ctx,
&query,
store,
ui,
Some(*space_view_id),
&parent,
);
});
}

ui.horizontal(|ui| {
ui.label("in");
space_view_button(ctx, ui, space_view);
});
}
} else {
item_ui::instance_path_parts_buttons(ctx, &query, store, ui, None, instance_path)
.on_hover_text(format!("{typ} '{instance_path}'"));
item_title_ui(
ctx.re_ui,
ui,
name,
None,
&format!("{typ} '{instance_path}'"),
);

if let Some(parent) = parent {
ui.horizontal(|ui| {
ui.label("path");
item_ui::entity_path_parts_buttons(ctx, &query, store, ui, None, &parent);
});
}

list_existing_data_blueprints(ui, ctx, &instance_path.entity_path, viewport);
}
Expand Down Expand Up @@ -761,7 +794,9 @@ fn show_list_item_for_container_child(
fn has_blueprint_section(item: &Item) -> bool {
match item {
Item::ComponentPath(_) | Item::Container(_) => false,
Item::InstancePath(space_view_id, _) => space_view_id.is_some(),
Item::InstancePath(space_view_id, instance_path) => {
space_view_id.is_some() && instance_path.instance_key.is_splat()
}
_ => true,
}
}
Expand Down Expand Up @@ -912,22 +947,7 @@ fn blueprint_ui_for_instance_path(
) {
if let Some(space_view_id) = space_view_id {
if let Some(space_view) = viewport.blueprint.space_view(space_view_id) {
if instance_path.instance_key.is_specific() {
let (query, store) =
guess_query_and_store_for_selected_entity(ctx, &instance_path.entity_path);
ui.horizontal(|ui| {
ui.label("Part of");
item_ui::entity_path_button(
ctx,
&query,
store,
ui,
Some(*space_view_id),
&instance_path.entity_path,
);
});
// TODO(emilk): show the values of this specific instance (e.g. point in the point cloud)!
} else {
if instance_path.instance_key.is_splat() {
// splat - the whole entity
let space_view_class = *space_view.class_identifier();
let entity_path = &instance_path.entity_path;
Expand Down

0 comments on commit 20ff5fb

Please sign in to comment.