diff options
author | Bastien Montagne <bastien@blender.org> | 2020-05-22 16:42:14 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-05-22 16:42:14 +0300 |
commit | 7581c8f2f2f0856164dd6ed84d66034282b22029 (patch) | |
tree | fd78bfdae2b942b5378b47685e175a7d2d1ed504 /io_scene_fbx | |
parent | 8e70aeae091c5b3578ded4b6977150e6d19b3c48 (diff) |
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).
Diffstat (limited to 'io_scene_fbx')
-rw-r--r-- | io_scene_fbx/__init__.py | 4 | ||||
-rw-r--r-- | io_scene_fbx/import_fbx.py | 14 |
2 files changed, 8 insertions, 10 deletions
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() |