glTF exporter performance. Better cache management
Better management of case of multiple object with each multiple actions
This commit is contained in:
parent
374c730236
commit
64f4623585
|
@ -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',
|
||||
|
|
|
@ -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 :
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue