Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-04-29 10:48:19 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-04-29 10:54:16 +0300
commit73af884df004171bacffb82f3ff7f6e627a12690 (patch)
treec06d59b246fff461ad82e0bff48a0cc5e284c06c /source
parent7a475a89eb398ca5f42ddfdef3c04aa8051858f2 (diff)
Fix T87592: Mirror fail with bisect, axis object & non-uniform scale
Bisect-plane calculation needed to take non-uniform scale into account.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/mesh_mirror.c13
1 files changed, 13 insertions, 0 deletions
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) {