[Bf-blender-cvs] [39cf62607fe] master: Bevel: Remove Debugging Code

Hans Goudey noreply at git.blender.org
Sat Jan 25 00:12:39 CET 2020


Commit: 39cf62607fe5439008ae2c3114918dfb844f8877
Author: Hans Goudey
Date:   Fri Jan 24 18:12:30 2020 -0500
Branches: master
https://developer.blender.org/rB39cf62607fe5439008ae2c3114918dfb844f8877

Bevel: Remove Debugging Code

Remove old / trivial print statements and drawing code.

Reviewed By: howardt

Differential Revision: https://developer.blender.org/D6661

===================================================================

M	source/blender/bmesh/tools/bmesh_bevel.c

===================================================================

diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c
index 57dbbcbfca4..bc84c6872c4 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -60,16 +60,7 @@
 #define BEVEL_MATCH_SPEC_WEIGHT 0.2
 
 //#define DEBUG_CUSTOM_PROFILE_CUTOFF
-//#define DEBUG_CUSTOM_PROFILE_SAMPLE
-
-#if defined(DEBUG_PROFILE_ORIENTATION_DRAW) || defined(DEBUG_CUSTOM_PROFILE_PIPE)
-static float debug_color_red[4] = {1.0f, 0.0f, 0.0f, 1.0f};
-static float debug_color_blue[4] = {0.0f, 0.0f, 1.0f, 1.0f};
-extern void DRW_debug_sphere(const float center[3], const float radius, const float color[4]);
-extern void DRW_debug_line_v3v3(const float v1[3], const float v2[3], const float color[4]);
-#endif
-
-/* happens far too often, uncomment for development */
+/* Happens far too often, uncomment for development. */
 // #define BEVEL_ASSERT_PROJECT
 
 /* for testing */
@@ -268,7 +259,7 @@ typedef struct BevVert {
   VMesh *vmesh;
 } BevVert;
 
