Fix T40646: Knife project fails with clipping
This commit is contained in:
parent
e848cb9e48
commit
f9b7617104
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue