diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 7907c312282b..96bd48d68f4b 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -20,6 +20,7 @@ To get an auto-generated PR description you can put "copilot:summary" or "copilo * Using full set of examples from `nightly` build: [rerun.io/viewer](https://rerun.io/viewer/pr/{{pr.number}}?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json) * [ ] The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG * [ ] If applicable, add a new check to the [release checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)! +* [ ] If have noted any breaking changes to the log API in `CHANGELOG.md` and the migration guide - [PR Build Summary](https://build.rerun.io/pr/{{pr.number}}) - [Recent benchmark results](https://build.rerun.io/graphs/crates.html) diff --git a/CHANGELOG.md b/CHANGELOG.md index 96db87b4e85f..656c27d9473b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased](https://github.com/rerun-io/rerun/compare/latest...HEAD) +# ⚠️ Breaking changes +* `mesh_material: Material` has been renamed to `albedo_factor: AlbedoFactor` [#6841](https://github.com/rerun-io/rerun/pull/6841) + ## [0.17.0](https://github.com/rerun-io/rerun/compare/0.16.1...0.17.0) - More Blueprint features and better notebooks - 2024-07-08 diff --git a/crates/store/re_types/Cargo.toml b/crates/store/re_types/Cargo.toml index 6e3f025b7484..494869f0b54f 100644 --- a/crates/store/re_types/Cargo.toml +++ b/crates/store/re_types/Cargo.toml @@ -22,7 +22,7 @@ features = ["all"] [features] -default = [] +default = ["ecolor"] ## All features except `testing`. all = ["ecolor", "egui_plot", "glam", "image", "mint", "serde"] diff --git a/crates/store/re_types/definitions/rerun/archetypes/mesh3d.fbs b/crates/store/re_types/definitions/rerun/archetypes/mesh3d.fbs index eec6ce93c5dd..ee65d8520069 100644 --- a/crates/store/re_types/definitions/rerun/archetypes/mesh3d.fbs +++ b/crates/store/re_types/definitions/rerun/archetypes/mesh3d.fbs @@ -42,8 +42,8 @@ table Mesh3D ( /// An optional uv texture coordinate for each vertex. vertex_texcoords: [rerun.components.Texcoord2D] ("attr.rerun.component_optional", nullable, order: 3200); - /// Optional material properties for the mesh as a whole. - mesh_material: rerun.components.Material ("attr.rerun.component_optional", nullable, order: 3300); + /// A color multiplier applied to the whole mesh. + albedo_factor: rerun.components.AlbedoFactor ("attr.rerun.component_optional", nullable, order: 3300); /// Optional albedo texture. /// diff --git a/crates/store/re_types/definitions/rerun/components.fbs b/crates/store/re_types/definitions/rerun/components.fbs index edeae9a586bf..39e4ae2149de 100644 --- a/crates/store/re_types/definitions/rerun/components.fbs +++ b/crates/store/re_types/definitions/rerun/components.fbs @@ -1,4 +1,5 @@ include "./components/aggregation_policy.fbs"; +include "./components/albedo_factor.fbs"; include "./components/annotation_context.fbs"; include "./components/axis_length.fbs"; include "./components/blob.fbs"; @@ -20,7 +21,6 @@ include "./components/line_strip3d.fbs"; include "./components/magnification_filter.fbs"; include "./components/marker_shape.fbs"; include "./components/marker_size.fbs"; -include "./components/material.fbs"; include "./components/media_type.fbs"; include "./components/name.fbs"; include "./components/opacity.fbs"; diff --git a/crates/store/re_types/definitions/rerun/components/albedo_factor.fbs b/crates/store/re_types/definitions/rerun/components/albedo_factor.fbs new file mode 100644 index 000000000000..f912fa5db83f --- /dev/null +++ b/crates/store/re_types/definitions/rerun/components/albedo_factor.fbs @@ -0,0 +1,20 @@ +include "arrow/attributes.fbs"; +include "python/attributes.fbs"; +include "rust/attributes.fbs"; + +include "rerun/datatypes.fbs"; +include "rerun/attributes.fbs"; + +namespace rerun.components; + +// --- + +/// A color multiplier, usually applied to a whole entity, e.g. a mesh. +table AlbedoFactor ( + "attr.docs.unreleased", + "attr.rust.derive": "Copy, PartialEq, Eq, PartialOrd, Ord, Hash, bytemuck::Pod, bytemuck::Zeroable", + "attr.rust.repr": "transparent" +) { + albedo_factor: rerun.datatypes.Rgba32 (order: 100); +} + diff --git a/crates/store/re_types/definitions/rerun/components/material.fbs b/crates/store/re_types/definitions/rerun/components/material.fbs deleted file mode 100644 index e53955aa3f3a..000000000000 --- a/crates/store/re_types/definitions/rerun/components/material.fbs +++ /dev/null @@ -1,18 +0,0 @@ -include "arrow/attributes.fbs"; -include "python/attributes.fbs"; -include "rust/attributes.fbs"; - -include "rerun/datatypes.fbs"; -include "rerun/attributes.fbs"; - -namespace rerun.components; - -// --- - -/// Material properties of a mesh, e.g. its color multiplier. -table Material ( - "attr.rust.derive": "Default, PartialEq, Eq" -) { - material: rerun.datatypes.Material (order: 100); -} - diff --git a/crates/store/re_types/definitions/rerun/datatypes.fbs b/crates/store/re_types/definitions/rerun/datatypes.fbs index 4ca2def9345c..0f65e4339349 100644 --- a/crates/store/re_types/definitions/rerun/datatypes.fbs +++ b/crates/store/re_types/definitions/rerun/datatypes.fbs @@ -12,7 +12,6 @@ include "./datatypes/keypoint_id.fbs"; include "./datatypes/keypoint_pair.fbs"; include "./datatypes/mat3x3.fbs"; include "./datatypes/mat4x4.fbs"; -include "./datatypes/material.fbs"; include "./datatypes/quaternion.fbs"; include "./datatypes/range1d.fbs"; include "./datatypes/range2d.fbs"; diff --git a/crates/store/re_types/definitions/rerun/datatypes/material.fbs b/crates/store/re_types/definitions/rerun/datatypes/material.fbs deleted file mode 100644 index 608384eaec28..000000000000 --- a/crates/store/re_types/definitions/rerun/datatypes/material.fbs +++ /dev/null @@ -1,18 +0,0 @@ -include "arrow/attributes.fbs"; -include "python/attributes.fbs"; -include "rust/attributes.fbs"; - -include "rerun/attributes.fbs"; -include "rerun/datatypes/rgba32.fbs"; - -namespace rerun.datatypes; - -// --- - -/// Material properties of a mesh, e.g. its color multiplier. -struct Material ( - "attr.rust.derive": "Copy, PartialEq, Eq, Hash" -) { - /// Optional color multiplier. - albedo_factor: rerun.datatypes.Rgba32 (nullable, order: 100); -} diff --git a/crates/store/re_types/src/archetypes/mesh3d.rs b/crates/store/re_types/src/archetypes/mesh3d.rs index 594ba25a0445..33792b24c035 100644 --- a/crates/store/re_types/src/archetypes/mesh3d.rs +++ b/crates/store/re_types/src/archetypes/mesh3d.rs @@ -68,8 +68,8 @@ pub struct Mesh3D { /// An optional uv texture coordinate for each vertex. pub vertex_texcoords: Option>, - /// Optional material properties for the mesh as a whole. - pub mesh_material: Option, + /// A color multiplier applied to the whole mesh. + pub albedo_factor: Option, /// Optional albedo texture. /// @@ -92,7 +92,7 @@ impl ::re_types_core::SizeBytes for Mesh3D { + self.vertex_normals.heap_size_bytes() + self.vertex_colors.heap_size_bytes() + self.vertex_texcoords.heap_size_bytes() - + self.mesh_material.heap_size_bytes() + + self.albedo_factor.heap_size_bytes() + self.albedo_texture.heap_size_bytes() + self.class_ids.heap_size_bytes() } @@ -104,7 +104,7 @@ impl ::re_types_core::SizeBytes for Mesh3D { && >>::is_pod() && >>::is_pod() && >>::is_pod() - && >::is_pod() + && >::is_pod() && >::is_pod() && >>::is_pod() } @@ -127,7 +127,7 @@ static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = [ "rerun.components.Color".into(), "rerun.components.Texcoord2D".into(), - "rerun.components.Material".into(), + "rerun.components.AlbedoFactor".into(), "rerun.components.TensorData".into(), "rerun.components.ClassId".into(), ] @@ -142,7 +142,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 9usize]> = "rerun.components.Mesh3DIndicator".into(), "rerun.components.Color".into(), "rerun.components.Texcoord2D".into(), - "rerun.components.Material".into(), + "rerun.components.AlbedoFactor".into(), "rerun.components.TensorData".into(), "rerun.components.ClassId".into(), ] @@ -267,9 +267,10 @@ impl ::re_types_core::Archetype for Mesh3D { } else { None }; - let mesh_material = if let Some(array) = arrays_by_name.get("rerun.components.Material") { - ::from_arrow_opt(&**array) - .with_context("rerun.archetypes.Mesh3D#mesh_material")? + let albedo_factor = if let Some(array) = arrays_by_name.get("rerun.components.AlbedoFactor") + { + ::from_arrow_opt(&**array) + .with_context("rerun.archetypes.Mesh3D#albedo_factor")? .into_iter() .next() .flatten() @@ -304,7 +305,7 @@ impl ::re_types_core::Archetype for Mesh3D { vertex_normals, vertex_colors, vertex_texcoords, - mesh_material, + albedo_factor, albedo_texture, class_ids, }) @@ -330,7 +331,7 @@ impl ::re_types_core::AsComponents for Mesh3D { self.vertex_texcoords .as_ref() .map(|comp_batch| (comp_batch as &dyn ComponentBatch).into()), - self.mesh_material + self.albedo_factor .as_ref() .map(|comp| (comp as &dyn ComponentBatch).into()), self.albedo_texture @@ -358,7 +359,7 @@ impl Mesh3D { vertex_normals: None, vertex_colors: None, vertex_texcoords: None, - mesh_material: None, + albedo_factor: None, albedo_texture: None, class_ids: None, } @@ -404,13 +405,13 @@ impl Mesh3D { self } - /// Optional material properties for the mesh as a whole. + /// A color multiplier applied to the whole mesh. #[inline] - pub fn with_mesh_material( + pub fn with_albedo_factor( mut self, - mesh_material: impl Into, + albedo_factor: impl Into, ) -> Self { - self.mesh_material = Some(mesh_material.into()); + self.albedo_factor = Some(albedo_factor.into()); self } diff --git a/crates/store/re_types/src/components/.gitattributes b/crates/store/re_types/src/components/.gitattributes index 4443e3b05798..1393cc86c665 100644 --- a/crates/store/re_types/src/components/.gitattributes +++ b/crates/store/re_types/src/components/.gitattributes @@ -2,6 +2,7 @@ .gitattributes linguist-generated=true aggregation_policy.rs linguist-generated=true +albedo_factor.rs linguist-generated=true annotation_context.rs linguist-generated=true axis_length.rs linguist-generated=true blob.rs linguist-generated=true @@ -22,7 +23,6 @@ line_strip3d.rs linguist-generated=true magnification_filter.rs linguist-generated=true marker_shape.rs linguist-generated=true marker_size.rs linguist-generated=true -material.rs linguist-generated=true media_type.rs linguist-generated=true mod.rs linguist-generated=true name.rs linguist-generated=true diff --git a/crates/store/re_types/src/components/material.rs b/crates/store/re_types/src/components/albedo_factor.rs similarity index 58% rename from crates/store/re_types/src/components/material.rs rename to crates/store/re_types/src/components/albedo_factor.rs index 8758cb463709..ceb765af3c48 100644 --- a/crates/store/re_types/src/components/material.rs +++ b/crates/store/re_types/src/components/albedo_factor.rs @@ -1,5 +1,5 @@ // 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/material.fbs". +// Based on "crates/store/re_types/definitions/rerun/components/albedo_factor.fbs". #![allow(unused_imports)] #![allow(unused_parens)] @@ -18,11 +18,14 @@ use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; use ::re_types_core::{DeserializationError, DeserializationResult}; -/// **Component**: Material properties of a mesh, e.g. its color multiplier. -#[derive(Clone, Debug, Default, PartialEq, Eq)] -pub struct Material(pub crate::datatypes::Material); +/// **Component**: A color multiplier, usually applied to a whole entity, e.g. a mesh. +#[derive( + Clone, Debug, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, bytemuck::Pod, bytemuck::Zeroable, +)] +#[repr(transparent)] +pub struct AlbedoFactor(pub crate::datatypes::Rgba32); -impl ::re_types_core::SizeBytes for Material { +impl ::re_types_core::SizeBytes for AlbedoFactor { #[inline] fn heap_size_bytes(&self) -> u64 { self.0.heap_size_bytes() @@ -30,52 +33,52 @@ impl ::re_types_core::SizeBytes for Material { #[inline] fn is_pod() -> bool { - ::is_pod() + ::is_pod() } } -impl> From for Material { +impl> From for AlbedoFactor { fn from(v: T) -> Self { Self(v.into()) } } -impl std::borrow::Borrow for Material { +impl std::borrow::Borrow for AlbedoFactor { #[inline] - fn borrow(&self) -> &crate::datatypes::Material { + fn borrow(&self) -> &crate::datatypes::Rgba32 { &self.0 } } -impl std::ops::Deref for Material { - type Target = crate::datatypes::Material; +impl std::ops::Deref for AlbedoFactor { + type Target = crate::datatypes::Rgba32; #[inline] - fn deref(&self) -> &crate::datatypes::Material { + fn deref(&self) -> &crate::datatypes::Rgba32 { &self.0 } } -impl std::ops::DerefMut for Material { +impl std::ops::DerefMut for AlbedoFactor { #[inline] - fn deref_mut(&mut self) -> &mut crate::datatypes::Material { + fn deref_mut(&mut self) -> &mut crate::datatypes::Rgba32 { &mut self.0 } } -::re_types_core::macros::impl_into_cow!(Material); +::re_types_core::macros::impl_into_cow!(AlbedoFactor); -impl ::re_types_core::Loggable for Material { +impl ::re_types_core::Loggable for AlbedoFactor { type Name = ::re_types_core::ComponentName; #[inline] fn name() -> Self::Name { - "rerun.components.Material".into() + "rerun.components.AlbedoFactor".into() } #[inline] fn arrow_datatype() -> arrow2::datatypes::DataType { - crate::datatypes::Material::arrow_datatype() + crate::datatypes::Rgba32::arrow_datatype() } fn to_arrow_opt<'a>( @@ -84,7 +87,7 @@ impl ::re_types_core::Loggable for Material { where Self: Clone + 'a, { - crate::datatypes::Material::to_arrow_opt(data.into_iter().map(|datum| { + crate::datatypes::Rgba32::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), @@ -98,7 +101,15 @@ impl ::re_types_core::Loggable for Material { where Self: Sized, { - crate::datatypes::Material::from_arrow_opt(arrow_data) + crate::datatypes::Rgba32::from_arrow_opt(arrow_data) .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) } + + #[inline] + fn from_arrow(arrow_data: &dyn arrow2::array::Array) -> DeserializationResult> + where + Self: Sized, + { + crate::datatypes::Rgba32::from_arrow(arrow_data).map(bytemuck::cast_vec) + } } diff --git a/crates/store/re_types/src/components/albedo_factor_ext.rs b/crates/store/re_types/src/components/albedo_factor_ext.rs new file mode 100644 index 000000000000..122d33ec95fa --- /dev/null +++ b/crates/store/re_types/src/components/albedo_factor_ext.rs @@ -0,0 +1,10 @@ +use crate::datatypes::Rgba32; + +use super::AlbedoFactor; + +impl Default for AlbedoFactor { + #[inline] + fn default() -> Self { + Self(Rgba32::WHITE) + } +} diff --git a/crates/store/re_types/src/components/material_ext.rs b/crates/store/re_types/src/components/material_ext.rs deleted file mode 100644 index f5a4a1fd2f2e..000000000000 --- a/crates/store/re_types/src/components/material_ext.rs +++ /dev/null @@ -1,11 +0,0 @@ -use crate::datatypes::Rgba32; - -use super::Material; - -impl Material { - /// A new material using a given color multiplier. - #[inline] - pub fn from_albedo_factor(color: impl Into) -> Self { - Self(crate::datatypes::Material::from_albedo_factor(color)) - } -} diff --git a/crates/store/re_types/src/components/mod.rs b/crates/store/re_types/src/components/mod.rs index 681aa584be15..a3fb8b1638e6 100644 --- a/crates/store/re_types/src/components/mod.rs +++ b/crates/store/re_types/src/components/mod.rs @@ -1,6 +1,8 @@ // DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/rust/api.rs mod aggregation_policy; +mod albedo_factor; +mod albedo_factor_ext; mod annotation_context; mod axis_length; mod axis_length_ext; @@ -37,8 +39,6 @@ mod marker_shape; mod marker_shape_ext; mod marker_size; mod marker_size_ext; -mod material; -mod material_ext; mod media_type; mod media_type_ext; mod name; @@ -87,6 +87,7 @@ mod view_coordinates; mod view_coordinates_ext; pub use self::aggregation_policy::AggregationPolicy; +pub use self::albedo_factor::AlbedoFactor; pub use self::annotation_context::AnnotationContext; pub use self::axis_length::AxisLength; pub use self::blob::Blob; @@ -107,7 +108,6 @@ pub use self::line_strip3d::LineStrip3D; pub use self::magnification_filter::MagnificationFilter; pub use self::marker_shape::MarkerShape; pub use self::marker_size::MarkerSize; -pub use self::material::Material; pub use self::media_type::MediaType; pub use self::name::Name; pub use self::opacity::Opacity; diff --git a/crates/store/re_types/src/datatypes/.gitattributes b/crates/store/re_types/src/datatypes/.gitattributes index d2d2a1195e5d..62e380762ceb 100644 --- a/crates/store/re_types/src/datatypes/.gitattributes +++ b/crates/store/re_types/src/datatypes/.gitattributes @@ -11,7 +11,6 @@ keypoint_id.rs linguist-generated=true keypoint_pair.rs linguist-generated=true mat3x3.rs linguist-generated=true mat4x4.rs linguist-generated=true -material.rs linguist-generated=true mod.rs linguist-generated=true quaternion.rs linguist-generated=true range1d.rs linguist-generated=true diff --git a/crates/store/re_types/src/datatypes/material.rs b/crates/store/re_types/src/datatypes/material.rs deleted file mode 100644 index d49b5d7e7950..000000000000 --- a/crates/store/re_types/src/datatypes/material.rs +++ /dev/null @@ -1,210 +0,0 @@ -// 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/datatypes/material.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::ComponentName; -use ::re_types_core::SerializationResult; -use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; -use ::re_types_core::{DeserializationError, DeserializationResult}; - -/// **Datatype**: Material properties of a mesh, e.g. its color multiplier. -#[derive(Clone, Debug, Copy, PartialEq, Eq, Hash)] -pub struct Material { - /// Optional color multiplier. - pub albedo_factor: Option, -} - -impl ::re_types_core::SizeBytes for Material { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.albedo_factor.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - } -} - -impl>> From for Material { - fn from(v: T) -> Self { - Self { - albedo_factor: v.into(), - } - } -} - -impl std::borrow::Borrow> for Material { - #[inline] - fn borrow(&self) -> &Option { - &self.albedo_factor - } -} - -impl std::ops::Deref for Material { - type Target = Option; - - #[inline] - fn deref(&self) -> &Option { - &self.albedo_factor - } -} - -impl std::ops::DerefMut for Material { - #[inline] - fn deref_mut(&mut self) -> &mut Option { - &mut self.albedo_factor - } -} - -::re_types_core::macros::impl_into_cow!(Material); - -impl ::re_types_core::Loggable for Material { - type Name = ::re_types_core::DatatypeName; - - #[inline] - fn name() -> Self::Name { - "rerun.datatypes.Material".into() - } - - #[inline] - fn arrow_datatype() -> arrow2::datatypes::DataType { - #![allow(clippy::wildcard_imports)] - use arrow2::datatypes::*; - DataType::Struct(std::sync::Arc::new(vec![Field::new( - "albedo_factor", - ::arrow_datatype(), - true, - )])) - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult> - where - Self: Clone + 'a, - { - #![allow(clippy::wildcard_imports)] - use ::re_types_core::{Loggable as _, ResultExt as _}; - use arrow2::{array::*, datatypes::*}; - Ok({ - let (somes, data): (Vec<_>, Vec<_>) = data - .into_iter() - .map(|datum| { - let datum: Option<::std::borrow::Cow<'a, Self>> = datum.map(Into::into); - (datum.is_some(), datum) - }) - .unzip(); - let bitmap: Option = { - let any_nones = somes.iter().any(|some| !*some); - any_nones.then(|| somes.into()) - }; - StructArray::new( - Self::arrow_datatype(), - vec![{ - let (somes, albedo_factor): (Vec<_>, Vec<_>) = data - .iter() - .map(|datum| { - let datum = datum - .as_ref() - .map(|datum| datum.albedo_factor.clone()) - .flatten(); - (datum.is_some(), datum) - }) - .unzip(); - let albedo_factor_bitmap: Option = { - let any_nones = somes.iter().any(|some| !*some); - any_nones.then(|| somes.into()) - }; - PrimitiveArray::new( - DataType::UInt32, - albedo_factor - .into_iter() - .map(|datum| datum.map(|datum| datum.0).unwrap_or_default()) - .collect(), - albedo_factor_bitmap, - ) - .boxed() - }], - bitmap, - ) - .boxed() - }) - } - - fn from_arrow_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - #![allow(clippy::wildcard_imports)] - use ::re_types_core::{Loggable as _, ResultExt as _}; - use arrow2::{array::*, buffer::*, datatypes::*}; - Ok({ - let arrow_data = arrow_data - .as_any() - .downcast_ref::() - .ok_or_else(|| { - let expected = Self::arrow_datatype(); - let actual = arrow_data.data_type().clone(); - DeserializationError::datatype_mismatch(expected, actual) - }) - .with_context("rerun.datatypes.Material")?; - if arrow_data.is_empty() { - Vec::new() - } else { - let (arrow_data_fields, arrow_data_arrays) = - (arrow_data.fields(), arrow_data.values()); - let arrays_by_name: ::std::collections::HashMap<_, _> = arrow_data_fields - .iter() - .map(|field| field.name.as_str()) - .zip(arrow_data_arrays) - .collect(); - let albedo_factor = { - if !arrays_by_name.contains_key("albedo_factor") { - return Err(DeserializationError::missing_struct_field( - Self::arrow_datatype(), - "albedo_factor", - )) - .with_context("rerun.datatypes.Material"); - } - let arrow_data = &**arrays_by_name["albedo_factor"]; - arrow_data - .as_any() - .downcast_ref::() - .ok_or_else(|| { - let expected = DataType::UInt32; - let actual = arrow_data.data_type().clone(); - DeserializationError::datatype_mismatch(expected, actual) - }) - .with_context("rerun.datatypes.Material#albedo_factor")? - .into_iter() - .map(|opt| opt.copied()) - .map(|res_or_opt| res_or_opt.map(crate::datatypes::Rgba32)) - }; - arrow2::bitmap::utils::ZipValidity::new_with_validity( - ::itertools::izip!(albedo_factor), - arrow_data.validity(), - ) - .map(|opt| { - opt.map(|(albedo_factor)| Ok(Self { albedo_factor })) - .transpose() - }) - .collect::>>() - .with_context("rerun.datatypes.Material")? - } - }) - } -} diff --git a/crates/store/re_types/src/datatypes/material_ext.rs b/crates/store/re_types/src/datatypes/material_ext.rs deleted file mode 100644 index 18732b20f8d3..000000000000 --- a/crates/store/re_types/src/datatypes/material_ext.rs +++ /dev/null @@ -1,24 +0,0 @@ -use crate::datatypes::Rgba32; - -use super::Material; - -impl Material { - /// A new material using a given color multiplier. - #[inline] - pub fn from_albedo_factor(color: impl Into) -> Self { - Self { - albedo_factor: Some(color.into()), - } - } -} - -#[allow(clippy::derivable_impls)] // Soon no longer be derivable, also wanted to comment on choices here. -impl Default for Material { - #[inline] - fn default() -> Self { - Self { - // TODO(andreas): Would be nicer to not make this optional and just use white as default factor. - albedo_factor: None, - } - } -} diff --git a/crates/store/re_types/src/datatypes/mod.rs b/crates/store/re_types/src/datatypes/mod.rs index 355b74feb7ff..c1eaf7d5f059 100644 --- a/crates/store/re_types/src/datatypes/mod.rs +++ b/crates/store/re_types/src/datatypes/mod.rs @@ -20,8 +20,6 @@ mod mat3x3; mod mat3x3_ext; mod mat4x4; mod mat4x4_ext; -mod material; -mod material_ext; mod quaternion; mod quaternion_ext; mod range1d; @@ -78,7 +76,6 @@ pub use self::keypoint_id::KeypointId; pub use self::keypoint_pair::KeypointPair; pub use self::mat3x3::Mat3x3; pub use self::mat4x4::Mat4x4; -pub use self::material::Material; pub use self::quaternion::Quaternion; pub use self::range1d::Range1D; pub use self::range2d::Range2D; diff --git a/crates/store/re_types/src/datatypes/rgba32_ext.rs b/crates/store/re_types/src/datatypes/rgba32_ext.rs index be83d3aa1afb..55f740fba225 100644 --- a/crates/store/re_types/src/datatypes/rgba32_ext.rs +++ b/crates/store/re_types/src/datatypes/rgba32_ext.rs @@ -23,6 +23,14 @@ impl Rgba32 { Self(r << 24 | g << 16 | b << 8 | a) } + /// From linear-space sRGB values in 0-1 range, with a separate/unmultiplied alpha. + /// + /// This is a lossy conversion. + #[cfg(feature = "ecolor")] + pub fn from_linear_unmultiplied_rgba_f32(r: f32, g: f32, b: f32, a: f32) -> Self { + ecolor::Rgba::from_rgba_unmultiplied(r, g, b, a).into() + } + /// Most significant byte is `r`, least significant byte is `a`. #[inline] pub const fn from_u32(rgba: u32) -> Self { diff --git a/crates/store/re_types/tests/mesh3d.rs b/crates/store/re_types/tests/mesh3d.rs index eb5f159aa145..fd003ac5d09e 100644 --- a/crates/store/re_types/tests/mesh3d.rs +++ b/crates/store/re_types/tests/mesh3d.rs @@ -3,9 +3,7 @@ use std::collections::HashMap; use re_types::{ archetypes::Mesh3D, components::{ClassId, Position3D, Texcoord2D, TriangleIndices, Vector3D}, - datatypes::{ - Material, Rgba32, TensorBuffer, TensorData, TensorDimension, UVec3D, Vec2D, Vec3D, - }, + datatypes::{Rgba32, TensorBuffer, TensorData, TensorDimension, UVec3D, Vec2D, Vec3D}, Archetype as _, AsComponents as _, }; @@ -47,12 +45,7 @@ fn roundtrip() { Texcoord2D(Vec2D([0.0, 1.0])), // Texcoord2D(Vec2D([2.0, 3.0])), // ]), - mesh_material: Some( - Material { - albedo_factor: Some(Rgba32::from_unmultiplied_rgba(0xEE, 0x11, 0x22, 0x33)), - } - .into(), - ), + albedo_factor: Some(Rgba32::from_unmultiplied_rgba(0xEE, 0x11, 0x22, 0x33).into()), albedo_texture: Some(tensor_data.clone()), class_ids: Some(vec![ ClassId::from(126), // @@ -65,7 +58,7 @@ fn roundtrip() { .with_vertex_normals([[4.0, 5.0, 6.0], [40.0, 50.0, 60.0]]) .with_vertex_colors([0xAA0000CC, 0x00BB00DD]) .with_vertex_texcoords([[0.0, 1.0], [2.0, 3.0]]) - .with_mesh_material(Material::from_albedo_factor(0xEE112233)) + .with_albedo_factor(0xEE112233) .with_class_ids([126, 127]) .with_albedo_texture(tensor_data); similar_asserts::assert_eq!(expected, arch); diff --git a/crates/top/rerun/src/sdk.rs b/crates/top/rerun/src/sdk.rs index 6ce29379ff10..ed8970b66f7f 100644 --- a/crates/top/rerun/src/sdk.rs +++ b/crates/top/rerun/src/sdk.rs @@ -24,7 +24,7 @@ mod prelude { // Also import any component or datatype that has a unique name: pub use re_chunk::ChunkTimeline; pub use re_types::components::{ - Color, HalfSize2D, HalfSize3D, LineStrip2D, LineStrip3D, Material, MediaType, + AlbedoFactor, Color, HalfSize2D, HalfSize3D, LineStrip2D, LineStrip3D, MediaType, OutOfTreeTransform3D, Position2D, Position3D, Radius, Text, TextLogLevel, TriangleIndices, Vector2D, Vector3D, }; diff --git a/crates/viewer/re_edit_ui/src/color.rs b/crates/viewer/re_edit_ui/src/color.rs index aceb332d7779..48392540adf1 100644 --- a/crates/viewer/re_edit_ui/src/color.rs +++ b/crates/viewer/re_edit_ui/src/color.rs @@ -1,13 +1,21 @@ -use re_types::components::Color; -use re_viewer_context::{MaybeMutRef, ViewerContext}; +use re_types::datatypes::Rgba32; +use re_viewer_context::MaybeMutRef; -pub fn edit_color_ui( - _ctx: &ViewerContext<'_>, +pub fn edit_rgba32( + _ctx: &re_viewer_context::ViewerContext<'_>, ui: &mut egui::Ui, - color: &mut MaybeMutRef<'_, Color>, + value: &mut MaybeMutRef<'_, impl std::ops::DerefMut>, ) -> egui::Response { + let mut value: MaybeMutRef<'_, Rgba32> = match value { + MaybeMutRef::Ref(value) => MaybeMutRef::Ref(value), + MaybeMutRef::MutRef(value) => MaybeMutRef::MutRef(value), + }; + edit_rgba32_impl(ui, &mut value) +} + +fn edit_rgba32_impl(ui: &mut egui::Ui, color: &mut MaybeMutRef<'_, Rgba32>) -> egui::Response { let response = if let Some(color) = color.as_mut() { - let mut edit_color = (*color).into(); + let mut edit_color = egui::Color32::from(*color); let response = egui::color_picker::color_edit_button_srgba( ui, &mut edit_color, @@ -18,7 +26,7 @@ pub fn edit_color_ui( *color = edit_color.into(); response } else { - let [r, g, b, a] = color.0.to_array(); + let [r, g, b, a] = color.to_array(); let color = egui::Color32::from_rgba_unmultiplied(r, g, b, a); egui::color_picker::show_color(ui, color, egui::Vec2::new(32.0, 16.0)) }; @@ -29,7 +37,7 @@ pub fn edit_color_ui( ui.visuals().widgets.noninteractive.fg_stroke, ); - let [r, g, b, a] = color.0.to_array(); + let [r, g, b, a] = color.to_array(); response.on_hover_ui(|ui| { ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Extend); ui.monospace(format!("#{r:02x}{g:02x}{b:02x}{a:02x}")); diff --git a/crates/viewer/re_edit_ui/src/lib.rs b/crates/viewer/re_edit_ui/src/lib.rs index ca19c3b463ca..af4efaf8b46e 100644 --- a/crates/viewer/re_edit_ui/src/lib.rs +++ b/crates/viewer/re_edit_ui/src/lib.rs @@ -6,7 +6,6 @@ mod color; mod datatype_editors; mod marker_shape; -mod material; mod radius; mod range1d; mod response_utils; @@ -19,8 +18,9 @@ use datatype_editors::{ use re_types::{ blueprint::components::{BackgroundKind, Corner2D, LockRangeDuringZoom, ViewFit, Visible}, components::{ - AggregationPolicy, AxisLength, Colormap, DepthMeter, DrawOrder, FillRatio, GammaCorrection, - ImagePlaneDistance, MagnificationFilter, MarkerSize, Name, Opacity, StrokeWidth, Text, + AggregationPolicy, AlbedoFactor, AxisLength, Color, Colormap, DepthMeter, DrawOrder, + FillRatio, GammaCorrection, ImagePlaneDistance, MagnificationFilter, MarkerSize, Name, + Opacity, StrokeWidth, Text, }, Loggable as _, }; @@ -32,12 +32,12 @@ use re_viewer_context::gpu_bridge::colormap_edit_or_view_ui; /// ⚠️ This is supposed to be the only export of this crate. /// This crate is meant to be a leaf crate in the viewer ecosystem and should only be used by the `re_viewer` crate itself. pub fn register_editors(registry: &mut re_viewer_context::ComponentUiRegistry) { - registry.add_singleline_edit_or_view(color::edit_color_ui); + registry.add_singleline_edit_or_view::(color::edit_rgba32); registry.add_singleline_edit_or_view(radius::edit_radius_ui); registry.add_singleline_edit_or_view(marker_shape::edit_marker_shape_ui); - registry.add_singleline_edit_or_view(material::edit_material_ui); + registry.add_singleline_edit_or_view::(color::edit_rgba32); registry.add_singleline_edit_or_view(range1d::edit_range1d); registry.add_singleline_edit_or_view::(edit_f32_zero_to_max); diff --git a/crates/viewer/re_edit_ui/src/material.rs b/crates/viewer/re_edit_ui/src/material.rs deleted file mode 100644 index 172cd4e83469..000000000000 --- a/crates/viewer/re_edit_ui/src/material.rs +++ /dev/null @@ -1,26 +0,0 @@ -use re_types::{components::Material, datatypes::Rgba32}; -use re_viewer_context::{MaybeMutRef, ViewerContext}; - -use crate::color::edit_color_ui; - -// TODO(andreas): as we add more elements to the Material struct, we'll need a multi-line editor. -// begs the question though if a material struct is really the right way to go! -pub fn edit_material_ui( - ctx: &ViewerContext<'_>, - ui: &mut egui::Ui, - value: &mut MaybeMutRef<'_, Material>, -) -> egui::Response { - ui.label("Albedo"); // "Albedo factor" makes the UI too wide. - - let re_types::datatypes::Material { albedo_factor } = value.as_ref().0; - let albedo_factor = albedo_factor.unwrap_or(Rgba32::WHITE).into(); - - if let Some(value) = value.as_mut() { - let mut edit_color = albedo_factor; - let response = edit_color_ui(ctx, ui, &mut MaybeMutRef::MutRef(&mut edit_color)); - value.albedo_factor = Some(edit_color.0); - response - } else { - edit_color_ui(ctx, ui, &mut MaybeMutRef::Ref(&albedo_factor)) - } -} diff --git a/crates/viewer/re_renderer/src/importer/gltf.rs b/crates/viewer/re_renderer/src/importer/gltf.rs index d3230fad373e..d8788270006a 100644 --- a/crates/viewer/re_renderer/src/importer/gltf.rs +++ b/crates/viewer/re_renderer/src/importer/gltf.rs @@ -282,7 +282,7 @@ fn import_mesh( label: primitive.material().name().into(), index_range: index_offset..triangle_indices.len() as u32 * 3, albedo, - albedo_multiplier: albedo_factor, + albedo_factor, }); } if vertex_positions.is_empty() || triangle_indices.is_empty() { diff --git a/crates/viewer/re_renderer/src/importer/obj.rs b/crates/viewer/re_renderer/src/importer/obj.rs index 823904d4676d..ecaa97836acc 100644 --- a/crates/viewer/re_renderer/src/importer/obj.rs +++ b/crates/viewer/re_renderer/src/importer/obj.rs @@ -102,7 +102,7 @@ pub fn load_obj_from_buffer( label: "default material".into(), index_range: 0..mesh.indices.len() as u32, albedo: texture.clone(), - albedo_multiplier: crate::Rgba::WHITE, + albedo_factor: crate::Rgba::WHITE, }], }; diff --git a/crates/viewer/re_renderer/src/importer/stl.rs b/crates/viewer/re_renderer/src/importer/stl.rs index 09213345d84c..f2ed7e5b3ab9 100644 --- a/crates/viewer/re_renderer/src/importer/stl.rs +++ b/crates/viewer/re_renderer/src/importer/stl.rs @@ -37,7 +37,7 @@ pub fn load_stl_from_buffer( label: "default material".into(), index_range: 0..num_vertices as u32, albedo: ctx.texture_manager_2d.white_texture_unorm_handle().clone(), - albedo_multiplier: crate::Rgba::WHITE, + albedo_factor: crate::Rgba::WHITE, }; let mesh = mesh::Mesh { diff --git a/crates/viewer/re_renderer/src/mesh.rs b/crates/viewer/re_renderer/src/mesh.rs index 7db0f8848400..f2939dd0ec88 100644 --- a/crates/viewer/re_renderer/src/mesh.rs +++ b/crates/viewer/re_renderer/src/mesh.rs @@ -164,7 +164,7 @@ pub struct Material { pub albedo: GpuTexture2D, /// Factor applied to the decoded albedo color. - pub albedo_multiplier: Rgba, + pub albedo_factor: Rgba, } #[derive(Clone)] @@ -202,7 +202,7 @@ pub(crate) mod gpu_data { #[repr(C, align(256))] #[derive(Clone, Copy, bytemuck::Pod, bytemuck::Zeroable)] pub struct MaterialUniformBuffer { - pub albedo_multiplier: wgpu_buffer_types::Vec4, + pub albedo_factor: wgpu_buffer_types::Vec4, pub end_padding: [wgpu_buffer_types::PaddingRow; 16 - 1], } } @@ -298,7 +298,7 @@ impl GpuMesh { data.materials .iter() .map(|material| gpu_data::MaterialUniformBuffer { - albedo_multiplier: material.albedo_multiplier.into(), + albedo_factor: material.albedo_factor.into(), end_padding: Default::default(), }), ); diff --git a/crates/viewer/re_space_view_spatial/src/mesh_loader.rs b/crates/viewer/re_space_view_spatial/src/mesh_loader.rs index 1ef30c9e371e..7fa4e3013e69 100644 --- a/crates/viewer/re_space_view_spatial/src/mesh_loader.rs +++ b/crates/viewer/re_space_view_spatial/src/mesh_loader.rs @@ -100,7 +100,7 @@ impl LoadedMesh { vertex_colors, vertex_texcoords, triangle_indices, - mesh_material, + albedo_factor, class_ids: _, albedo_texture, } = mesh3d; @@ -147,8 +147,6 @@ impl LoadedMesh { vec![glam::Vec2::ZERO; num_positions] }; - let albedo_factor = mesh_material.as_ref().and_then(|mat| mat.albedo_factor); - let bbox = { re_tracing::profile_scope!("bbox"); macaw::BoundingBox::from_points(vertex_positions.iter().copied()) @@ -174,7 +172,7 @@ impl LoadedMesh { label: name.clone().into(), index_range: 0..num_indices as _, albedo, - albedo_multiplier: albedo_factor.map_or(re_renderer::Rgba::WHITE, |c| c.into()), + albedo_factor: albedo_factor.map_or(re_renderer::Rgba::WHITE, |c| c.0.into()), }], }; diff --git a/crates/viewer/re_space_view_spatial/src/visualizers/meshes.rs b/crates/viewer/re_space_view_spatial/src/visualizers/meshes.rs index 652cbe7be81b..5b6e6469a2c1 100644 --- a/crates/viewer/re_space_view_spatial/src/visualizers/meshes.rs +++ b/crates/viewer/re_space_view_spatial/src/visualizers/meshes.rs @@ -7,7 +7,7 @@ use re_renderer::RenderContext; use re_types::{ archetypes::Mesh3D, components::{ - ClassId, Color, Material, Position3D, TensorData, Texcoord2D, TriangleIndices, Vector3D, + AlbedoFactor, ClassId, Color, Position3D, TensorData, Texcoord2D, TriangleIndices, Vector3D, }, }; use re_viewer_context::{ @@ -47,7 +47,7 @@ struct Mesh3DComponentData<'a> { vertex_texcoords: &'a [Texcoord2D], triangle_indices: Option<&'a [TriangleIndices]>, - mesh_material: Option<&'a Material>, + albedo_factor: Option<&'a AlbedoFactor>, albedo_texture: Option<&'a TensorData>, class_ids: &'a [ClassId], @@ -106,7 +106,7 @@ impl Mesh3DVisualizer { vertex_colors: (!vertex_colors.is_empty()).then_some(vertex_colors), vertex_texcoords: (!vertex_texcoords.is_empty()) .then_some(vertex_texcoords), - mesh_material: data.mesh_material.cloned(), + albedo_factor: data.albedo_factor.copied(), albedo_texture: data.albedo_texture.cloned(), class_ids: (!data.class_ids.is_empty()) .then(|| data.class_ids.to_owned()), @@ -194,7 +194,7 @@ impl VisualizerSystem for Mesh3DVisualizer { let vertex_colors = results.get_or_empty_dense(resolver)?; let vertex_texcoords = results.get_or_empty_dense(resolver)?; let triangle_indices = results.get_or_empty_dense(resolver)?; - let mesh_materials = results.get_or_empty_dense(resolver)?; + let albedo_factors = results.get_or_empty_dense(resolver)?; let albedo_textures = results.get_or_empty_dense(resolver)?; let class_ids = results.get_or_empty_dense(resolver)?; @@ -206,7 +206,7 @@ impl VisualizerSystem for Mesh3DVisualizer { vertex_colors.range_indexed(), vertex_texcoords.range_indexed(), triangle_indices.range_indexed(), - mesh_materials.range_indexed(), + albedo_factors.range_indexed(), albedo_textures.range_indexed(), class_ids.range_indexed(), ) @@ -218,7 +218,7 @@ impl VisualizerSystem for Mesh3DVisualizer { vertex_colors, vertex_texcoords, triangle_indices, - mesh_material, + albedo_factor, albedo_texture, class_ids, )| { @@ -230,7 +230,7 @@ impl VisualizerSystem for Mesh3DVisualizer { vertex_colors: vertex_colors.unwrap_or_default(), vertex_texcoords: vertex_texcoords.unwrap_or_default(), triangle_indices, - mesh_material: mesh_material.and_then(|v| v.first()), + albedo_factor: albedo_factor.and_then(|v| v.first()), albedo_texture: albedo_texture.and_then(|v| v.first()), class_ids: class_ids.unwrap_or_default(), } diff --git a/crates/viewer/re_viewer/src/reflection/mod.rs b/crates/viewer/re_viewer/src/reflection/mod.rs index 98b9e0c9da0e..83d414852019 100644 --- a/crates/viewer/re_viewer/src/reflection/mod.rs +++ b/crates/viewer/re_viewer/src/reflection/mod.rs @@ -223,6 +223,13 @@ fn generate_component_reflection() -> Result::name(), + ComponentReflection { + docstring_md: "A color multiplier, usually applied to a whole entity, e.g. a mesh.", + placeholder: Some(AlbedoFactor::default().to_arrow()?), + }, + ), ( ::name(), ComponentReflection { @@ -370,13 +377,6 @@ fn generate_component_reflection() -> Result::name(), - ComponentReflection { - docstring_md: "Material properties of a mesh, e.g. its color multiplier.", - placeholder: Some(Material::default().to_arrow()?), - }, - ), ( ::name(), ComponentReflection { diff --git a/docs/content/howto/ros2-nav-turtlebot.md b/docs/content/howto/ros2-nav-turtlebot.md index a58bfcf9e2c5..a8cf516c9520 100644 --- a/docs/content/howto/ros2-nav-turtlebot.md +++ b/docs/content/howto/ros2-nav-turtlebot.md @@ -457,7 +457,7 @@ if node_data: vertex_positions=mesh.vertices, triangle_indices=mesh.faces, vertex_normals=mesh.vertex_normals, - mesh_material=rr.Material(albedo_factor=albedo_factor), + albedo_factor=albedo_factor, ), timeless=timeless, ) diff --git a/docs/content/reference/migration/migration-0-18.md b/docs/content/reference/migration/migration-0-18.md new file mode 100644 index 000000000000..a9f4a91fec89 --- /dev/null +++ b/docs/content/reference/migration/migration-0-18.md @@ -0,0 +1,15 @@ +--- +title: Migrating from 0.17 to 0.18 +order: 180 +--- + +NOTE! Rerun 0.18 has not yet been released + + +## ⚠️ Breaking changes +### `mesh_material: Material` has been renamed to `albedo_factor: AlbedoFactor` [#6841](https://github.com/rerun-io/rerun/pull/6841) +The field `mesh_material` in `Mesh3D` is now named `albedo_factor` and wraps a `datatypes.Rgba32`. + +When constructing a `Mesh3D`: +* C++ & Rust: `.with_mesh_material(Material::from_albedo_factor(color))` -> `with_albedo_factor(color)` +* Python: `mesh_material=rr.Material(albedo_factor=color)` -> `albedo_factor=color` diff --git a/docs/content/reference/types/archetypes/mesh3d.md b/docs/content/reference/types/archetypes/mesh3d.md index 048e765d30fe..87c8320e4466 100644 --- a/docs/content/reference/types/archetypes/mesh3d.md +++ b/docs/content/reference/types/archetypes/mesh3d.md @@ -11,7 +11,7 @@ A 3D triangle mesh as specified by its per-mesh and per-vertex properties. **Recommended**: [`TriangleIndices`](../components/triangle_indices.md), [`Vector3D`](../components/vector3d.md) -**Optional**: [`Color`](../components/color.md), [`Texcoord2D`](../components/texcoord2d.md), [`Material`](../components/material.md), [`TensorData`](../components/tensor_data.md), [`ClassId`](../components/class_id.md) +**Optional**: [`Color`](../components/color.md), [`Texcoord2D`](../components/texcoord2d.md), [`AlbedoFactor`](../components/albedo_factor.md), [`TensorData`](../components/tensor_data.md), [`ClassId`](../components/class_id.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 806392704a9e..9f95ad392889 100644 --- a/docs/content/reference/types/components.md +++ b/docs/content/reference/types/components.md @@ -14,6 +14,7 @@ on [Entities and Components](../../concepts/entity-component.md). * [`AggregationPolicy`](components/aggregation_policy.md): Policy for aggregation of multiple scalar plot values. +* [`AlbedoFactor`](components/albedo_factor.md): A color multiplier, usually applied to a whole entity, e.g. a mesh. * [`AnnotationContext`](components/annotation_context.md): The `AnnotationContext` provides additional information on how to display entities. * [`AxisLength`](components/axis_length.md): The length of an axis in local units of the space. * [`Blob`](components/blob.md): A binary blob of data. @@ -35,7 +36,6 @@ on [Entities and Components](../../concepts/entity-component.md). * [`MagnificationFilter`](components/magnification_filter.md): Filter used when magnifying an image/texture such that a single pixel/texel is displayed as multiple pixels on screen. * [`MarkerShape`](components/marker_shape.md): The visual appearance of a point in e.g. a 2D plot. * [`MarkerSize`](components/marker_size.md): Radius of a marker of a point in e.g. a 2D plot, measured in UI points. -* [`Material`](components/material.md): Material properties of a mesh, e.g. its color multiplier. * [`MediaType`](components/media_type.md): A standardized media type (RFC2046, formerly known as MIME types), encoded as a utf8 string. * [`Name`](components/name.md): A display name, typically for an entity or a item like a plot series. * [`Opacity`](components/opacity.md): Degree of transparency ranging from 0.0 (fully transparent) to 1.0 (fully opaque). diff --git a/docs/content/reference/types/components/.gitattributes b/docs/content/reference/types/components/.gitattributes index 8414aa31234d..956bb88f6712 100644 --- a/docs/content/reference/types/components/.gitattributes +++ b/docs/content/reference/types/components/.gitattributes @@ -2,6 +2,7 @@ .gitattributes linguist-generated=true aggregation_policy.md linguist-generated=true +albedo_factor.md linguist-generated=true annotation_context.md linguist-generated=true axis_length.md linguist-generated=true blob.md linguist-generated=true @@ -23,7 +24,6 @@ line_strip3d.md linguist-generated=true magnification_filter.md linguist-generated=true marker_shape.md linguist-generated=true marker_size.md linguist-generated=true -material.md linguist-generated=true media_type.md linguist-generated=true name.md linguist-generated=true opacity.md linguist-generated=true diff --git a/docs/content/reference/types/components/albedo_factor.md b/docs/content/reference/types/components/albedo_factor.md new file mode 100644 index 000000000000..2dee8c154451 --- /dev/null +++ b/docs/content/reference/types/components/albedo_factor.md @@ -0,0 +1,20 @@ +--- +title: "AlbedoFactor" +--- + + +A color multiplier, usually applied to a whole entity, e.g. a mesh. + +## Fields + +* albedo_factor: [`Rgba32`](../datatypes/rgba32.md) + +## API reference links + * 🌊 [C++ API docs for `AlbedoFactor`](https://ref.rerun.io/docs/cpp/stable/structrerun_1_1components_1_1AlbedoFactor.html?speculative-link) + * 🐍 [Python API docs for `AlbedoFactor`](https://ref.rerun.io/docs/python/stable/common/components?speculative-link#rerun.components.AlbedoFactor) + * 🦀 [Rust API docs for `AlbedoFactor`](https://docs.rs/rerun/latest/rerun/components/struct.AlbedoFactor.html?speculative-link) + + +## Used by + +* [`Mesh3D`](../archetypes/mesh3d.md) diff --git a/docs/content/reference/types/components/material.md b/docs/content/reference/types/components/material.md deleted file mode 100644 index ddfae17bab8b..000000000000 --- a/docs/content/reference/types/components/material.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: "Material" ---- - - -Material properties of a mesh, e.g. its color multiplier. - -## Fields - -* material: [`Material`](../datatypes/material.md) - -## API reference links - * 🌊 [C++ API docs for `Material`](https://ref.rerun.io/docs/cpp/stable/structrerun_1_1components_1_1Material.html) - * 🐍 [Python API docs for `Material`](https://ref.rerun.io/docs/python/stable/common/components#rerun.components.Material) - * 🦀 [Rust API docs for `Material`](https://docs.rs/rerun/latest/rerun/components/struct.Material.html) - - -## Used by - -* [`Mesh3D`](../archetypes/mesh3d.md) diff --git a/docs/content/reference/types/datatypes.md b/docs/content/reference/types/datatypes.md index d448c2e9ebfe..c3ae218c7f6d 100644 --- a/docs/content/reference/types/datatypes.md +++ b/docs/content/reference/types/datatypes.md @@ -21,7 +21,6 @@ Data types are the lowest layer of the data model hierarchy. They are re-usable * [`KeypointPair`](datatypes/keypoint_pair.md): A connection between two `Keypoints`. * [`Mat3x3`](datatypes/mat3x3.md): A 3x3 Matrix. * [`Mat4x4`](datatypes/mat4x4.md): A 4x4 Matrix. -* [`Material`](datatypes/material.md): Material properties of a mesh, e.g. its color multiplier. * [`Quaternion`](datatypes/quaternion.md): A Quaternion represented by 4 real numbers. * [`Range1D`](datatypes/range1d.md): A 1D range, specifying a lower and upper bound. * [`Range2D`](datatypes/range2d.md): An Axis-Aligned Bounding Box in 2D space, implemented as the minimum and maximum corners. diff --git a/docs/content/reference/types/datatypes/.gitattributes b/docs/content/reference/types/datatypes/.gitattributes index 1dc294049dc2..be14b19de7fa 100644 --- a/docs/content/reference/types/datatypes/.gitattributes +++ b/docs/content/reference/types/datatypes/.gitattributes @@ -15,7 +15,6 @@ keypoint_id.md linguist-generated=true keypoint_pair.md linguist-generated=true mat3x3.md linguist-generated=true mat4x4.md linguist-generated=true -material.md linguist-generated=true quaternion.md linguist-generated=true range1d.md linguist-generated=true range2d.md linguist-generated=true diff --git a/docs/content/reference/types/datatypes/material.md b/docs/content/reference/types/datatypes/material.md deleted file mode 100644 index 32d03bc0ac5e..000000000000 --- a/docs/content/reference/types/datatypes/material.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: "Material" ---- - - -Material properties of a mesh, e.g. its color multiplier. - -## Fields - -* albedo_factor: [`Rgba32`](../datatypes/rgba32.md) - -## API reference links - * 🌊 [C++ API docs for `Material`](https://ref.rerun.io/docs/cpp/stable/structrerun_1_1datatypes_1_1Material.html) - * 🐍 [Python API docs for `Material`](https://ref.rerun.io/docs/python/stable/common/datatypes#rerun.datatypes.Material) - * 🦀 [Rust API docs for `Material`](https://docs.rs/rerun/latest/rerun/datatypes/struct.Material.html) - - -## Used by - -* [`Material`](../components/material.md) diff --git a/docs/content/reference/types/datatypes/rgba32.md b/docs/content/reference/types/datatypes/rgba32.md index c8e9fb53dca9..45865db43719 100644 --- a/docs/content/reference/types/datatypes/rgba32.md +++ b/docs/content/reference/types/datatypes/rgba32.md @@ -20,6 +20,6 @@ byte is `R` and the least significant byte is `A`. ## Used by +* [`AlbedoFactor`](../components/albedo_factor.md?speculative-link) * [`AnnotationInfo`](../datatypes/annotation_info.md) * [`Color`](../components/color.md) -* [`Material`](../datatypes/material.md) diff --git a/examples/python/raw_mesh/README.md b/examples/python/raw_mesh/README.md index c0a6d1ac607f..65e4646a96dd 100644 --- a/examples/python/raw_mesh/README.md +++ b/examples/python/raw_mesh/README.md @@ -42,7 +42,7 @@ rr.log( vertex_texcoords=vertex_texcoords, albedo_texture=albedo_texture, triangle_indices=mesh.faces, - mesh_material=mesh_material, + albedo_factor=albedo_factor, ), ) ``` diff --git a/examples/python/raw_mesh/raw_mesh/__main__.py b/examples/python/raw_mesh/raw_mesh/__main__.py index dfbd0590b531..200bdd039e2c 100755 --- a/examples/python/raw_mesh/raw_mesh/__main__.py +++ b/examples/python/raw_mesh/raw_mesh/__main__.py @@ -11,7 +11,6 @@ import rerun as rr # pip install rerun-sdk import rerun.blueprint as rrb import trimesh -from rerun.components import Material from .download_dataset import AVAILABLE_MESHES, ensure_mesh_downloaded @@ -56,7 +55,7 @@ def log_scene(scene: trimesh.Scene, node: str, path: str | None = None) -> None: if mesh is not None: vertex_colors = None vertex_texcoords = None - mesh_material = None + albedo_factor = None albedo_texture = None try: @@ -78,7 +77,7 @@ def log_scene(scene: trimesh.Scene, node: str, path: str | None = None) -> None: if len(colors) == 4: # If trimesh gives us a single vertex color for the entire mesh, we can interpret that # as an albedo factor for the whole primitive. - mesh_material = Material(albedo_factor=np.array(colors)) + albedo_factor = np.array(colors) else: vertex_colors = colors except Exception: @@ -93,7 +92,7 @@ def log_scene(scene: trimesh.Scene, node: str, path: str | None = None) -> None: vertex_texcoords=vertex_texcoords, albedo_texture=albedo_texture, triangle_indices=mesh.faces, - mesh_material=mesh_material, + albedo_factor=albedo_factor, ), ) diff --git a/examples/python/ros_node/rerun_urdf.py b/examples/python/ros_node/rerun_urdf.py index e9012ae7cfd1..57c071de4dae 100644 --- a/examples/python/ros_node/rerun_urdf.py +++ b/examples/python/ros_node/rerun_urdf.py @@ -54,11 +54,11 @@ def log_scene(scene: trimesh.Scene, node: str, path: str | None = None, static: if mesh: # If vertex colors are set, use the average color as the albedo factor # for the whole mesh. - vertex_colors = None + mean_vertex_color = None try: colors = np.mean(mesh.visual.vertex_colors, axis=0) if len(colors) == 4: - vertex_colors = np.array(colors) / 255.0 + mean_vertex_color = np.array(colors) / 255.0 except Exception: pass @@ -72,7 +72,7 @@ def log_scene(scene: trimesh.Scene, node: str, path: str | None = None, static: except Exception: pass - albedo_factor = vertex_colors if vertex_colors is not None else visual_color + albedo_factor = mean_vertex_color or visual_color rr.log( path, @@ -80,7 +80,7 @@ def log_scene(scene: trimesh.Scene, node: str, path: str | None = None, static: vertex_positions=mesh.vertices, triangle_indices=mesh.faces, vertex_normals=mesh.vertex_normals, - mesh_material=rr.Material(albedo_factor=albedo_factor), + albedo_factor=albedo_factor, ), static=static, ) diff --git a/examples/rust/raw_mesh/src/main.rs b/examples/rust/raw_mesh/src/main.rs index 1674a427a48c..3347350eb255 100644 --- a/examples/rust/raw_mesh/src/main.rs +++ b/examples/rust/raw_mesh/src/main.rs @@ -11,11 +11,7 @@ use std::path::PathBuf; use bytes::Bytes; -use rerun::{ - components::Transform3D, - external::{ecolor, re_log}, - Color, Mesh3D, RecordingStream, -}; +use rerun::{components::Transform3D, external::re_log, Color, Mesh3D, RecordingStream, Rgba32}; // TODO(cmc): This example needs to support animations to showcase Rerun's time capabilities. @@ -50,11 +46,8 @@ impl From for Mesh3D { if let Some(vertex_texcoords) = vertex_texcoords { mesh = mesh.with_vertex_texcoords(vertex_texcoords); } - if albedo_factor.is_some() { - mesh = mesh.with_mesh_material(rerun::datatypes::Material { - albedo_factor: albedo_factor - .map(|[r, g, b, a]| ecolor::Rgba::from_rgba_unmultiplied(r, g, b, a).into()), - }); + if let Some([r, g, b, a]) = albedo_factor { + mesh = mesh.with_albedo_factor(Rgba32::from_linear_unmultiplied_rgba_f32(r, g, b, a)); } mesh.sanity_check().unwrap(); diff --git a/rerun_cpp/src/rerun.hpp b/rerun_cpp/src/rerun.hpp index 803682896285..2ef9115d109e 100644 --- a/rerun_cpp/src/rerun.hpp +++ b/rerun_cpp/src/rerun.hpp @@ -29,12 +29,12 @@ namespace rerun { using namespace archetypes; // Also import any component or datatype that has a unique name: + using components::AlbedoFactor; using components::Color; using components::HalfSize2D; using components::HalfSize3D; using components::LineStrip2D; using components::LineStrip3D; - using components::Material; using components::MediaType; using components::OutOfTreeTransform3D; using components::Position2D; diff --git a/rerun_cpp/src/rerun/archetypes/mesh3d.cpp b/rerun_cpp/src/rerun/archetypes/mesh3d.cpp index 65beb892deda..e8c46900da4f 100644 --- a/rerun_cpp/src/rerun/archetypes/mesh3d.cpp +++ b/rerun_cpp/src/rerun/archetypes/mesh3d.cpp @@ -41,8 +41,8 @@ namespace rerun { RR_RETURN_NOT_OK(result.error); cells.push_back(std::move(result.value)); } - if (archetype.mesh_material.has_value()) { - auto result = DataCell::from_loggable(archetype.mesh_material.value()); + if (archetype.albedo_factor.has_value()) { + auto result = DataCell::from_loggable(archetype.albedo_factor.value()); RR_RETURN_NOT_OK(result.error); cells.push_back(std::move(result.value)); } diff --git a/rerun_cpp/src/rerun/archetypes/mesh3d.hpp b/rerun_cpp/src/rerun/archetypes/mesh3d.hpp index 8ed4db039722..fb977af0e8a4 100644 --- a/rerun_cpp/src/rerun/archetypes/mesh3d.hpp +++ b/rerun_cpp/src/rerun/archetypes/mesh3d.hpp @@ -5,9 +5,9 @@ #include "../collection.hpp" #include "../compiler_utils.hpp" +#include "../components/albedo_factor.hpp" #include "../components/class_id.hpp" #include "../components/color.hpp" -#include "../components/material.hpp" #include "../components/position3d.hpp" #include "../components/tensor_data.hpp" #include "../components/texcoord2d.hpp" @@ -77,8 +77,8 @@ namespace rerun::archetypes { /// An optional uv texture coordinate for each vertex. std::optional> vertex_texcoords; - /// Optional material properties for the mesh as a whole. - std::optional mesh_material; + /// A color multiplier applied to the whole mesh. + std::optional albedo_factor; /// Optional albedo texture. /// @@ -136,9 +136,9 @@ namespace rerun::archetypes { RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) } - /// Optional material properties for the mesh as a whole. - Mesh3D with_mesh_material(rerun::components::Material _mesh_material) && { - mesh_material = std::move(_mesh_material); + /// A color multiplier applied to the whole mesh. + Mesh3D with_albedo_factor(rerun::components::AlbedoFactor _albedo_factor) && { + albedo_factor = std::move(_albedo_factor); // See: https://github.com/rerun-io/rerun/issues/4027 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) } diff --git a/rerun_cpp/src/rerun/components.hpp b/rerun_cpp/src/rerun/components.hpp index 051d6be94add..2613da9217b6 100644 --- a/rerun_cpp/src/rerun/components.hpp +++ b/rerun_cpp/src/rerun/components.hpp @@ -3,6 +3,7 @@ #pragma once #include "components/aggregation_policy.hpp" +#include "components/albedo_factor.hpp" #include "components/annotation_context.hpp" #include "components/axis_length.hpp" #include "components/blob.hpp" @@ -24,7 +25,6 @@ #include "components/magnification_filter.hpp" #include "components/marker_shape.hpp" #include "components/marker_size.hpp" -#include "components/material.hpp" #include "components/media_type.hpp" #include "components/name.hpp" #include "components/opacity.hpp" diff --git a/rerun_cpp/src/rerun/components/.gitattributes b/rerun_cpp/src/rerun/components/.gitattributes index a2bd42936be1..93cdfa5cd914 100644 --- a/rerun_cpp/src/rerun/components/.gitattributes +++ b/rerun_cpp/src/rerun/components/.gitattributes @@ -3,6 +3,7 @@ .gitattributes linguist-generated=true aggregation_policy.cpp linguist-generated=true aggregation_policy.hpp linguist-generated=true +albedo_factor.hpp linguist-generated=true annotation_context.cpp linguist-generated=true annotation_context.hpp linguist-generated=true axis_length.hpp linguist-generated=true @@ -30,7 +31,6 @@ magnification_filter.hpp linguist-generated=true marker_shape.cpp linguist-generated=true marker_shape.hpp linguist-generated=true marker_size.hpp linguist-generated=true -material.hpp linguist-generated=true media_type.hpp linguist-generated=true name.hpp linguist-generated=true opacity.hpp linguist-generated=true diff --git a/rerun_cpp/src/rerun/components/albedo_factor.hpp b/rerun_cpp/src/rerun/components/albedo_factor.hpp new file mode 100644 index 000000000000..0e0d0247b9a6 --- /dev/null +++ b/rerun_cpp/src/rerun/components/albedo_factor.hpp @@ -0,0 +1,64 @@ +// 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/albedo_factor.fbs". + +#pragma once + +#include "../datatypes/rgba32.hpp" +#include "../result.hpp" + +#include +#include + +namespace rerun::components { + /// **Component**: A color multiplier, usually applied to a whole entity, e.g. a mesh. + struct AlbedoFactor { + rerun::datatypes::Rgba32 albedo_factor; + + public: + AlbedoFactor() = default; + + AlbedoFactor(rerun::datatypes::Rgba32 albedo_factor_) : albedo_factor(albedo_factor_) {} + + AlbedoFactor& operator=(rerun::datatypes::Rgba32 albedo_factor_) { + albedo_factor = albedo_factor_; + return *this; + } + + AlbedoFactor(uint32_t rgba_) : albedo_factor(rgba_) {} + + AlbedoFactor& operator=(uint32_t rgba_) { + albedo_factor = rgba_; + return *this; + } + + /// Cast to the underlying Rgba32 datatype + operator rerun::datatypes::Rgba32() const { + return albedo_factor; + } + }; +} // namespace rerun::components + +namespace rerun { + static_assert(sizeof(rerun::datatypes::Rgba32) == sizeof(components::AlbedoFactor)); + + /// \private + template <> + struct Loggable { + static constexpr const char Name[] = "rerun.components.AlbedoFactor"; + + /// 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::AlbedoFactor` into an arrow array. + static Result> to_arrow( + const components::AlbedoFactor* instances, size_t num_instances + ) { + return Loggable::to_arrow( + &instances->albedo_factor, + num_instances + ); + } + }; +} // namespace rerun diff --git a/rerun_cpp/src/rerun/components/material.hpp b/rerun_cpp/src/rerun/components/material.hpp deleted file mode 100644 index 70c3e07a1192..000000000000 --- a/rerun_cpp/src/rerun/components/material.hpp +++ /dev/null @@ -1,74 +0,0 @@ -// 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/material.fbs". - -#pragma once - -#include "../datatypes/material.hpp" -#include "../datatypes/rgba32.hpp" -#include "../result.hpp" - -#include -#include -#include - -namespace rerun::components { - /// **Component**: Material properties of a mesh, e.g. its color multiplier. - struct Material { - rerun::datatypes::Material material; - - public: - // Extensions to generated type defined in 'material_ext.cpp' - - static Material from_albedo_factor(rerun::datatypes::Rgba32 color) { - return Material(color); - } - - public: - Material() = default; - - Material(rerun::datatypes::Material material_) : material(material_) {} - - Material& operator=(rerun::datatypes::Material material_) { - material = material_; - return *this; - } - - Material(std::optional albedo_factor_) - : material(albedo_factor_) {} - - Material& operator=(std::optional albedo_factor_) { - material = albedo_factor_; - return *this; - } - - /// Cast to the underlying Material datatype - operator rerun::datatypes::Material() const { - return material; - } - }; -} // namespace rerun::components - -namespace rerun { - static_assert(sizeof(rerun::datatypes::Material) == sizeof(components::Material)); - - /// \private - template <> - struct Loggable { - static constexpr const char Name[] = "rerun.components.Material"; - - /// 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::Material` into an arrow array. - static Result> to_arrow( - const components::Material* instances, size_t num_instances - ) { - return Loggable::to_arrow( - &instances->material, - num_instances - ); - } - }; -} // namespace rerun diff --git a/rerun_cpp/src/rerun/components/material_ext.cpp b/rerun_cpp/src/rerun/components/material_ext.cpp deleted file mode 100644 index ed321d39f547..000000000000 --- a/rerun_cpp/src/rerun/components/material_ext.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "material.hpp" - -// Uncomment for better auto-complete while editing the extension. -// #define EDIT_EXTENSION - -namespace rerun { - namespace components { - -#ifdef EDIT_EXTENSION - struct MaterialExt { -#define Material MaterialExt - - // - - static Material from_albedo_factor(rerun::datatypes::Rgba32 color) { - return Material(color); - } - - // - }; -#endif - } // namespace components -} // namespace rerun diff --git a/rerun_cpp/src/rerun/datatypes.hpp b/rerun_cpp/src/rerun/datatypes.hpp index e90571375309..271b47a5c1c2 100644 --- a/rerun_cpp/src/rerun/datatypes.hpp +++ b/rerun_cpp/src/rerun/datatypes.hpp @@ -16,7 +16,6 @@ #include "datatypes/keypoint_pair.hpp" #include "datatypes/mat3x3.hpp" #include "datatypes/mat4x4.hpp" -#include "datatypes/material.hpp" #include "datatypes/quaternion.hpp" #include "datatypes/range1d.hpp" #include "datatypes/range2d.hpp" diff --git a/rerun_cpp/src/rerun/datatypes/.gitattributes b/rerun_cpp/src/rerun/datatypes/.gitattributes index 605ffd6572a3..5bb82b277234 100644 --- a/rerun_cpp/src/rerun/datatypes/.gitattributes +++ b/rerun_cpp/src/rerun/datatypes/.gitattributes @@ -29,8 +29,6 @@ mat3x3.cpp linguist-generated=true mat3x3.hpp linguist-generated=true mat4x4.cpp linguist-generated=true mat4x4.hpp linguist-generated=true -material.cpp linguist-generated=true -material.hpp linguist-generated=true quaternion.cpp linguist-generated=true quaternion.hpp linguist-generated=true range1d.cpp linguist-generated=true diff --git a/rerun_cpp/src/rerun/datatypes/material.cpp b/rerun_cpp/src/rerun/datatypes/material.cpp deleted file mode 100644 index a212b33c5313..000000000000 --- a/rerun_cpp/src/rerun/datatypes/material.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// 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/datatypes/material.fbs". - -#include "material.hpp" - -#include "rgba32.hpp" - -#include -#include - -namespace rerun::datatypes {} - -namespace rerun { - const std::shared_ptr& Loggable::arrow_datatype() { - static const auto datatype = arrow::struct_({ - arrow::field( - "albedo_factor", - Loggable::arrow_datatype(), - true - ), - }); - return datatype; - } - - Result> Loggable::to_arrow( - const datatypes::Material* instances, size_t num_instances - ) { - // TODO(andreas): Allow configuring the memory pool. - arrow::MemoryPool* pool = arrow::default_memory_pool(); - auto datatype = arrow_datatype(); - - ARROW_ASSIGN_OR_RAISE(auto builder, arrow::MakeBuilder(datatype, pool)) - if (instances && num_instances > 0) { - RR_RETURN_NOT_OK(Loggable::fill_arrow_array_builder( - static_cast(builder.get()), - instances, - num_instances - )); - } - std::shared_ptr array; - ARROW_RETURN_NOT_OK(builder->Finish(&array)); - return array; - } - - rerun::Error Loggable::fill_arrow_array_builder( - arrow::StructBuilder* builder, const datatypes::Material* elements, size_t num_elements - ) { - if (builder == nullptr) { - return rerun::Error(ErrorCode::UnexpectedNullArgument, "Passed array builder is null."); - } - if (elements == nullptr) { - return rerun::Error( - ErrorCode::UnexpectedNullArgument, - "Cannot serialize null pointer to arrow array." - ); - } - - { - auto field_builder = static_cast(builder->field_builder(0)); - ARROW_RETURN_NOT_OK(field_builder->Reserve(static_cast(num_elements))); - for (size_t elem_idx = 0; elem_idx < num_elements; elem_idx += 1) { - const auto& element = elements[elem_idx]; - if (element.albedo_factor.has_value()) { - RR_RETURN_NOT_OK(Loggable::fill_arrow_array_builder( - field_builder, - &element.albedo_factor.value(), - 1 - )); - } else { - ARROW_RETURN_NOT_OK(field_builder->AppendNull()); - } - } - } - ARROW_RETURN_NOT_OK(builder->AppendValues(static_cast(num_elements), nullptr)); - - return Error::ok(); - } -} // namespace rerun diff --git a/rerun_cpp/src/rerun/datatypes/material.hpp b/rerun_cpp/src/rerun/datatypes/material.hpp deleted file mode 100644 index b2492e0244b3..000000000000 --- a/rerun_cpp/src/rerun/datatypes/material.hpp +++ /dev/null @@ -1,67 +0,0 @@ -// 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/datatypes/material.fbs". - -#pragma once - -#include "../result.hpp" -#include "rgba32.hpp" - -#include -#include -#include - -namespace arrow { - class Array; - class DataType; - class StructBuilder; -} // namespace arrow - -namespace rerun::datatypes { - /// **Datatype**: Material properties of a mesh, e.g. its color multiplier. - struct Material { - /// Optional color multiplier. - std::optional albedo_factor; - - public: - Material() = default; - - Material(std::optional albedo_factor_) - : albedo_factor(albedo_factor_) {} - - Material& operator=(std::optional albedo_factor_) { - albedo_factor = albedo_factor_; - return *this; - } - - Material(uint32_t rgba_) : albedo_factor(rgba_) {} - - Material& operator=(uint32_t rgba_) { - albedo_factor = rgba_; - return *this; - } - }; -} // namespace rerun::datatypes - -namespace rerun { - template - struct Loggable; - - /// \private - template <> - struct Loggable { - static constexpr const char Name[] = "rerun.datatypes.Material"; - - /// Returns the arrow data type this type corresponds to. - static const std::shared_ptr& arrow_datatype(); - - /// Serializes an array of `rerun::datatypes::Material` into an arrow array. - static Result> to_arrow( - const datatypes::Material* instances, size_t num_instances - ); - - /// Fills an arrow array builder with an array of this type. - static rerun::Error fill_arrow_array_builder( - arrow::StructBuilder* builder, const datatypes::Material* elements, size_t num_elements - ); - }; -} // namespace rerun diff --git a/rerun_cpp/tests/archetypes/mesh3d.cpp b/rerun_cpp/tests/archetypes/mesh3d.cpp index 34e0d8c21f6d..bc9553847b16 100644 --- a/rerun_cpp/tests/archetypes/mesh3d.cpp +++ b/rerun_cpp/tests/archetypes/mesh3d.cpp @@ -18,21 +18,15 @@ SCENARIO( .with_vertex_normals({{4.0, 5.0, 6.0}, {40.0, 50.0, 60.0}}) .with_vertex_colors({{0xAA, 0x00, 0x00, 0xCC}, {0x00, 0xBB, 0x00, 0xDD}}) .with_triangle_indices({{1, 2, 3}, {4, 5, 6}}) - .with_mesh_material(Material::from_albedo_factor(0xEE112233)) + .with_albedo_factor(0xEE112233) .with_class_ids({126, 127}); - rerun::datatypes::Material mesh_material_inner_manual; - mesh_material_inner_manual.albedo_factor = {0xEE, 0x11, 0x22, 0x33}; - - Material mesh_material_manual; - mesh_material_manual.material = mesh_material_inner_manual; - Mesh3D from_manual; from_manual.vertex_positions = {{1.0, 2.0, 3.0}, {10.0, 20.0, 30.0}}; from_manual.vertex_normals = {{4.0, 5.0, 6.0}, {40.0, 50.0, 60.0}}; from_manual.vertex_colors = {{0xAA, 0x00, 0x00, 0xCC}, {0x00, 0xBB, 0x00, 0xDD}}; from_manual.triangle_indices = {{1, 2, 3}, {4, 5, 6}}; - from_manual.mesh_material = {mesh_material_manual}; + from_manual.albedo_factor = {{0xEE, 0x11, 0x22, 0x33}}; from_manual.class_ids = {126, 127}; test_compare_archetype_serialization(from_manual, from_builder); diff --git a/rerun_py/rerun_sdk/rerun/__init__.py b/rerun_py/rerun_sdk/rerun/__init__.py index 77c4223e6fd1..fb91da4e20b7 100644 --- a/rerun_py/rerun_sdk/rerun/__init__.py +++ b/rerun_py/rerun_sdk/rerun/__init__.py @@ -72,7 +72,7 @@ BlueprintLike as BlueprintLike, ) from .components import ( - Material as Material, + AlbedoFactor as AlbedoFactor, MediaType as MediaType, OutOfTreeTransform3D as OutOfTreeTransform3D, OutOfTreeTransform3DBatch as OutOfTreeTransform3DBatch, diff --git a/rerun_py/rerun_sdk/rerun/archetypes/mesh3d.py b/rerun_py/rerun_sdk/rerun/archetypes/mesh3d.py index e7619d5e60f0..c3b1c2090049 100644 --- a/rerun_py/rerun_sdk/rerun/archetypes/mesh3d.py +++ b/rerun_py/rerun_sdk/rerun/archetypes/mesh3d.py @@ -63,7 +63,7 @@ def __attrs_clear__(self) -> None: vertex_normals=None, # type: ignore[arg-type] vertex_colors=None, # type: ignore[arg-type] vertex_texcoords=None, # type: ignore[arg-type] - mesh_material=None, # type: ignore[arg-type] + albedo_factor=None, # type: ignore[arg-type] albedo_texture=None, # type: ignore[arg-type] class_ids=None, # type: ignore[arg-type] ) @@ -121,12 +121,12 @@ def _clear(cls) -> Mesh3D: # # (Docstring intentionally commented out to hide this field from the docs) - mesh_material: components.MaterialBatch | None = field( + albedo_factor: components.AlbedoFactorBatch | None = field( metadata={"component": "optional"}, default=None, - converter=components.MaterialBatch._optional, # type: ignore[misc] + converter=components.AlbedoFactorBatch._optional, # type: ignore[misc] ) - # Optional material properties for the mesh as a whole. + # A color multiplier applied to the whole mesh. # # (Docstring intentionally commented out to hide this field from the docs) diff --git a/rerun_py/rerun_sdk/rerun/archetypes/mesh3d_ext.py b/rerun_py/rerun_sdk/rerun/archetypes/mesh3d_ext.py index 6329b528dd24..812eb503d342 100644 --- a/rerun_py/rerun_sdk/rerun/archetypes/mesh3d_ext.py +++ b/rerun_py/rerun_sdk/rerun/archetypes/mesh3d_ext.py @@ -18,7 +18,7 @@ def __init__( vertex_colors: datatypes.Rgba32ArrayLike | None = None, vertex_texcoords: datatypes.Vec2DArrayLike | None = None, albedo_texture: datatypes.TensorDataLike | None = None, - mesh_material: datatypes.MaterialLike | None = None, + albedo_factor: datatypes.Rgba32Like | None = None, class_ids: datatypes.ClassIdArrayLike | None = None, ): """ @@ -39,8 +39,8 @@ def __init__( If specified, this must have as many elements as `vertex_positions`. vertex_colors: An optional color for each vertex. - mesh_material: - Optional material properties for the mesh as a whole. + albedo_factor: + Optional color multiplier for the whole mesh albedo_texture: Optional albedo texture. Used with `vertex_texcoords` on `Mesh3D`. Currently supports only sRGB(A) textures, ignoring alpha. @@ -58,7 +58,7 @@ def __init__( vertex_colors=vertex_colors, vertex_texcoords=vertex_texcoords, albedo_texture=albedo_texture, - mesh_material=mesh_material, + albedo_factor=albedo_factor, class_ids=class_ids, ) return diff --git a/rerun_py/rerun_sdk/rerun/components/.gitattributes b/rerun_py/rerun_sdk/rerun/components/.gitattributes index c83b49339b01..f0dc6e659300 100644 --- a/rerun_py/rerun_sdk/rerun/components/.gitattributes +++ b/rerun_py/rerun_sdk/rerun/components/.gitattributes @@ -3,6 +3,7 @@ .gitattributes linguist-generated=true __init__.py linguist-generated=true aggregation_policy.py linguist-generated=true +albedo_factor.py linguist-generated=true annotation_context.py linguist-generated=true axis_length.py linguist-generated=true blob.py linguist-generated=true @@ -24,7 +25,6 @@ line_strip3d.py linguist-generated=true magnification_filter.py linguist-generated=true marker_shape.py linguist-generated=true marker_size.py linguist-generated=true -material.py linguist-generated=true media_type.py linguist-generated=true name.py linguist-generated=true opacity.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 726bd0c09c7a..0d0cda4c0c77 100644 --- a/rerun_py/rerun_sdk/rerun/components/__init__.py +++ b/rerun_py/rerun_sdk/rerun/components/__init__.py @@ -9,6 +9,7 @@ AggregationPolicyLike, AggregationPolicyType, ) +from .albedo_factor import AlbedoFactor, AlbedoFactorBatch, AlbedoFactorType from .annotation_context import ( AnnotationContext, AnnotationContextArrayLike, @@ -42,7 +43,6 @@ ) from .marker_shape import MarkerShape, MarkerShapeArrayLike, MarkerShapeBatch, MarkerShapeLike, MarkerShapeType from .marker_size import MarkerSize, MarkerSizeBatch, MarkerSizeType -from .material import Material, MaterialBatch, MaterialType from .media_type import MediaType, MediaTypeBatch, MediaTypeType from .name import Name, NameBatch, NameType from .opacity import Opacity, OpacityBatch, OpacityType @@ -79,6 +79,9 @@ "AggregationPolicyBatch", "AggregationPolicyLike", "AggregationPolicyType", + "AlbedoFactor", + "AlbedoFactorBatch", + "AlbedoFactorType", "AnnotationContext", "AnnotationContextArrayLike", "AnnotationContextBatch", @@ -154,9 +157,6 @@ "MarkerSize", "MarkerSizeBatch", "MarkerSizeType", - "Material", - "MaterialBatch", - "MaterialType", "MediaType", "MediaTypeBatch", "MediaTypeType", diff --git a/rerun_py/rerun_sdk/rerun/components/albedo_factor.py b/rerun_py/rerun_sdk/rerun/components/albedo_factor.py new file mode 100644 index 000000000000..f0b8a7d0173c --- /dev/null +++ b/rerun_py/rerun_sdk/rerun/components/albedo_factor.py @@ -0,0 +1,36 @@ +# 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/albedo_factor.fbs". + +# You can extend this class by creating a "AlbedoFactorExt" class in "albedo_factor_ext.py". + +from __future__ import annotations + +from .. import datatypes +from .._baseclasses import ( + ComponentBatchMixin, + ComponentMixin, +) + +__all__ = ["AlbedoFactor", "AlbedoFactorBatch", "AlbedoFactorType"] + + +class AlbedoFactor(datatypes.Rgba32, ComponentMixin): + """**Component**: A color multiplier, usually applied to a whole entity, e.g. a mesh.""" + + _BATCH_TYPE = None + # You can define your own __init__ function as a member of AlbedoFactorExt in albedo_factor_ext.py + + # Note: there are no fields here because AlbedoFactor delegates to datatypes.Rgba32 + pass + + +class AlbedoFactorType(datatypes.Rgba32Type): + _TYPE_NAME: str = "rerun.components.AlbedoFactor" + + +class AlbedoFactorBatch(datatypes.Rgba32Batch, ComponentBatchMixin): + _ARROW_TYPE = AlbedoFactorType() + + +# This is patched in late to avoid circular dependencies. +AlbedoFactor._BATCH_TYPE = AlbedoFactorBatch # type: ignore[assignment] diff --git a/rerun_py/rerun_sdk/rerun/components/material.py b/rerun_py/rerun_sdk/rerun/components/material.py deleted file mode 100644 index a88785ed5333..000000000000 --- a/rerun_py/rerun_sdk/rerun/components/material.py +++ /dev/null @@ -1,36 +0,0 @@ -# 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/material.fbs". - -# You can extend this class by creating a "MaterialExt" class in "material_ext.py". - -from __future__ import annotations - -from .. import datatypes -from .._baseclasses import ( - ComponentBatchMixin, - ComponentMixin, -) - -__all__ = ["Material", "MaterialBatch", "MaterialType"] - - -class Material(datatypes.Material, ComponentMixin): - """**Component**: Material properties of a mesh, e.g. its color multiplier.""" - - _BATCH_TYPE = None - # You can define your own __init__ function as a member of MaterialExt in material_ext.py - - # Note: there are no fields here because Material delegates to datatypes.Material - pass - - -class MaterialType(datatypes.MaterialType): - _TYPE_NAME: str = "rerun.components.Material" - - -class MaterialBatch(datatypes.MaterialBatch, ComponentBatchMixin): - _ARROW_TYPE = MaterialType() - - -# This is patched in late to avoid circular dependencies. -Material._BATCH_TYPE = MaterialBatch # type: ignore[assignment] diff --git a/rerun_py/rerun_sdk/rerun/datatypes/.gitattributes b/rerun_py/rerun_sdk/rerun/datatypes/.gitattributes index b2da34ccc71e..9324b6a30d31 100644 --- a/rerun_py/rerun_sdk/rerun/datatypes/.gitattributes +++ b/rerun_py/rerun_sdk/rerun/datatypes/.gitattributes @@ -16,7 +16,6 @@ keypoint_id.py linguist-generated=true keypoint_pair.py linguist-generated=true mat3x3.py linguist-generated=true mat4x4.py linguist-generated=true -material.py linguist-generated=true quaternion.py linguist-generated=true range1d.py linguist-generated=true range2d.py linguist-generated=true diff --git a/rerun_py/rerun_sdk/rerun/datatypes/__init__.py b/rerun_py/rerun_sdk/rerun/datatypes/__init__.py index 4c7678ece044..d4c870848d2d 100644 --- a/rerun_py/rerun_sdk/rerun/datatypes/__init__.py +++ b/rerun_py/rerun_sdk/rerun/datatypes/__init__.py @@ -34,7 +34,6 @@ from .keypoint_pair import KeypointPair, KeypointPairArrayLike, KeypointPairBatch, KeypointPairLike, KeypointPairType from .mat3x3 import Mat3x3, Mat3x3ArrayLike, Mat3x3Batch, Mat3x3Like, Mat3x3Type from .mat4x4 import Mat4x4, Mat4x4ArrayLike, Mat4x4Batch, Mat4x4Like, Mat4x4Type -from .material import Material, MaterialArrayLike, MaterialBatch, MaterialLike, MaterialType from .quaternion import Quaternion, QuaternionArrayLike, QuaternionBatch, QuaternionLike, QuaternionType from .range1d import Range1D, Range1DArrayLike, Range1DBatch, Range1DLike, Range1DType from .range2d import Range2D, Range2DArrayLike, Range2DBatch, Range2DLike, Range2DType @@ -191,11 +190,6 @@ "Mat4x4Batch", "Mat4x4Like", "Mat4x4Type", - "Material", - "MaterialArrayLike", - "MaterialBatch", - "MaterialLike", - "MaterialType", "Quaternion", "QuaternionArrayLike", "QuaternionBatch", diff --git a/rerun_py/rerun_sdk/rerun/datatypes/material.py b/rerun_py/rerun_sdk/rerun/datatypes/material.py deleted file mode 100644 index 77ed8127a971..000000000000 --- a/rerun_py/rerun_sdk/rerun/datatypes/material.py +++ /dev/null @@ -1,81 +0,0 @@ -# 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/datatypes/material.fbs". - -# You can extend this class by creating a "MaterialExt" class in "material_ext.py". - -from __future__ import annotations - -from typing import Any, Sequence, Union - -import pyarrow as pa -from attrs import define, field - -from .. import datatypes -from .._baseclasses import ( - BaseBatch, - BaseExtensionType, -) -from .material_ext import MaterialExt - -__all__ = ["Material", "MaterialArrayLike", "MaterialBatch", "MaterialLike", "MaterialType"] - - -def _material__albedo_factor__special_field_converter_override( - x: datatypes.Rgba32Like | None, -) -> datatypes.Rgba32 | None: - if x is None: - return None - elif isinstance(x, datatypes.Rgba32): - return x - else: - return datatypes.Rgba32(x) - - -@define(init=False) -class Material(MaterialExt): - """**Datatype**: Material properties of a mesh, e.g. its color multiplier.""" - - def __init__(self: Any, albedo_factor: datatypes.Rgba32Like | None = None): - """ - Create a new instance of the Material datatype. - - Parameters - ---------- - albedo_factor: - Optional color multiplier. - - """ - - # You can define your own __init__ function as a member of MaterialExt in material_ext.py - self.__attrs_init__(albedo_factor=albedo_factor) - - albedo_factor: datatypes.Rgba32 | None = field( - default=None, converter=_material__albedo_factor__special_field_converter_override - ) - # Optional color multiplier. - # - # (Docstring intentionally commented out to hide this field from the docs) - - -MaterialLike = Material -MaterialArrayLike = Union[ - Material, - Sequence[MaterialLike], -] - - -class MaterialType(BaseExtensionType): - _TYPE_NAME: str = "rerun.datatypes.Material" - - def __init__(self) -> None: - pa.ExtensionType.__init__( - self, pa.struct([pa.field("albedo_factor", pa.uint32(), nullable=True, metadata={})]), self._TYPE_NAME - ) - - -class MaterialBatch(BaseBatch[MaterialArrayLike]): - _ARROW_TYPE = MaterialType() - - @staticmethod - def _native_to_pa_array(data: MaterialArrayLike, data_type: pa.DataType) -> pa.Array: - return MaterialExt.native_to_pa_array_override(data, data_type) diff --git a/rerun_py/rerun_sdk/rerun/datatypes/material_ext.py b/rerun_py/rerun_sdk/rerun/datatypes/material_ext.py deleted file mode 100644 index 1771142c3c84..000000000000 --- a/rerun_py/rerun_sdk/rerun/datatypes/material_ext.py +++ /dev/null @@ -1,31 +0,0 @@ -from __future__ import annotations - -from typing import TYPE_CHECKING - -import pyarrow as pa - -if TYPE_CHECKING: - from . import MaterialArrayLike - - -class MaterialExt: - """Extension for [Material][rerun.datatypes.Material].""" - - @staticmethod - def native_to_pa_array_override(data: MaterialArrayLike, data_type: pa.DataType) -> pa.Array: - from . import Material, Rgba32Type - - if isinstance(data, Material): - data = [data] - - field_albedo_factors = data_type.field("albedo_factor") - - albedo_factors = pa.array( - [datum.albedo_factor.rgba if datum.albedo_factor is not None else None for datum in data], - type=Rgba32Type().storage_type, - ) - - return pa.StructArray.from_arrays( - arrays=[albedo_factors], - fields=[field_albedo_factors], - ) diff --git a/rerun_py/tests/unit/test_mesh3d.py b/rerun_py/tests/unit/test_mesh3d.py index 7ccc1129da0f..475b0739b193 100644 --- a/rerun_py/tests/unit/test_mesh3d.py +++ b/rerun_py/tests/unit/test_mesh3d.py @@ -4,13 +4,13 @@ from typing import Any, Optional, cast import rerun as rr -from rerun.components import MaterialBatch, Position3DBatch, TriangleIndicesBatch, Vector3DBatch +from rerun.components import AlbedoFactorBatch, Position3DBatch, TriangleIndicesBatch, Vector3DBatch from rerun.components.texcoord2d import Texcoord2DBatch from rerun.datatypes import ( ClassIdArrayLike, - Material, - MaterialLike, + Rgba32, Rgba32ArrayLike, + Rgba32Like, UVec3DArrayLike, Vec2DArrayLike, Vec3DArrayLike, @@ -30,16 +30,16 @@ vec3ds_expected, ) -mesh_materials: list[MaterialLike | None] = [ +albedo_factors: list[Rgba32Like | None] = [ None, - Material(albedo_factor=0xAA0000CC), + Rgba32(0xAA0000CC), ] -def mesh_material_expected(obj: Any) -> Any: - expected = none_empty_or_value(obj, Material(albedo_factor=0xAA0000CC)) +def albedo_factor_expected(obj: Any) -> Any: + expected = none_empty_or_value(obj, Rgba32(0xAA0000CC)) - return MaterialBatch._optional(expected) + return AlbedoFactorBatch._optional(expected) def test_mesh3d() -> None: @@ -55,7 +55,7 @@ def test_mesh3d() -> None: vertex_colors_arrays, vertex_texcoord_arrays, triangle_indices_arrays, - mesh_materials, + albedo_factors, class_ids_arrays, ) @@ -65,7 +65,7 @@ def test_mesh3d() -> None: vertex_colors, vertex_texcoords, triangle_indices, - mesh_material, + albedo_factor, class_ids, ) in all_arrays: vertex_positions = vertex_positions if vertex_positions is not None else vertex_positions_arrays[-1] @@ -76,7 +76,7 @@ def test_mesh3d() -> None: vertex_colors = cast(Optional[Rgba32ArrayLike], vertex_colors) vertex_texcoords = cast(Optional[Vec2DArrayLike], vertex_texcoords) triangle_indices = cast(Optional[UVec3DArrayLike], triangle_indices) - mesh_material = cast(Optional[MaterialLike], mesh_material) + albedo_factor = cast(Optional[Rgba32Like], albedo_factor) class_ids = cast(Optional[ClassIdArrayLike], class_ids) print( @@ -86,7 +86,7 @@ def test_mesh3d() -> None: f" vertex_colors={vertex_colors}\n" f" vertex_texcoords={vertex_texcoords}\n" f" triangle_indices={triangle_indices}\n" - f" mesh_material={mesh_material}\n" + f" albedo_factor={albedo_factor}\n" f" class_ids={class_ids}\n" f")" ) @@ -96,7 +96,7 @@ def test_mesh3d() -> None: vertex_colors=vertex_colors, vertex_texcoords=vertex_texcoords, triangle_indices=triangle_indices, - mesh_material=mesh_material, + albedo_factor=albedo_factor, class_ids=class_ids, ) print(f"A: {arch}\n") @@ -106,29 +106,9 @@ def test_mesh3d() -> None: assert arch.vertex_colors == colors_expected(vertex_colors) assert arch.vertex_texcoords == vec2ds_expected(vertex_texcoords, Texcoord2DBatch) assert arch.triangle_indices == uvec3ds_expected(triangle_indices, TriangleIndicesBatch) - assert arch.mesh_material == mesh_material_expected(mesh_material) + assert arch.albedo_factor == albedo_factor_expected(albedo_factor) assert arch.class_ids == class_ids_expected(class_ids) -def test_nullable_albedo_factor() -> None: - # NOTE: We're just making sure that this doesn't crash… trust me, it used to. - assert ( - len( - MaterialBatch([ - Material(albedo_factor=[0xCC, 0x00, 0xCC, 0xFF]), - ]) - ) - == 1 - ) - assert ( - len( - MaterialBatch([ - Material(), - ]) - ) - == 1 - ) - - if __name__ == "__main__": test_mesh3d() diff --git a/scripts/lint.py b/scripts/lint.py index 11947e7f2b9c..9997c6040e89 100755 --- a/scripts/lint.py +++ b/scripts/lint.py @@ -793,8 +793,6 @@ def is_acronym_or_pascal_case(s: str) -> bool: if word.startswith("`"): inline_code_block = True - if word.endswith("`"): - inline_code_block = False if last_punctuation: word = word.capitalize() @@ -819,6 +817,9 @@ def is_acronym_or_pascal_case(s: str) -> bool: else: word = word.lower() + if word.endswith("`"): + inline_code_block = False + new_words.append((word + last_punctuation) if last_punctuation else word) is_first_word = False diff --git a/tests/python/release_checklist/check_all_components_ui.py b/tests/python/release_checklist/check_all_components_ui.py index faace7855220..47b2597be415 100644 --- a/tests/python/release_checklist/check_all_components_ui.py +++ b/tests/python/release_checklist/check_all_components_ui.py @@ -76,6 +76,7 @@ def alternatives(self) -> list[Any] | None: ALL_COMPONENTS: dict[str, TestCase] = { "AggregationPolicyBatch": TestCase(rr.components.AggregationPolicy.Average), + "AlbedoFactor": TestCase(rr.components.AlbedoFactor((255, 255, 0, 255))), "AnnotationContextBatch": TestCase([ rr.datatypes.ClassDescriptionMapElem( class_id=1, @@ -119,7 +120,6 @@ def alternatives(self) -> list[Any] | None: batch=[rr.components.MarkerShape.Plus, rr.components.MarkerShape.Cross, rr.components.MarkerShape.Circle] ), "MarkerSizeBatch": TestCase(batch=[5.0, 1.0, 2.0]), - "MaterialBatch": TestCase(rr.datatypes.Material((255, 255, 0, 255))), "MediaTypeBatch": TestCase("application/jpg"), "NameBatch": TestCase(batch=["Hello World", "Foo Bar", "Baz Qux"]), "OutOfTreeTransform3DBatch": TestCase(