[Bf-blender-cvs] [73af884df00] blender-v2.93-release: Fix T87592: Mirror fail with bisect, axis object & non-uniform scale

Campbell Barton noreply at git.blender.org
Thu Apr 29 09:54:35 CEST 2021


Commit: 73af884df004171bacffb82f3ff7f6e627a12690
Author: Campbell Barton
Date:   Thu Apr 29 17:48:19 2021 +1000
Branches: blender-v2.93-release
https://developer.blender.org/rB73af884df004171bacffb82f3ff7f6e627a12690

Fix T87592: Mirror fail with bisect, axis object & non-uniform scale

Bisect-plane calculation needed to take non-uniform scale into account.

===================================================================

M	source/blender/blenkernel/intern/mesh_mirror.c

===================================================================

diff --git a/source/blender/blenkernel/intern/mesh_mirror.c b/source/blender/blenkernel/intern/mesh_mirror.c
index 93a2e9058fa..3d30c218fba 100644
--- a/source/blender/blenkernel/intern/mesh_mirror.c
+++ b/source/blender/blenkernel/intern/mesh_mirror.c
@@ -183,6 +183,19 @@ Mesh *BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(MirrorModifierData *mmd,
     if (do_bisect) {
       copy_v3_v3(plane_co, itmp[3]);
       copy_v3_v3(plane_no, itmp[axis]);
+
+      /* Account for non-uniform scale in `ob`, see: T87592. */
+      float ob_scale[3] = {
+          len_squared_v3(ob->obmat[0]),
+          len_squared_v3(ob->obmat[1]),
+          len_squared_v3(ob->obmat[2]),
+      };
+      /* Scale to avoid precision loss with extreme values. */
+      const float ob_scale_max = max_fff(UNPACK3(ob_scale));
+      if (LIKELY(ob_scale_max != 0.0f)) {
+        mul_v3_fl(ob_scale, 1.0f / ob_scale_max);
+        mul_v3_v3(plane_no, ob_scale);
+      }
     }
   }
   else if (do_bisect) {



More information about the Bf-blender-cvs mailing list