GLTF exporter fails with IndexError in primitive_creation #104852

Closed
opened 2023-08-28 07:06:02 +02:00 by Pratik Borhade · 5 comments
Member

System Information
Operating system: Ubuntu Linux
Graphics card: 5700xt

Blender Version
Broken: 3.6.2

Short description of error
Exporting a cell fracture animation as GLB throws an error.

Exact steps for others to reproduce the error
Based on the default startup or an attached .blend file (as simple as possible).

  1. Create a mesh, merge into one object.
  2. Run create cell fracture on it (adding a force field)
  3. Baked the animations.
  4. Export as GLB (initially attempt to merge all animations into single animation, failed with error below)
  5. Attempt to export GLB without merging animation, same error.
    Have attached a blend file

I did a similar animation on a different mesh last week and it worked, so my assumption is this mesh is stranger or has some quirk.

Call stack ``` Python: Traceback (most recent call last): File "/snap/blender/3915/3.6/scripts/addons/io_scene_gltf2/__init__.py", line 852, in execute return gltf2_blender_export.save(context, export_settings) File "/snap/blender/3915/3.6/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_export.py", line 34, in save json, buffer = __export(export_settings) File "/snap/blender/3915/3.6/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_export.py", line 51, in __export __gather_gltf(exporter, export_settings) File "/snap/blender/3915/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 "/snap/blender/3915/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 "/snap/blender/3915/3.6/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_cache.py", line 35, in wrapper_cached result = func(*args, **kwargs) File "/snap/blender/3915/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 "/snap/blender/3915/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 "/snap/blender/3915/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 "/snap/blender/3915/3.6/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_cache.py", line 35, in wrapper_cached result = func(*args, **kwargs) File "/snap/blender/3915/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 "/snap/blender/3915/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 "/snap/blender/3915/3.6/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_cache.py", line 35, in wrapper_cached result = func(*args, **kwargs) File "/snap/blender/3915/3.6/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_primitives.py", line 63, in gather_primitives blender_primitives = __gather_cache_primitives(blender_mesh, uuid_for_skined_data, File "/snap/blender/3915/3.6/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_cache.py", line 35, in wrapper_cached result = func(*args, **kwargs) File "/snap/blender/3915/3.6/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_primitives.py", line 131, in __gather_cache_primitives blender_primitives = gltf2_blender_gather_primitives_extract.extract_primitives( File "/snap/blender/3915/3.6/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_primitives_extract.py", line 24, in extract_primitives return primitive_creator.primitive_creation() File "/snap/blender/3915/3.6/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_primitives_extract.py", line 387, in primitive_creation self.prim_dots = self.dots[dot_indices] IndexError: index 18389 is out of bounds for axis 0 with size 18383 ```

Originally reported at: blender/blender#111598

