From a0ea5aac2c57b5c3b3d71f41ef7c2245dd296420 Mon Sep 17 00:00:00 2001 From: Multirious Date: Wed, 27 Mar 2024 11:38:01 +0700 Subject: [PATCH] Update interpolators reflect --- src/interpolate.rs | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/interpolate.rs b/src/interpolate.rs index b69a7a6..cdd3f74 100644 --- a/src/interpolate.rs +++ b/src/interpolate.rs @@ -236,21 +236,15 @@ impl Plugin for DefaultInterpolatorsPlugin { .register_type::>() .register_type::>() .register_type::>() - .register_type::>() - .register_type_data::>() - .register_type_data::>() - .register_type_data::>() - .register_type_data::>(); + .register_type::>(); #[cfg(feature = "bevy_sprite")] app.add_tween_systems(tween::component_tween_system::) - .register_type::>() - .register_type_data::>(); + .register_type::>(); #[cfg(all(feature = "bevy_sprite", feature = "bevy_asset",))] app.add_tween_systems(tween::asset_tween_system::) - .register_type::>() - .register_type_data::>(); + .register_type::>(); } } @@ -276,8 +270,11 @@ impl Plugin for DefaultDynInterpolatorsPlugin { } } +type ReflectInterpolatorTransform = ReflectInterpolator; + /// [`Interpolator`] for [`Transform`]'s translation. #[derive(Debug, Default, Clone, PartialEq, Reflect)] +#[reflect(InterpolatorTransform)] pub struct Translation { #[allow(missing_docs)] pub start: Vec3, @@ -294,6 +291,7 @@ impl Interpolator for Translation { /// [`Interpolator`] for [`Transform`]'s rotation using the [`Quat::slerp`] function. #[derive(Debug, Default, Clone, PartialEq, Reflect)] +#[reflect(InterpolatorTransform)] pub struct Rotation { #[allow(missing_docs)] pub start: Quat, @@ -310,6 +308,7 @@ impl Interpolator for Rotation { /// [`Interpolator`] for [`Transform`]'s scale #[derive(Debug, Default, Clone, PartialEq, Reflect)] +#[reflect(InterpolatorTransform)] pub struct Scale { #[allow(missing_docs)] pub start: Vec3, @@ -327,6 +326,7 @@ impl Interpolator for Scale { /// [`Interpolator`] for [`Transform`]'s rotation at Z axis. /// Usually used for 2D rotation. #[derive(Debug, Default, Clone, PartialEq, Reflect)] +#[reflect(InterpolatorTransform)] pub struct AngleZ { #[allow(missing_docs)] pub start: f32, @@ -342,9 +342,12 @@ impl Interpolator for AngleZ { } } +type ReflectInterpolatorSprite = ReflectInterpolator; + /// [`Interpolator`] for [`Sprite`]'s color #[cfg(feature = "bevy_sprite")] #[derive(Debug, Default, Clone, PartialEq, Reflect)] +#[reflect(InterpolatorSprite)] pub struct SpriteColor { #[allow(missing_docs)] pub start: Color, @@ -361,9 +364,13 @@ impl Interpolator for SpriteColor { } } +type ReflectInterpolatorColorMaterial = + ReflectInterpolator; + /// [`Interpolator`] for [`Sprite`]'s [`ColorMaterial`] #[cfg(feature = "bevy_sprite")] #[derive(Debug, Default, Clone, PartialEq, Reflect)] +#[reflect(InterpolatorColorMaterial)] pub struct ColorMaterial { #[allow(missing_docs)] pub start: Color,