Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reflect derived traits on all components and resources: bevy_transform #15230

Merged
merged 4 commits into from
Sep 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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