Merge pull request #69181 from fire/gltf-runtime-image-fallback
Fixes cases where the runtime ResourceLoader cannot load gltf images.
This commit is contained in:
commit
7b84b133ee
1 changed files with 2 additions and 1 deletions
|
@ -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
|
// 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.
|
// the material), so we do this only as fallback.
|
||||||
Ref<Texture2D> texture = ResourceLoader::load(uri);
|
Ref<Texture2D> texture = ResourceLoader::load(uri);
|
||||||
|
String extension = uri.get_extension().to_lower();
|
||||||
if (texture.is_valid()) {
|
if (texture.is_valid()) {
|
||||||
p_state->images.push_back(texture);
|
p_state->images.push_back(texture);
|
||||||
continue;
|
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.
|
// Fallback to loading as byte array.
|
||||||
// This enables us to support the spec's requirement that we honor mimetype
|
// This enables us to support the spec's requirement that we honor mimetype
|
||||||
// regardless of file URI.
|
// regardless of file URI.
|
||||||
|
|
Loading…
Reference in a new issue