Skip to content

Commit

Permalink
remove Transform3D::IDENTITY from c++ and Rust as it stops making sen…
Browse files Browse the repository at this point in the history
…se with an empty archetype
  • Loading branch information
Wumpf committed Jul 11, 2024
1 parent 9816281 commit 28105bb
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 13 deletions.
9 changes: 0 additions & 9 deletions crates/store/re_types/src/archetypes/transform3d_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,6 @@ use crate::{
use super::Transform3D;

impl Transform3D {
/// Identity transform, i.e. parent & child are in the same space.
/// TODO: remove, wrong concept here now.
pub const IDENTITY: Self = Self {
transform: crate::components::Transform3D::IDENTITY,
mat3x3: None,
translation: None,
axis_length: None,
};

/// From a translation.
#[inline]
pub fn from_translation(translation: impl Into<Translation3D>) -> Self {
Expand Down
2 changes: 1 addition & 1 deletion crates/store/re_types/tests/transform3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ fn roundtrip() {
];

let all_arch = [
Transform3D::IDENTITY, //
Transform3D::default(),
Transform3D::from_translation_scale([1.0, 2.0, 3.0], Scale3D::Uniform(42.0)).from_parent(), //
Transform3D::from_translation_rotation(
[1.0, 2.0, 3.0],
Expand Down
2 changes: 1 addition & 1 deletion crates/viewer/re_edit_ui/src/datatype_editors/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub fn edit_or_view_vec3d(
) -> egui::Response {
let mut value: MaybeMutRef<'_, datatypes::Vec3D> = match value {
MaybeMutRef::Ref(value) => MaybeMutRef::Ref(value),
MaybeMutRef::MutRef(value) => MaybeMutRef::MutRef(value.deref_mut()),
MaybeMutRef::MutRef(value) => MaybeMutRef::MutRef(value),
};
edit_or_view_vec3d_impl(ui, &mut value)
}
Expand Down
6 changes: 6 additions & 0 deletions docs/content/reference/migration/migration-0-18.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ rerun::Transform3D().with_mat3x3(matrix).with_translation(translation)
```
Note that the order of the method calls does _not_ affect the order in which transformation is applied!
`rerun::Transform3D::IDENTITY` has been removed, sue `rerun::Transform3D()` to start out with
an empty archetype instead that you can populate (e.g. `rerun::Transform3D().with_mat3x3(rerun::datatypes::Mat3x3::IDENTITY)`).
TODO(andreas): Talk about OutOfTreeTransform
TODO(andreas): … and Asset3D specifically
Expand Down Expand Up @@ -129,5 +132,8 @@ rerun::Transform3D::default().with_mat3x3(matrix).with_translation(translation)
```
Note that the order of the method calls does _not_ affect the order in which transformation is applied!

`rerun::Transform3D::IDENTITY` has been removed, sue `rerun::Transform3D::default()` to start out with
an empty archetype instead that you can populate (e.g. `rerun::Transform3D::default().with_mat3x3(rerun::datatypes::Mat3x3::IDENTITY)`).

TODO(andreas): Talk about OutOfTreeTransform
TODO(andreas): … and Asset3D specifically
2 changes: 0 additions & 2 deletions rerun_cpp/src/rerun/archetypes/transform3d_ext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,5 @@ namespace rerun {
// </CODEGEN_COPY_TO_HEADER>
#endif

const Transform3D Transform3D::IDENTITY = Transform3D();

} // namespace archetypes
} // namespace rerun
2 changes: 2 additions & 0 deletions tests/cpp/roundtrips/transform3d/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ int main(int, char** argv) {
.with_from_parent(true)
);

rerun::Transform3D().with_mat3x3(rerun::datatypes::Mat3x3::IDENTITY);

rec.log(
"transform/rigid",
rerun::archetypes::Transform3D::from_translation_rotation(
Expand Down

0 comments on commit 28105bb

Please sign in to comment.