Describe the bug
The GLTF exporter crashes when exporting a scene that contains the following setup:
An object has a material (e.g. the default Principled BSDF shader), with a texture serving as an input for the material (e.g. in the Base Color slot).
The object has an armature modifier applied to it for skinning. The object does not need to be parented to the armature for the crash to occur.
The exporter is set to apply modifiers on export.
To Reproduce
Steps to reproduce the behavior:
Create an armature.
Parent the default cube to it, selecting the option to deform the mesh using the armature, with automatic weights, for example.
In the material for the cube, set the base color to use an image - it can be external or internal.
Go to export a GLTF file and enable "Apply Modifiers".
Export.
The export will fail. The message I received is as follows:
Python: Traceback (most recent call last):
File "/home/solarlune/Applications/blender/4.2/scripts/addons/io_scene_gltf2/__init__.py", line 1227, in execute
res = gltf2_blender_export.save(context, export_settings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/solarlune/Applications/blender/4.2/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_export.py", line 37, in save
json, buffer = __export(export_settings)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/solarlune/Applications/blender/4.2/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_export.py", line 55, in __export
__gather_gltf(exporter, export_settings)
File "/home/solarlune/Applications/blender/4.2/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_export.py", line 196, in __gather_gltf
active_scene_idx, scenes, animations = gltf2_blender_gather.gather_gltf2(export_settings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/solarlune/Applications/blender/4.2/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather.py", line 30, in gather_gltf2
scenes.append(__gather_scene(blender_scene, export_settings))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/solarlune/Applications/blender/4.2/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_cache.py", line 36, in wrapper_cached
result = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/solarlune/Applications/blender/4.2/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather.py", line 89, in __gather_scene
node = gltf2_blender_gather_nodes.gather_node(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/solarlune/Applications/blender/4.2/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py", line 47, in gather_node
children=__gather_children(vnode, export_settings),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/solarlune/Applications/blender/4.2/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py", line 103, in __gather_children
node = gather_node(c, export_settings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/solarlune/Applications/blender/4.2/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py", line 41, in gather_node
mesh = __gather_mesh(vnode, blender_object, export_settings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/solarlune/Applications/blender/4.2/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py", line 331, in __gather_mesh
result = gltf2_blender_gather_mesh.gather_mesh(blender_mesh,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/solarlune/Applications/blender/4.2/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_cache.py", line 36, in wrapper_cached
result = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/solarlune/Applications/blender/4.2/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 "/home/solarlune/Applications/blender/4.2/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_mesh.py", line 135, in __gather_primitives
return gltf2_blender_gather_primitives.gather_primitives(blender_mesh,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/solarlune/Applications/blender/4.2/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_cache.py", line 36, in wrapper_cached
result = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/solarlune/Applications/blender/4.2/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_primitives.py", line 56, in gather_primitives
blender_primitives, addional_materials_udim = __gather_cache_primitives(materials, blender_mesh, uuid_for_skined_data,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/solarlune/Applications/blender/4.2/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_cache.py", line 36, in wrapper_cached
result = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/solarlune/Applications/blender/4.2/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_primitives.py", line 124, in __gather_cache_primitives
blender_primitives, additional_materials_udim, shared_attributes = gltf2_blender_gather_primitives_extract.extract_primitives(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/solarlune/Applications/blender/4.2/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_primitives_extract.py", line 29, in extract_primitives
primitive_creator.manage_material_info() # UVMap & Vertex Color
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/solarlune/Applications/blender/4.2/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_primitives_extract.py", line 401, in manage_material_info
base_material, material_info = get_base_material(material_idx, self.materials, self.export_settings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/solarlune/Applications/blender/4.2/scripts/addons/io_scene_gltf2/blender/exp/material/gltf2_blender_gather_materials.py", line 629, in get_base_material
material, material_info = gather_material(
^^^^^^^^^^^^^^^^
File "/home/solarlune/Applications/blender/4.2/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_cache.py", line 36, in wrapper_cached
result = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/solarlune/Applications/blender/4.2/scripts/addons/io_scene_gltf2/blender/exp/material/gltf2_blender_gather_materials.py", line 80, in gather_material
pbr_metallic_roughness, uvmap_info_pbr_metallic_roughness, vc_info, udim_info_prb_mr = __gather_pbr_metallic_roughness(blender_material, orm_texture, export_settings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/solarlune/Applications/blender/4.2/scripts/addons/io_scene_gltf2/blender/exp/material/gltf2_blender_gather_materials.py", line 433, in __gather_pbr_metallic_roughness
return gltf2_blender_gather_materials_pbr_metallic_roughness.gather_material_pbr_metallic_roughness(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/solarlune/Applications/blender/4.2/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_cache.py", line 36, in wrapper_cached
result = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/solarlune/Applications/blender/4.2/scripts/addons/io_scene_gltf2/blender/exp/material/gltf2_blender_gather_materials_pbr_metallic_roughness.py", line 27, in gather_material_pbr_metallic_roughness
base_color_texture, uvmap_info, udim_info_bc, _ = __gather_base_color_texture(blender_material, export_settings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/solarlune/Applications/blender/4.2/scripts/addons/io_scene_gltf2/blender/exp/material/gltf2_blender_gather_materials_pbr_metallic_roughness.py", line 130, in __gather_base_color_texture
tex, uvmap_info, udim_info, factor = gather_texture_info(inputs[0], inputs, export_settings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/solarlune/Applications/blender/4.2/scripts/addons/io_scene_gltf2/blender/exp/material/gltf2_blender_gather_texture_info.py", line 29, in gather_texture_info
return __gather_texture_info_helper(primary_socket, blender_shader_sockets, 'DEFAULT', filter_type, export_settings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/solarlune/Applications/blender/4.2/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_cache.py", line 36, in wrapper_cached
result = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/solarlune/Applications/blender/4.2/scripts/addons/io_scene_gltf2/blender/exp/material/gltf2_blender_gather_texture_info.py", line 54, in __gather_texture_info_helper
index, factor, udim_image = __gather_index(blender_shader_sockets, None, export_settings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/solarlune/Applications/blender/4.2/scripts/addons/io_scene_gltf2/blender/exp/material/gltf2_blender_gather_texture_info.py", line 208, in __gather_index
return gltf2_blender_gather_texture.gather_texture(blender_shader_sockets, use_tile, export_settings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/solarlune/Applications/blender/4.2/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_cache.py", line 36, in wrapper_cached
result = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/solarlune/Applications/blender/4.2/scripts/addons/io_scene_gltf2/blender/exp/material/gltf2_blender_gather_texture.py", line 44, in gather_texture
sampler=__gather_sampler(blender_shader_sockets, export_settings),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/solarlune/Applications/blender/4.2/scripts/addons/io_scene_gltf2/blender/exp/material/gltf2_blender_gather_texture.py", line 198, in __gather_sampler
return gather_sampler(
^^^^^^^^^^^^^^^
File "/home/solarlune/Applications/blender/4.2/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_cache.py", line 36, in wrapper_cached
result = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/solarlune/Applications/blender/4.2/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_sampler.py", line 21, in gather_sampler
group_path.append(bpy.data.materials[tab[0]])
~~~~~~~~~~~~~~~~~~^^^^^^^^
KeyError: 'bpy_prop_collection[key]: key "" not found'
Expected behavior
It should simply export the GLTF successfully.
Describe the bug The GLTF exporter crashes when exporting a scene that contains the following setup:
To Reproduce Steps to reproduce the behavior:
The export will fail. The message I received is as follows:
Expected behavior It should simply export the GLTF successfully.
.blend file/ .gltf (mandatory) applyModifiersArmatureBug.zip
Version
Note that I don't believe the last stable version had this issue.