Cleanup: style, whitespace, doxy filepaths
[blender-staging.git] / source / blender / editors / mesh / editmesh_knife.c
index 3cef5478503834dc8847fc53ed8246843eb7d475..a84b8d9dcc82f21644b5c82fb2793698aa754a2c 100644 (file)
@@ -1050,8 +1050,6 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
                glVertex3fv(kcd->prev.cage);
                glVertex3fv(kcd->curr.cage);
                glEnd();
-
-               glLineWidth(1.0);
        }
 
        if (kcd->prev.vert) {
@@ -1080,8 +1078,6 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
                glVertex3fv(kcd->curr.edge->v1->cageco);
                glVertex3fv(kcd->curr.edge->v2->cageco);
                glEnd();
-
-               glLineWidth(1.0);
        }
        else if (kcd->curr.vert) {
                glColor3ubv(kcd->colors.point);
@@ -1151,7 +1147,6 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
                }
 
                glEnd();
-               glLineWidth(1.0);
        }
 
        if (kcd->totkvert > 0) {
@@ -1439,7 +1434,10 @@ static bool point_is_visible(
                        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)) {
+                       if (clip_segment_v3_plane_n(
+                               view_clip[0], view_clip[1], kcd->vc.rv3d->clip_local, 6,
+                               view_clip[0], view_clip[1]))
+                       {
                                dist = len_v3v3(p_ofs, view_clip[1]);
                        }
                }
@@ -1627,7 +1625,11 @@ static void knife_find_line_hits(KnifeTool_OpData *kcd)
                face_tol = KNIFE_FLT_EPS_PX_FACE;
        }
        else {
-               vert_tol = line_tol = face_tol = 0.001f;
+               /* Use 1/100th of a pixel, see T43896 (too big), T47910 (too small).
+                *
+                * Update, leave this as is until we investigate not using pixel coords for geometry calculations: T48023
+                */
+               vert_tol = line_tol = face_tol = 0.5f;
        }
 
        vert_tol_sq = vert_tol * vert_tol;
@@ -2277,15 +2279,11 @@ static void knife_make_face_cuts(KnifeTool_OpData *kcd, BMFace *f, ListBase *kfe
        KnifeEdge *kfe;
        Ref *ref;
        int edge_array_len = BLI_listbase_count(kfedges);
-       bool ok;
        int i;
 
-       BMFace **face_arr;
-       int face_arr_len;
-
        BMEdge **edge_array = BLI_array_alloca(edge_array, edge_array_len);
 
-        /* point to knife edges we've created edges in, edge_array aligned */
+       /* point to knife edges we've created edges in, edge_array aligned */
        KnifeEdge **kfe_array = BLI_array_alloca(kfe_array, edge_array_len);
 
        BLI_assert(BLI_gset_size(kcd->edgenet.edge_visit) == 0);
@@ -2358,12 +2356,17 @@ static void knife_make_face_cuts(KnifeTool_OpData *kcd, BMFace *f, ListBase *kfe
                }
 #endif
 
-               ok = BM_face_split_edgenet(
-                        bm, f, edge_array, edge_array_len,
-                        &face_arr, &face_arr_len);
+               {
+                       BMFace **face_arr = NULL;
+                       int face_arr_len;
 
-               if (ok) {
-                       MEM_freeN(face_arr);
+                       BM_face_split_edgenet(
+                               bm, f, edge_array, edge_array_len,
+                               &face_arr, &face_arr_len);
+
+                       if (face_arr) {
+                               MEM_freeN(face_arr);
+                       }
                }
 
                /* remove dangling edges, not essential - but nice for users */