mirror of
https://github.com/bevyengine/bevy
synced 2024-12-01 00:49:12 +00:00
Remove thiserror
from bevy_transform
(#15761)
# Objective - Contributes to #15460 ## Solution - Removed `thiserror` from `bevy_transform`
This commit is contained in:
parent
8fd3d54e48
commit
bdc649a2d1
3 changed files with 15 additions and 13 deletions
|
@ -20,7 +20,11 @@ bevy_reflect = { path = "../bevy_reflect", version = "0.15.0-dev", features = [
|
||||||
"bevy",
|
"bevy",
|
||||||
], optional = true }
|
], optional = true }
|
||||||
serde = { version = "1", features = ["derive"], 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]
|
[dev-dependencies]
|
||||||
bevy_tasks = { path = "../bevy_tasks", version = "0.15.0-dev" }
|
bevy_tasks = { path = "../bevy_tasks", version = "0.15.0-dev" }
|
||||||
|
|
|
@ -4,6 +4,7 @@ use super::Transform;
|
||||||
use bevy_math::{Affine3A, Dir3, Isometry3d, Mat4, Quat, Vec3, Vec3A};
|
use bevy_math::{Affine3A, Dir3, Isometry3d, Mat4, Quat, Vec3, Vec3A};
|
||||||
#[cfg(all(feature = "bevy-support", feature = "serialize"))]
|
#[cfg(all(feature = "bevy-support", feature = "serialize"))]
|
||||||
use bevy_reflect::{ReflectDeserialize, ReflectSerialize};
|
use bevy_reflect::{ReflectDeserialize, ReflectSerialize};
|
||||||
|
use derive_more::derive::From;
|
||||||
#[cfg(feature = "bevy-support")]
|
#[cfg(feature = "bevy-support")]
|
||||||
use {
|
use {
|
||||||
bevy_ecs::{component::Component, reflect::ReflectComponent},
|
bevy_ecs::{component::Component, reflect::ReflectComponent},
|
||||||
|
@ -39,7 +40,7 @@ use {
|
||||||
/// - [`transform`][transform_example]
|
/// - [`transform`][transform_example]
|
||||||
///
|
///
|
||||||
/// [transform_example]: https://github.com/bevyengine/bevy/blob/latest/examples/transforms/transform.rs
|
/// [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 = "serialize", derive(serde::Serialize, serde::Deserialize))]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "bevy-support",
|
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 {
|
impl From<Mat4> for GlobalTransform {
|
||||||
fn from(world_from_local: Mat4) -> Self {
|
fn from(world_from_local: Mat4) -> Self {
|
||||||
Self(Affine3A::from_mat4(world_from_local))
|
Self(Affine3A::from_mat4(world_from_local))
|
||||||
|
|
|
@ -6,7 +6,7 @@ use bevy_ecs::{
|
||||||
system::{Query, SystemParam},
|
system::{Query, SystemParam},
|
||||||
};
|
};
|
||||||
use bevy_hierarchy::{HierarchyQueryExt, Parent};
|
use bevy_hierarchy::{HierarchyQueryExt, Parent};
|
||||||
use thiserror::Error;
|
use derive_more::derive::{Display, Error};
|
||||||
|
|
||||||
use crate::components::{GlobalTransform, Transform};
|
use crate::components::{GlobalTransform, Transform};
|
||||||
|
|
||||||
|
@ -64,17 +64,20 @@ fn map_error(err: QueryEntityError, ancestor: bool) -> ComputeGlobalTransformErr
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Error returned by [`TransformHelper::compute_global_transform`].
|
/// Error returned by [`TransformHelper::compute_global_transform`].
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error, Display)]
|
||||||
pub enum ComputeGlobalTransformError {
|
pub enum ComputeGlobalTransformError {
|
||||||
/// The entity or one of its ancestors is missing the [`Transform`] component.
|
/// 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),
|
MissingTransform(Entity),
|
||||||
/// The entity does not exist.
|
/// The entity does not exist.
|
||||||
#[error("The entity {0:?} does not exist")]
|
#[display("The entity {_0:?} does not exist")]
|
||||||
|
#[error(ignore)]
|
||||||
NoSuchEntity(Entity),
|
NoSuchEntity(Entity),
|
||||||
/// An ancestor is missing.
|
/// An ancestor is missing.
|
||||||
/// This probably means that your hierarchy has been improperly maintained.
|
/// 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),
|
MalformedHierarchy(Entity),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue