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-03-09 18:20:54 +0300
committerJulien Duroure <julien.duroure@gmail.com>2020-03-09 18:20:54 +0300
commit6e7dfdd8a91fdccae321f6192dd22accb5bc2426 (patch)
treeb319d1f25dcbb518e2a91566cb0a78ac35d2a9e7 /io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py
parentf4cf9b00db36bf096e1cf5ad50127ade8b985dd2 (diff)
glTF importer: prettify bones: manage more readable bone rotation
Thanks to scurest!
Diffstat (limited to 'io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py')
-rwxr-xr-xio_scene_gltf2/blender/imp/gltf2_blender_animation_node.py13
1 files changed, 8 insertions, 5 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 a0205483..b6369b8b 100755
--- a/io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py
+++ b/io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py
@@ -74,20 +74,22 @@ class BlenderNodeAnim():
blender_path = "location"
group_name = "Location"
num_components = 3
+ values = [gltf.loc_gltf_to_blender(vals) for vals in values]
+ values = vnode.base_locs_to_final_locs(values)
if vnode.parent is not None and gltf.vnodes[vnode.parent].type == VNode.Bone:
# Nodes with a bone parent need to be translated
- # backwards by their bone length (always 1 currently)
- off = Vector((0, -1, 0))
- values = [gltf.loc_gltf_to_blender(vals) + off for vals in values]
- else:
- values = [gltf.loc_gltf_to_blender(vals) for vals in values]
+ # backwards from the tip to the root
+ bone_length = gltf.vnodes[vnode.parent].bone_length
+ off = Vector((0, -bone_length, 0))
+ values = [vals + off for vals in values]
elif channel.target.path == "rotation":
blender_path = "rotation_quaternion"
group_name = "Rotation"
num_components = 4
values = [gltf.quaternion_gltf_to_blender(vals) for vals in values]
+ values = vnode.base_rots_to_final_rots(values)
# Manage antipodal quaternions
for i in range(1, len(values)):
@@ -99,6 +101,7 @@ class BlenderNodeAnim():
group_name = "Scale"
num_components = 3
values = [gltf.scale_gltf_to_blender(vals) for vals in values]
+ values = vnode.base_scales_to_final_scales(values)
coords = [0] * (2 * len(keys))
coords[::2] = (key[0] * fps for key in keys)