Skip to content

Commit

Permalink
Reflect derived traits on all components and resources: bevy_transform (
Browse files Browse the repository at this point in the history
bevyengine#15230)

Fixes bevyengine#15187 for bevy_transform
  • Loading branch information
blazepaws authored Sep 15, 2024
1 parent cb6ab16 commit 5a0c09d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
8 changes: 7 additions & 1 deletion crates/bevy_transform/src/components/global_transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ use bevy_ecs::{component::Component, reflect::ReflectComponent};
use bevy_math::{Affine3A, Dir3, Isometry3d, Mat4, Quat, Vec3, Vec3A};
#[cfg(feature = "bevy-support")]
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
#[cfg(all(feature = "bevy-support", feature = "serialize"))]
use bevy_reflect::{ReflectDeserialize, ReflectSerialize};

/// [`GlobalTransform`] is an affine transformation from entity-local coordinates to worldspace coordinates.
///
Expand Down Expand Up @@ -39,7 +41,11 @@ use bevy_reflect::{std_traits::ReflectDefault, Reflect};
#[cfg_attr(
feature = "bevy-support",
derive(Component, Reflect),
reflect(Component, Default, PartialEq)
reflect(Component, Default, PartialEq, Debug)
)]
#[cfg_attr(
all(feature = "bevy-support", feature = "serialize"),
reflect(Serialize, Deserialize)
)]
pub struct GlobalTransform(Affine3A);

Expand Down
8 changes: 6 additions & 2 deletions crates/bevy_transform/src/components/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use super::GlobalTransform;
use bevy_ecs::{component::Component, reflect::ReflectComponent};
use bevy_math::{Affine3A, Dir3, Isometry3d, Mat3, Mat4, Quat, Vec3};
#[cfg(feature = "bevy-support")]
use bevy_reflect::{prelude::*, Reflect};
use bevy_reflect::prelude::*;
use std::ops::Mul;

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

0 comments on commit 5a0c09d

Please sign in to comment.