summaryrefslogtreecommitdiff
path: root/modules/gltf
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-01-20 08:48:32 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-01-20 08:48:32 +0100
commit7b84b133eea607f4d903a95322fe0364635a39d8 (patch)
treeb67a23bfcff3643e9167dd89bda0f9046c2a453d /modules/gltf
parentce1233dc528d9288b3fc1836b39ff08e7adec991 (diff)
parenta103400871c28fe4c7e8a2fb28e1e0396ab6f4be (diff)
Merge pull request #69181 from fire/gltf-runtime-image-fallback
Fixes cases where the runtime ResourceLoader cannot load gltf images.
Diffstat (limited to 'modules/gltf')
-rw-r--r--modules/gltf/gltf_document.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp
index 788a70f640..5634c51c61 100644
--- a/modules/gltf/gltf_document.cpp
+++ b/modules/gltf/gltf_document.cpp
@@ -3124,10 +3124,11 @@ Error GLTFDocument::_parse_images(Ref<GLTFState> p_state, const String &p_base_p
// API for that in Godot, so we'd have to load as a buffer (i.e. embedded in
// the material), so we do this only as fallback.
Ref<Texture2D> texture = ResourceLoader::load(uri);
+ String extension = uri.get_extension().to_lower();
if (texture.is_valid()) {
p_state->images.push_back(texture);
continue;
- } else if (mimetype == "image/png" || mimetype == "image/jpeg") {
+ } else if (mimetype == "image/png" || mimetype == "image/jpeg" || extension == "png" || extension == "jpg" || extension == "jpeg") {
// Fallback to loading as byte array.
// This enables us to support the spec's requirement that we honor mimetype
// regardless of file URI.