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.5k stars 319 forks source link

Exporter fails when "Full Collection Hierachy" Option is enabled #2357

Closed benthillerkus closed 2 months ago

benthillerkus commented 2 months ago

Describe the bug When exporting with the "Full Collection Hierachy" option enabled, the export fails.

To Reproduce Steps to reproduce the behavior:

  1. Export as GLTF
  2. Select "Full Collection Hierachy"
Python: Traceback (most recent call last):
  File "C:\Program Files (x86)\Steam\steamapps\common\Blender\4.3\scripts\addons_core\io_scene_gltf2\__init__.py", line 1303, in execute
    res = gltf2_blender_export.save(context, export_settings)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files (x86)\Steam\steamapps\common\Blender\4.3\scripts\addons_core\io_scene_gltf2\blender\exp\export.py", line 37, in save
    json, buffer = __export(export_settings)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files (x86)\Steam\steamapps\common\Blender\4.3\scripts\addons_core\io_scene_gltf2\blender\exp\export.py", line 55, in __export
    __gather_gltf(exporter, export_settings)
  File "C:\Program Files (x86)\Steam\steamapps\common\Blender\4.3\scripts\addons_core\io_scene_gltf2\blender\exp\export.py", line 202, in __gather_gltf
    active_scene_idx, scenes, animations = gltf2_blender_gather.gather_gltf2(export_settings)
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files (x86)\Steam\steamapps\common\Blender\4.3\scripts\addons_core\io_scene_gltf2\blender\exp\gather.py", line 31, in gather_gltf2
    scenes.append(__gather_scene(blender_scene, export_settings))
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files (x86)\Steam\steamapps\common\Blender\4.3\scripts\addons_core\io_scene_gltf2\blender\exp\cache.py", line 37, in wrapper_cached
    result = func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files (x86)\Steam\steamapps\common\Blender\4.3\scripts\addons_core\io_scene_gltf2\blender\exp\gather.py", line 60, in __gather_scene
    vtree.construct(blender_scene)
  File "C:\Program Files (x86)\Steam\steamapps\common\Blender\4.3\scripts\addons_core\io_scene_gltf2\blender\exp\tree.py", line 142, in construct
    self.recursive_node_traverse(
  File "C:\Program Files (x86)\Steam\steamapps\common\Blender\4.3\scripts\addons_core\io_scene_gltf2\blender\exp\tree.py", line 394, in recursive_node_traverse
    self.recursive_node_traverse(
  File "C:\Program Files (x86)\Steam\steamapps\common\Blender\4.3\scripts\addons_core\io_scene_gltf2\blender\exp\tree.py", line 182, in recursive_node_traverse
    self.nodes[parent_uuid].blender_object is not None and self.nodes[parent_uuid].blender_object.is_instancer is True):
                                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Collection' object has no attribute 'is_instancer'

Expected behavior The export does not fail. Every collection and collections inside them are represented in the exported file.

Screenshots If applicable, add screenshots to help explain your problem.

.blend file/ .gltf (mandatory) You can just use the default startup file, here's mine anyways blender gltf full collection export broken.zip

Version

Additional context https://projects.blender.org/blender/blender/issues/127759

julienduroure commented 2 months ago

Confirmed