Cleanup: style, whitespace, doxy filepaths
[blender-staging.git] / source / blender / editors / mesh / editmesh_knife.c
index 89d3cf7db059809fa8c278ceb9742f4e412144a4..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) {
@@ -1630,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;
@@ -2280,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);
@@ -2361,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;
+
+                       BM_face_split_edgenet(
+                               bm, f, edge_array, edge_array_len,
+                               &face_arr, &face_arr_len);
 
-               if (ok) {
-                       MEM_freeN(face_arr);
+                       if (face_arr) {
+                               MEM_freeN(face_arr);
+                       }
                }
 
                /* remove dangling edges, not essential - but nice for users */