[Bf-extensions-cvs] [0b4844ed] blender-v3.4-release: glTF exporter: Fix exporting skined mesh without armature

Julien Duroure noreply at git.blender.org
Sat Nov 19 06:12:36 CET 2022


Commit: 0b4844ede97062d4cfc7dc21edeec58e7c83462a
Author: Julien Duroure
Date:   Sat Nov 19 06:11:10 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rBA0b4844ede97062d4cfc7dc21edeec58e7c83462a

glTF exporter: Fix exporting skined mesh without armature

Fix exporting skined mesh without armature, when user export selection only, and export skined mesh without selecting the corresponding armature

Introduced in 97bb515d3ac4

===================================================================

M	io_scene_gltf2/__init__.py
M	io_scene_gltf2/blender/exp/gltf2_blender_gather_skins.py
M	io_scene_gltf2/blender/exp/gltf2_blender_gather_tree.py

===================================================================

diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py
index e917f535..4afcc889 100755
--- a/io_scene_gltf2/__init__.py
+++ b/io_scene_gltf2/__init__.py
@@ -4,7 +4,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": (3, 4, 46),
+    "version": (3, 4, 47),
     'blender': (3, 3, 0),
     'location': 'File > Import-Export',
     'description': 'Import-Export as glTF 2.0',
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_skins.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_skins.py
index 3e4673e1..e4a4b28c 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_skins.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_skins.py
@@ -24,6 +24,10 @@ def gather_skin(armature_uuid, export_settings):
     :return: a glTF2 skin object
     """
 
+    if armature_uuid not in export_settings['vtree'].nodes:
+        # User filtered objects to export, and keep the skined mesh, without keeping the armature
+        return None
+
     blender_armature_object = export_settings['vtree'].nodes[armature_uuid].blender_object
 
     if not __filter_skin(blender_armature_object, export_settings):
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_tree.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_tree.py
index 180327a2..2e761dba 100644
--- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_tree.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_tree.py
@@ -417,7 +417,11 @@ class VExportTree:
 
     def add_neutral_bones(self):
         added_armatures = []
-        for n in [n for n in self.nodes.values() if n.armature is not None and n.blender_type == VExportNode.OBJECT and hasattr(self.nodes[n.armature], "need_neutral_bone")]: #all skin meshes objects where neutral bone is needed
+        for n in [n for n in self.nodes.values() if \
+                n.armature is not None and \
+                n.armature in self.nodes and \
+                n.blender_type == VExportNode.OBJECT and \
+                hasattr(self.nodes[n.armature], "need_neutral_bone")]: #all skin meshes objects where neutral bone is needed
 
             if n.armature not in added_armatures:



More information about the Bf-extensions-cvs mailing list