[Bf-extensions-cvs] [efc92efe] master: Fix regression in glTF animation export

Julien Duroure noreply at git.blender.org
Tue Jul 16 12:15:29 CEST 2019


Commit: efc92efec2cfeeb13d269bf82695994285aebb6a
Author: Julien Duroure
Date:   Tue Jul 16 12:11:49 2019 +0200
Branches: master
https://developer.blender.org/rBAefc92efec2cfeeb13d269bf82695994285aebb6a

Fix regression in glTF animation export

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

M	io_scene_gltf2/__init__.py
M	io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py
M	io_scene_gltf2/io/exp/gltf2_io_draco_compression_extension.py

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

diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py
index f3fd36b9..f85502f9 100755
--- a/io_scene_gltf2/__init__.py
+++ b/io_scene_gltf2/__init__.py
@@ -15,7 +15,7 @@
 bl_info = {
     'name': 'glTF 2.0 format',
     'author': 'Julien Duroure, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
-    "version": (0, 9, 35),
+    "version": (0, 9, 36),
     'blender': (2, 80, 0),
     'location': 'File > Import-Export',
     'description': 'Import-Export as glTF 2.0',
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py
index dcc1d7ad..f1fc31a2 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py
@@ -30,8 +30,24 @@ from io_scene_gltf2.io.com import gltf2_io
 from io_scene_gltf2.io.com import gltf2_io_extensions
 
 
- at cached
 def gather_node(blender_object, blender_scene, export_settings):
+    # custom cache to avoid cache miss when called from animation
+    # with blender_scene=None
+
+    # invalidate cache if export settings have changed
+    if not hasattr(gather_node, "__export_settings") or export_settings != gather_node.__export_settings:
+        gather_node.__cache = {}
+        gather_node.__export_settings = export_settings
+
+    if blender_scene is None and blender_object.name in gather_node.__cache:
+        return gather_node.__cache[blender_object.name]
+
+    node = __gather_node(blender_object, blender_scene, export_settings)
+    gather_node.__cache[blender_object.name] = node
+    return node
+
+ at cached
+def __gather_node(blender_object, blender_scene, export_settings):
     # If blender_scene is None, we are coming from animation export
     # Check to know if object is exported is already done, so we don't check
     # again if object is instanced in scene : this check was already done when exporting object itself
@@ -72,12 +88,12 @@ def gather_node(blender_object, blender_scene, export_settings):
 def __filter_node(blender_object, blender_scene, export_settings):
     if blender_object.users == 0:
         return False
-    if export_settings[gltf2_blender_export_keys.SELECTED] and blender_object.select_get() is False:
-        return False
     if blender_scene is not None:
         instanced =  any([blender_object.name in layer.objects for layer in blender_scene.view_layers])
         if instanced is False:
             return False
+    if export_settings[gltf2_blender_export_keys.SELECTED] and blender_object.select_get() is False:
+        return False
 
     return True
 
diff --git a/io_scene_gltf2/io/exp/gltf2_io_draco_compression_extension.py b/io_scene_gltf2/io/exp/gltf2_io_draco_compression_extension.py
index c0450539..6ae48fff 100644
--- a/io_scene_gltf2/io/exp/gltf2_io_draco_compression_extension.py
+++ b/io_scene_gltf2/io/exp/gltf2_io_draco_compression_extension.py
@@ -159,7 +159,7 @@ def __traverse_node(node, f):
     f(node)
     if not (node.children is None):
         for child in node.children:
-            __traverse_node(child)
+            __traverse_node(child, f)
 
 
 def __compress_primitive(primitive, dll, export_settings):



More information about the Bf-extensions-cvs mailing list