diff options
author | Cian Jinks <cjinks99@gmail.com> | 2022-01-04 23:26:09 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2022-01-11 12:28:07 +0300 |
commit | 9a7b1d22450cd4ccec82c2cd5b64ad6b610cc05d (patch) | |
tree | 634b151092b6aae5c0585d2d11a191d60cfc6d1c | |
parent | 72aefef9d23aa0c355822324b91e83c1f3fbbaab (diff) |
Fix T94145: Knife tool fails in orthographic mode
Calculating min and max orthographic extent forgot to convert to
worldspace coordinates.
-rw-r--r-- | source/blender/editors/mesh/editmesh_knife.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 18ae112de47..bda4087ce6b 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -2605,6 +2605,7 @@ static bool knife_ray_intersect_face(KnifeTool_OpData *kcd, /** * Calculate the center and maximum excursion of mesh. + * (Considers all meshes in multi-object edit mode) */ static void calc_ortho_extent(KnifeTool_OpData *kcd) { @@ -2613,6 +2614,7 @@ static void calc_ortho_extent(KnifeTool_OpData *kcd) BMIter iter; BMVert *v; float min[3], max[3]; + float ws[3]; INIT_MINMAX(min, max); for (uint b = 0; b < kcd->objects_len; b++) { @@ -2620,11 +2622,17 @@ static void calc_ortho_extent(KnifeTool_OpData *kcd) em = BKE_editmesh_from_object(ob); if (kcd->cagecos[b]) { - minmax_v3v3_v3_array(min, max, kcd->cagecos[b], em->bm->totvert); + for (int i = 0; i < em->bm->totvert; i++) { + copy_v3_v3(ws, kcd->cagecos[b][i]); + mul_m4_v3(ob->obmat, ws); + minmax_v3v3_v3(min, max, ws); + } } else { BM_ITER_MESH (v, &iter, em->bm, BM_VERTS_OF_MESH) { - minmax_v3v3_v3(min, max, v->co); + copy_v3_v3(ws, v->co); + mul_m4_v3(ob->obmat, ws); + minmax_v3v3_v3(min, max, ws); } } } |