Remove thiserror from bevy_transform (#15761)

# Objective

- Contributes to #15460

## Solution

- Removed `thiserror` from `bevy_transform`
This commit is contained in:
Zachary Harrold 2024-10-10 01:27:30 +11:00 committed by GitHub
parent 8fd3d54e48
commit bdc649a2d1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 13 deletions

View file

@ -20,7 +20,11 @@ bevy_reflect = { path = "../bevy_reflect", version = "0.15.0-dev", features = [
"bevy",
], optional = true }
serde = { version = "1", features = ["derive"], optional = true }
thiserror = "1.0"
derive_more = { version = "1", default-features = false, features = [
"error",
"from",
"display",
] }
[dev-dependencies]
bevy_tasks = { path = "../bevy_tasks", version = "0.15.0-dev" }

View file

@ -4,6 +4,7 @@ use super::Transform;
use bevy_math::{Affine3A, Dir3, Isometry3d, Mat4, Quat, Vec3, Vec3A};
#[cfg(all(feature = "bevy-support", feature = "serialize"))]
use bevy_reflect::{ReflectDeserialize, ReflectSerialize};
use derive_more::derive::From;
#[cfg(feature = "bevy-support")]
use {
bevy_ecs::{component::Component, reflect::ReflectComponent},
@ -39,7 +40,7 @@ use {
/// - [`transform`][transform_example]
///
/// [transform_example]: https://github.com/bevyengine/bevy/blob/latest/examples/transforms/transform.rs
#[derive(Debug, PartialEq, Clone, Copy)]
#[derive(Debug, PartialEq, Clone, Copy, From)]
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(
feature = "bevy-support",
@ -274,12 +275,6 @@ impl From<Transform> for GlobalTransform {
}
}
impl From<Affine3A> for GlobalTransform {
fn from(affine: Affine3A) -> Self {
Self(affine)
}
}
impl From<Mat4> for GlobalTransform {
fn from(world_from_local: Mat4) -> Self {
Self(Affine3A::from_mat4(world_from_local))

View file

@ -6,7 +6,7 @@ use bevy_ecs::{
system::{Query, SystemParam},
};
use bevy_hierarchy::{HierarchyQueryExt, Parent};
use thiserror::Error;
use derive_more::derive::{Display, Error};
use crate::components::{GlobalTransform, Transform};
@ -64,17 +64,20 @@ fn map_error(err: QueryEntityError, ancestor: bool) -> ComputeGlobalTransformErr
}
/// Error returned by [`TransformHelper::compute_global_transform`].
#[derive(Debug, Error)]
#[derive(Debug, Error, Display)]
pub enum ComputeGlobalTransformError {
/// The entity or one of its ancestors is missing the [`Transform`] component.
#[error("The entity {0:?} or one of its ancestors is missing the `Transform` component")]
#[display("The entity {_0:?} or one of its ancestors is missing the `Transform` component")]
#[error(ignore)]
MissingTransform(Entity),
/// The entity does not exist.
#[error("The entity {0:?} does not exist")]
#[display("The entity {_0:?} does not exist")]
#[error(ignore)]
NoSuchEntity(Entity),
/// An ancestor is missing.
/// This probably means that your hierarchy has been improperly maintained.
#[error("The ancestor {0:?} is missing")]
#[display("The ancestor {_0:?} is missing")]
#[error(ignore)]
MalformedHierarchy(Entity),
}