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-07-21 21:14:06 +0300
committerJulien Duroure <julien.duroure@gmail.com>2020-07-21 21:14:06 +0300
commit63dd8498ac106b5645822a124aa0edb0d917d5a8 (patch)
treefe890d51836f813a75303bbc3dee83dc6a0b2326 /io_scene_gltf2/blender/exp/gltf2_blender_gather_joints.py
parent40db41a902be5dfd8305ea389aa5e8eec1aa74d6 (diff)
glTF exporter: Add support for use_inherit_rotation and inherit_scale.
Thanks Skywolf285!
Diffstat (limited to 'io_scene_gltf2/blender/exp/gltf2_blender_gather_joints.py')
-rwxr-xr-xio_scene_gltf2/blender/exp/gltf2_blender_gather_joints.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_joints.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_joints.py
index af086c1b..1cb26551 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_joints.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_joints.py
@@ -43,7 +43,14 @@ def gather_joint(blender_object, blender_bone, export_settings):
else:
correction_matrix_local = gltf2_blender_math.multiply(
blender_bone.parent.bone.matrix_local.inverted(), blender_bone.bone.matrix_local)
- matrix_basis = blender_bone.matrix_basis
+
+ if (blender_bone.bone.use_inherit_rotation == False or blender_bone.bone.inherit_scale != "FULL") and blender_bone.parent != None:
+ rest_mat = (blender_bone.parent.bone.matrix_local.inverted_safe() @ blender_bone.bone.matrix_local)
+ matrix_basis = (rest_mat.inverted_safe() @ blender_bone.parent.matrix.inverted_safe() @ blender_bone.matrix)
+ else:
+ matrix_basis = blender_bone.matrix
+ matrix_basis = blender_object.convert_space(pose_bone=blender_bone, matrix=matrix_basis, from_space='POSE', to_space='LOCAL')
+
trans, rot, sca = gltf2_blender_extract.decompose_transition(
gltf2_blender_math.multiply(correction_matrix_local, matrix_basis), export_settings)
translation, rotation, scale = (None, None, None)