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>2018-12-19 23:18:23 +0300
committerJulien Duroure <julien.duroure@gmail.com>2018-12-19 23:18:23 +0300
commit9c914cb37526bd8c080e84886d70e582618cc128 (patch)
treeaf78cf5c3a3ee9d5713dd561e1f282a5d7bd5495 /io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py
parent6a1ce20043860e4f836294d46a86b5fcf7fbf1a8 (diff)
glTF import: add support of KHR_lights_punctual extension
Diffstat (limited to 'io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py')
-rwxr-xr-xio_scene_gltf2/blender/imp/gltf2_blender_animation_node.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py b/io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py
index c053f84a..60947c1f 100755
--- a/io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py
+++ b/io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py
@@ -16,6 +16,7 @@ import bpy
from mathutils import Vector
from ..com.gltf2_blender_conversion import loc_gltf_to_blender, quaternion_gltf_to_blender, scale_gltf_to_blender
+from ..com.gltf2_blender_conversion import correction_rotation
from ...io.imp.gltf2_io_binary import BinaryData
@@ -96,9 +97,15 @@ class BlenderNodeAnim():
for idx, key in enumerate(keys):
if animation.samplers[channel.sampler].interpolation == "CUBICSPLINE":
# TODO manage tangent?
- obj.rotation_quaternion = quaternion_gltf_to_blender(values[idx * 3 + 1])
+ vals = values[idx * 3 + 1]
else:
- obj.rotation_quaternion = quaternion_gltf_to_blender(values[idx])
+ vals = values[idx]
+
+ if node.correction_needed is True:
+ obj.rotation_quaternion = (quaternion_gltf_to_blender(vals).to_matrix().to_4x4() @ correction_rotation()).to_quaternion()
+ else:
+ obj.rotation_quaternion = quaternion_gltf_to_blender(vals)
+
obj.keyframe_insert(blender_path, frame=key[0] * fps, group='rotation')
# Setting interpolation