[Bf-blender-cvs] [3b7ce702326] master: Fix T94499: Knife missed clipping check

Cian Jinks noreply at git.blender.org
Mon Jun 13 20:28:52 CEST 2022


Commit: 3b7ce7023267635b878a046a8ab8ecccf9e66718
Author: Cian Jinks
Date:   Mon Jun 13 19:24:43 2022 +0100
Branches: master
https://developer.blender.org/rB3b7ce7023267635b878a046a8ab8ecccf9e66718

Fix T94499: Knife missed clipping check

The knife BVH raycast functionality was missing a check to discard
points which were clipped.

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

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 c16b82e34bd..5680865ae67 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -1355,13 +1355,19 @@ static void knife_bvh_raycast_cb(void *userdata,
 #endif
 
   if (isect && dist < hit->dist) {
+    madd_v3_v3v3fl(hit->co, ray->origin, ray->direction, dist);
+
+    /* Discard clipped points. */
+    if (RV3D_CLIPPING_ENABLED(kcd->vc.v3d, kcd->vc.rv3d) &&
+        ED_view3d_clipping_test(kcd->vc.rv3d, hit->co, false)) {
+      return;
+    }
+
     hit->dist = dist;
     hit->index = index;
 
     copy_v3_v3(hit->no, ltri[0]->f->no);
 
-    madd_v3_v3v3fl(hit->co, ray->origin, ray->direction, dist);
-
     kcd->bvh.looptris = em->looptris;
     copy_v2_v2(kcd->bvh.uv, uv);
     kcd->bvh.base_index = b;



More information about the Bf-blender-cvs mailing list