-/* face classification: note depend on F_RECON > F_EDGE > F_VERT */
+/* Face classification. Note: depends on F_RECON > F_EDGE > F_VERT */
 typedef enum {
   /** Used when there is no face at all */
   F_NONE,
@@ -292,10 +283,6 @@ enum {
   ANGLE_LARGER = 1,
 };
 
-#if 0
-static const char* fkind_names[] = {"F_NONE", "F_ORIG", "F_VERT", "F_EDGE", "F_RECON"}; /* DEBUG */
-#endif
-
 /** Bevel parameters and state */
 typedef struct BevelParams {
   /** Records BevVerts made: key BMVert*, value BevVert* */
@@ -364,13 +351,6 @@ typedef struct BevelParams {
 /* Only for debugging, shouldn't be in blender repo. */
 // #include "bevdebug.c"
 
-/* Some flags to re-enable old behavior for a while,
- * in case fixes broke things not caught by regression tests. */
-static int bev_debug_flags = 0;
-#define DEBUG_OLD_PLANE_SPECIAL (bev_debug_flags & 1)
-#define DEBUG_OLD_PROJ_TO_PERP_PLANE (bev_debug_flags & 2)
-#define DEBUG_OLD_FLAT_MID (bev_debug_flags & 4)
-
 /* use the unused _BM_ELEM_TAG_ALT flag to flag the 'long' loops (parallel to beveled edge)
  * of edge-polygons. */
 #define BM_ELEM_LONG_TAG (1 << 6)
@@ -1355,23 +1335,8 @@ static void set_profile_params(BevelParams *bp, BevVert *bv, BoundVert *bndv)
     }
     normalize_v3(pro->proj_dir);
     project_to_edge(e->e, start, end, pro->middle);
-    if (DEBUG_OLD_PROJ_TO_PERP_PLANE) {
-      /* Put arc endpoints on plane with normal proj_dir, containing middle. */
-      add_v3_v3v3(co3, start, pro->proj_dir);
-      if (!isect_line_plane_v3(pro->start, start, co3, pro->middle, pro->proj_dir)) {
-        /* Shouldn't happen. */
-        copy_v3_v3(pro->start, start);
-      }
-      add_v3_v3v3(co3, end, pro->proj_dir);
-      if (!isect_line_plane_v3(pro->end, end, co3, pro->middle, pro->proj_dir)) {
-        /* Shouldn't happen. */
-        copy_v3_v3(pro->end, end);
-      }
-    }
-    else {
-      copy_v3_v3(pro->start, start);
-      copy_v3_v3(pro->end, end);
-    }
+    copy_v3_v3(pro->start, start);
+    copy_v3_v3(pro->end, end);
     /* Default plane to project onto is the one with triangle start - middle - end in it. */
     sub_v3_v3v3(d1, pro->middle, start);
     sub_v3_v3v3(d2, pro->middle, end);
@@ -1389,64 +1354,50 @@ static void set_profile_params(BevelParams *bp, BevVert *bv, BoundVert *bndv)
        * If the profile is going to lead into unbeveled edges on each side
        * (that is, both BoundVerts are "on-edge" points on non-beveled edges)
        */
-      if (DEBUG_OLD_PLANE_SPECIAL && (e->prev->is_bev || e->next->is_bev)) {
-        do_linear_interp = true;
-      }
-      else {
-        if (DEBUG_OLD_PROJ_TO_PERP_PLANE) {
-          copy_v3_v3(pro->start, start);
-          copy_v3_v3(pro->end, end);
-        }
-        if (DEBUG_OLD_FLAT_MID) {
-          copy_v3_v3(pro->middle, bv->v->co);
-        }
-        else {
-          copy_v3_v3(pro->middle, bv->v->co);
-          if (e->prev->is_bev && e->next->is_bev && bv->selcount >= 3) {
-            /* Want mid at the meet point of next and prev offset edges. */
-            float d3[3], d4[3], co4[3], meetco[3], isect2[3];
-            int isect_kind;
-
-            sub_v3_v3v3(d3, e->prev->e->v1->co, e->prev->e->v2->co);
-            sub_v3_v3v3(d4, e->next->e->v1->co, e->next->e->v2->co);
-            normalize_v3(d3);
-            normalize_v3(d4);
-            if (nearly_parallel(d3, d4)) {
-              /* Offset lines are collinear - want linear interpolation. */
-              mid_v3_v3v3(pro->middle, start, end);
-              do_linear_interp = true;
-            }
-            else {
-              add_v3_v3v3(co3, start, d3);
-              add_v3_v3v3(co4, end, d4);
-              isect_kind = isect_line_line_v3(start, co3, end, co4, meetco, isect2);
-              if (isect_kind != 0) {
-                copy_v3_v3(pro->middle, meetco);
-              }
-              else {
-                /* Offset lines don't intersect - want linear interpolation. */
-                mid_v3_v3v3(pro->middle, start, end);
-                do_linear_interp = true;
-              }
-            }
-          }
-        }
-        copy_v3_v3(pro->end, end);
-        sub_v3_v3v3(d1, pro->middle, start);
-        normalize_v3(d1);
-        sub_v3_v3v3(d2, pro->middle, end);
-        normalize_v3(d2);
-        cross_v3_v3v3(pro->plane_no, d1, d2);
-        normalize_v3(pro->plane_no);
-        if (nearly_parallel(d1, d2)) {
-          /* Whole profile is collinear with edge: just interpolate. */
+      copy_v3_v3(pro->middle, bv->v->co);
+      if (e->prev->is_bev && e->next->is_bev && bv->selcount >= 3) {
+        /* Want mid at the meet point of next and prev offset edges. */
+        float d3[3], d4[3], co4[3], meetco[3], isect2[3];
+        int isect_kind;
+
+        sub_v3_v3v3(d3, e->prev->e->v1->co, e->prev->e->v2->co);
+        sub_v3_v3v3(d4, e->next->e->v1->co, e->next->e->v2->co);
+        normalize_v3(d3);
+        normalize_v3(d4);
+        if (nearly_parallel(d3, d4)) {
+          /* Offset lines are collinear - want linear interpolation. */
+          mid_v3_v3v3(pro->middle, start, end);
           do_linear_interp = true;
         }
         else {
-          copy_v3_v3(pro->plane_co, bv->v->co);
-          copy_v3_v3(pro->proj_dir, pro->plane_no);
+          add_v3_v3v3(co3, start, d3);
+          add_v3_v3v3(co4, end, d4);
+          isect_kind = isect_line_line_v3(start, co3, end, co4, meetco, isect2);
+          if (isect_kind != 0) {
+            copy_v3_v3(pro->middle, meetco);
+          }
+          else {
+            /* Offset lines don't intersect - want linear interpolation. */
+            mid_v3_v3v3(pro->middle, start, end);
+            do_linear_interp = true;
+          }
         }
       }
+      copy_v3_v3(pro->end, end);
+      sub_v3_v3v3(d1, pro->middle, start);
+      normalize_v3(d1);
+      sub_v3_v3v3(d2, pro->middle, end);
+      normalize_v3(d2);
+      cross_v3_v3v3(pro->plane_no, d1, d2);
+      normalize_v3(pro->plane_no);
+      if (nearly_parallel(d1, d2)) {
+        /* Whole profile is collinear with edge: just interpolate. */
+        do_linear_interp = true;
+      }
+      else {
+        copy_v3_v3(pro->plane_co, bv->v->co);
+        copy_v3_v3(pro->proj_dir, pro->plane_no);
+      }
     }
     copy_v3_v3(pro->plane_co, start);
   }
@@ -2532,17 +2483,6 @@ static void build_boundary_terminal_edge(BevelParams *bp,
       vm->mesh_kind = M_POLY;
     }
   }
-#ifdef DEBUG_CUSTOM_PROFILE_WELD
-  if (bp->seg > 1) {
-    printf("Terminal Edge Profile Coordinates:\n");
-    for (int k = 0; k < bp->seg; k++) {
-      printf("%0.4f, %0.4f, %0.4f\n",
-             (double)vm->boundstart->profile.prof_co[3 * k],
-             (double)vm->boundstart->profile.prof_co[3 * k + 1],
-             (double)vm->boundstart->profile.prof_co[3 * k + 2]);
-    }
-  }
-#endif
 }
 
 /* Helper for build_boundary to handle special miters */
