[Bf-extensions-cvs] [a96fa1e6] master: glTF exporter: fix transforms for mesh parented directly to bones
Julien Duroure
noreply at git.blender.org
Sun Nov 24 10:59:54 CET 2019
Commit: a96fa1e6111a62ac0d179e149419844b71323996
Author: Julien Duroure
Date: Sun Nov 24 10:59:25 2019 +0100
Branches: master
https://developer.blender.org/rBAa96fa1e6111a62ac0d179e149419844b71323996
glTF exporter: fix transforms for mesh parented directly to bones
===================================================================
M io_scene_gltf2/__init__.py
M io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py
===================================================================
diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py
index 3b72e89d..c3d2a9ff 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, 1, 15),
+ "version": (1, 1, 16),
'blender': (2, 81, 6),
'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0',
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py
index a0cc9bf2..f1901180 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py
@@ -174,8 +174,8 @@ def __gather_children(blender_object, blender_scene, export_settings):
rot_quat = Quaternion(rot)
axis_basis_change = Matrix(
((1.0, 0.0, 0.0, 0.0), (0.0, 0.0, -1.0, 0.0), (0.0, 1.0, 0.0, 0.0), (0.0, 0.0, 0.0, 1.0)))
- mat = gltf2_blender_math.multiply(axis_basis_change, child.matrix_basis)
- mat = gltf2_blender_math.multiply(child.matrix_parent_inverse, mat)
+ mat = gltf2_blender_math.multiply(child.matrix_parent_inverse, child.matrix_basis)
+ mat = gltf2_blender_math.multiply(mat, axis_basis_change)
_, rot_quat, _ = mat.decompose()
child_node.rotation = [rot_quat[1], rot_quat[2], rot_quat[3], rot_quat[0]]
@@ -185,7 +185,7 @@ def __gather_children(blender_object, blender_scene, export_settings):
if trans is None:
trans = [0, 0, 0]
# bones go down their local y axis
- bone_tail = [0, blender_bone.length, 0]
+ bone_tail = [0, blender_bone.length / blender_bone.matrix.to_scale()[1], 0]
child_node.translation = [trans[idx] + bone_tail[idx] for idx in range(3)]
parent_joint.children.append(child_node)
More information about the Bf-extensions-cvs
mailing list