diff --git a/crates/store/re_chunk/src/helpers.rs b/crates/store/re_chunk/src/helpers.rs index 710eba1b6eab..f2a284628f8d 100644 --- a/crates/store/re_chunk/src/helpers.rs +++ b/crates/store/re_chunk/src/helpers.rs @@ -349,7 +349,7 @@ impl UnitChunkShared { /// Returns the raw data for the specified component, assuming a mono-batch. /// - /// Returns an error if the underlying batch is not of unit length. + /// Returns none if the underlying batch is not of unit length. #[inline] pub fn component_mono_raw( &self, @@ -369,7 +369,7 @@ impl UnitChunkShared { /// Returns the deserialized data for the specified component, assuming a mono-batch. /// - /// Returns an error if the data cannot be deserialized, or if the underlying batch is not of unit length. + /// Returns none if the data cannot be deserialized, or if the underlying batch is not of unit length. #[inline] pub fn component_mono(&self) -> Option> { let res = self.component_mono_raw(&C::name())?; diff --git a/crates/store/re_query/src/latest_at.rs b/crates/store/re_query/src/latest_at.rs index eb0afd78425d..922cd3a648b1 100644 --- a/crates/store/re_query/src/latest_at.rs +++ b/crates/store/re_query/src/latest_at.rs @@ -508,7 +508,7 @@ impl LatestAtResults { /// Returns the deserialized data for the specified component, assuming a mono-batch. /// - /// Returns an error if the data cannot be deserialized, or if the underlying batch is not of unit length. + /// Logs an error if the data cannot be deserialized, or if the underlying batch is not of unit length. #[inline] pub fn component_mono(&self) -> Option { self.component_mono_with_log_level(re_log::Level::Error) @@ -516,7 +516,7 @@ impl LatestAtResults { /// Returns the deserialized data for the specified component, assuming a mono-batch. /// - /// Returns an error if the data cannot be deserialized, or if the underlying batch is not of unit length. + /// Returns none if the data cannot be deserialized, or if the underlying batch is not of unit length. #[inline] pub fn component_mono_quiet(&self) -> Option { self.components diff --git a/crates/viewer/re_view_spatial/src/transform_cache.rs b/crates/viewer/re_view_spatial/src/transform_cache.rs index 8799d9c812ce..9af7169979d8 100644 --- a/crates/viewer/re_view_spatial/src/transform_cache.rs +++ b/crates/viewer/re_view_spatial/src/transform_cache.rs @@ -445,38 +445,51 @@ fn query_and_resolve_tree_transform_at_entity( // TODO(andreas): Filter out styling components. let components = archetypes::Transform3D::all_components(); let component_names = components.iter().map(|descr| descr.component_name); - let result = entity_db.latest_at(query, entity_path, component_names); - if result.components.is_empty() { + let results = entity_db.latest_at(query, entity_path, component_names); + if results.components.is_empty() { return None; } let mut transform = Affine3A::IDENTITY; + // It's an error if there's more than one component. Warn in that case. + let mono_log_level = re_log::Level::Warn; + // The order of the components here is important, and checked by `debug_assert_transform_field_order` - if let Some(translation) = result.component_instance::(0) { + if let Some(translation) = + results.component_mono_with_log_level::(mono_log_level) + { transform = Affine3A::from(translation); } - if let Some(axis_angle) = result.component_instance::(0) { + if let Some(axis_angle) = + results.component_mono_with_log_level::(mono_log_level) + { if let Ok(axis_angle) = Affine3A::try_from(axis_angle) { transform *= axis_angle; } else { return Some(Affine3A::ZERO); } } - if let Some(quaternion) = result.component_instance::(0) { + if let Some(quaternion) = + results.component_mono_with_log_level::(mono_log_level) + { if let Ok(quaternion) = Affine3A::try_from(quaternion) { transform *= quaternion; } else { return Some(Affine3A::ZERO); } } - if let Some(scale) = result.component_instance::(0) { + if let Some(scale) = + results.component_mono_with_log_level::(mono_log_level) + { if scale.x() == 0.0 && scale.y() == 0.0 && scale.z() == 0.0 { return Some(Affine3A::ZERO); } transform *= Affine3A::from(scale); } - if let Some(mat3x3) = result.component_instance::(0) { + if let Some(mat3x3) = + results.component_mono_with_log_level::(mono_log_level) + { let affine_transform = Affine3A::from(mat3x3); if affine_transform.matrix3.determinant() == 0.0 { return Some(Affine3A::ZERO); @@ -484,7 +497,7 @@ fn query_and_resolve_tree_transform_at_entity( transform *= affine_transform; } - if result.component_instance::(0) + if results.component_mono_with_log_level::(mono_log_level) == Some(components::TransformRelation::ChildFromParent) { let determinant = transform.matrix3.determinant();