@@ -3209,53 +3149,6 @@ static void regularize_profile_orientation(BevelParams *bp, BMEdge *bme)
   }
 }
 
-#ifdef DEBUG_PROFILE_ORIENTATION_DRAW
-/**
- * Draws markers on beveled edges showing the side that the profile starts on. A sphere shows
- * the start side of the profile where it starts, and the lines connected to the sphere show which
- * edge the orientation corresponds to.
- * \note Only drawn while bevel is calculating, the debug geometry is not persistent.
- */
-static void debug_draw_profile_orientation(BevelParams *bp, BMesh *bm)
-{
-  BMIter iter;
-  BMEdge *bmedge;
-  float middle[3];
-
-  BM_ITER_MESH (bmedge, &iter, bm, BM_EDGES_OF_MESH) {
-    if (BM_elem_flag_test(bmedge, BM_ELEM_TAG)) {
-      mid_v3_v3v3(middle, bmedge->v1->co, bmedge->v2->co);
-
-      /* Draw the orientation for the first side of the edge. */
-      EdgeHalf *edge_half = find_edge_half(find_bevvert(bp, bmedge->v1), bmedge);
-      if (edge_half->leftv->is_profile_start) { /* The left boundvert defines the profiles. */
-        DRW_debug_sphere(edge_half->leftv->nv.co, 0.04f, debug_color_red);
-        DRW_debug_line_v3v3(middle, edge_half->leftv->nv.co, debug_color_red);
-        DRW_debug_line_v3v3(bmedge->v1->co, edge_half->leftv->nv.co, debug_color_red);
-      }
-      else {
-        DRW_debug_sphere(edge_half->rightv->nv.co, 0.04f, debug_color_red);
-        DRW_debug_line_v3v3(middle, edge_half->rightv->nv.co, debug_color_red);
-        DRW_debug_line_v3v3(bmedge->v1->co, edge_half->rightv->nv.co, debug_color_red);
-      }
-
-      /* Draw the orientation for the second side of the edge. */
-      edge_half = find_edge_half(find_bevvert(bp, bmedge->v2), bmedge);
-      if (edge_half->leftv->is_profile_start) {
-        DRW_debug_sphere(edge_half->leftv->nv.co, 0.05f, debug_color_blue);
-        DRW_debug_line_v3v3(middle, edge_half->leftv->nv.co, debug_color_blue);
-        DRW_debug_line_v3v3(bmedge->v2->co, edge_half->leftv->nv.co, debug_color_blue);
-      }
-      else {
-        DRW_debug_sphere(edge_half->rightv->nv.co, 0.05f, debug_color_blue);
-        DRW_debug_line_v3v3(middle, edge_half->rightv->nv.co, debug_color_blue);
-        DRW_debug_line_v3v3(bmedge->v2->co, edge_half->rightv->nv.co, debug_color_blue);
-      }
-    }
-  }
-}
-#endif
-
 /* Adjust

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list