diff --git a/crates/store/re_types/definitions/rerun/archetypes/line_strips3d.fbs b/crates/store/re_types/definitions/rerun/archetypes/line_strips3d.fbs
index 6984cdcd2334..3df0519c0b5d 100644
--- a/crates/store/re_types/definitions/rerun/archetypes/line_strips3d.fbs
+++ b/crates/store/re_types/definitions/rerun/archetypes/line_strips3d.fbs
@@ -9,6 +9,7 @@ namespace rerun.archetypes;
/// \example archetypes/line_strips3d_batch title="Many strips" image="https://static.rerun.io/line_strip3d_batch/15e8ff18a6c95a3191acb0eae6eb04adea3b4874/1200w.png"
/// \example archetypes/line_strips3d_ui_radius title="Lines with scene & UI radius each" image="https://static.rerun.io/line_strip3d_ui_radius/36b98f47e45747b5a3601511ff39b8d74c61d120/1200w.png"
table LineStrips3D (
+ "attr.rust.archetype_eager": "",
"attr.rust.derive": "PartialEq",
"attr.docs.category": "Spatial 3D",
"attr.docs.view_types": "Spatial3DView, Spatial2DView: if logged above active projection"
diff --git a/crates/store/re_types/src/archetypes/line_strips3d.rs b/crates/store/re_types/src/archetypes/line_strips3d.rs
index 761c01bb048d..308ae9c0fe83 100644
--- a/crates/store/re_types/src/archetypes/line_strips3d.rs
+++ b/crates/store/re_types/src/archetypes/line_strips3d.rs
@@ -98,30 +98,30 @@ use ::re_types_core::{DeserializationError, DeserializationResult};
///
///
///
-#[derive(Clone, Debug, PartialEq)]
+#[derive(Clone, Debug, PartialEq, Default)]
pub struct LineStrips3D {
/// All the actual 3D line strips that make up the batch.
- pub strips: Vec,
+ pub strips: Option,
/// Optional radii for the line strips.
- pub radii: Option>,
+ pub radii: Option,
/// Optional colors for the line strips.
- pub colors: Option>,
+ pub colors: Option,
/// Optional text labels for the line strips.
///
/// If there's a single label present, it will be placed at the center of the entity.
/// Otherwise, each instance will have its own label.
- pub labels: Option>,
+ pub labels: Option,
/// Optional choice of whether the text labels should be shown by default.
- pub show_labels: Option,
+ pub show_labels: Option,
/// Optional [`components::ClassId`][crate::components::ClassId]s for the lines.
///
/// The [`components::ClassId`][crate::components::ClassId] provides colors and labels if not specified explicitly.
- pub class_ids: Option>,
+ pub class_ids: Option,
}
impl LineStrips3D {
@@ -284,76 +284,28 @@ impl ::re_types_core::Archetype for LineStrips3D {
re_tracing::profile_function!();
use ::re_types_core::{Loggable as _, ResultExt as _};
let arrays_by_descr: ::nohash_hasher::IntMap<_, _> = arrow_data.into_iter().collect();
- let strips = {
- let array = arrays_by_descr
- .get(&Self::descriptor_strips())
- .ok_or_else(DeserializationError::missing_data)
- .with_context("rerun.archetypes.LineStrips3D#strips")?;
- ::from_arrow_opt(&**array)
- .with_context("rerun.archetypes.LineStrips3D#strips")?
- .into_iter()
- .map(|v| v.ok_or_else(DeserializationError::missing_data))
- .collect::>>()
- .with_context("rerun.archetypes.LineStrips3D#strips")?
- };
- let radii = if let Some(array) = arrays_by_descr.get(&Self::descriptor_radii()) {
- Some({
- ::from_arrow_opt(&**array)
- .with_context("rerun.archetypes.LineStrips3D#radii")?
- .into_iter()
- .map(|v| v.ok_or_else(DeserializationError::missing_data))
- .collect::>>()
- .with_context("rerun.archetypes.LineStrips3D#radii")?
- })
- } else {
- None
- };
- let colors = if let Some(array) = arrays_by_descr.get(&Self::descriptor_colors()) {
- Some({
- ::from_arrow_opt(&**array)
- .with_context("rerun.archetypes.LineStrips3D#colors")?
- .into_iter()
- .map(|v| v.ok_or_else(DeserializationError::missing_data))
- .collect::>>()
- .with_context("rerun.archetypes.LineStrips3D#colors")?
- })
- } else {
- None
- };
- let labels = if let Some(array) = arrays_by_descr.get(&Self::descriptor_labels()) {
- Some({
- ::from_arrow_opt(&**array)
- .with_context("rerun.archetypes.LineStrips3D#labels")?
- .into_iter()
- .map(|v| v.ok_or_else(DeserializationError::missing_data))
- .collect::>>()
- .with_context("rerun.archetypes.LineStrips3D#labels")?
- })
- } else {
- None
- };
- let show_labels = if let Some(array) = arrays_by_descr.get(&Self::descriptor_show_labels())
- {
- ::from_arrow_opt(&**array)
- .with_context("rerun.archetypes.LineStrips3D#show_labels")?
- .into_iter()
- .next()
- .flatten()
- } else {
- None
- };
- let class_ids = if let Some(array) = arrays_by_descr.get(&Self::descriptor_class_ids()) {
- Some({
- ::from_arrow_opt(&**array)
- .with_context("rerun.archetypes.LineStrips3D#class_ids")?
- .into_iter()
- .map(|v| v.ok_or_else(DeserializationError::missing_data))
- .collect::>>()
- .with_context("rerun.archetypes.LineStrips3D#class_ids")?
- })
- } else {
- None
- };
+ let strips = arrays_by_descr
+ .get(&Self::descriptor_strips())
+ .map(|array| SerializedComponentBatch::new(array.clone(), Self::descriptor_strips()));
+ let radii = arrays_by_descr
+ .get(&Self::descriptor_radii())
+ .map(|array| SerializedComponentBatch::new(array.clone(), Self::descriptor_radii()));
+ let colors = arrays_by_descr
+ .get(&Self::descriptor_colors())
+ .map(|array| SerializedComponentBatch::new(array.clone(), Self::descriptor_colors()));
+ let labels = arrays_by_descr
+ .get(&Self::descriptor_labels())
+ .map(|array| SerializedComponentBatch::new(array.clone(), Self::descriptor_labels()));
+ let show_labels = arrays_by_descr
+ .get(&Self::descriptor_show_labels())
+ .map(|array| {
+ SerializedComponentBatch::new(array.clone(), Self::descriptor_show_labels())
+ });
+ let class_ids = arrays_by_descr
+ .get(&Self::descriptor_class_ids())
+ .map(|array| {
+ SerializedComponentBatch::new(array.clone(), Self::descriptor_class_ids())
+ });
Ok(Self {
strips,
radii,
@@ -366,57 +318,17 @@ impl ::re_types_core::Archetype for LineStrips3D {
}
impl ::re_types_core::AsComponents for LineStrips3D {
- fn as_component_batches(&self) -> Vec> {
- re_tracing::profile_function!();
+ #[inline]
+ fn as_serialized_batches(&self) -> Vec {
use ::re_types_core::Archetype as _;
[
- Some(Self::indicator()),
- (Some(&self.strips as &dyn ComponentBatch)).map(|batch| {
- ::re_types_core::ComponentBatchCowWithDescriptor {
- batch: batch.into(),
- descriptor_override: Some(Self::descriptor_strips()),
- }
- }),
- (self
- .radii
- .as_ref()
- .map(|comp_batch| (comp_batch as &dyn ComponentBatch)))
- .map(|batch| ::re_types_core::ComponentBatchCowWithDescriptor {
- batch: batch.into(),
- descriptor_override: Some(Self::descriptor_radii()),
- }),
- (self
- .colors
- .as_ref()
- .map(|comp_batch| (comp_batch as &dyn ComponentBatch)))
- .map(|batch| ::re_types_core::ComponentBatchCowWithDescriptor {
- batch: batch.into(),
- descriptor_override: Some(Self::descriptor_colors()),
- }),
- (self
- .labels
- .as_ref()
- .map(|comp_batch| (comp_batch as &dyn ComponentBatch)))
- .map(|batch| ::re_types_core::ComponentBatchCowWithDescriptor {
- batch: batch.into(),
- descriptor_override: Some(Self::descriptor_labels()),
- }),
- (self
- .show_labels
- .as_ref()
- .map(|comp| (comp as &dyn ComponentBatch)))
- .map(|batch| ::re_types_core::ComponentBatchCowWithDescriptor {
- batch: batch.into(),
- descriptor_override: Some(Self::descriptor_show_labels()),
- }),
- (self
- .class_ids
- .as_ref()
- .map(|comp_batch| (comp_batch as &dyn ComponentBatch)))
- .map(|batch| ::re_types_core::ComponentBatchCowWithDescriptor {
- batch: batch.into(),
- descriptor_override: Some(Self::descriptor_class_ids()),
- }),
+ Self::indicator().serialized(),
+ self.strips.clone(),
+ self.radii.clone(),
+ self.colors.clone(),
+ self.labels.clone(),
+ self.show_labels.clone(),
+ self.class_ids.clone(),
]
.into_iter()
.flatten()
@@ -433,7 +345,7 @@ impl LineStrips3D {
strips: impl IntoIterator- >,
) -> Self {
Self {
- strips: strips.into_iter().map(Into::into).collect(),
+ strips: try_serialize_field(Self::descriptor_strips(), strips),
radii: None,
colors: None,
labels: None,
@@ -442,13 +354,61 @@ impl LineStrips3D {
}
}
+ /// Update only some specific fields of a `LineStrips3D`.
+ #[inline]
+ pub fn update_fields() -> Self {
+ Self::default()
+ }
+
+ /// Clear all the fields of a `LineStrips3D`.
+ #[inline]
+ pub fn clear_fields() -> Self {
+ use ::re_types_core::Loggable as _;
+ Self {
+ strips: Some(SerializedComponentBatch::new(
+ crate::components::LineStrip3D::arrow_empty(),
+ Self::descriptor_strips(),
+ )),
+ radii: Some(SerializedComponentBatch::new(
+ crate::components::Radius::arrow_empty(),
+ Self::descriptor_radii(),
+ )),
+ colors: Some(SerializedComponentBatch::new(
+ crate::components::Color::arrow_empty(),
+ Self::descriptor_colors(),
+ )),
+ labels: Some(SerializedComponentBatch::new(
+ crate::components::Text::arrow_empty(),
+ Self::descriptor_labels(),
+ )),
+ show_labels: Some(SerializedComponentBatch::new(
+ crate::components::ShowLabels::arrow_empty(),
+ Self::descriptor_show_labels(),
+ )),
+ class_ids: Some(SerializedComponentBatch::new(
+ crate::components::ClassId::arrow_empty(),
+ Self::descriptor_class_ids(),
+ )),
+ }
+ }
+
+ /// All the actual 3D line strips that make up the batch.
+ #[inline]
+ pub fn with_strips(
+ mut self,
+ strips: impl IntoIterator
- >,
+ ) -> Self {
+ self.strips = try_serialize_field(Self::descriptor_strips(), strips);
+ self
+ }
+
/// Optional radii for the line strips.
#[inline]
pub fn with_radii(
mut self,
radii: impl IntoIterator
- >,
) -> Self {
- self.radii = Some(radii.into_iter().map(Into::into).collect());
+ self.radii = try_serialize_field(Self::descriptor_radii(), radii);
self
}
@@ -458,7 +418,7 @@ impl LineStrips3D {
mut self,
colors: impl IntoIterator
- >,
) -> Self {
- self.colors = Some(colors.into_iter().map(Into::into).collect());
+ self.colors = try_serialize_field(Self::descriptor_colors(), colors);
self
}
@@ -471,7 +431,7 @@ impl LineStrips3D {
mut self,
labels: impl IntoIterator
- >,
) -> Self {
- self.labels = Some(labels.into_iter().map(Into::into).collect());
+ self.labels = try_serialize_field(Self::descriptor_labels(), labels);
self
}
@@ -481,7 +441,7 @@ impl LineStrips3D {
mut self,
show_labels: impl Into,
) -> Self {
- self.show_labels = Some(show_labels.into());
+ self.show_labels = try_serialize_field(Self::descriptor_show_labels(), [show_labels]);
self
}
@@ -493,7 +453,7 @@ impl LineStrips3D {
mut self,
class_ids: impl IntoIterator
- >,
) -> Self {
- self.class_ids = Some(class_ids.into_iter().map(Into::into).collect());
+ self.class_ids = try_serialize_field(Self::descriptor_class_ids(), class_ids);
self
}
}
@@ -508,14 +468,4 @@ impl ::re_byte_size::SizeBytes for LineStrips3D {
+ self.show_labels.heap_size_bytes()
+ self.class_ids.heap_size_bytes()
}
-
- #[inline]
- fn is_pod() -> bool {
- >::is_pod()
- &&