Remove bevy_animation dependency on bevy_text (#15642)

# Objective

- Fixes #15640

## Solution

- Do it

## Testing

- ran many_foxes
This commit is contained in:
vero 2024-10-04 08:22:15 -04:00 committed by GitHub
parent 2526410096
commit 2530f262f5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 18 deletions

View File

@ -27,7 +27,6 @@ bevy_utils = { path = "../bevy_utils", version = "0.15.0-dev" }
bevy_ecs = { path = "../bevy_ecs", version = "0.15.0-dev" } bevy_ecs = { path = "../bevy_ecs", version = "0.15.0-dev" }
bevy_transform = { path = "../bevy_transform", version = "0.15.0-dev" } bevy_transform = { path = "../bevy_transform", version = "0.15.0-dev" }
bevy_hierarchy = { path = "../bevy_hierarchy", version = "0.15.0-dev" } bevy_hierarchy = { path = "../bevy_hierarchy", version = "0.15.0-dev" }
bevy_text = { path = "../bevy_text", version = "0.15.0-dev" }
# other # other
petgraph = { version = "0.6", features = ["serde-1"] } petgraph = { version = "0.6", features = ["serde-1"] }

View File

@ -104,20 +104,20 @@ use crate::{
/// You can implement this trait on a unit struct in order to support animating /// You can implement this trait on a unit struct in order to support animating
/// custom components other than transforms and morph weights. Use that type in /// custom components other than transforms and morph weights. Use that type in
/// conjunction with [`AnimatableCurve`] (and perhaps [`AnimatableKeyframeCurve`] /// conjunction with [`AnimatableCurve`] (and perhaps [`AnimatableKeyframeCurve`]
/// to define the animation itself). For example, in order to animate font size of a /// to define the animation itself).
/// text section from 24 pt. to 80 pt., you might use: /// For example, in order to animate field of view, you might use:
/// ///
/// # use bevy_animation::prelude::AnimatableProperty; /// # use bevy_animation::prelude::AnimatableProperty;
/// # use bevy_reflect::Reflect; /// # use bevy_reflect::Reflect;
/// # use bevy_text::Text; /// # use bevy_render::camera::PerspectiveProjection;
/// #[derive(Reflect)] /// #[derive(Reflect)]
/// struct FontSizeProperty; /// struct FieldOfViewProperty;
/// ///
/// impl AnimatableProperty for FontSizeProperty { /// impl AnimatableProperty for FieldOfViewProperty {
/// type Component = Text; /// type Component = PerspectiveProjection;
/// type Property = f32; /// type Property = f32;
/// fn get_mut(component: &mut Self::Component) -> Option<&mut Self::Property> { /// fn get_mut(component: &mut Self::Component) -> Option<&mut Self::Property> {
/// Some(&mut component.sections.get_mut(0)?.style.font_size) /// Some(&mut component.fov)
/// } /// }
/// } /// }
/// ///
@ -127,15 +127,15 @@ use crate::{
/// # use bevy_animation::prelude::{AnimatableProperty, AnimatableKeyframeCurve, AnimatableCurve}; /// # use bevy_animation::prelude::{AnimatableProperty, AnimatableKeyframeCurve, AnimatableCurve};
/// # use bevy_core::Name; /// # use bevy_core::Name;
/// # use bevy_reflect::Reflect; /// # use bevy_reflect::Reflect;
/// # use bevy_text::Text; /// # use bevy_render::camera::PerspectiveProjection;
/// # let animation_target_id = AnimationTargetId::from(&Name::new("Test")); /// # let animation_target_id = AnimationTargetId::from(&Name::new("Test"));
/// # #[derive(Reflect)] /// # #[derive(Reflect)]
/// # struct FontSizeProperty; /// # struct FieldOfViewProperty;
/// # impl AnimatableProperty for FontSizeProperty { /// # impl AnimatableProperty for FieldOfViewProperty {
/// # type Component = Text; /// # type Component = PerspectiveProjection;
/// # type Property = f32; /// # type Property = f32;
/// # fn get_mut(component: &mut Self::Component) -> Option<&mut Self::Property> { /// # fn get_mut(component: &mut Self::Component) -> Option<&mut Self::Property> {
/// # Some(&mut component.sections.get_mut(0)?.style.font_size) /// # Some(&mut component.fov)
/// # } /// # }
/// # } /// # }
/// let mut animation_clip = AnimationClip::default(); /// let mut animation_clip = AnimationClip::default();
@ -143,18 +143,18 @@ use crate::{
/// animation_target_id, /// animation_target_id,
/// AnimatableKeyframeCurve::new( /// AnimatableKeyframeCurve::new(
/// [ /// [
/// (0.0, 24.0), /// (0.0, core::f32::consts::PI / 4.0),
/// (1.0, 80.0), /// (1.0, core::f32::consts::PI / 3.0),
/// ] /// ]
/// ) /// )
/// .map(AnimatableCurve::<FontSizeProperty, _>::from_curve) /// .map(AnimatableCurve::<FieldOfViewProperty, _>::from_curve)
/// .expect("Failed to create font size curve") /// .expect("Failed to create font size curve")
/// ); /// );
/// ///
/// Here, the use of [`AnimatableKeyframeCurve`] creates a curve out of the given keyframe time-value /// Here, the use of [`AnimatableKeyframeCurve`] creates a curve out of the given keyframe time-value
/// pairs, using the [`Animatable`] implementation of `f32` to interpolate between them. The /// pairs, using the [`Animatable`] implementation of `f32` to interpolate between them. The
/// invocation of [`AnimatableCurve::from_curve`] with `FontSizeProperty` indicates that the `f32` /// invocation of [`AnimatableCurve::from_curve`] with `FieldOfViewProperty` indicates that the `f32`
/// output from that curve is to be used to animate the font size of a `Text` component (as /// output from that curve is to be used to animate the font size of a `PerspectiveProjection` component (as
/// configured above). /// configured above).
/// ///
/// [`AnimationClip`]: crate::AnimationClip /// [`AnimationClip`]: crate::AnimationClip