[Bf-extensions-cvs] [64f46235] master: glTF exporter performance. Better cache management

Julien Duroure noreply at git.blender.org
Tue Mar 29 17:50:01 CEST 2022


Commit: 64f462358522f914cad4828b3a2e7a4aba900676
Author: Julien Duroure
Date:   Tue Mar 29 17:49:53 2022 +0200
Branches: master
https://developer.blender.org/rBA64f462358522f914cad4828b3a2e7a4aba900676

glTF exporter performance. Better cache management

Better management of case of multiple object with each multiple actions

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

M	io_scene_gltf2/__init__.py
M	io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_sampler_keyframes.py
M	io_scene_gltf2/blender/exp/gltf2_blender_gather_cache.py

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

diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py
index 9d8ccca2..d08c39dd 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, 2, 19),
+    "version": (3, 2, 20),
     'blender': (3, 1, 0),
     'location': 'File > Import-Export',
     'description': 'Import-Export as glTF 2.0',
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_sampler_keyframes.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_sampler_keyframes.py
index 66ce11c7..e1ed19ea 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_sampler_keyframes.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_sampler_keyframes.py
@@ -132,7 +132,8 @@ def get_object_matrix(blender_obj_uuid: str,
                       bake_range_end: int,
                       current_frame: int,
                       step: int,
-                      export_settings
+                      export_settings,
+                      only_gather_provided=False
                     ):
 
     data = {}
@@ -144,11 +145,16 @@ def get_object_matrix(blender_obj_uuid: str,
     start_frame = min([v[0] for v in [a.frame_range for a in bpy.data.actions]])
     end_frame = max([v[1] for v in [a.frame_range for a in bpy.data.actions]])
 
+    if only_gather_provided:
+        obj_uuids = [blender_obj_uuid]
+    else:
+        obj_uuids = [uid for (uid, n) in export_settings['vtree'].nodes.items() if n.blender_type not in [VExportNode.BONE]]
+
     frame = start_frame
     while frame <= end_frame:
         bpy.context.scene.frame_set(int(frame))
 
-        for obj_uuid in [uid for (uid, n) in export_settings['vtree'].nodes.items() if n.blender_type not in [VExportNode.BONE]]:
+        for obj_uuid in obj_uuids:
             blender_obj = export_settings['vtree'].nodes[obj_uuid].blender_object
 
             # if this object is not animated, do not skip :
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_cache.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_cache.py
index 4f95431c..3539b968 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_cache.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_cache.py
@@ -93,7 +93,7 @@ def objectcache(func):
         # object is in cache, but not this action
         # We need to keep other actions
         elif cache_key_args[1] not in func.__objectcache[cache_key_args[0]].keys():
-            result = func(*args)
+            result = func(*args, only_gather_provided=True)
             func.__objectcache[cache_key_args[0]][cache_key_args[1]] = result[cache_key_args[0]][cache_key_args[1]]
             return result[cache_key_args[0]][cache_key_args[1]][cache_key_args[4]]
         # all is already cached



More information about the Bf-extensions-cvs mailing list