Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Duroure <julien.duroure@gmail.com>2020-04-18 10:12:47 +0300
committerJulien Duroure <julien.duroure@gmail.com>2020-04-18 10:12:47 +0300
commit18a0f95a848247fce2143903b520f4433ecd7163 (patch)
tree1ccf3d37a641418d5578ce55c2f8ee46698bb52d
parentea5bb9d92065a6c7389c1a9e0415c75014cc08e8 (diff)
glTF exporter: fix bug export sampled animation with non 'classical' (constant/linear/bezier) interpolation
-rwxr-xr-xio_scene_gltf2/__init__.py2
-rwxr-xr-xio_scene_gltf2/blender/exp/gltf2_blender_gather_animation_samplers.py18
2 files changed, 10 insertions, 10 deletions
diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py
index 47e90dca..4a7b9f3c 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, 64),
+ "version": (1, 2, 65),
'blender': (2, 83, 9),
'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0',
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_samplers.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_samplers.py
index b95b576a..f2375bb1 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_samplers.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_samplers.py
@@ -271,19 +271,19 @@ def __gather_interpolation(channels: typing.Tuple[bpy.types.FCurve],
# If only single keyframe revert to STEP
if max_keyframes < 2:
return 'STEP'
- else:
- blender_keyframe = [c for c in channels if c is not None][0].keyframe_points[0]
- # For sampled animations: CONSTANT are STEP, other are LINEAR
- return {
- "BEZIER": "LINEAR",
- "LINEAR": "LINEAR",
- "CONSTANT": "STEP"
- }[blender_keyframe.interpolation]
+ # If all keyframes are CONSTANT, we can use STEP.
+ if all(all(k.interpolation == 'CONSTANT' for k in c.keyframe_points) for c in channels if c is not None):
+ return 'STEP'
+
+ # Otherwise, sampled keyframes use LINEAR interpolation.
+ return 'LINEAR'
+ # Non-sampled keyframes implies that all keys are of the same type, and that the
+ # type is supported by glTF (because we checked in needs_baking).
blender_keyframe = [c for c in channels if c is not None][0].keyframe_points[0]
- # Select the interpolation method. Any unsupported method will fallback to STEP
+ # Select the interpolation method.
return {
"BEZIER": "CUBICSPLINE",
"LINEAR": "LINEAR",