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 97bb515d3a
This commit is contained in:
Julien Duroure 2022-11-19 06:11:10 +01:00
parent c79b5d9325
commit 0b4844ede9
3 changed files with 10 additions and 2 deletions

View File

@ -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',

View File

@ -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):

View File

@ -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: