Skip to content

Commit aba3dd5

Browse files
committed
Rename every "label" in bevy_gltf to "subasset".
1 parent 576d975 commit aba3dd5

File tree

5 files changed

+108
-100
lines changed

5 files changed

+108
-100
lines changed

crates/bevy_gltf/src/assets.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use bevy_platform::collections::HashMap;
1212
use bevy_reflect::{prelude::ReflectDefault, Reflect, TypePath};
1313
use bevy_scene::Scene;
1414

15-
use crate::GltfAssetLabel;
15+
use crate::GltfSubassetName;
1616

1717
/// Representation of a loaded glTF file.
1818
#[derive(Asset, Debug, TypePath)]
@@ -84,9 +84,9 @@ impl GltfMesh {
8484
}
8585
}
8686

87-
/// Subasset label for this mesh within the gLTF parent asset.
88-
pub fn asset_label(&self) -> GltfAssetLabel {
89-
GltfAssetLabel::Mesh(self.index)
87+
/// Subasset name for this mesh within the gLTF parent asset.
88+
pub fn subasset_name(&self) -> GltfSubassetName {
89+
GltfSubassetName::Mesh(self.index)
9090
}
9191
}
9292

@@ -152,9 +152,9 @@ impl GltfNode {
152152
}
153153
}
154154

155-
/// Subasset label for this node within the gLTF parent asset.
156-
pub fn asset_label(&self) -> GltfAssetLabel {
157-
GltfAssetLabel::Node(self.index)
155+
/// Subasset name for this node within the gLTF parent asset.
156+
pub fn subasset_name(&self) -> GltfSubassetName {
157+
GltfSubassetName::Node(self.index)
158158
}
159159
}
160160

@@ -207,9 +207,9 @@ impl GltfPrimitive {
207207
}
208208
}
209209

210-
/// Subasset label for this primitive within its parent [`GltfMesh`] within the gLTF parent asset.
211-
pub fn asset_label(&self) -> GltfAssetLabel {
212-
GltfAssetLabel::Primitive {
210+
/// Subasset name for this primitive within its parent [`GltfMesh`] within the gLTF parent asset.
211+
pub fn subasset_name(&self) -> GltfSubassetName {
212+
GltfSubassetName::Primitive {
213213
mesh: self.parent_mesh_index,
214214
primitive: self.index,
215215
}
@@ -255,9 +255,9 @@ impl GltfSkin {
255255
}
256256
}
257257

258-
/// Subasset label for this skin within the gLTF parent asset.
259-
pub fn asset_label(&self) -> GltfAssetLabel {
260-
GltfAssetLabel::Skin(self.index)
258+
/// Subasset name for this skin within the gLTF parent asset.
259+
pub fn subasset_name(&self) -> GltfSubassetName {
260+
GltfSubassetName::Skin(self.index)
261261
}
262262
}
263263

crates/bevy_gltf/src/lib.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
//! fn spawn_gltf(mut commands: Commands, asset_server: Res<AssetServer>) {
2525
//! commands.spawn((
2626
//! // This is equivalent to "models/FlightHelmet/FlightHelmet.gltf#Scene0"
27-
//! // The `#Scene0` label here is very important because it tells bevy to load the first scene in the glTF file.
27+
//! // The `#Scene0` subasset name here is very important because it tells bevy to load the first scene in the glTF file.
2828
//! // If this isn't specified bevy doesn't know which part of the glTF file to load.
29-
//! SceneRoot(asset_server.load(GltfAssetLabel::Scene(0).from_asset("models/FlightHelmet/FlightHelmet.gltf"))),
29+
//! SceneRoot(asset_server.load(GltfSubassetName::Scene(0).from_asset("models/FlightHelmet/FlightHelmet.gltf"))),
3030
//! // You can use the transform to give it a position
3131
//! Transform::from_xyz(2.0, 0.0, -5.0),
3232
//! ));
@@ -82,13 +82,13 @@
8282
//! }
8383
//! ```
8484
//!
85-
//! ## Asset Labels
85+
//! ## Subasset names
8686
//!
87-
//! The glTF loader let's you specify labels that let you target specific parts of the glTF.
87+
//! The glTF loader let's you specify subasset names that let you target specific parts of the glTF.
8888
//!
89-
//! Be careful when using this feature, if you misspell a label it will simply ignore it without warning.
89+
//! Be careful when using this feature, if you misspell a subasset name it will simply ignore it without warning.
9090
//!
91-
//! You can use [`GltfAssetLabel`] to ensure you are using the correct label.
91+
//! You can use [`GltfSubassetName`] to ensure you are using the correct subasset name.
9292
//!
9393
//! # Supported KHR Extensions
9494
//!
@@ -129,8 +129,8 @@
129129
130130
mod assets;
131131
pub mod convert_coordinates;
132-
mod label;
133132
mod loader;
133+
mod subasset_name;
134134
mod vertex_attributes;
135135

136136
extern crate alloc;
@@ -152,12 +152,12 @@ use bevy_mesh::MeshVertexAttribute;
152152
/// This includes the most common types in this crate, re-exported for your convenience.
153153
pub mod prelude {
154154
#[doc(hidden)]
155-
pub use crate::{assets::Gltf, assets::GltfExtras, label::GltfAssetLabel};
155+
pub use crate::{assets::Gltf, assets::GltfExtras, subasset_name::GltfSubassetName};
156156
}
157157

158158
use crate::{convert_coordinates::GltfConvertCoordinates, extensions::GltfExtensionHandlers};
159159

160-
pub use {assets::*, label::GltfAssetLabel, loader::*};
160+
pub use {assets::*, loader::*, subasset_name::GltfSubassetName};
161161

162162
// Has to store an Arc<Mutex<...>> as there is no other way to mutate fields of asset loaders.
163163
/// Stores default [`ImageSamplerDescriptor`] in main world.

crates/bevy_gltf/src/loader/gltf_ext/material.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use gltf::{json::texture::Info, Material};
66

77
use serde_json::value;
88

9-
use crate::GltfAssetLabel;
9+
use crate::GltfSubassetName;
1010

1111
use super::texture::texture_transform_to_affine2;
1212

@@ -161,13 +161,16 @@ pub(crate) fn warn_on_differing_texture_transforms(
161161
}
162162
}
163163

164-
pub(crate) fn material_label(material: &Material, is_scale_inverted: bool) -> GltfAssetLabel {
164+
pub(crate) fn material_subasset_name(
165+
material: &Material,
166+
is_scale_inverted: bool,
167+
) -> GltfSubassetName {
165168
if let Some(index) = material.index() {
166-
GltfAssetLabel::Material {
169+
GltfSubassetName::Material {
167170
index,
168171
is_scale_inverted,
169172
}
170173
} else {
171-
GltfAssetLabel::DefaultMaterial
174+
GltfSubassetName::DefaultMaterial
172175
}
173176
}

0 commit comments

Comments
 (0)