From c21db60e6e066af6102629e5871e3a2b4d41dd5f Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Fri, 13 Dec 2024 17:57:02 +0100 Subject: [PATCH] introduce invalid transform & deprecate disconnected space, add migration guide --- .../rerun/archetypes/disconnected_space.fbs | 1 + .../rerun/archetypes/transform3d.fbs | 9 ++ .../re_types/definitions/rerun/components.fbs | 1 + .../rerun/components/disconnected_space.fbs | 1 + .../rerun/components/invalid_transform.fbs | 17 +++ .../src/archetypes/disconnected_space.rs | 4 + crates/store/re_types/src/archetypes/mod.rs | 4 +- .../re_types/src/archetypes/transform3d.rs | 63 +++++++++- .../re_types/src/components/.gitattributes | 1 + .../src/components/disconnected_space.rs | 4 + .../src/components/invalid_transform.rs | 113 ++++++++++++++++++ crates/store/re_types/src/components/mod.rs | 6 +- crates/store/re_types/src/reflection/mod.rs | 12 ++ .../reference/migration/migration-0-21.md | 11 ++ docs/content/reference/types/archetypes.md | 2 +- .../types/archetypes/disconnected_space.md | 5 +- .../reference/types/archetypes/transform3d.md | 2 +- docs/content/reference/types/components.md | 3 +- .../reference/types/components/.gitattributes | 1 + .../types/components/disconnected_space.md | 5 +- .../types/components/invalid_transform.md | 31 +++++ .../content/reference/types/datatypes/bool.md | 1 + .../rerun/archetypes/disconnected_space.cpp | 5 + .../rerun/archetypes/disconnected_space.hpp | 9 +- .../src/rerun/archetypes/transform3d.cpp | 14 ++- .../src/rerun/archetypes/transform3d.hpp | 23 ++++ rerun_cpp/src/rerun/components.hpp | 1 + rerun_cpp/src/rerun/components/.gitattributes | 1 + .../rerun/components/disconnected_space.hpp | 4 +- .../rerun/components/invalid_transform.hpp | 81 +++++++++++++ .../rerun/archetypes/disconnected_space.py | 2 + .../rerun_sdk/rerun/archetypes/transform3d.py | 16 +++ .../rerun_sdk/rerun/components/.gitattributes | 1 + .../rerun_sdk/rerun/components/__init__.py | 3 + .../rerun/components/disconnected_space.py | 3 + .../rerun/components/invalid_transform.py | 41 +++++++ 36 files changed, 487 insertions(+), 14 deletions(-) create mode 100644 crates/store/re_types/definitions/rerun/components/invalid_transform.fbs create mode 100644 crates/store/re_types/src/components/invalid_transform.rs create mode 100644 docs/content/reference/types/components/invalid_transform.md create mode 100644 rerun_cpp/src/rerun/components/invalid_transform.hpp create mode 100644 rerun_py/rerun_sdk/rerun/components/invalid_transform.py diff --git a/crates/store/re_types/definitions/rerun/archetypes/disconnected_space.fbs b/crates/store/re_types/definitions/rerun/archetypes/disconnected_space.fbs index e7b3ad0373015..259f6934dd96c 100644 --- a/crates/store/re_types/definitions/rerun/archetypes/disconnected_space.fbs +++ b/crates/store/re_types/definitions/rerun/archetypes/disconnected_space.fbs @@ -9,6 +9,7 @@ namespace rerun.archetypes; /// /// \example archetypes/disconnected_space title="Disconnected space" image="https://static.rerun.io/disconnected_space/709041fc304b50c74db773b780e32294fe90c95f/1200w.png" table DisconnectedSpace ( + "attr.rerun.deprecated": "Use [archetypes.Transform3D] with [rerun.components.InvalidTransform] instead.", "attr.rust.derive": "Copy, PartialEq, Eq", "attr.docs.view_types": "Spatial2DView, Spatial3DView" ) { diff --git a/crates/store/re_types/definitions/rerun/archetypes/transform3d.fbs b/crates/store/re_types/definitions/rerun/archetypes/transform3d.fbs index df0de1c10e2e0..b64a42fd756e0 100644 --- a/crates/store/re_types/definitions/rerun/archetypes/transform3d.fbs +++ b/crates/store/re_types/definitions/rerun/archetypes/transform3d.fbs @@ -40,6 +40,15 @@ table Transform3D ( /// Specifies the relation this transform establishes between this entity and its parent. relation: rerun.components.TransformRelation ("attr.rerun.component_optional", nullable, order: 1600); + /// Optionally flags the transform as invalid. + /// + /// Specifies that the entity path at which this is logged is spatially disconnected from its parent, + /// making it impossible to transform the entity path into its parent's space and vice versa. + /// This can be useful for instance to express temporily unknown transforms. + /// + /// By default all transforms are considered valid. + invalid: rerun.components.InvalidTransform ("attr.rerun.component_optional", nullable, order: 1700); + // --- visual representation /// Visual length of the 3 axes. diff --git a/crates/store/re_types/definitions/rerun/components.fbs b/crates/store/re_types/definitions/rerun/components.fbs index 4dc580313dc27..7b6a3d298c3d5 100644 --- a/crates/store/re_types/definitions/rerun/components.fbs +++ b/crates/store/re_types/definitions/rerun/components.fbs @@ -25,6 +25,7 @@ include "./components/half_size3d.fbs"; include "./components/image_buffer.fbs"; include "./components/image_format.fbs"; include "./components/image_plane_distance.fbs"; +include "./components/invalid_transform.fbs"; include "./components/keypoint_id.fbs"; include "./components/latlon.fbs"; include "./components/length.fbs"; diff --git a/crates/store/re_types/definitions/rerun/components/disconnected_space.fbs b/crates/store/re_types/definitions/rerun/components/disconnected_space.fbs index 2aef729a83ae4..7f7a00a4aa322 100644 --- a/crates/store/re_types/definitions/rerun/components/disconnected_space.fbs +++ b/crates/store/re_types/definitions/rerun/components/disconnected_space.fbs @@ -10,6 +10,7 @@ namespace rerun.components; /// It *only* applies to views that work with spatial transformations, i.e. 2D & 3D views. /// This is useful for specifying that a subgraph is independent of the rest of the scene. struct DisconnectedSpace ( + "attr.rerun.deprecated": "Use [archetypes.Transform3D] with [rerun.components.InvalidTransform] instead.", "attr.python.aliases": "bool", "attr.python.array_aliases": "bool, npt.NDArray[np.bool_]", "attr.rust.derive": "Copy, PartialEq, Eq" diff --git a/crates/store/re_types/definitions/rerun/components/invalid_transform.fbs b/crates/store/re_types/definitions/rerun/components/invalid_transform.fbs new file mode 100644 index 0000000000000..8228b652c4932 --- /dev/null +++ b/crates/store/re_types/definitions/rerun/components/invalid_transform.fbs @@ -0,0 +1,17 @@ +namespace rerun.components; + +/// Flags the transform at its entity path as invalid. +/// +/// Specifies that the entity path at which this is logged is spatially disconnected from its parent, +/// making it impossible to transform the entity path into its parent's space and vice versa. +/// This can be useful for instance to express temporily unknown transforms. +/// +/// Note that by default all transforms are considered valid. +struct InvalidTransform ( + "attr.python.aliases": "bool", + "attr.python.array_aliases": "bool, npt.NDArray[np.bool_]", + "attr.rust.derive": "Copy, PartialEq, Eq" +) { + /// Whether the entity path at which this is logged as an invalid transform to its parent. + invalid: rerun.datatypes.Bool (order: 100); +} diff --git a/crates/store/re_types/src/archetypes/disconnected_space.rs b/crates/store/re_types/src/archetypes/disconnected_space.rs index 58d59fa1b79ae..2c0ec4bca39ff 100644 --- a/crates/store/re_types/src/archetypes/disconnected_space.rs +++ b/crates/store/re_types/src/archetypes/disconnected_space.rs @@ -11,6 +11,7 @@ #![allow(clippy::redundant_closure)] #![allow(clippy::too_many_arguments)] #![allow(clippy::too_many_lines)] +#![allow(deprecated)] use ::re_types_core::external::arrow2; use ::re_types_core::SerializationResult; @@ -62,6 +63,9 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; /// /// #[derive(Clone, Debug, Copy, PartialEq, Eq)] +#[deprecated( + note = "Use [archetypes.Transform3D] with [rerun.components.InvalidTransform] instead." +)] pub struct DisconnectedSpace { /// Whether the entity path at which this is logged is disconnected from its parent. pub disconnected_space: crate::components::DisconnectedSpace, diff --git a/crates/store/re_types/src/archetypes/mod.rs b/crates/store/re_types/src/archetypes/mod.rs index 3bac64ce396ef..2915cf90a60aa 100644 --- a/crates/store/re_types/src/archetypes/mod.rs +++ b/crates/store/re_types/src/archetypes/mod.rs @@ -68,7 +68,6 @@ pub use self::boxes2d::Boxes2D; pub use self::boxes3d::Boxes3D; pub use self::capsules3d::Capsules3D; pub use self::depth_image::DepthImage; -pub use self::disconnected_space::DisconnectedSpace; pub use self::ellipsoids3d::Ellipsoids3D; pub use self::encoded_image::EncodedImage; pub use self::geo_line_strings::GeoLineStrings; @@ -93,3 +92,6 @@ pub use self::text_log::TextLog; pub use self::transform3d::Transform3D; pub use self::video_frame_reference::VideoFrameReference; pub use self::view_coordinates::ViewCoordinates; + +#[allow(deprecated)] +pub use self::disconnected_space::DisconnectedSpace; diff --git a/crates/store/re_types/src/archetypes/transform3d.rs b/crates/store/re_types/src/archetypes/transform3d.rs index 81eeef4990e09..135b904f91d4e 100644 --- a/crates/store/re_types/src/archetypes/transform3d.rs +++ b/crates/store/re_types/src/archetypes/transform3d.rs @@ -186,6 +186,15 @@ pub struct Transform3D { /// Specifies the relation this transform establishes between this entity and its parent. pub relation: Option, + /// Optionally flags the transform as invalid. + /// + /// Specifies that the entity path at which this is logged is spatially disconnected from its parent, + /// making it impossible to transform the entity path into its parent's space and vice versa. + /// This can be useful for instance to express temporily unknown transforms. + /// + /// By default all transforms are considered valid. + pub invalid: Option, + /// Visual length of the 3 axes. /// /// The length is interpreted in the local coordinate system of the transform. @@ -205,7 +214,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz }] }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 7usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 8usize]> = once_cell::sync::Lazy::new(|| { [ ComponentDescriptor { @@ -238,6 +247,11 @@ static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 7usize]> component_name: "rerun.components.TransformRelation".into(), archetype_field_name: Some("relation".into()), }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Transform3D".into()), + component_name: "rerun.components.InvalidTransform".into(), + archetype_field_name: Some("invalid".into()), + }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.Transform3D".into()), component_name: "rerun.components.AxisLength".into(), @@ -246,7 +260,7 @@ static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 7usize]> ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 8usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 9usize]> = once_cell::sync::Lazy::new(|| { [ ComponentDescriptor { @@ -284,6 +298,11 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 8usize]> = component_name: "rerun.components.TransformRelation".into(), archetype_field_name: Some("relation".into()), }, + ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Transform3D".into()), + component_name: "rerun.components.InvalidTransform".into(), + archetype_field_name: Some("invalid".into()), + }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.Transform3D".into()), component_name: "rerun.components.AxisLength".into(), @@ -293,8 +312,8 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 8usize]> = }); impl Transform3D { - /// The total number of components in the archetype: 0 required, 1 recommended, 7 optional - pub const NUM_COMPONENTS: usize = 8usize; + /// The total number of components in the archetype: 0 required, 1 recommended, 8 optional + pub const NUM_COMPONENTS: usize = 9usize; } /// Indicator component for the [`Transform3D`] [`::re_types_core::Archetype`] @@ -406,6 +425,15 @@ impl ::re_types_core::Archetype for Transform3D { } else { None }; + let invalid = if let Some(array) = arrays_by_name.get("rerun.components.InvalidTransform") { + ::from_arrow2_opt(&**array) + .with_context("rerun.archetypes.Transform3D#invalid")? + .into_iter() + .next() + .flatten() + } else { + None + }; let axis_length = if let Some(array) = arrays_by_name.get("rerun.components.AxisLength") { ::from_arrow2_opt(&**array) .with_context("rerun.archetypes.Transform3D#axis_length")? @@ -422,6 +450,7 @@ impl ::re_types_core::Archetype for Transform3D { scale, mat3x3, relation, + invalid, axis_length, }) } @@ -493,6 +522,16 @@ impl ::re_types_core::AsComponents for Transform3D { }), } }), + (Some(&self.invalid as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::ComponentBatchCowWithDescriptor { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.archetypes.Transform3D".into()), + archetype_field_name: Some(("invalid").into()), + component_name: ("rerun.components.InvalidTransform").into(), + }), + } + }), (Some(&self.axis_length as &dyn ComponentBatch)).map(|batch| { ::re_types_core::ComponentBatchCowWithDescriptor { batch: batch.into(), @@ -523,6 +562,7 @@ impl Transform3D { scale: None, mat3x3: None, relation: None, + invalid: None, axis_length: None, } } @@ -581,6 +621,19 @@ impl Transform3D { self } + /// Optionally flags the transform as invalid. + /// + /// Specifies that the entity path at which this is logged is spatially disconnected from its parent, + /// making it impossible to transform the entity path into its parent's space and vice versa. + /// This can be useful for instance to express temporily unknown transforms. + /// + /// By default all transforms are considered valid. + #[inline] + pub fn with_invalid(mut self, invalid: impl Into) -> Self { + self.invalid = Some(invalid.into()); + self + } + /// Visual length of the 3 axes. /// /// The length is interpreted in the local coordinate system of the transform. @@ -604,6 +657,7 @@ impl ::re_types_core::SizeBytes for Transform3D { + self.scale.heap_size_bytes() + self.mat3x3.heap_size_bytes() + self.relation.heap_size_bytes() + + self.invalid.heap_size_bytes() + self.axis_length.heap_size_bytes() } @@ -615,6 +669,7 @@ impl ::re_types_core::SizeBytes for Transform3D { && >::is_pod() && >::is_pod() && >::is_pod() + && >::is_pod() && >::is_pod() } } diff --git a/crates/store/re_types/src/components/.gitattributes b/crates/store/re_types/src/components/.gitattributes index 3cf54dbb31cb9..cda69ef0f2030 100644 --- a/crates/store/re_types/src/components/.gitattributes +++ b/crates/store/re_types/src/components/.gitattributes @@ -25,6 +25,7 @@ half_size3d.rs linguist-generated=true image_buffer.rs linguist-generated=true image_format.rs linguist-generated=true image_plane_distance.rs linguist-generated=true +invalid_transform.rs linguist-generated=true keypoint_id.rs linguist-generated=true lat_lon.rs linguist-generated=true length.rs linguist-generated=true diff --git a/crates/store/re_types/src/components/disconnected_space.rs b/crates/store/re_types/src/components/disconnected_space.rs index 0b890cf603189..cc9b25efc2ad7 100644 --- a/crates/store/re_types/src/components/disconnected_space.rs +++ b/crates/store/re_types/src/components/disconnected_space.rs @@ -11,6 +11,7 @@ #![allow(clippy::redundant_closure)] #![allow(clippy::too_many_arguments)] #![allow(clippy::too_many_lines)] +#![allow(deprecated)] use ::re_types_core::external::arrow2; use ::re_types_core::SerializationResult; @@ -25,6 +26,9 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; /// It *only* applies to views that work with spatial transformations, i.e. 2D & 3D views. /// This is useful for specifying that a subgraph is independent of the rest of the scene. #[derive(Clone, Debug, Copy, PartialEq, Eq)] +#[deprecated( + note = "Use [archetypes.Transform3D] with [rerun.components.InvalidTransform] instead." +)] pub struct DisconnectedSpace( /// Whether the entity path at which this is logged is disconnected from its parent. /// diff --git a/crates/store/re_types/src/components/invalid_transform.rs b/crates/store/re_types/src/components/invalid_transform.rs new file mode 100644 index 0000000000000..4fa8e58bf4a16 --- /dev/null +++ b/crates/store/re_types/src/components/invalid_transform.rs @@ -0,0 +1,113 @@ +// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/rust/api.rs +// Based on "crates/store/re_types/definitions/rerun/components/invalid_transform.fbs". + +#![allow(unused_imports)] +#![allow(unused_parens)] +#![allow(clippy::clone_on_copy)] +#![allow(clippy::cloned_instead_of_copied)] +#![allow(clippy::map_flatten)] +#![allow(clippy::needless_question_mark)] +#![allow(clippy::new_without_default)] +#![allow(clippy::redundant_closure)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::too_many_lines)] + +use ::re_types_core::external::arrow2; +use ::re_types_core::SerializationResult; +use ::re_types_core::{ComponentBatch, ComponentBatchCowWithDescriptor}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; +use ::re_types_core::{DeserializationError, DeserializationResult}; + +/// **Component**: Flags the transform at its entity path as invalid. +/// +/// Specifies that the entity path at which this is logged is spatially disconnected from its parent, +/// making it impossible to transform the entity path into its parent's space and vice versa. +/// This can be useful for instance to express temporily unknown transforms. +/// +/// Note that by default all transforms are considered valid. +#[derive(Clone, Debug, Copy, PartialEq, Eq)] +pub struct InvalidTransform( + /// Whether the entity path at which this is logged as an invalid transform to its parent. + pub crate::datatypes::Bool, +); + +impl ::re_types_core::Component for InvalidTransform { + #[inline] + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.components.InvalidTransform") + } +} + +::re_types_core::macros::impl_into_cow!(InvalidTransform); + +impl ::re_types_core::Loggable for InvalidTransform { + #[inline] + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::Bool::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::Bool::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::Bool::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + } +} + +impl> From for InvalidTransform { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for InvalidTransform { + #[inline] + fn borrow(&self) -> &crate::datatypes::Bool { + &self.0 + } +} + +impl std::ops::Deref for InvalidTransform { + type Target = crate::datatypes::Bool; + + #[inline] + fn deref(&self) -> &crate::datatypes::Bool { + &self.0 + } +} + +impl std::ops::DerefMut for InvalidTransform { + #[inline] + fn deref_mut(&mut self) -> &mut crate::datatypes::Bool { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for InvalidTransform { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + } +} diff --git a/crates/store/re_types/src/components/mod.rs b/crates/store/re_types/src/components/mod.rs index c085b8954e44a..d29279cd2c511 100644 --- a/crates/store/re_types/src/components/mod.rs +++ b/crates/store/re_types/src/components/mod.rs @@ -39,6 +39,7 @@ mod image_format; mod image_format_ext; mod image_plane_distance; mod image_plane_distance_ext; +mod invalid_transform; mod keypoint_id; mod keypoint_id_ext; mod lat_lon; @@ -136,7 +137,6 @@ pub use self::class_id::ClassId; pub use self::color::Color; pub use self::colormap::Colormap; pub use self::depth_meter::DepthMeter; -pub use self::disconnected_space::DisconnectedSpace; pub use self::draw_order::DrawOrder; pub use self::entity_path::EntityPath; pub use self::fill_mode::FillMode; @@ -151,6 +151,7 @@ pub use self::half_size3d::HalfSize3D; pub use self::image_buffer::ImageBuffer; pub use self::image_format::ImageFormat; pub use self::image_plane_distance::ImagePlaneDistance; +pub use self::invalid_transform::InvalidTransform; pub use self::keypoint_id::KeypointId; pub use self::lat_lon::LatLon; pub use self::length::Length; @@ -197,3 +198,6 @@ pub use self::vector2d::Vector2D; pub use self::vector3d::Vector3D; pub use self::video_timestamp::VideoTimestamp; pub use self::view_coordinates::ViewCoordinates; + +#[allow(deprecated)] +pub use self::disconnected_space::DisconnectedSpace; diff --git a/crates/store/re_types/src/reflection/mod.rs b/crates/store/re_types/src/reflection/mod.rs index 63d3d61794813..ed3e60033ccab 100644 --- a/crates/store/re_types/src/reflection/mod.rs +++ b/crates/store/re_types/src/reflection/mod.rs @@ -551,6 +551,14 @@ fn generate_component_reflection() -> Result::name(), + ComponentReflection { + docstring_md: "Flags the transform at its entity path as invalid.\n\nSpecifies that the entity path at which this is logged is spatially disconnected from its parent,\nmaking it impossible to transform the entity path into its parent's space and vice versa.\nThis can be useful for instance to express temporily unknown transforms.\n\nNote that by default all transforms are considered valid.", + custom_placeholder: None, + datatype: InvalidTransform::arrow2_datatype(), + }, + ), ( ::name(), ComponentReflection { @@ -1900,6 +1908,10 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { : "Relation", component_name : "rerun.components.TransformRelation" .into(), docstring_md : "Specifies the relation this transform establishes between this entity and its parent.", + is_required : false, }, ArchetypeFieldReflection { name : "invalid", + display_name : "Invalid", component_name : + "rerun.components.InvalidTransform".into(), docstring_md : + "Optionally flags the transform as invalid.\n\nSpecifies that the entity path at which this is logged is spatially disconnected from its parent,\nmaking it impossible to transform the entity path into its parent's space and vice versa.\nThis can be useful for instance to express temporily unknown transforms.\n\nBy default all transforms are considered valid.", is_required : false, }, ArchetypeFieldReflection { name : "axis_length", display_name : "Axis length", component_name : "rerun.components.AxisLength".into(), docstring_md : diff --git a/docs/content/reference/migration/migration-0-21.md b/docs/content/reference/migration/migration-0-21.md index 71f9397f22fab..1be5f68e73a98 100644 --- a/docs/content/reference/migration/migration-0-21.md +++ b/docs/content/reference/migration/migration-0-21.md @@ -65,3 +65,14 @@ Previously, the viewer would show 3 arrows for every logged transform if any of For many usecases this led to too many arrows being shown by default. We therefore removed the last condition - arrows will no longer show by default if they're the only visualizer. The easiest way to opt-in to transform arrows is to set `AxisLength` (`axis_length` field on the `Transform3D` archetype) on your transforms. + +### `DisconnectedSpace` archetype/component deprecated in favor of `InvalidTransform` + +The `DisconnectedSpace` archetype and `DisconnectedSpace` component have been deprecated in favor of the `InvalidTransform` component which is part of the `Transform3D` component. + +Previously, the `DisconnectedSpace` archetype played a double role by governing view spawn heuristics & being used as a transform placeholder. +This caused a lot of complexity and often broke or caused confusion (see https://github.com/rerun-io/rerun/issues/6817, https://github.com/rerun-io/rerun/issues/4465, https://github.com/rerun-io/rerun/issues/4221). +By now, explicit blueprints offer a better way to express which views should be spawned and what content they should query. +(you can learn more about blueprints [here](https://rerun.io/docs/getting-started/configure-the-viewer/through-code-tutorial)). + +`DisconnectedSpace` will be removed in a future release. diff --git a/docs/content/reference/types/archetypes.md b/docs/content/reference/types/archetypes.md index 4b6f07b9b037e..5176d0a479a38 100644 --- a/docs/content/reference/types/archetypes.md +++ b/docs/content/reference/types/archetypes.md @@ -73,5 +73,5 @@ This page lists all built-in archetypes. * [`AnnotationContext`](archetypes/annotation_context.md): The annotation context provides additional information on how to display entities. * [`Clear`](archetypes/clear.md): Empties all the components of an entity. -* [`DisconnectedSpace`](archetypes/disconnected_space.md): Spatially disconnect this entity from its parent. +* ⚠️ _deprecated_ [`DisconnectedSpace`](archetypes/disconnected_space.md): Spatially disconnect this entity from its parent. diff --git a/docs/content/reference/types/archetypes/disconnected_space.md b/docs/content/reference/types/archetypes/disconnected_space.md index 752465188940c..b8cf66a9c945c 100644 --- a/docs/content/reference/types/archetypes/disconnected_space.md +++ b/docs/content/reference/types/archetypes/disconnected_space.md @@ -1,8 +1,11 @@ --- -title: "DisconnectedSpace" +title: "DisconnectedSpace (deprecated)" --- +**⚠️ This type is deprecated and may be removed in future versions** +Use [archetypes.Transform3D] with [rerun.components.InvalidTransform] instead. + Spatially disconnect this entity from its parent. Specifies that the entity path at which this is logged is spatially disconnected from its parent, diff --git a/docs/content/reference/types/archetypes/transform3d.md b/docs/content/reference/types/archetypes/transform3d.md index 8d63c1681cdd7..2cc39785d4d1a 100644 --- a/docs/content/reference/types/archetypes/transform3d.md +++ b/docs/content/reference/types/archetypes/transform3d.md @@ -18,7 +18,7 @@ For transforms that affect only a single entity and do not propagate along the e ## Components -**Optional**: [`Translation3D`](../components/translation3d.md), [`RotationAxisAngle`](../components/rotation_axis_angle.md), [`RotationQuat`](../components/rotation_quat.md), [`Scale3D`](../components/scale3d.md), [`TransformMat3x3`](../components/transform_mat3x3.md), [`TransformRelation`](../components/transform_relation.md), [`AxisLength`](../components/axis_length.md) +**Optional**: [`Translation3D`](../components/translation3d.md), [`RotationAxisAngle`](../components/rotation_axis_angle.md), [`RotationQuat`](../components/rotation_quat.md), [`Scale3D`](../components/scale3d.md), [`TransformMat3x3`](../components/transform_mat3x3.md), [`TransformRelation`](../components/transform_relation.md), [`InvalidTransform`](../components/invalid_transform.md), [`AxisLength`](../components/axis_length.md) ## Shown in * [Spatial3DView](../views/spatial3d_view.md) diff --git a/docs/content/reference/types/components.md b/docs/content/reference/types/components.md index c9be262b0fdef..c087e9b5509b4 100644 --- a/docs/content/reference/types/components.md +++ b/docs/content/reference/types/components.md @@ -23,7 +23,7 @@ on [Entities and Components](../../concepts/entity-component.md). * [`Color`](components/color.md): An RGBA color with unmultiplied/separate alpha, in sRGB gamma space with linear alpha. * [`Colormap`](components/colormap.md): Colormap for mapping scalar values within a given range to a color. * [`DepthMeter`](components/depth_meter.md): The world->depth map scaling factor. -* [`DisconnectedSpace`](components/disconnected_space.md): Spatially disconnect this entity from its parent. +* ⚠️ _deprecated_ [`DisconnectedSpace`](components/disconnected_space.md): Spatially disconnect this entity from its parent. * [`DrawOrder`](components/draw_order.md): Draw order of 2D elements. Higher values are drawn on top of lower values. * [`EntityPath`](components/entity_path.md): A path to an entity, usually to reference some data that is part of the target entity. * [`FillMode`](components/fill_mode.md): How a geometric shape is drawn and colored. @@ -38,6 +38,7 @@ on [Entities and Components](../../concepts/entity-component.md). * [`ImageBuffer`](components/image_buffer.md): A buffer that is known to store image data. * [`ImageFormat`](components/image_format.md): The metadata describing the contents of a [`components.ImageBuffer`](https://rerun.io/docs/reference/types/components/image_buffer). * [`ImagePlaneDistance`](components/image_plane_distance.md): The distance from the camera origin to the image plane when the projection is shown in a 3D viewer. +* [`InvalidTransform`](components/invalid_transform.md): Flags the transform at its entity path as invalid. * [`KeypointId`](components/keypoint_id.md): A 16-bit ID representing a type of semantic keypoint within a class. * [`LatLon`](components/lat_lon.md): A geospatial position expressed in [EPSG:4326](https://epsg.io/4326) latitude and longitude (North/East-positive degrees). * [`Length`](components/length.md): Length, or one-dimensional size. diff --git a/docs/content/reference/types/components/.gitattributes b/docs/content/reference/types/components/.gitattributes index ecb4df1c74f11..f75b0b17a4ba5 100644 --- a/docs/content/reference/types/components/.gitattributes +++ b/docs/content/reference/types/components/.gitattributes @@ -26,6 +26,7 @@ half_size3d.md linguist-generated=true image_buffer.md linguist-generated=true image_format.md linguist-generated=true image_plane_distance.md linguist-generated=true +invalid_transform.md linguist-generated=true keypoint_id.md linguist-generated=true lat_lon.md linguist-generated=true length.md linguist-generated=true diff --git a/docs/content/reference/types/components/disconnected_space.md b/docs/content/reference/types/components/disconnected_space.md index fd9447abb871e..e171962746c25 100644 --- a/docs/content/reference/types/components/disconnected_space.md +++ b/docs/content/reference/types/components/disconnected_space.md @@ -1,8 +1,11 @@ --- -title: "DisconnectedSpace" +title: "DisconnectedSpace (deprecated)" --- +**⚠️ This type is deprecated and may be removed in future versions** +Use [archetypes.Transform3D] with [rerun.components.InvalidTransform] instead. + Spatially disconnect this entity from its parent. Specifies that the entity path at which this is logged is spatially disconnected from its parent, diff --git a/docs/content/reference/types/components/invalid_transform.md b/docs/content/reference/types/components/invalid_transform.md new file mode 100644 index 0000000000000..5dc9e2b54d9c0 --- /dev/null +++ b/docs/content/reference/types/components/invalid_transform.md @@ -0,0 +1,31 @@ +--- +title: "InvalidTransform" +--- + + +Flags the transform at its entity path as invalid. + +Specifies that the entity path at which this is logged is spatially disconnected from its parent, +making it impossible to transform the entity path into its parent's space and vice versa. +This can be useful for instance to express temporily unknown transforms. + +Note that by default all transforms are considered valid. + +## Rerun datatype +[`Bool`](../datatypes/bool.md) + + +## Arrow datatype +``` +boolean +``` + +## API reference links + * 🌊 [C++ API docs for `InvalidTransform`](https://ref.rerun.io/docs/cpp/stable/structrerun_1_1components_1_1InvalidTransform.html) + * 🐍 [Python API docs for `InvalidTransform`](https://ref.rerun.io/docs/python/stable/common/components#rerun.components.InvalidTransform) + * 🦀 [Rust API docs for `InvalidTransform`](https://docs.rs/rerun/latest/rerun/components/struct.InvalidTransform.html) + + +## Used by + +* [`Transform3D`](../archetypes/transform3d.md) diff --git a/docs/content/reference/types/datatypes/bool.md b/docs/content/reference/types/datatypes/bool.md index 4ee2740a5ed3a..2f9dcd728ab61 100644 --- a/docs/content/reference/types/datatypes/bool.md +++ b/docs/content/reference/types/datatypes/bool.md @@ -21,4 +21,5 @@ boolean * [`ClearIsRecursive`](../components/clear_is_recursive.md) * [`DisconnectedSpace`](../components/disconnected_space.md) +* [`InvalidTransform`](../components/invalid_transform.md) * [`ShowLabels`](../components/show_labels.md) diff --git a/rerun_cpp/src/rerun/archetypes/disconnected_space.cpp b/rerun_cpp/src/rerun/archetypes/disconnected_space.cpp index 3e811827419f9..4c1ca31b8df62 100644 --- a/rerun_cpp/src/rerun/archetypes/disconnected_space.cpp +++ b/rerun_cpp/src/rerun/archetypes/disconnected_space.cpp @@ -5,6 +5,9 @@ #include "../collection_adapter_builtins.hpp" +RR_PUSH_WARNINGS +RR_DISABLE_DEPRECATION_WARNING + namespace rerun::archetypes {} namespace rerun { @@ -38,3 +41,5 @@ namespace rerun { return cells; } } // namespace rerun + +RR_POP_WARNINGS diff --git a/rerun_cpp/src/rerun/archetypes/disconnected_space.hpp b/rerun_cpp/src/rerun/archetypes/disconnected_space.hpp index 298fe3c31c7fd..aeec794912e10 100644 --- a/rerun_cpp/src/rerun/archetypes/disconnected_space.hpp +++ b/rerun_cpp/src/rerun/archetypes/disconnected_space.hpp @@ -4,6 +4,7 @@ #pragma once #include "../collection.hpp" +#include "../compiler_utils.hpp" #include "../component_batch.hpp" #include "../components/disconnected_space.hpp" #include "../indicator_component.hpp" @@ -42,7 +43,9 @@ namespace rerun::archetypes { /// rec.log("world/wormhole/point", rerun::Points3D({{2.0f, 2.0f, 2.0f}})); /// } /// ``` - struct DisconnectedSpace { + struct [[deprecated( + "Use [archetypes.Transform3D] with [rerun.components.InvalidTransform] instead." + )]] DisconnectedSpace { /// Whether the entity path at which this is logged is disconnected from its parent. rerun::components::DisconnectedSpace disconnected_space; @@ -67,6 +70,8 @@ namespace rerun { /// \private template struct AsComponents; + RR_PUSH_WARNINGS + RR_DISABLE_DEPRECATION_WARNING /// \private template <> @@ -76,4 +81,6 @@ namespace rerun { const archetypes::DisconnectedSpace& archetype ); }; + + RR_POP_WARNINGS } // namespace rerun diff --git a/rerun_cpp/src/rerun/archetypes/transform3d.cpp b/rerun_cpp/src/rerun/archetypes/transform3d.cpp index d75e3b616af61..f69183e3668e4 100644 --- a/rerun_cpp/src/rerun/archetypes/transform3d.cpp +++ b/rerun_cpp/src/rerun/archetypes/transform3d.cpp @@ -14,7 +14,7 @@ namespace rerun { ) { using namespace archetypes; std::vector cells; - cells.reserve(8); + cells.reserve(9); { auto result = ComponentBatch::from_loggable( @@ -88,6 +88,18 @@ namespace rerun { RR_RETURN_NOT_OK(result.error); cells.push_back(std::move(result.value)); } + { + auto result = ComponentBatch::from_loggable( + archetype.invalid, + ComponentDescriptor( + "rerun.archetypes.Transform3D", + "invalid", + "rerun.components.InvalidTransform" + ) + ); + RR_RETURN_NOT_OK(result.error); + cells.push_back(std::move(result.value)); + } { auto result = ComponentBatch::from_loggable( archetype.axis_length, diff --git a/rerun_cpp/src/rerun/archetypes/transform3d.hpp b/rerun_cpp/src/rerun/archetypes/transform3d.hpp index 7ced69fb7342e..45219641b02d0 100644 --- a/rerun_cpp/src/rerun/archetypes/transform3d.hpp +++ b/rerun_cpp/src/rerun/archetypes/transform3d.hpp @@ -7,6 +7,7 @@ #include "../compiler_utils.hpp" #include "../component_batch.hpp" #include "../components/axis_length.hpp" +#include "../components/invalid_transform.hpp" #include "../components/rotation_axis_angle.hpp" #include "../components/rotation_quat.hpp" #include "../components/scale3d.hpp" @@ -169,6 +170,15 @@ namespace rerun::archetypes { /// Specifies the relation this transform establishes between this entity and its parent. std::optional relation; + /// Optionally flags the transform as invalid. + /// + /// Specifies that the entity path at which this is logged is spatially disconnected from its parent, + /// making it impossible to transform the entity path into its parent's space and vice versa. + /// This can be useful for instance to express temporily unknown transforms. + /// + /// By default all transforms are considered valid. + std::optional invalid; + /// Visual length of the 3 axes. /// /// The length is interpreted in the local coordinate system of the transform. @@ -560,6 +570,19 @@ namespace rerun::archetypes { RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) } + /// Optionally flags the transform as invalid. + /// + /// Specifies that the entity path at which this is logged is spatially disconnected from its parent, + /// making it impossible to transform the entity path into its parent's space and vice versa. + /// This can be useful for instance to express temporily unknown transforms. + /// + /// By default all transforms are considered valid. + Transform3D with_invalid(rerun::components::InvalidTransform _invalid) && { + invalid = std::move(_invalid); + // See: https://github.com/rerun-io/rerun/issues/4027 + RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) + } + /// Visual length of the 3 axes. /// /// The length is interpreted in the local coordinate system of the transform. diff --git a/rerun_cpp/src/rerun/components.hpp b/rerun_cpp/src/rerun/components.hpp index 17ff34250df4e..d4db2f6e5f684 100644 --- a/rerun_cpp/src/rerun/components.hpp +++ b/rerun_cpp/src/rerun/components.hpp @@ -27,6 +27,7 @@ #include "components/image_buffer.hpp" #include "components/image_format.hpp" #include "components/image_plane_distance.hpp" +#include "components/invalid_transform.hpp" #include "components/keypoint_id.hpp" #include "components/lat_lon.hpp" #include "components/length.hpp" diff --git a/rerun_cpp/src/rerun/components/.gitattributes b/rerun_cpp/src/rerun/components/.gitattributes index 57a1800528b72..e06df9f6df583 100644 --- a/rerun_cpp/src/rerun/components/.gitattributes +++ b/rerun_cpp/src/rerun/components/.gitattributes @@ -32,6 +32,7 @@ half_size3d.hpp linguist-generated=true image_buffer.hpp linguist-generated=true image_format.hpp linguist-generated=true image_plane_distance.hpp linguist-generated=true +invalid_transform.hpp linguist-generated=true keypoint_id.hpp linguist-generated=true lat_lon.hpp linguist-generated=true length.hpp linguist-generated=true diff --git a/rerun_cpp/src/rerun/components/disconnected_space.hpp b/rerun_cpp/src/rerun/components/disconnected_space.hpp index 24dd0ee0d89fc..0eb765bf5a1ae 100644 --- a/rerun_cpp/src/rerun/components/disconnected_space.hpp +++ b/rerun_cpp/src/rerun/components/disconnected_space.hpp @@ -17,7 +17,9 @@ namespace rerun::components { /// making it impossible to transform the entity path into its parent's space and vice versa. /// It *only* applies to views that work with spatial transformations, i.e. 2D & 3D views. /// This is useful for specifying that a subgraph is independent of the rest of the scene. - struct DisconnectedSpace { + struct [[deprecated( + "Use [archetypes.Transform3D] with [rerun.components.InvalidTransform] instead." + )]] DisconnectedSpace { /// Whether the entity path at which this is logged is disconnected from its parent. /// /// Set to true to disconnect the entity from its parent. diff --git a/rerun_cpp/src/rerun/components/invalid_transform.hpp b/rerun_cpp/src/rerun/components/invalid_transform.hpp new file mode 100644 index 0000000000000..84f2e2795f4dd --- /dev/null +++ b/rerun_cpp/src/rerun/components/invalid_transform.hpp @@ -0,0 +1,81 @@ +// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/store/re_types/definitions/rerun/components/invalid_transform.fbs". + +#pragma once + +#include "../component_descriptor.hpp" +#include "../datatypes/bool.hpp" +#include "../result.hpp" + +#include +#include + +namespace rerun::components { + /// **Component**: Flags the transform at its entity path as invalid. + /// + /// Specifies that the entity path at which this is logged is spatially disconnected from its parent, + /// making it impossible to transform the entity path into its parent's space and vice versa. + /// This can be useful for instance to express temporily unknown transforms. + /// + /// Note that by default all transforms are considered valid. + struct InvalidTransform { + /// Whether the entity path at which this is logged as an invalid transform to its parent. + rerun::datatypes::Bool invalid; + + public: + InvalidTransform() = default; + + InvalidTransform(rerun::datatypes::Bool invalid_) : invalid(invalid_) {} + + InvalidTransform& operator=(rerun::datatypes::Bool invalid_) { + invalid = invalid_; + return *this; + } + + InvalidTransform(bool value_) : invalid(value_) {} + + InvalidTransform& operator=(bool value_) { + invalid = value_; + return *this; + } + + /// Cast to the underlying Bool datatype + operator rerun::datatypes::Bool() const { + return invalid; + } + }; +} // namespace rerun::components + +namespace rerun { + static_assert(sizeof(rerun::datatypes::Bool) == sizeof(components::InvalidTransform)); + + /// \private + template <> + struct Loggable { + static constexpr ComponentDescriptor Descriptor = "rerun.components.InvalidTransform"; + + /// Returns the arrow data type this type corresponds to. + static const std::shared_ptr& arrow_datatype() { + return Loggable::arrow_datatype(); + } + + /// Serializes an array of `rerun::components::InvalidTransform` into an arrow array. + static Result> to_arrow( + const components::InvalidTransform* instances, size_t num_instances + ) { + if (num_instances == 0) { + return Loggable::to_arrow(nullptr, 0); + } else if (instances == nullptr) { + return rerun::Error( + ErrorCode::UnexpectedNullArgument, + "Passed array instances is null when num_elements> 0." + ); + } else { + return Loggable::to_arrow( + &instances->invalid, + num_instances + ); + } + } + }; +} // namespace rerun diff --git a/rerun_py/rerun_sdk/rerun/archetypes/disconnected_space.py b/rerun_py/rerun_sdk/rerun/archetypes/disconnected_space.py index bbac1df347ea3..e900f3c1887d0 100644 --- a/rerun_py/rerun_sdk/rerun/archetypes/disconnected_space.py +++ b/rerun_py/rerun_sdk/rerun/archetypes/disconnected_space.py @@ -6,6 +6,7 @@ from __future__ import annotations from attrs import define, field +from typing_extensions import deprecated # type: ignore[misc, unused-ignore] from .. import components from .._baseclasses import ( @@ -16,6 +17,7 @@ __all__ = ["DisconnectedSpace"] +@deprecated("""Use [archetypes.Transform3D] with [rerun.components.InvalidTransform] instead.""") @define(str=False, repr=False, init=False) class DisconnectedSpace(DisconnectedSpaceExt, Archetype): """ diff --git a/rerun_py/rerun_sdk/rerun/archetypes/transform3d.py b/rerun_py/rerun_sdk/rerun/archetypes/transform3d.py index b2c8e2daa166b..455cc8bfcb050 100644 --- a/rerun_py/rerun_sdk/rerun/archetypes/transform3d.py +++ b/rerun_py/rerun_sdk/rerun/archetypes/transform3d.py @@ -146,6 +146,7 @@ def __attrs_clear__(self) -> None: scale=None, # type: ignore[arg-type] mat3x3=None, # type: ignore[arg-type] relation=None, # type: ignore[arg-type] + invalid=None, # type: ignore[arg-type] axis_length=None, # type: ignore[arg-type] ) @@ -210,6 +211,21 @@ def _clear(cls) -> Transform3D: # # (Docstring intentionally commented out to hide this field from the docs) + invalid: components.InvalidTransformBatch | None = field( + metadata={"component": "optional"}, + default=None, + converter=components.InvalidTransformBatch._required, # type: ignore[misc] + ) + # Optionally flags the transform as invalid. + # + # Specifies that the entity path at which this is logged is spatially disconnected from its parent, + # making it impossible to transform the entity path into its parent's space and vice versa. + # This can be useful for instance to express temporily unknown transforms. + # + # By default all transforms are considered valid. + # + # (Docstring intentionally commented out to hide this field from the docs) + axis_length: components.AxisLengthBatch | None = field( metadata={"component": "optional"}, default=None, diff --git a/rerun_py/rerun_sdk/rerun/components/.gitattributes b/rerun_py/rerun_sdk/rerun/components/.gitattributes index bc78f211dc279..b80afd72fa3f1 100644 --- a/rerun_py/rerun_sdk/rerun/components/.gitattributes +++ b/rerun_py/rerun_sdk/rerun/components/.gitattributes @@ -27,6 +27,7 @@ half_size3d.py linguist-generated=true image_buffer.py linguist-generated=true image_format.py linguist-generated=true image_plane_distance.py linguist-generated=true +invalid_transform.py linguist-generated=true keypoint_id.py linguist-generated=true lat_lon.py linguist-generated=true length.py linguist-generated=true diff --git a/rerun_py/rerun_sdk/rerun/components/__init__.py b/rerun_py/rerun_sdk/rerun/components/__init__.py index 1bc230a70e79f..664765d32d3ac 100644 --- a/rerun_py/rerun_sdk/rerun/components/__init__.py +++ b/rerun_py/rerun_sdk/rerun/components/__init__.py @@ -37,6 +37,7 @@ from .image_buffer import ImageBuffer, ImageBufferBatch from .image_format import ImageFormat, ImageFormatBatch from .image_plane_distance import ImagePlaneDistance, ImagePlaneDistanceBatch +from .invalid_transform import InvalidTransform, InvalidTransformBatch from .keypoint_id import KeypointId, KeypointIdBatch from .lat_lon import LatLon, LatLonBatch from .length import Length, LengthBatch @@ -157,6 +158,8 @@ "ImageFormatBatch", "ImagePlaneDistance", "ImagePlaneDistanceBatch", + "InvalidTransform", + "InvalidTransformBatch", "KeypointId", "KeypointIdBatch", "LatLon", diff --git a/rerun_py/rerun_sdk/rerun/components/disconnected_space.py b/rerun_py/rerun_sdk/rerun/components/disconnected_space.py index 4ca00a3af3c09..85464f14ef551 100644 --- a/rerun_py/rerun_sdk/rerun/components/disconnected_space.py +++ b/rerun_py/rerun_sdk/rerun/components/disconnected_space.py @@ -5,6 +5,8 @@ from __future__ import annotations +from typing_extensions import deprecated # type: ignore[misc, unused-ignore] + from .. import datatypes from .._baseclasses import ( ComponentBatchMixin, @@ -16,6 +18,7 @@ __all__ = ["DisconnectedSpace", "DisconnectedSpaceBatch"] +@deprecated("""Use [archetypes.Transform3D] with [rerun.components.InvalidTransform] instead.""") class DisconnectedSpace(DisconnectedSpaceExt, datatypes.Bool, ComponentMixin): """ **Component**: Spatially disconnect this entity from its parent. diff --git a/rerun_py/rerun_sdk/rerun/components/invalid_transform.py b/rerun_py/rerun_sdk/rerun/components/invalid_transform.py new file mode 100644 index 0000000000000..1903c733e4b8c --- /dev/null +++ b/rerun_py/rerun_sdk/rerun/components/invalid_transform.py @@ -0,0 +1,41 @@ +# DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/python/mod.rs +# Based on "crates/store/re_types/definitions/rerun/components/invalid_transform.fbs". + +# You can extend this class by creating a "InvalidTransformExt" class in "invalid_transform_ext.py". + +from __future__ import annotations + +from .. import datatypes +from .._baseclasses import ( + ComponentBatchMixin, + ComponentDescriptor, + ComponentMixin, +) + +__all__ = ["InvalidTransform", "InvalidTransformBatch"] + + +class InvalidTransform(datatypes.Bool, ComponentMixin): + """ + **Component**: Flags the transform at its entity path as invalid. + + Specifies that the entity path at which this is logged is spatially disconnected from its parent, + making it impossible to transform the entity path into its parent's space and vice versa. + This can be useful for instance to express temporily unknown transforms. + + Note that by default all transforms are considered valid. + """ + + _BATCH_TYPE = None + # You can define your own __init__ function as a member of InvalidTransformExt in invalid_transform_ext.py + + # Note: there are no fields here because InvalidTransform delegates to datatypes.Bool + pass + + +class InvalidTransformBatch(datatypes.BoolBatch, ComponentBatchMixin): + _COMPONENT_DESCRIPTOR: ComponentDescriptor = ComponentDescriptor("rerun.components.InvalidTransform") + + +# This is patched in late to avoid circular dependencies. +InvalidTransform._BATCH_TYPE = InvalidTransformBatch # type: ignore[assignment]