[Bf-blender-cvs] [65021f87461] newboolean: clang-format

Howard Trickey noreply at git.blender.org
Mon Dec 2 15:05:34 CET 2019


Commit: 65021f87461cfe7fb9374762ccabf75a11f046f2
Author: Howard Trickey
Date:   Tue Oct 29 06:28:08 2019 -0400
Branches: newboolean
https://developer.blender.org/rB65021f87461cfe7fb9374762ccabf75a11f046f2

clang-format

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

M	source/blender/bmesh/tools/bmesh_boolean.c
M	source/blender/editors/mesh/editmesh_intersect.c

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

diff --git a/source/blender/bmesh/tools/bmesh_boolean.c b/source/blender/bmesh/tools/bmesh_boolean.c
index 0f79b3a76d6..05bf2c4a5a2 100644
--- a/source/blender/bmesh/tools/bmesh_boolean.c
+++ b/source/blender/bmesh/tools/bmesh_boolean.c
@@ -301,7 +301,7 @@ static bool find_in_intset(const IntSet *set, int value)
   for (ln = set->list; ln; ln = ln->next) {
     if (POINTER_AS_INT(ln->link) == value) {
       return true;
-	}
+    }
   }
   return false;
 }
@@ -1102,18 +1102,18 @@ static void imesh_face_calc_tesselation(IMesh *im, int f, int (*r_index)[3])
 {
   if (im->bm) {
     BMFace *bmf = BM_face_at_index(im->bm, f);
-    BMLoop **loops = BLI_array_alloca(loops, bmf->len);
+    BMLoop **loops = BLI_array_alloca(loops, (size_t)bmf->len);
     /* OK to use argument use_fixed_quad == true: don't need convex quads. */
-    BM_face_calc_tessellation(bmf, true, loops, (uint (*)[3])r_index);
+    BM_face_calc_tessellation(bmf, true, loops, (uint(*)[3])r_index);
     /* Need orientation of triangles to match that of face. Because of using
      * use_fix_quads == true, we know that we only might have a problem here
      * for polygons with more than 4 sides. */
     if (bmf->len > 4) {
-	  float tri0_no[3];
-	  BMVert *v0, *v1, *v2;
-	  v0 = loops[r_index[0][0]]->v;
-	  v1 = loops[r_index[0][1]]->v;
-	  v2 = loops[r_index[0][2]]->v;
+      float tri0_no[3];
+      BMVert *v0, *v1, *v2;
+      v0 = loops[r_index[0][0]]->v;
+      v1 = loops[r_index[0][1]]->v;
+      v2 = loops[r_index[0][2]]->v;
       normal_tri_v3(tri0_no, v0->co, v1->co, v2->co);
       if (dot_v3v3(tri0_no, bmf->no) < 0.0f) {
         /* Need to reverse winding order for all triangles in tesselation. */
@@ -1122,9 +1122,9 @@ static void imesh_face_calc_tesselation(IMesh *im, int f, int (*r_index)[3])
           tmp = r_index[i][1];
           r_index[i][1] = r_index[i][2];
           r_index[i][2] = tmp;
-		}
-	  }
-	}
+        }
+      }
+    }
   }
   else {
     ; /* TODO */
@@ -1249,7 +1249,7 @@ static void apply_meshchange_to_bmesh(BMesh *bm, MeshChange *change)
       bme = BM_edge_create(bm, bmv1, bmv2, bme_eg, BM_CREATE_NO_DOUBLE);
       if (bme_eg) {
         BM_elem_select_copy(bm, bme, bme_eg);
-	  }
+      }
 #ifdef BOOLDEBUG
       if (dbg_level > 0) {
         printf("created BMEdge for new edge %d, v1=%d, v2=%d, bmv1=%p, bmv2=%p\n",
@@ -1313,10 +1313,10 @@ static void apply_meshchange_to_bmesh(BMesh *bm, MeshChange *change)
       bmf = BM_face_create(bm, face_bmvs, face_bmes, facelen, bmf_eg, 0);
       if (bmf_eg) {
         BM_elem_select_copy(bm, bmf, bmf_eg);
-	  }
-	  if (find_in_intset(&change->face_flip, f)) {
-	    BM_face_normal_flip(bm, bmf);
-	  }
+      }
+      if (find_in_intset(&change->face_flip, f)) {
+        BM_face_normal_flip(bm, bmf);
+      }
 #ifdef BOOLDEBUG
       if (dbg_level > 0) {
         printf("created BMFace for new face %d\n", f);
@@ -1334,20 +1334,20 @@ static void apply_meshchange_to_bmesh(BMesh *bm, MeshChange *change)
     if (f < bm_tot_f) {
       bmf = bm->ftable[f];
       BM_face_normal_flip(bm, bmf);
-	}
+    }
   }
 
   /* Need to tag the intersection edges. */
   intset_iter_init(&is_iter, intersection_edges);
