KhronosGroup / glTF-Blender-IO

Blender glTF 2.0 importer and exporter
https://docs.blender.org/manual/en/latest/addons/import_export/scene_gltf2.html
Apache License 2.0
1.48k stars 316 forks source link

export_scene.gltf throws exception when Color Attribute is being used #2325

Open bachirelkhoury opened 3 weeks ago

bachirelkhoury commented 3 weeks ago

Describe the bug When exporting a scene where a mesh has a Vertex Color Attribute assigned, the Exception is being thrown.

Python: Traceback (most recent call last):
  File "/Applications/Blender.app/Contents/Resources/4.2/scripts/modules/bpy/ops.py", line 109, in __call__
    ret = _op_call(self.idname_py(), kw)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Error: Python: Traceback (most recent call last):
  File "/Applications/Blender.app/Contents/Resources/4.2/scripts/addons_core/io_scene_gltf2/__init__.py", line 1288, in execute
    res = gltf2_blender_export.save(context, export_settings)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/Blender.app/Contents/Resources/4.2/scripts/addons_core/io_scene_gltf2/blender/exp/gltf2_blender_export.py", line 37, in save
    json, buffer = __export(export_settings)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/Blender.app/Contents/Resources/4.2/scripts/addons_core/io_scene_gltf2/blender/exp/gltf2_blender_export.py", line 65, in __export
    __detect_animated_extensions(exporter.glTF.to_dict(), export_settings)
                                 ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/Blender.app/Contents/Resources/4.2/scripts/addons_core/io_scene_gltf2/io/com/gltf2_io.py", line 1180, in to_dict
    result["accessors"] = from_union([lambda x: from_list(lambda x: to_class(Accessor, x), x), from_none],
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/Blender.app/Contents/Resources/4.2/scripts/addons_core/io_scene_gltf2/io/com/gltf2_io.py", line 46, in from_union
    assert False
AssertionError
Location: /Applications/Blender.app/Contents/Resources/4.2/scripts/modules/bpy/ops.py:109

To Reproduce Steps to reproduce the behavior:

  1. Open the attached Blender file in Blender 4.2 or 4.2.1 LTS then Click on Scripting
  2. Select TestExportGLTF
  3. Select "base_mesh" object
  4. Run the script

Expected behavior I expect the selected object to be exported to gltf succesfully.

Screenshots image

See file attached: test-verext-color-exception.blend.zip

Version

julienduroure commented 3 weeks ago

Confirmed. This is a duplicate of #2319 Bug is on loose edges & loose vertices