diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-01-20 12:41:47 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-01-20 12:46:25 +0300 |
commit | 6fa5d22109e276dd5f732f50445a4247a8f3c22b (patch) | |
tree | fa757837e84aa7b850b722348c1235085046e320 /source/blender | |
parent | 90bac235eaac6c026d552fc46fe26f86c52c8230 (diff) |
Fix T43896: Knife Project fails when zoomed out
While knife-project still uses screen-space projection,
use much lower snap thresholds when projecting.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/mesh/editmesh_knife.c | 51 |
1 files changed, 31 insertions, 20 deletions
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 4192b9f69d2..0dd7b85c612 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -1621,9 +1621,14 @@ static void knife_find_line_hits(KnifeTool_OpData *kcd) /* Now go through the candidates and find intersections */ /* These tolerances, in screen space, are for intermediate hits, as ends are already snapped to screen */ - vert_tol = KNIFE_FLT_EPS_PX_VERT; - line_tol = KNIFE_FLT_EPS_PX_EDGE; - face_tol = KNIFE_FLT_EPS_PX_FACE; + if (kcd->is_interactive) { + vert_tol = KNIFE_FLT_EPS_PX_VERT; + line_tol = KNIFE_FLT_EPS_PX_EDGE; + face_tol = KNIFE_FLT_EPS_PX_FACE; + } + else { + vert_tol = line_tol = face_tol = 0.001f; + } vert_tol_sq = vert_tol * vert_tol; line_tol_sq = line_tol * line_tol; @@ -1884,17 +1889,7 @@ static int knife_sample_screen_density(KnifeTool_OpData *kcd, const float radius * surrounding mesh (in screen space)*/ static float knife_snap_size(KnifeTool_OpData *kcd, float maxsize) { - float density; - - if (kcd->is_interactive) { - density = (float)knife_sample_screen_density(kcd, maxsize * 2.0f); - } - else { - density = 1.0f; - } - - if (density < 1.0f) - density = 1.0f; + float density = (float)knife_sample_screen_density(kcd, maxsize * 2.0f); return min_ff(maxsize / (density * 0.5f), maxsize); } @@ -1905,10 +1900,18 @@ static KnifeEdge *knife_find_closest_edge(KnifeTool_OpData *kcd, float p[3], flo { BMFace *f; float co[3], cageco[3], sco[2]; - float maxdist = knife_snap_size(kcd, kcd->ethresh); + float maxdist; + + if (kcd->is_interactive) { + maxdist = knife_snap_size(kcd, kcd->ethresh); - if (kcd->ignore_vert_snapping) - maxdist *= 0.5f; + if (kcd->ignore_vert_snapping) { + maxdist *= 0.5f; + } + } + else { + maxdist = KNIFE_FLT_EPS; + } f = knife_find_closest_face(kcd, co, cageco, NULL); *is_space = !f; @@ -2028,10 +2031,18 @@ static KnifeVert *knife_find_closest_vert(KnifeTool_OpData *kcd, float p[3], flo bool *is_space) { BMFace *f; - float co[3], cageco[3], sco[2], maxdist = knife_snap_size(kcd, kcd->vthresh); + float co[3], cageco[3], sco[2]; + float maxdist; - if (kcd->ignore_vert_snapping) - maxdist *= 0.5f; + if (kcd->is_interactive) { + maxdist = knife_snap_size(kcd, kcd->vthresh); + if (kcd->ignore_vert_snapping) { + maxdist *= 0.5f; + } + } + else { + maxdist = KNIFE_FLT_EPS; + } f = knife_find_closest_face(kcd, co, cageco, is_space); |