[Bf-extensions-cvs] [7581c8f2] master: FBX: Make importing heavy animations twice more quicker.
Bastien Montagne
noreply at git.blender.org
Fri May 22 15:44:00 CEST 2020
Commit: 7581c8f2f2f0856164dd6ed84d66034282b22029
Author: Bastien Montagne
Date: Fri May 22 15:42:14 2020 +0200
Branches: master
https://developer.blender.org/rBA7581c8f2f2f0856164dd6ed84d66034282b22029
FBX: Make importing heavy animations twice more quicker.
Further optimizations on top of rBA8e70aeae091c5b357.
Note that these changes require latest master (2.90.3 at least).
===================================================================
M io_scene_fbx/__init__.py
M io_scene_fbx/import_fbx.py
===================================================================
diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py
index 08e95cf9..2e7d6987 100644
--- a/io_scene_fbx/__init__.py
+++ b/io_scene_fbx/__init__.py
@@ -21,8 +21,8 @@
bl_info = {
"name": "FBX format",
"author": "Campbell Barton, Bastien Montagne, Jens Restemeier",
- "version": (4, 21, 0),
- "blender": (2, 81, 6),
+ "version": (4, 21, 1),
+ "blender": (2, 90, 3),
"location": "File > Import-Export",
"description": "FBX IO meshes, UV's, vertex colors, materials, textures, cameras, lamps and actions",
"warning": "",
diff --git a/io_scene_fbx/import_fbx.py b/io_scene_fbx/import_fbx.py
index e580a147..a2534884 100644
--- a/io_scene_fbx/import_fbx.py
+++ b/io_scene_fbx/import_fbx.py
@@ -583,7 +583,7 @@ def blen_read_animations_action_item(action, item, cnodes, fps, anim_offset):
fc_key = (fc.data_path, fc.array_index)
if not keyframes.get(fc_key):
keyframes[fc_key] = []
- keyframes[fc_key].append((frame, value))
+ keyframes[fc_key].extend((frame, value))
if isinstance(item, Material):
grpname = item.name
@@ -712,15 +712,13 @@ def blen_read_animations_action_item(action, item, cnodes, fps, anim_offset):
# Add all keyframe points at once
fcurve = action.fcurves.find(data_path=data_path, index=index)
- num_keys = len(key_values)
+ num_keys = len(key_values) // 2
fcurve.keyframe_points.add(num_keys)
+ fcurve.keyframe_points.foreach_set('co', key_values)
+ linear_enum_value = bpy.types.Keyframe.bl_rna.properties['interpolation'].enum_items['LINEAR'].value
+ fcurve.keyframe_points.foreach_set('interpolation', (linear_enum_value,) * num_keys)
- # Apply values to each keyframe point
- for kf_point, v in zip(fcurve.keyframe_points, key_values):
- kf_point.co = v
- kf_point.interpolation = 'LINEAR'
-
- # Since we inserted our keyframes in 'FAST' mode, we have to update the fcurves now.
+ # Since we inserted our keyframes in 'ultra-fast' mode, we have to update the fcurves now.
for fc in blen_curves:
fc.update()
More information about the Bf-extensions-cvs
mailing list