question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Exporting with "JPEG image" option selected throws exception when textures are not packed

See original GitHub issue

When exporting to Gltf with option “JPEG format (.jpg)” selected, if textures are not packed into blend file it will throw an exception:

Traceback (most recent call last):
  File "/home/ali/.config/blender/2.81/scripts/addons/io_scene_gltf2/__init__.py", line 483, in execute
    return gltf2_blender_export.save(context, export_settings)
  File "/home/ali/.config/blender/2.81/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_export.py", line 40, in save
    json, buffer = __export(export_settings)
  File "/home/ali/.config/blender/2.81/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_export.py", line 53, in __export
    __gather_gltf(exporter, export_settings)
  File "/home/ali/.config/blender/2.81/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_export.py", line 62, in __gather_gltf
    active_scene_idx, scenes, animations = gltf2_blender_gather.gather_gltf2(export_settings)
  File "/home/ali/.config/blender/2.81/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather.py", line 37, in gather_gltf2
    scenes.append(__gather_scene(blender_scene, export_settings))
  File "/home/ali/.config/blender/2.81/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_cache.py", line 65, in wrapper_cached
    result = func(*args)
  File "/home/ali/.config/blender/2.81/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather.py", line 56, in __gather_scene
    node = gltf2_blender_gather_nodes.gather_node(blender_object, blender_scene, export_settings)
  File "/home/ali/.config/blender/2.81/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py", line 46, in gather_node
    node = __gather_node(blender_object, blender_scene, export_settings)
  File "/home/ali/.config/blender/2.81/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_cache.py", line 65, in wrapper_cached
    result = func(*args)
  File "/home/ali/.config/blender/2.81/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py", line 64, in __gather_node
    mesh=__gather_mesh(blender_object, export_settings),
  File "/home/ali/.config/blender/2.81/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py", line 337, in __gather_mesh
    export_settings)
  File "/home/ali/.config/blender/2.81/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_cache.py", line 65, in wrapper_cached
    result = func(*args)
  File "/home/ali/.config/blender/2.81/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_mesh.py", line 42, in gather_mesh
    primitives=__gather_primitives(blender_mesh, blender_object, vertex_groups, modifiers, material_names, export_settings),
  File "/home/ali/.config/blender/2.81/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_mesh.py", line 129, in __gather_primitives
    export_settings)
  File "/home/ali/.config/blender/2.81/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_cache.py", line 65, in wrapper_cached
    result = func(*args)
  File "/home/ali/.config/blender/2.81/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_primitives.py", line 64, in gather_primitives
    export_settings)
  File "/home/ali/.config/blender/2.81/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_cache.py", line 65, in wrapper_cached
    result = func(*args)
  File "/home/ali/.config/blender/2.81/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_materials.py", line 56, in gather_material
    pbr_metallic_roughness=__gather_pbr_metallic_roughness(blender_material, orm_texture, export_settings)
  File "/home/ali/.config/blender/2.81/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_materials.py", line 221, in __gather_pbr_metallic_roughness
    export_settings)
  File "/home/ali/.config/blender/2.81/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_cache.py", line 65, in wrapper_cached
    result = func(*args)
  File "/home/ali/.config/blender/2.81/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_materials_pbr_metallic_roughness.py", line 33, in gather_material_pbr_metallic_roughness
    base_color_texture=__gather_base_color_texture(blender_material, export_settings),
  File "/home/ali/.config/blender/2.81/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_materials_pbr_metallic_roughness.py", line 107, in __gather_base_color_texture
    return gltf2_blender_gather_texture_info.gather_texture_info(inputs, export_settings)
  File "/home/ali/.config/blender/2.81/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_cache.py", line 65, in wrapper_cached
    result = func(*args)
  File "/home/ali/.config/blender/2.81/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_texture_info.py", line 37, in gather_texture_info
    index=__gather_index(blender_shader_sockets_or_texture_slots, export_settings),
  File "/home/ali/.config/blender/2.81/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_texture_info.py", line 97, in __gather_index
    return gltf2_blender_gather_texture.gather_texture(blender_shader_sockets_or_texture_slots, export_settings)
  File "/home/ali/.config/blender/2.81/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_cache.py", line 65, in wrapper_cached
    result = func(*args)
  File "/home/ali/.config/blender/2.81/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_texture.py", line 48, in gather_texture
    source=__gather_source(blender_shader_sockets_or_texture_slots, export_settings)
  File "/home/ali/.config/blender/2.81/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_texture.py", line 97, in __gather_source
    return gltf2_blender_gather_image.gather_image(blender_shader_sockets_or_texture_slots, export_settings)
  File "/home/ali/.config/blender/2.81/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_cache.py", line 65, in wrapper_cached
    result = func(*args)
  File "/home/ali/.config/blender/2.81/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py", line 48, in gather_image
    uri = __gather_uri(image_data, mime_type, name, export_settings)
  File "/home/ali/.config/blender/2.81/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_cache.py", line 65, in wrapper_cached
    result = func(*args)
  File "/home/ali/.config/blender/2.81/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py", line 124, in __gather_uri
    data=image_data.encode(mime_type=mime_type),
  File "/home/ali/.config/blender/2.81/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_image.py", line 115, in encode
    return self.__encode_happy()
  File "/home/ali/.config/blender/2.81/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_image.py", line 121, in __encode_happy
    return self.__encode_from_image(self.blender_image())
  File "/home/ali/.config/blender/2.81/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_image.py", line 292, in __encode_from_image
    return _encode_temp_image(tmp_image, self.file_format)
  File "/home/ali/.config/blender/2.81/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_image.py", line 308, in _encode_temp_image
    tmp_image.save()
RuntimeError: Error: Image 'Material_59.003_baseColor.png.001' does not have any image data


location: <unknown location>:-1


Linux OS Blender v2.81 Gltf Addon v1.2.6

A test blend file: https://github.com/KhronosGroup/glTF-Blender-IO/files/4116950/untitled.blend.zip (Make sure to unpack texture before exporting)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
scurestcommented, Jan 28, 2020

I think calling .update() here might be a good thing to do anyway. It also appears to make this piece of bizarreness unnecessary

https://github.com/KhronosGroup/glTF-Blender-IO/blob/fdaeb0865d85c610dc3d1fd02c596db582d2cb5a/addons/io_scene_gltf2/blender/exp/gltf2_blender_image.py#L303-L305

0reactions
Ali-RScommented, Jan 31, 2020

Thanks for the quick fix 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Importing and working with external assets in Twinmotion
He takes you through the requirements and file formats for assets coming into Twinmotion, as well as shows you how to work with...
Read more >
Substance Painter 2020.1 Exporting Textures - YouTube
In this video we take a look at the new Export Textures dialog found in Substance Painter 2020.1 (6.1.0).Learn more about the release...
Read more >
Blender How to Export FBX with Texture - Tutorial. - YouTube
In this VERY short video I will show you how to export a model out of Blender and have the textures export and...
Read more >
Problem: Unable to export layouts to JPEG files in ArcGIS Pro
The failed JPEG export error message in ArcGIS Pro. Cause. The 'Color depth' property is not selected in ArcGIS Pro 3.0.
Read more >
Mineways Documentation - Real-Time Rendering
Export Options - rendering-related export options shown on the giant dialog. ... Example: in the first image, the inside of the building is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found