diff options
Diffstat (limited to 'io_scene_gltf2/blender')
-rwxr-xr-x | io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py | 11 |
1 files changed, 10 insertions, 1 deletions
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 35c2df00..702935fb 100755 --- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py +++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py @@ -423,8 +423,17 @@ def __gather_trans_rot_scale(blender_object, export_settings): sca = __convert_swizzle_scale(sca, export_settings) if blender_object.instance_type == 'COLLECTION' and blender_object.instance_collection: - trans -= __convert_swizzle_location( + offset = -__convert_swizzle_location( blender_object.instance_collection.instance_offset, export_settings) + + s = Matrix.Diagonal(sca).to_4x4() + r = rot.to_matrix().to_4x4() + t = Matrix.Translation(trans).to_4x4() + o = Matrix.Translation(offset).to_4x4() + m = t @ r @ s @ o + + trans = m.translation + translation, rotation, scale = (None, None, None) trans[0], trans[1], trans[2] = gltf2_blender_math.round_if_near(trans[0], 0.0), gltf2_blender_math.round_if_near(trans[1], 0.0), \ gltf2_blender_math.round_if_near(trans[2], 0.0) |