From 7c6975f6c88ffffda4e9514265ae4ebf9ddd5e27 Mon Sep 17 00:00:00 2001 From: Julien Duroure Date: Fri, 30 Aug 2024 06:26:47 +0200 Subject: [PATCH] glTF exporter: avoid double export Make sure to not check instances inside instances collection when GN instance is enable. --- scripts/addons_core/io_scene_gltf2/__init__.py | 2 +- scripts/addons_core/io_scene_gltf2/blender/exp/tree.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/addons_core/io_scene_gltf2/__init__.py b/scripts/addons_core/io_scene_gltf2/__init__.py index e697c68d55d..3b3c4a10ef1 100755 --- a/scripts/addons_core/io_scene_gltf2/__init__.py +++ b/scripts/addons_core/io_scene_gltf2/__init__.py @@ -5,7 +5,7 @@ bl_info = { 'name': 'glTF 2.0 format', 'author': 'Julien Duroure, Scurest, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors', - "version": (4, 3, 15), + "version": (4, 3, 16), 'blender': (4, 2, 0), 'location': 'File > Import-Export', 'description': 'Import-Export as glTF 2.0', diff --git a/scripts/addons_core/io_scene_gltf2/blender/exp/tree.py b/scripts/addons_core/io_scene_gltf2/blender/exp/tree.py index 62030dbb638..e87959561af 100644 --- a/scripts/addons_core/io_scene_gltf2/blender/exp/tree.py +++ b/scripts/addons_core/io_scene_gltf2/blender/exp/tree.py @@ -448,7 +448,9 @@ class VExportTree: dupli_world_matrix=mat) # Geometry Nodes instances - if self.export_settings['gltf_gn_mesh'] is True: + # Make sure to not check instances for instanced collection, because we + # will export what's inside the collection twice + if self.export_settings['gltf_gn_mesh'] is True and node.blender_type == VExportNode.OBJECT: # Do not force export as empty # Because GN graph can have both geometry and instances depsgraph = bpy.context.evaluated_depsgraph_get()