**System Information** Operating system: Ubuntu Linux Graphics card: 5700xt **Blender Version** Broken: 3.6.2 **Short description of error** Exporting a cell fracture animation as GLB throws an error. **Exact steps for others to reproduce the error** Based on the default startup or an attached .blend file (as simple as possible). 1. Create a mesh, merge into one object. 2. Run create cell fracture on it (adding a force field) 3. Baked the animations. 4. Export as GLB (initially attempt to merge all animations into single animation, failed with error below) 6. Attempt to export GLB without merging animation, same error. Have attached a blend file I did a similar animation on a different mesh last week and it worked, so my assumption is this mesh is stranger or has some quirk. <details> <summary> Call stack </summary> ``` Python: Traceback (most recent call last): File "/snap/blender/3915/3.6/scripts/addons/io_scene_gltf2/__init__.py", line 852, in execute return gltf2_blender_export.save(context, export_settings) File "/snap/blender/3915/3.6/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_export.py", line 34, in save json, buffer = __export(export_settings) File "/snap/blender/3915/3.6/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_export.py", line 51, in __export __gather_gltf(exporter, export_settings) File "/snap/blender/3915/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 "/snap/blender/3915/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 "/snap/blender/3915/3.6/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_cache.py", line 35, in wrapper_cached result = func(*args, **kwargs) File "/snap/blender/3915/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 "/snap/blender/3915/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 "/snap/blender/3915/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 "/snap/blender/3915/3.6/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_cache.py", line 35, in wrapper_cached result = func(*args, **kwargs) File "/snap/blender/3915/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 "/snap/blender/3915/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 "/snap/blender/3915/3.6/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_cache.py", line 35, in wrapper_cached result = func(*args, **kwargs) File "/snap/blender/3915/3.6/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_primitives.py", line 63, in gather_primitives blender_primitives = __gather_cache_primitives(blender_mesh, uuid_for_skined_data, File "/snap/blender/3915/3.6/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_cache.py", line 35, in wrapper_cached result = func(*args, **kwargs) File "/snap/blender/3915/3.6/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_primitives.py", line 131, in __gather_cache_primitives blender_primitives = gltf2_blender_gather_primitives_extract.extract_primitives( File "/snap/blender/3915/3.6/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_primitives_extract.py", line 24, in extract_primitives return primitive_creator.primitive_creation() File "/snap/blender/3915/3.6/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_primitives_extract.py", line 387, in primitive_creation self.prim_dots = self.dots[dot_indices] IndexError: index 18389 is out of bounds for axis 0 with size 18383 ``` </details> Originally reported at: https://projects.blender.org/blender/blender/issues/111598
Pratik Borhade added the
Priority
Normal
Status
Needs Triage
Type
Report
labels 2023-08-28 07:06:03 +02:00
Julien Duroure self-assigned this 2023-08-29 06:12:42 +02:00
Member

Hello,
Please provide the .blend file you are trying to export.

Hello, Please provide the .blend file you are trying to export.
Julien Duroure removed their assignment 2023-08-29 06:18:01 +02:00
Julien Duroure added
Status
Needs Information from User
and removed
Status
Needs Triage
labels 2023-08-29 06:18:11 +02:00
Author
Member

@JulienDuroure hi, it is provided in original report 😅 : blender/blender#111598

Anyways, uploading here: test file

@JulienDuroure hi, it is provided in original report 😅 : https://projects.blender.org/blender/blender/issues/111598 Anyways, uploading here: [test file](https://projects.blender.org/attachments/c5d0ecbc-6afd-4eca-ada0-17981d759358)
Member

Here is a simpler file with no animation, and only the object responsible of the backtrace.

Seems the cell fracture does not generate a valid mesh here, as bpy.context.object.data.validate() returns True.

glTF can't export it correctly, as the mesh is not valid. Let's add a check, and skip this primitive/mesh

Here is a simpler file with no animation, and only the object responsible of the backtrace. Seems the cell fracture does not generate a valid mesh here, as bpy.context.object.data.validate() returns True. glTF can't export it correctly, as the mesh is not valid. Let's add a check, and skip this primitive/mesh
Author
Member

Indeed, mesh is corrupted.

Let's add a check, and skip this primitive/mesh

So, are you adding a condition mesh.validate to skip invalid geometries?

Indeed, mesh is corrupted. > Let's add a check, and skip this primitive/mesh So, are you adding a condition `mesh.validate` to skip invalid geometries?
Member

We already have a mesh.validate, that sometime solve the mesh issue, and let export some part of the mesh, depending the initial issue on the mesh.
My proposition is to add a Warning when validate() changed the mesh, and omit invalid geometry only in case we can't export anything.
Here is the PR : https://github.com/KhronosGroup/glTF-Blender-IO/pull/1977/files

We already have a mesh.validate, that sometime solve the mesh issue, and let export some part of the mesh, depending the initial issue on the mesh. My proposition is to add a Warning when validate() changed the mesh, and omit invalid geometry only in case we can't export anything. Here is the PR : https://github.com/KhronosGroup/glTF-Blender-IO/pull/1977/files
Julien Duroure added
Status
Confirmed
and removed
Status
Needs Information from User
labels 2023-08-30 17:43:29 +02:00
Blender Bot added
Status
Resolved
and removed
Status
Confirmed
labels 2023-09-06 17:38:19 +02:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#104852
No description provided.