Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into andreas/non-mut-ctx
Browse files Browse the repository at this point in the history
  • Loading branch information
Wumpf committed Nov 29, 2023
2 parents c4a0551 + 0ab1412 commit e5fb87f
Show file tree
Hide file tree
Showing 76 changed files with 3,453 additions and 1,127 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion crates/re_data_ui/src/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,8 @@ fn tensor_pixel_value_ui(
ui.label(format!("{x}, {y}"));
ui.end_row();

if tensor.num_dim() == 2 {
// Check for annotations on any single-channel image
if let Some([_, _, 1]) = tensor.image_height_width_channels() {
if let Some(raw_value) = tensor.get(&[y, x]) {
if let (TensorDataMeaning::ClassId, Some(u16_val)) =
(meaning, raw_value.try_as_u16())
Expand Down
2 changes: 1 addition & 1 deletion crates/re_data_ui/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ impl DataUi for Item {
query: &re_arrow_store::LatestAtQuery,
) {
match self {
Item::SpaceView(_) | Item::DataBlueprintGroup(_, _) => {
Item::SpaceView(_) | Item::DataBlueprintGroup(_, _, _) => {
// Shouldn't be reachable since SelectionPanel::contents doesn't show data ui for these.
// If you add something in here make sure to adjust SelectionPanel::contents accordingly.
}
Expand Down
7 changes: 4 additions & 3 deletions crates/re_data_ui/src/item_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use egui::Ui;
use re_data_store::InstancePath;
use re_log_types::{ComponentPath, EntityPath, TimeInt, Timeline};
use re_viewer_context::{
DataBlueprintGroupHandle, HoverHighlight, Item, SpaceViewId, UiVerbosity, ViewerContext,
DataQueryId, HoverHighlight, Item, SpaceViewId, UiVerbosity, ViewerContext,
};

use super::DataUi;
Expand Down Expand Up @@ -197,9 +197,10 @@ pub fn data_blueprint_group_button_to(
ui: &mut egui::Ui,
text: impl Into<egui::WidgetText>,
space_view_id: SpaceViewId,
group_handle: DataBlueprintGroupHandle,
query_id: DataQueryId,
entity_path: EntityPath,
) -> egui::Response {
let item = Item::DataBlueprintGroup(space_view_id, group_handle);
let item = Item::DataBlueprintGroup(space_view_id, query_id, entity_path);
let response = ctx
.re_ui
.selectable_label_with_icon(
Expand Down
14 changes: 14 additions & 0 deletions crates/re_log_types/src/path/entity_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,20 @@ impl From<EntityPath> for String {
}
}

impl From<re_types_core::datatypes::EntityPath> for EntityPath {
#[inline]
fn from(value: re_types_core::datatypes::EntityPath) -> Self {
EntityPath::parse_forgiving(&value.0)
}
}

impl From<&EntityPath> for re_types_core::datatypes::EntityPath {
#[inline]
fn from(value: &EntityPath) -> Self {
Self(value.to_string().into())
}
}

// ----------------------------------------------------------------------------

use re_types_core::Loggable;
Expand Down
26 changes: 24 additions & 2 deletions crates/re_log_types/src/path/entity_path_expr.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::fmt::Display;

use crate::EntityPath;

/// An expression that corresponds to multiple [`EntityPath`]s within a tree.
Expand Down Expand Up @@ -44,13 +46,33 @@ impl EntityPathExpr {
}
}

impl Display for EntityPathExpr {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Exact(path) => path.fmt(f),
Self::Recursive(path) => {
if path.is_root() {
write!(f, "/")
} else {
write!(f, "{path}/")
}
}
}
}
}

impl From<&str> for EntityPathExpr {
#[inline]
fn from(path: &str) -> Self {
if let Some(path) = path.strip_suffix('/') {
Self::Recursive(EntityPath::from(path))
let path = path.trim_start_matches('/');
if path.is_empty() {
Self::Recursive(EntityPath::root())
} else {
Self::Recursive(EntityPath::from(path))
}
} else {
Self::Exact(EntityPath::from(path))
Self::Exact(EntityPath::from(path.trim_start_matches('/')))
}
}
}
Loading

0 comments on commit e5fb87f

Please sign in to comment.