Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - Log errors when loading textures from a gltf file #2260

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions crates/bevy_gltf/src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use bevy_asset::{
};
use bevy_core::Name;
use bevy_ecs::world::World;
use bevy_log::warn;
use bevy_math::Mat4;
use bevy_pbr::prelude::{PbrBundle, StandardMaterial};
use bevy_render::{
Expand Down Expand Up @@ -49,7 +50,7 @@ pub enum GltfError {
BufferFormatUnsupported,
#[error("invalid image mime type: {0}")]
InvalidImageMimeType(String),
#[error("{0}")]
#[error("You may need to add the feature for the file format: {0}")]
ImageError(#[from] TextureError),
#[error("failed to load an asset path: {0}")]
AssetIoError(#[from] AssetIoError),
Expand Down Expand Up @@ -262,7 +263,12 @@ async fn load_gltf<'a, 'b>(
});
})
.into_iter()
.filter_map(|result| result.ok())
.filter_map(|res| {
if let Err(err) = res.as_ref() {
warn!("Error loading GLTF texture: {}", err);
}
res.ok()
})
.for_each(|(texture, label)| {
load_context.set_labeled_asset(&label, LoadedAsset::new(texture));
});
Expand Down