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"
serde = "1"
blake3 = { version = "1.0" }
thiserror = "1"
derive_more = { version = "1", default-features = false, features = [
"error",
"from",
"display",
] }
thread_local = "1"
uuid = { version = "1.7", features = ["v4"] }
smallvec = "1"

View file

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

View file

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