[Bf-blender-cvs] [19b85c5f4b0] blender-v2.83-release: Fix T65585: Knife fails when cursor away from the object

Campbell Barton noreply at git.blender.org
Wed Dec 2 08:50:17 CET 2020


Commit: 19b85c5f4b0e937f231b86a5788cfaea5a27e26f
Author: Campbell Barton
Date:   Tue Nov 10 16:22:35 2020 +1100
Branches: blender-v2.83-release
https://developer.blender.org/rB19b85c5f4b0e937f231b86a5788cfaea5a27e26f

Fix T65585: Knife fails when cursor away from the object

Zeroed mouse coordinates were being used making projection fail.

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

M	source/blender/editors/mesh/editmesh_knife.c

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

diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index 5f5599b53df..d0df79beb91 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -1895,8 +1895,15 @@ static BMFace *knife_find_closest_face(KnifeTool_OpData *kcd,
 
   if (!f) {
     if (kcd->is_interactive) {
-      /* try to use backbuffer selection method if ray casting failed */
-      f = EDBM_face_find_nearest(&kcd->vc, &dist);
+      /* Try to use back-buffer selection method if ray casting failed.
+       *
+       * Apply the mouse coordinates to a copy of the view-context
+       * since we don't want to rely on this being set elsewhere. */
+      ViewContext vc = kcd->vc;
+      vc.mval[0] = (int)kcd->curr.mval[0];
+      vc.mval[1] = (int)kcd->curr.mval[1];
+
+      f = EDBM_face_find_nearest(&vc, &dist);
 
       /* cheat for now; just put in the origin instead
        * of a true coordinate on the face.



More information about the Bf-blender-cvs mailing list