Remove thiserror from bevy_animation (#15780)

# Objective

- Contributes to #15460

## Solution

- Removed `thiserror` from `bevy_animation`
This commit is contained in:
Zachary Harrold 2024-10-10 01:16:21 +11:00 committed by GitHub
parent 6f8f70b56d
commit 814f8ec039
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 19 additions and 22 deletions

View File

@ -34,7 +34,11 @@ petgraph = { version = "0.6", features = ["serde-1"] }
ron = "0.8" ron = "0.8"
serde = "1" serde = "1"
blake3 = { version = "1.0" } blake3 = { version = "1.0" }
thiserror = "1" derive_more = { version = "1", default-features = false, features = [
"error",
"from",
"display",
] }
thread_local = "1" thread_local = "1"
uuid = { version = "1.7", features = ["v4"] } uuid = { version = "1.7", features = ["v4"] }
smallvec = "1" smallvec = "1"

View File

@ -5,7 +5,7 @@ use bevy_math::{
vec4, Quat, Vec4, VectorSpace, vec4, Quat, Vec4, VectorSpace,
}; };
use bevy_reflect::Reflect; use bevy_reflect::Reflect;
use thiserror::Error; use derive_more::derive::{Display, Error, From};
/// A keyframe-defined curve that "interpolates" by stepping at `t = 1.0` to the next keyframe. /// A keyframe-defined curve that "interpolates" by stepping at `t = 1.0` to the next keyframe.
#[derive(Debug, Clone, Reflect)] #[derive(Debug, Clone, Reflect)]
@ -318,20 +318,19 @@ where
} }
/// An error indicating that a multisampling keyframe curve could not be constructed. /// An error indicating that a multisampling keyframe curve could not be constructed.
#[derive(Debug, Error)] #[derive(Debug, Error, Display, From)]
#[error("unable to construct a curve using this data")] #[display("unable to construct a curve using this data")]
pub enum WideKeyframeCurveError { pub enum WideKeyframeCurveError {
/// The number of given values was not divisible by a multiple of the number of keyframes. /// The number of given values was not divisible by a multiple of the number of keyframes.
#[error("number of values ({values_given}) is not divisible by {divisor}")] #[display("number of values ({values_given}) is not divisible by {divisor}")]
LengthMismatch { LengthMismatch {
/// The number of values given. /// The number of values given.
values_given: usize, values_given: usize,
/// The number that `values_given` was supposed to be divisible by. /// The number that `values_given` was supposed to be divisible by.
divisor: usize, divisor: usize,
}, },
/// An error was returned by the internal core constructor. /// An error was returned by the internal core constructor.
CoreError(#[from] ChunkedUnevenCoreError), CoreError(ChunkedUnevenCoreError),
} }
impl<T> WideCubicKeyframeCurve<T> { impl<T> WideCubicKeyframeCurve<T> {

View File

@ -16,6 +16,7 @@ use bevy_ecs::{
}; };
use bevy_reflect::{prelude::ReflectDefault, Reflect, ReflectSerialize}; use bevy_reflect::{prelude::ReflectDefault, Reflect, ReflectSerialize};
use bevy_utils::HashMap; use bevy_utils::HashMap;
use derive_more::derive::{Display, Error, From};
use petgraph::{ use petgraph::{
graph::{DiGraph, NodeIndex}, graph::{DiGraph, NodeIndex},
Direction, Direction,
@ -23,7 +24,6 @@ use petgraph::{
use ron::de::SpannedError; use ron::de::SpannedError;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use smallvec::SmallVec; use smallvec::SmallVec;
use thiserror::Error;
use crate::{AnimationClip, AnimationTargetId}; use crate::{AnimationClip, AnimationTargetId};
@ -126,16 +126,10 @@ pub struct AnimationGraph {
} }
/// A [`Handle`] to the [`AnimationGraph`] to be used by the [`AnimationPlayer`](crate::AnimationPlayer) on the same entity. /// A [`Handle`] to the [`AnimationGraph`] to be used by the [`AnimationPlayer`](crate::AnimationPlayer) on the same entity.
#[derive(Component, Clone, Debug, Default, Deref, DerefMut, Reflect, PartialEq, Eq)] #[derive(Component, Clone, Debug, Default, Deref, DerefMut, Reflect, PartialEq, Eq, From)]
#[reflect(Component, Default)] #[reflect(Component, Default)]
pub struct AnimationGraphHandle(pub Handle<AnimationGraph>); pub struct AnimationGraphHandle(pub Handle<AnimationGraph>);
impl From<Handle<AnimationGraph>> for AnimationGraphHandle {
fn from(handle: Handle<AnimationGraph>) -> Self {
Self(handle)
}
}
impl From<AnimationGraphHandle> for AssetId<AnimationGraph> { impl From<AnimationGraphHandle> for AssetId<AnimationGraph> {
fn from(handle: AnimationGraphHandle) -> Self { fn from(handle: AnimationGraphHandle) -> Self {
handle.id() handle.id()
@ -230,18 +224,18 @@ pub struct AnimationGraphAssetLoader;
/// Various errors that can occur when serializing or deserializing animation /// Various errors that can occur when serializing or deserializing animation
/// graphs to and from RON, respectively. /// graphs to and from RON, respectively.
#[derive(Error, Debug)] #[derive(Error, Display, Debug, From)]
pub enum AnimationGraphLoadError { pub enum AnimationGraphLoadError {
/// An I/O error occurred. /// An I/O error occurred.
#[error("I/O")] #[display("I/O")]
Io(#[from] io::Error), Io(io::Error),
/// An error occurred in RON serialization or deserialization. /// An error occurred in RON serialization or deserialization.
#[error("RON serialization")] #[display("RON serialization")]
Ron(#[from] ron::Error), Ron(ron::Error),
/// An error occurred in RON deserialization, and the location of the error /// An error occurred in RON deserialization, and the location of the error
/// is supplied. /// is supplied.
#[error("RON serialization")] #[display("RON serialization")]
SpannedRon(#[from] SpannedError), SpannedRon(SpannedError),
} }
/// Acceleration structures for animation graphs that allows Bevy to evaluate /// Acceleration structures for animation graphs that allows Bevy to evaluate