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>2021-09-15 18:34:32 +0300
committerJulien Duroure <julien.duroure@gmail.com>2021-09-15 18:34:32 +0300
commit29c9aa34754494bc478a08f0be60f38f4844a83d (patch)
tree59cd0f15ca95a01d5ae0a42bec7a5e21ca31ba9f /io_scene_gltf2/blender/exp/gltf2_blender_extract.py
parent4d562682c099ce740d705893008a91a30a206710 (diff)
glTF exporter: cleanup: use inverted_safe on matrices
Diffstat (limited to 'io_scene_gltf2/blender/exp/gltf2_blender_extract.py')
-rwxr-xr-xio_scene_gltf2/blender/exp/gltf2_blender_extract.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_extract.py b/io_scene_gltf2/blender/exp/gltf2_blender_extract.py
index dc508d18..f7318c2b 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_extract.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_extract.py
@@ -387,7 +387,7 @@ def __get_positions(blender_mesh, key_blocks, armature, blender_object, export_s
# Transform for skinning
if armature and blender_object:
- apply_matrix = armature.matrix_world.inverted() @ blender_object.matrix_world
+ apply_matrix = armature.matrix_world.inverted_safe() @ blender_object.matrix_world
loc_transform = armature.matrix_world @ apply_matrix
loc_transform = blender_object.matrix_world
@@ -427,8 +427,8 @@ def __get_normals(blender_mesh, key_blocks, armature, blender_object, export_set
# Transform for skinning
if armature and blender_object:
- apply_matrix = (armature.matrix_world.inverted() @ blender_object.matrix_world)
- apply_matrix = apply_matrix.to_3x3().inverted().transposed()
+ apply_matrix = (armature.matrix_world.inverted_safe() @ blender_object.matrix_world)
+ apply_matrix = apply_matrix.to_3x3().inverted_safe().transposed()
normal_transform = armature.matrix_world.to_3x3() @ apply_matrix
normals[:] = __apply_mat_to_all(normal_transform, normals)
@@ -463,7 +463,7 @@ def __get_tangents(blender_mesh, armature, blender_object, export_settings):
# Transform for skinning
if armature and blender_object:
- apply_matrix = armature.matrix_world.inverted() @ blender_object.matrix_world
+ apply_matrix = armature.matrix_world.inverted_safe() @ blender_object.matrix_world
tangent_transform = apply_matrix.to_quaternion().to_matrix()
tangents = __apply_mat_to_all(tangent_transform, tangents)
__normalize_vecs(tangents)
@@ -482,7 +482,7 @@ def __get_bitangent_signs(blender_mesh, armature, blender_object, export_setting
if armature and blender_object:
# Bitangent signs should flip when handedness changes
# TODO: confirm
- apply_matrix = armature.matrix_world.inverted() @ blender_object.matrix_world
+ apply_matrix = armature.matrix_world.inverted_safe() @ blender_object.matrix_world
tangent_transform = apply_matrix.to_quaternion().to_matrix()
flipped = tangent_transform.determinant() < 0
if flipped: