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

Fixes https://github.com/bevyengine/bevy/issues/15187 for bevy_transform
This commit is contained in:
Blazepaws 2024-09-15 20:19:44 +02:00 committed by GitHub
parent cb6ab16c97
commit 5a0c09d38f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 3 deletions

View file

@ -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.
///
@ -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);

View file

@ -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
@ -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.