1use bevy_asset::AssetPath;
4
5#[derive(#[automatically_derived]
impl ::core::fmt::Debug for GltfAssetLabel {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
GltfAssetLabel::Scene(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Scene",
&__self_0),
GltfAssetLabel::Node(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Node",
&__self_0),
GltfAssetLabel::Mesh(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Mesh",
&__self_0),
GltfAssetLabel::Primitive { mesh: __self_0, primitive: __self_1 }
=>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"Primitive", "mesh", __self_0, "primitive", &__self_1),
GltfAssetLabel::Texture(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"Texture", &__self_0),
GltfAssetLabel::Material {
index: __self_0, is_scale_inverted: __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f,
"Material", "index", __self_0, "is_scale_inverted",
&__self_1),
GltfAssetLabel::DefaultMaterial =>
::core::fmt::Formatter::write_str(f, "DefaultMaterial"),
GltfAssetLabel::Animation(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"Animation", &__self_0),
GltfAssetLabel::Skin(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Skin",
&__self_0),
GltfAssetLabel::InverseBindMatrices(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"InverseBindMatrices", &__self_0),
}
}
}Debug, #[automatically_derived]
impl ::core::clone::Clone for GltfAssetLabel {
#[inline]
fn clone(&self) -> GltfAssetLabel {
let _: ::core::clone::AssertParamIsClone<usize>;
let _: ::core::clone::AssertParamIsClone<bool>;
*self
}
}Clone, #[automatically_derived]
impl ::core::marker::Copy for GltfAssetLabel { }Copy, #[automatically_derived]
impl ::core::cmp::PartialEq for GltfAssetLabel {
#[inline]
fn eq(&self, other: &GltfAssetLabel) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr &&
match (self, other) {
(GltfAssetLabel::Scene(__self_0),
GltfAssetLabel::Scene(__arg1_0)) => __self_0 == __arg1_0,
(GltfAssetLabel::Node(__self_0),
GltfAssetLabel::Node(__arg1_0)) => __self_0 == __arg1_0,
(GltfAssetLabel::Mesh(__self_0),
GltfAssetLabel::Mesh(__arg1_0)) => __self_0 == __arg1_0,
(GltfAssetLabel::Primitive {
mesh: __self_0, primitive: __self_1 },
GltfAssetLabel::Primitive {
mesh: __arg1_0, primitive: __arg1_1 }) =>
__self_0 == __arg1_0 && __self_1 == __arg1_1,
(GltfAssetLabel::Texture(__self_0),
GltfAssetLabel::Texture(__arg1_0)) => __self_0 == __arg1_0,
(GltfAssetLabel::Material {
index: __self_0, is_scale_inverted: __self_1 },
GltfAssetLabel::Material {
index: __arg1_0, is_scale_inverted: __arg1_1 }) =>
__self_1 == __arg1_1 && __self_0 == __arg1_0,
(GltfAssetLabel::Animation(__self_0),
GltfAssetLabel::Animation(__arg1_0)) =>
__self_0 == __arg1_0,
(GltfAssetLabel::Skin(__self_0),
GltfAssetLabel::Skin(__arg1_0)) => __self_0 == __arg1_0,
(GltfAssetLabel::InverseBindMatrices(__self_0),
GltfAssetLabel::InverseBindMatrices(__arg1_0)) =>
__self_0 == __arg1_0,
_ => true,
}
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for GltfAssetLabel {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<usize>;
let _: ::core::cmp::AssertParamIsEq<bool>;
}
}Eq)]
33pub enum GltfAssetLabel {
34 Scene(usize),
36 Node(usize),
38 Mesh(usize),
40 Primitive {
42 mesh: usize,
44 primitive: usize,
46 },
47 Texture(usize),
49 Material {
51 index: usize,
53 is_scale_inverted: bool,
56 },
57 DefaultMaterial,
59 Animation(usize),
61 Skin(usize),
63 InverseBindMatrices(usize),
66}
67
68impl core::fmt::Display for GltfAssetLabel {
69 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
70 match self {
71 GltfAssetLabel::Scene(index) => f.write_str(&::alloc::__export::must_use({
::alloc::fmt::format(format_args!("Scene{0}", index))
})format!("Scene{index}")),
72 GltfAssetLabel::Node(index) => f.write_str(&::alloc::__export::must_use({
::alloc::fmt::format(format_args!("Node{0}", index))
})format!("Node{index}")),
73 GltfAssetLabel::Mesh(index) => f.write_str(&::alloc::__export::must_use({
::alloc::fmt::format(format_args!("Mesh{0}", index))
})format!("Mesh{index}")),
74 GltfAssetLabel::Primitive { mesh, primitive } => {
75 f.write_str(&::alloc::__export::must_use({
::alloc::fmt::format(format_args!("Mesh{0}/Primitive{1}", mesh,
primitive))
})format!("Mesh{mesh}/Primitive{primitive}"))
76 }
77 GltfAssetLabel::Texture(index) => f.write_str(&::alloc::__export::must_use({
::alloc::fmt::format(format_args!("Texture{0}", index))
})format!("Texture{index}")),
78 GltfAssetLabel::Material {
79 index,
80 is_scale_inverted,
81 } => f.write_str(&::alloc::__export::must_use({
::alloc::fmt::format(format_args!("Material{1}{0}",
if *is_scale_inverted { " (inverted)" } else { "" }, index))
})format!(
82 "Material{index}{}",
83 if *is_scale_inverted {
84 " (inverted)"
85 } else {
86 ""
87 }
88 )),
89 GltfAssetLabel::DefaultMaterial => f.write_str("DefaultMaterial"),
90 GltfAssetLabel::Animation(index) => f.write_str(&::alloc::__export::must_use({
::alloc::fmt::format(format_args!("Animation{0}", index))
})format!("Animation{index}")),
91 GltfAssetLabel::Skin(index) => f.write_str(&::alloc::__export::must_use({
::alloc::fmt::format(format_args!("Skin{0}", index))
})format!("Skin{index}")),
92 GltfAssetLabel::InverseBindMatrices(index) => {
93 f.write_str(&::alloc::__export::must_use({
::alloc::fmt::format(format_args!("Skin{0}/InverseBindMatrices",
index))
})format!("Skin{index}/InverseBindMatrices"))
94 }
95 }
96 }
97}
98
99impl GltfAssetLabel {
100 pub fn from_asset(&self, path: impl Into<AssetPath<'static>>) -> AssetPath<'static> {
113 path.into().with_label(self.to_string())
114 }
115}