-  for ( ; !intset_iter_done(&is_iter); intset_iter_step(&is_iter)) {
-    int e = intset_iter_value(&is_iter);
+  for (; !intset_iter_done(&is_iter); intset_iter_step(&is_iter)) {
+    e = intset_iter_value(&is_iter);
     if (e < bm_tot_e) {
       bme = bm->etable[e];
-	}
-	else {
-	  bme = new_bmes[e - meshadd->eindex_start];
-	}
-	BM_elem_flag_enable(bme, BM_ELEM_TAG);
+    }
+    else {
+      bme = new_bmes[e - meshadd->eindex_start];
+    }
+    BM_elem_flag_enable(bme, BM_ELEM_TAG);
   }
 
   /* Delete the geometry we are supposed to delete now. */
@@ -1356,10 +1356,10 @@ static void apply_meshchange_to_bmesh(BMesh *bm, MeshChange *change)
       bmf = bm->ftable[f];
       if (change->use_face_kill_loose) {
         BM_face_kill_loose(bm, bmf);
-	  }
-	  else {
+      }
+      else {
         BM_face_kill(bm, bmf);
-	  }
+      }
 #ifdef BOOLDEBUG
       if (dbg_level > 0) {
         printf("killed bmf=%p for ftable[%d]\n", bmf, f);
@@ -1422,8 +1422,8 @@ static void bb_update(double bbmin[3], double bbmax[3], int v, const IMesh *im)
 
 /* Used as user_data in call to BM_mesh_calc_face_groups. */
 struct BoolFilterWrap {
-	int (*test_fn)(BMFace *f, void *user_data);
-	void *user_data;
+  int (*test_fn)(BMFace *f, void *user_data);
+  void *user_data;
 };
 
 /* Function used for imesh_calc_face_groups to return true
@@ -1438,26 +1438,26 @@ struct BoolFilterWrap {
  */
 static bool boolfilterfn(const BMLoop *l, void *user_data)
 {
-	if (BM_elem_flag_test(l->e, BM_ELEM_TAG)) {
-	  return false;
-	}
-
-	if (l->radial_next != l) {
-	  struct BoolFilterWrap *data = user_data;
-	  BMLoop *l_iter = l->radial_next;
-	  const int face_side = data->test_fn(l->f, data->user_data);
-	  do {
-		const int face_side_other = data->test_fn(l_iter->f, data->user_data);
-		if (UNLIKELY(face_side_other == -1)) {
-		  /* pass */
-		}
-		else if (face_side_other != face_side) {
-		  return false;
-		}
-	  } while ((l_iter = l_iter->radial_next) != l);
-	  return true;
-	}
-	return false;
+  if (BM_elem_flag_test(l->e, BM_ELEM_TAG)) {
+    return false;
+  }
+
+  if (l->radial_next != l) {
+    struct BoolFilterWrap *data = user_data;
+    BMLoop *l_iter = l->radial_next;
+    const int face_side = data->test_fn(l->f, data->user_data);
+    do {
+      const int face_side_other = data->test_fn(l_iter->f, data->user_data);
+      if (UNLIKELY(face_side_other == -1)) {
+        /* pass */
+      }
+      else if (face_side_other != face_side) {
+        return false;
+      }
+    } while ((l_iter = l_iter->radial_next) != l);
+    return true;
+  }
+  return false;
 }
 
 /* Calculate groups of faces.
@@ -1473,21 +1473,20 @@ static bool boolfilterfn(const BMLoop *l, void *user_data)
  * Each pair has a start index in r_groups_array and a length, specifying
  * the part of r_groups_array that has the face indices for the group.
  */
-static int imesh_calc_face_groups(BoolState *bs,
-                                  int *r_groups_array,
-                                  int (**r_group_index)[2])
+static int imesh_calc_face_groups(BoolState *bs, int *r_groups_array, int (**r_group_index)[2])
 {
   int ngroups;
   IMesh *im = &bs->im;
 
   if (im->bm) {
     struct BoolFilterWrap user_data_wrap = {
-      .test_fn = (int (*)(BMFace *, void *))bs->test_fn,
-      .user_data = bs->test_fn_user_data,
-	};
+        .test_fn = (int (*)(BMFace *, void *))bs->test_fn,
+        .user_data = bs->test_fn_user_data,
+    };
 
     BM_mesh_elem_table_ensure(im->bm, BM_FACE);
-    ngroups = BM_mesh_calc_face_groups(im->bm, r_groups_array, r_group_index, boolfilterfn, &user_data_wrap, 0, BM_EDGE);
+    ngroups = BM_mesh_calc_face_groups(
+        im->bm, r_groups_array, r_group_index, boolfilterfn, &user_data_wrap, 0, BM_EDGE);
   }
   else {
     /* TODO */
@@ -1567,7 +1566,7 @@ static int meshadd_add_edge(
   if (checkdup) {
     for (ln = meshadd->edges.list, i = meshadd->eindex_start; ln; ln = ln->next, i++) {
       newe = (NewEdge *)ln->link;
-      if ((newe->v1 == v1 && newe->v2 == v2) || (newe->v1 == v2 && newe->v2== v1)) {
+      if ((newe->v1 == v1 && newe->v2 == v2) || (newe->v1 == v2 && newe->v2 == v1)) {
         return i;
       }
     }
@@ -1618,11 +1617,11 @@ static void meshadd_get_face_no(const MeshAdd *meshadd, int f, double *r_no)
     nf = (NewFace *)ln->link;
     if (nf->example) {
       imesh_get_face_no(meshadd->im, nf->example, r_no);
-	}
-	else {
-	  printf("unexpected meshadd_get_face_no on face without example\n");
-	  BLI_assert(false);
-	}
+    }
+    else {
+      printf("unexpected meshadd_get_face_no on face without example\n");
+      BLI_assert(false);
+    }
   }
 }
 
@@ -2326,7 +2325,7 @@ static PartPartIntersect *self_intersect_part_and_ppis(BoolState *bs,
     }
     for (lnf = ppi->faces.list; lnf; lnf = lnf->next) {
       f = POINTER_AS_INT(lnf->link);
-        if (!find_in_indexedintset(&faces_needed, f)) {
+      if (!find_in_indexedintset(&faces_needed, f)) {
         face_len = imeshplus_facelen(&imp, f);
         nfaceverts += face_len;
         for (j = 0; j < face_len; j++) {
@@ -2828,7 +2827,7 @@ static void find_face_line_intersects(BoolState *bs,
         printf("no intersections\n");
       }
 #endif
-	  return;
+      return;
     }
     endpos = startpos;
     for (i = (startpos + 1) % flen; i != startpos; i = (i + 1) % flen) {
@@ -2859,7 +2858,11 @@ static void find_face_line_intersects(BoolState *bs,
     double co1[3], co2[3];
     madd_v3_v3v3db_db(co1, line_co1, line_dir, interval[0]);
     madd_v3_v3v3db_db(co2, line_co2, line_dir, interval[1]);
-    printf("interval (dists) = (%f,%f) -> cooords (%.3f,%.3f,%.3f)(%.3f,%.3f,%.3f)\n", interval[0], interval[1], F3(co1), F3(co2));
+    printf("interval (dists) = (%f,%f) -> cooords (%.3f,%.3f,%.3f)(%.3f,%.3f,%.3f)\n",
+           interval[0],
+           interval[1],
+           F3(co1),
+           F3(co2));
   }
 #endif
   BLI_linklist_append_arena(intervals, interval, bs->mem_arena);
@@ -2869,8 +2872,12 @@ static void find_face_line_intersects(BoolState *bs,
  * Needs to be the part of the geometry that is on the common line
  * of intersection, so that it is in the plane of both parts.
  */
-static PartPartIntersect *non_coplanar_part_part_intersect(
-    BoolState *bs, MeshPart *part_a, int a_index, MeshPart *part_b, int b_index, MeshChange *change)
+static PartPartIntersect *non_coplanar_part_part_intersect(BoolState *bs,
+                                                           MeshPart *part_a,
+                                                           int a_index,
+                                                           MeshPart *part_b,
+                                                           int b_index,
+                                                           MeshChange *change)
 {
   MemArena *arena = bs->mem_arena;
   IMesh *im = &bs->im;
@@ -3110,8 +3117,12 @@ static PartPartIntersect *non_coplanar_part_part_intersect(
   return ppi;
 }
 
-static PartPartIntersect *part_part_intersect(
-    BoolState *bs, M

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list