[Bf-extensions-cvs] [7ab9100d] blender-v2.82-release: glTF exporter: fix some strange reference error in blender api when exporting shapekeys / ApplyModifier

Julien Duroure noreply at git.blender.org
Mon Mar 9 20:54:52 CET 2020


Commit: 7ab9100d4a295b810aff90b0d240b932cb4c4942
Author: Julien Duroure
Date:   Wed Feb 19 22:30:46 2020 +0100
Branches: blender-v2.82-release
https://developer.blender.org/rBA7ab9100d4a295b810aff90b0d240b932cb4c4942

glTF exporter: fix some strange reference error in blender api when exporting shapekeys / ApplyModifier

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

M	io_scene_gltf2/blender/exp/gltf2_blender_gather_mesh.py

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

diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_mesh.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_mesh.py
index 50df1395..6a381c8f 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_mesh.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_mesh.py
@@ -135,6 +135,14 @@ def __gather_weights(blender_mesh: bpy.types.Mesh,
                      export_settings
                      ) -> Optional[List[float]]:
 
+    # Seems that in some files, when using Apply Modifier, shape_keys return an error
+    # ReferenceError: StructRNA of type Mesh has been removed
+    # Because shapekeys are not exported in that case, we can return None
+    try:
+        blender_mesh.shape_keys
+    except:
+        return None
+
     if not export_settings[MORPH] or not blender_mesh.shape_keys:
         return None



More information about the Bf-extensions-cvs mailing list