[Bf-blender-cvs] [f9b7617] master: Fix T40646: Knife project fails with clipping
Campbell Barton
noreply at git.blender.org
Mon Jun 16 20:11:17 CEST 2014
Commit: f9b7617104a74d9b1a267a775627cdad60e0e333
Author: Campbell Barton
Date: Tue Jun 17 03:53:02 2014 +1000
https://developer.blender.org/rBf9b7617104a74d9b1a267a775627cdad60e0e333
Fix T40646: Knife project fails with clipping
===================================================================
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 8be8c41..96a608a 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -1161,6 +1161,13 @@ static bool point_is_visible(KnifeTool_OpData *kcd, const float p[3], const floa
{
BMFace *f_hit;
+ /* If box clipping on, make sure p is not clipped */
+ if (kcd->vc.rv3d->rflag & RV3D_CLIPPING &&
+ ED_view3d_clipping_test(kcd->vc.rv3d, p, true))
+ {
+ return false;
+ }
+
/* If not cutting through, make sure no face is in front of p */
if (!kcd->cut_through) {
float dist;
@@ -1181,19 +1188,23 @@ static bool point_is_visible(KnifeTool_OpData *kcd, const float p[3], const floa
dist = kcd->vc.v3d->far * 2.0f;
}
+ if (kcd->vc.rv3d->rflag & RV3D_CLIPPING) {
+ float view_clip[2][3];
+ /* note: view_clip[0] should never get clipped */
+ copy_v3_v3(view_clip[0], p_ofs);
+ madd_v3_v3v3fl(view_clip[1], p_ofs, view, dist);
+
+ if (clip_segment_v3_plane_n(view_clip[0], view_clip[1], kcd->vc.rv3d->clip_local, 6)) {
+ dist = len_v3v3(p_ofs, view_clip[1]);
+ }
+ }
+
/* see if there's a face hit between p1 and the view */
f_hit = BKE_bmbvh_ray_cast(kcd->bmbvh, p_ofs, view, KNIFE_FLT_EPS, &dist, NULL, NULL);
if (f_hit)
return false;
}
- /* If box clipping on, make sure p is not clipped */
- if (kcd->vc.rv3d->rflag & RV3D_CLIPPING &&
- ED_view3d_clipping_test(kcd->vc.rv3d, p, true))
- {
- return false;
- }
-
return true;
}
More information about the Bf-blender-cvs
mailing list