9529ce41eb
The glTF 2.0 spec only makes `mimeType` mandatory for `bufferView` image data,
so the previous logic to handle URIs with base64-encoded images could fail if
`mimeType` is undefined.
The logic was documented and refactored to better handle the spec, notably:
- `uri` and `bufferView` are now mutually exclusive, and only the latter fails
if `mimeType` is undefined.
- `uri` with a file path will now respect the `mimeType` if defined, and thus
attempt loading the file with the specified format (even if its extension is
not the one expected for this format). So we can support bad extensions (PNG
data with `.jpg` extension) or custom ones (PNG data in `.img` file for
example).
- `uri` with base64 encoded data will infer MIME type from `data:image/png` or
`data:image/jpeg` if it was not documented in `mimeType` initially.
- `uri` with base64 encoded data, no `mimeType` and `application/octet-stream`
or `application/gltf-buffer` will fall back to trying both PNG and JPEG
loaders.
Fully fixes #33796 (and fixes up #42501).
(cherry picked from commit
|
||
---|---|---|
.. | ||
atlas_import_failed.xpm | ||
editor_import_collada.cpp | ||
editor_import_collada.h | ||
editor_import_plugin.cpp | ||
editor_import_plugin.h | ||
editor_scene_importer_gltf.cpp | ||
editor_scene_importer_gltf.h | ||
resource_importer_bitmask.cpp | ||
resource_importer_bitmask.h | ||
resource_importer_csv.cpp | ||
resource_importer_csv.h | ||
resource_importer_csv_translation.cpp | ||
resource_importer_csv_translation.h | ||
resource_importer_image.cpp | ||
resource_importer_image.h | ||
resource_importer_layered_texture.cpp | ||
resource_importer_layered_texture.h | ||
resource_importer_obj.cpp | ||
resource_importer_obj.h | ||
resource_importer_scene.cpp | ||
resource_importer_scene.h | ||
resource_importer_texture.cpp | ||
resource_importer_texture.h | ||
resource_importer_texture_atlas.cpp | ||
resource_importer_texture_atlas.h | ||
resource_importer_wav.cpp | ||
resource_importer_wav.h | ||
SCsub |