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
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-09-16 16:59:02 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-09-16 18:34:48 +0400
commitba314683fb81ac402d5e925b5770bd2060ba739c (patch)
tree767e2aa8e611c463abb57e320b09001c82bcb090 /source/blender/editors/mesh
parentaba5fc29d5817d8bb81c95efa0569bda21ba2a3f (diff)
Fix T41849: Knife fails with small lens
knife cursor depth could be projected behind the view with a wide angle lens.
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r--source/blender/editors/mesh/editmesh_knife.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index 30d8918d85c..07dc1b00363 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -183,6 +183,8 @@ typedef struct KnifeTool_OpData {
float projmat[4][4];
float projmat_inv[4][4];
+ /* vector along view z axis (object space, normalized) */
+ float proj_zaxis[3];
KnifeColors colors;
@@ -1921,8 +1923,12 @@ static int knife_update_active(KnifeTool_OpData *kcd)
knife_input_ray_segment(kcd, kcd->curr.mval, 1.0f, origin, origin_ofs);
- closest_to_line_v3(kcd->curr.cage, kcd->prev.cage, origin_ofs, origin);
- copy_v3_v3(kcd->curr.co, kcd->curr.cage);
+ if (!isect_line_plane_v3(kcd->curr.cage, origin, origin_ofs, kcd->prev.cage, kcd->proj_zaxis)) {
+ copy_v3_v3(kcd->curr.cage, kcd->prev.cage);
+
+ /* should never fail! */
+ BLI_assert(0);
+ }
}
if (kcd->mode == MODE_DRAGGING) {
@@ -2621,6 +2627,10 @@ static void knife_recalc_projmat(KnifeTool_OpData *kcd)
ED_view3d_ob_project_mat_get(kcd->ar->regiondata, kcd->ob, kcd->projmat);
invert_m4_m4(kcd->projmat_inv, kcd->projmat);
+ copy_v3_v3(kcd->proj_zaxis, kcd->vc.rv3d->viewinv[2]);
+ mul_mat3_m4_v3(kcd->ob->imat, kcd->proj_zaxis);
+ normalize_v3(kcd->proj_zaxis);
+
kcd->is_ortho = ED_view3d_clip_range_get(kcd->vc.v3d, kcd->vc.rv3d,
&kcd->clipsta, &kcd->clipend, true);
}