[Bf-extensions-cvs] [b8bc6b5e] master: glTF importer: Revert recent perf on keyframe creation (some issue with non sampled animation)
Julien Duroure
noreply at git.blender.org
Sun Jan 26 09:25:15 CET 2020
Commit: b8bc6b5e93e986bcb779e18078596a93b8133006
Author: Julien Duroure
Date: Sun Jan 26 09:24:26 2020 +0100
Branches: master
https://developer.blender.org/rBAb8bc6b5e93e986bcb779e18078596a93b8133006
glTF importer: Revert recent perf on keyframe creation (some issue with non sampled animation)
===================================================================
M io_scene_gltf2/__init__.py
M io_scene_gltf2/blender/imp/gltf2_blender_animation_utils.py
===================================================================
diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py
index 7cbeb08e..46e6fb26 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": (1, 2, 8),
+ "version": (1, 2, 9),
'blender': (2, 81, 6),
'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0',
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_animation_utils.py b/io_scene_gltf2/blender/imp/gltf2_blender_animation_utils.py
index 0d8cef6b..4feed76a 100644
--- a/io_scene_gltf2/blender/imp/gltf2_blender_animation_utils.py
+++ b/io_scene_gltf2/blender/imp/gltf2_blender_animation_utils.py
@@ -58,28 +58,25 @@ def make_fcurve(action, co, data_path, index=0, group_name=None, interpolation=N
group = action.groups[group_name]
fcurve.group = group
- # Set the default keyframe type in the prefs, then make keyframes
- prefs = bpy.context.preferences.edit
- try:
- orig_interp_type = prefs.keyframe_new_interpolation_type
- orig_handle_type = prefs.keyframe_new_handle_type
+ fcurve.keyframe_points.add(len(co) // 2)
+ fcurve.keyframe_points.foreach_set('co', co)
- if interpolation == 'CUBICSPLINE':
- prefs.keyframe_new_interpolation_type = 'BEZIER'
- prefs.keyframe_new_handle_type = 'AUTO'
+ # Setting interpolation
+ if interpolation == 'CUBICSPLINE':
+ for kf in fcurve.keyframe_points:
+ kf.interpolation = 'BEZIER'
+ kf.handle_right_type = 'AUTO'
+ kf.handle_left_type = 'AUTO'
+ else:
+ if interpolation == 'LINEAR':
+ blender_interpolation = 'LINEAR'
elif interpolation == 'STEP':
- prefs.keyframe_new_interpolation_type = 'CONSTANT'
- elif interpolation == 'LINEAR':
- prefs.keyframe_new_interpolation_type = 'LINEAR'
-
- fcurve.keyframe_points.add(len(co) // 2)
+ blender_interpolation = 'CONSTANT'
+ else:
+ blender_interpolation = 'LINEAR'
+ for kf in fcurve.keyframe_points:
+ kf.interpolation = blender_interpolation
- finally:
- # Restore original prefs
- prefs.keyframe_new_interpolation_type = orig_interp_type
- prefs.keyframe_new_handle_type = orig_handle_type
-
- fcurve.keyframe_points.foreach_set('co', co)
fcurve.update() # force updating tangents (this may change when tangent will be managed)
return fcurve
More information about the Bf-extensions-cvs
mailing list