glTF-Blender-IO
glTF-Blender-IO copied to clipboard
Deleting loaded image results in failing export with `Image doesnt have any image data` error
Describe the bug Export fails if a material references a deleted image
To Reproduce Steps to reproduce the behavior:
- Add image texture loaded from disc to material
- Export glTF
- All works fine, no errors
- delete image from disc
- observe error
Expected behavior Successful export without the referenced image - just a warning/error log that an image texture is missing
.blend file/ .gltf test.zip
Version
- OS: win 10
- Blender Version 3.6.2
Additional context
Traceback (most recent call last):
File "c:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\__init__.py", line 852, in execute
return gltf2_blender_export.save(context, export_settings)
File "c:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_export.py", line 34, in save
json, buffer = __export(export_settings)
File "c:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_export.py", line 51, in __export
__gather_gltf(exporter, export_settings)
File "c:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_export.py", line 65, in __gather_gltf
active_scene_idx, scenes, animations = gltf2_blender_gather.gather_gltf2(export_settings)
File "c:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather.py", line 28, in gather_gltf2
scenes.append(__gather_scene(blender_scene, export_settings))
File "c:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 35, in wrapper_cached
result = func(*args, **kwargs)
File "c:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather.py", line 69, in __gather_scene
node = gltf2_blender_gather_nodes.gather_node(
File "c:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_nodes.py", line 34, in gather_node
mesh=__gather_mesh(vnode, blender_object, export_settings),
File "c:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_nodes.py", line 242, in __gather_mesh
result = gltf2_blender_gather_mesh.gather_mesh(blender_mesh,
File "c:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 35, in wrapper_cached
result = func(*args, **kwargs)
File "c:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_mesh.py", line 57, in gather_mesh
primitives=__gather_primitives(blender_mesh, uuid_for_skined_data, vertex_groups, modifiers, materials, export_settings),
File "c:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_mesh.py", line 134, in __gather_primitives
return gltf2_blender_gather_primitives.gather_primitives(blender_mesh,
File "c:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 35, in wrapper_cached
result = func(*args, **kwargs)
File "c:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_primitives.py", line 77, in gather_primitives
material = gltf2_blender_gather_materials.gather_material(
File "c:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 35, in wrapper_cached
result = func(*args, **kwargs)
File "c:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\material\gltf2_blender_gather_materials.py", line 61, in gather_material
pbr_metallic_roughness, uvmap_actives_pbr_metallic_roughness = __gather_pbr_metallic_roughness(blender_material, orm_texture, export_settings)
File "c:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\material\gltf2_blender_gather_materials.py", line 350, in __gather_pbr_metallic_roughness
return gltf2_blender_gather_materials_pbr_metallic_roughness.gather_material_pbr_metallic_roughness(
File "c:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 35, in wrapper_cached
result = func(*args, **kwargs)
File "c:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\material\gltf2_blender_gather_materials_pbr_metallic_roughness.py", line 18, in gather_material_pbr_metallic_roughness
base_color_texture, use_active_uvmap_base_color_texture, _ = __gather_base_color_texture(blender_material, export_settings)
File "c:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\material\gltf2_blender_gather_materials_pbr_metallic_roughness.py", line 100, in __gather_base_color_texture
return gltf2_blender_gather_texture_info.gather_texture_info(inputs[0], inputs, export_settings)
File "c:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\material\gltf2_blender_gather_texture_info.py", line 22, in gather_texture_info
return __gather_texture_info_helper(primary_socket, blender_shader_sockets, 'DEFAULT', filter_type, export_settings)
File "c:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 35, in wrapper_cached
result = func(*args, **kwargs)
File "c:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\material\gltf2_blender_gather_texture_info.py", line 43, in __gather_texture_info_helper
index, factor = __gather_index(blender_shader_sockets, export_settings)
File "c:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\material\gltf2_blender_gather_texture_info.py", line 140, in __gather_index
return gltf2_blender_gather_texture.gather_texture(blender_shader_sockets, export_settings)
File "c:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 35, in wrapper_cached
result = func(*args, **kwargs)
File "c:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\material\gltf2_blender_gather_texture.py", line 29, in gather_texture
source, factor = __gather_source(blender_shader_sockets, export_settings)
File "c:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\material\gltf2_blender_gather_texture.py", line 81, in __gather_source
return gltf2_blender_gather_image.gather_image(blender_shader_sockets, export_settings)
File "c:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 35, in wrapper_cached
result = func(*args, **kwargs)
File "c:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\material\gltf2_blender_gather_image.py", line 44, in gather_image buffer_view, factor_buffer_view = __gather_buffer_view(image_data, mime_type, name, export_settings)
File "c:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 35, in wrapper_cached
result = func(*args, **kwargs)
File "c:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\material\gltf2_blender_gather_image.py", line 98, in __gather_buffer_view
data, factor = image_data.encode(mime_type, export_settings)
File "c:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\material\extensions\gltf2_blender_image.py", line 136, in encode
return self.__encode_happy(export_settings), None
File "c:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\material\extensions\gltf2_blender_image.py", line 146, in __encode_happy
return self.__encode_from_image(self.blender_image(), export_settings)
File "c:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\material\extensions\gltf2_blender_image.py", line 228, in __encode_from_image
make_temp_image_copy(guard, src_image=image)
File "c:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_scene_gltf2\blender\exp\material\extensions\gltf2_blender_image.py", line 268, in make_temp_image_copy
tmp_image.update()
RuntimeError: Error: Image '279895225900.png.001' does not have any image data