Skip to content

Commit 5a0c09d

Browse files
authored
Reflect derived traits on all components and resources: bevy_transform (#15230)
Fixes #15187 for bevy_transform
1 parent cb6ab16 commit 5a0c09d

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

crates/bevy_transform/src/components/global_transform.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ use bevy_ecs::{component::Component, reflect::ReflectComponent};
66
use bevy_math::{Affine3A, Dir3, Isometry3d, Mat4, Quat, Vec3, Vec3A};
77
#[cfg(feature = "bevy-support")]
88
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
9+
#[cfg(all(feature = "bevy-support", feature = "serialize"))]
10+
use bevy_reflect::{ReflectDeserialize, ReflectSerialize};
911

1012
/// [`GlobalTransform`] is an affine transformation from entity-local coordinates to worldspace coordinates.
1113
///
@@ -39,7 +41,11 @@ use bevy_reflect::{std_traits::ReflectDefault, Reflect};
3941
#[cfg_attr(
4042
feature = "bevy-support",
4143
derive(Component, Reflect),
42-
reflect(Component, Default, PartialEq)
44+
reflect(Component, Default, PartialEq, Debug)
45+
)]
46+
#[cfg_attr(
47+
all(feature = "bevy-support", feature = "serialize"),
48+
reflect(Serialize, Deserialize)
4349
)]
4450
pub struct GlobalTransform(Affine3A);
4551

crates/bevy_transform/src/components/transform.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use super::GlobalTransform;
33
use bevy_ecs::{component::Component, reflect::ReflectComponent};
44
use bevy_math::{Affine3A, Dir3, Isometry3d, Mat3, Mat4, Quat, Vec3};
55
#[cfg(feature = "bevy-support")]
6-
use bevy_reflect::{prelude::*, Reflect};
6+
use bevy_reflect::prelude::*;
77
use std::ops::Mul;
88

99
/// Describe the position of an entity. If the entity has a parent, the position is relative
@@ -38,7 +38,11 @@ use std::ops::Mul;
3838
#[cfg_attr(
3939
feature = "bevy-support",
4040
derive(Component, Reflect),
41-
reflect(Component, Default, PartialEq)
41+
reflect(Component, Default, PartialEq, Debug)
42+
)]
43+
#[cfg_attr(
44+
all(feature = "bevy-support", feature = "serialize"),
45+
reflect(Serialize, Deserialize)
4246
)]
4347
pub struct Transform {
4448
/// Position of the entity. In 2d, the last value of the `Vec3` is used for z-ordering.

0 commit comments

Comments
 (0)