[Bf-blender-cvs] [ecbf642dddc] sculpt-dev: Cleanup: Clang format

Pablo Dobarro noreply at git.blender.org
Wed Mar 24 20:56:31 CET 2021


Commit: ecbf642dddc6c29f0e4f04e28055645efa6fc332
Author: Pablo Dobarro
Date:   Wed Mar 24 18:48:39 2021 +0100
Branches: sculpt-dev
https://developer.blender.org/rBecbf642dddc6c29f0e4f04e28055645efa6fc332

Cleanup: Clang format

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

M	source/blender/editors/sculpt_paint/sculpt_cloth.c
M	source/blender/editors/sculpt_paint/sculpt_expand.c
M	source/blender/editors/sculpt_paint/sculpt_face_set_topology.c
M	source/blender/editors/sculpt_paint/sculpt_intern.h
M	source/blender/editors/sculpt_paint/sculpt_poly_loop.c

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

diff --git a/source/blender/editors/sculpt_paint/sculpt_cloth.c b/source/blender/editors/sculpt_paint/sculpt_cloth.c
index ac78cc67b2e..856a2652e21 100644
--- a/source/blender/editors/sculpt_paint/sculpt_cloth.c
+++ b/source/blender/editors/sculpt_paint/sculpt_cloth.c
@@ -1446,12 +1446,19 @@ typedef enum eSculpClothFilterPinchOriginType {
 } eSculptClothFilterPinchOriginType;
 
 static EnumPropertyItem prop_cloth_filter_pinch_origin_type[] = {
-    {CLOTH_FILTER_PINCH_ORIGIN_CURSOR, "CURSOR", 0, "Cursor", "Pinches to the location of the cursor"},
-    {CLOTH_FILTER_PINCH_ORIGIN_FACE_SET, "FACE_SET", 0, "Face Set", "Pinches to the average location of the Face Set"},
+    {CLOTH_FILTER_PINCH_ORIGIN_CURSOR,
+     "CURSOR",
+     0,
+     "Cursor",
+     "Pinches to the location of the cursor"},
+    {CLOTH_FILTER_PINCH_ORIGIN_FACE_SET,
+     "FACE_SET",
+     0,
+     "Face Set",
+     "Pinches to the average location of the Face Set"},
     {0, NULL, 0, NULL, NULL},
 };
 
-
 static EnumPropertyItem prop_cloth_filter_orientation_items[] = {
     {SCULPT_FILTER_ORIENTATION_LOCAL,
      "LOCAL",
@@ -1580,7 +1587,8 @@ static void cloth_filter_apply_forces_task_cb(void *__restrict userdata,
         char symm_area = SCULPT_get_vertex_symm_area(orig_data.co);
         float pinch_point[3];
         copy_v3_v3(pinch_point, ss->filter_cache->cloth_sim_pinch_point);
-        SCULPT_flip_v3_by_symm_area(pinch_point, symm, symm_area, ss->filter_cache->cloth_sim_pinch_point);
+        SCULPT_flip_v3_by_symm_area(
+            pinch_point, symm, symm_area, ss->filter_cache->cloth_sim_pinch_point);
         sub_v3_v3v3(force, pinch_point, vd.co);
         normalize_v3(force);
         mul_v3_fl(force, fade * data->filter_strength);
@@ -1670,25 +1678,26 @@ static int sculpt_cloth_filter_modal(bContext *C, wmOperator *op, const wmEvent
   return OPERATOR_RUNNING_MODAL;
 }
 
-
-static void sculpt_cloth_filter_face_set_pinch_origin_calculate(float r_pinch_origin[3], SculptSession *ss) {
-    const int totvert = SCULPT_vertex_count_get(ss);
-    const int active_face_set = SCULPT_active_face_set_get(ss);
-    float accum[3] = {0.0f};
-    int tot = 0;
-    for (int i = 0; i < totvert; i++) {
-      if (!SCULPT_vertex_has_face_set(ss, i, active_face_set)) {
-        continue;
-      }
-      add_v3_v3(accum, SCULPT_vertex_co_get(ss, i));
-      tot++;
-    }
-    if (tot > 0) {
-      mul_v3_v3fl(r_pinch_origin, accum, 1.0f/ tot);
-    }
-    else {
-      copy_v3_v3(r_pinch_origin, SCULPT_active_vertex_co_get(ss));
+static void sculpt_cloth_filter_face_set_pinch_origin_calculate(float r_pinch_origin[3],
+                                                                SculptSession *ss)
+{
+  const int totvert = SCULPT_vertex_count_get(ss);
+  const int active_face_set = SCULPT_active_face_set_get(ss);
+  float accum[3] = {0.0f};
+  int tot = 0;
+  for (int i = 0; i < totvert; i++) {
+    if (!SCULPT_vertex_has_face_set(ss, i, active_face_set)) {
+      continue;
     }
+    add_v3_v3(accum, SCULPT_vertex_co_get(ss, i));
+    tot++;
+  }
+  if (tot > 0) {
+    mul_v3_v3fl(r_pinch_origin, accum, 1.0f / tot);
+  }
+  else {
+    copy_v3_v3(r_pinch_origin, SCULPT_active_vertex_co_get(ss));
+  }
 }
 
 static int sculpt_cloth_filter_invoke(bContext *C, wmOperator *op, const wmEvent *event)
@@ -1729,14 +1738,14 @@ static int sculpt_cloth_filter_invoke(bContext *C, wmOperator *op, const wmEvent
       use_collisions,
       cloth_filter_is_deformation_filter(filter_type));
 
-  switch (pinch_origin)
-  {
-  case CLOTH_FILTER_PINCH_ORIGIN_CURSOR:
-    copy_v3_v3(ss->filter_cache->cloth_sim_pinch_point, SCULPT_active_vertex_co_get(ss));
-    break;
-  case CLOTH_FILTER_PINCH_ORIGIN_FACE_SET:
-    sculpt_cloth_filter_face_set_pinch_origin_calculate(ss->filter_cache->cloth_sim_pinch_point, ss);
-    break;
+  switch (pinch_origin) {
+    case CLOTH_FILTER_PINCH_ORIGIN_CURSOR:
+      copy_v3_v3(ss->filter_cache->cloth_sim_pinch_point, SCULPT_active_vertex_co_get(ss));
+      break;
+    case CLOTH_FILTER_PINCH_ORIGIN_FACE_SET:
+      sculpt_cloth_filter_face_set_pinch_origin_calculate(ss->filter_cache->cloth_sim_pinch_point,
+                                                          ss);
+      break;
   }
 
   SCULPT_cloth_brush_simulation_init(ss, ss->filter_cache->cloth_sim);
diff --git a/source/blender/editors/sculpt_paint/sculpt_expand.c b/source/blender/editors/sculpt_paint/sculpt_expand.c
index 1323994bb9f..6e8a000112f 100644
--- a/source/blender/editors/sculpt_paint/sculpt_expand.c
+++ b/source/blender/editors/sculpt_paint/sculpt_expand.c
@@ -705,9 +705,8 @@ static float *sculpt_expand_diagonals_falloff_create(Object *ob, const int v)
   return dists;
 }
 
-
 /**
- * Poly Loop: 
+ * Poly Loop:
  */
 static float *sculpt_expand_poly_loop_falloff_create(Object *ob, const int v)
 {
@@ -717,7 +716,7 @@ static float *sculpt_expand_poly_loop_falloff_create(Object *ob, const int v)
   BLI_bitmap *visited_vertices = BLI_BITMAP_NEW(totvert, "visited vertices");
   GSQueue *queue = BLI_gsqueue_new(sizeof(int));
 
- printf("POLY LOOP FALLOFF\n");
+  printf("POLY LOOP FALLOFF\n");
 
   /* Search and initialize a boundary per symmetry pass, then mark those vertices as visited. */
   const char symm = SCULPT_mesh_symmetry_xyz_get(ob);
@@ -1808,19 +1807,19 @@ static int sculpt_expand_modal(bContext *C, wmOperator *op, const wmEvent *event
         break;
       }
       case SCULPT_EXPAND_MODAL_SNAP_ENABLE: {
-          expand_cache->snap = true;
-          if (!expand_cache->snap_enabled_face_sets) {
-            expand_cache->snap_enabled_face_sets = BLI_gset_int_new("snap face sets");
-          }
-          sculpt_expand_snap_initialize_from_enabled(ss, expand_cache);
+        expand_cache->snap = true;
+        if (!expand_cache->snap_enabled_face_sets) {
+          expand_cache->snap_enabled_face_sets = BLI_gset_int_new("snap face sets");
+        }
+        sculpt_expand_snap_initialize_from_enabled(ss, expand_cache);
       } break;
       case SCULPT_EXPAND_MODAL_SNAP_DISABLE: {
-          expand_cache->snap = false;
-          if (expand_cache->snap_enabled_face_sets) {
-            BLI_gset_free(expand_cache->snap_enabled_face_sets, NULL);
-            expand_cache->snap_enabled_face_sets = NULL;
-          }
-      }break;
+        expand_cache->snap = false;
+        if (expand_cache->snap_enabled_face_sets) {
+          BLI_gset_free(expand_cache->snap_enabled_face_sets, NULL);
+          expand_cache->snap_enabled_face_sets = NULL;
+        }
+      } break;
       case SCULPT_EXPAND_MODAL_MOVE_TOGGLE: {
         if (expand_cache->move) {
           expand_cache->move = false;
@@ -2192,7 +2191,11 @@ void sculpt_expand_modal_keymap(wmKeyConfig *keyconf)
        ""},
       {SCULPT_EXPAND_MODAL_FALLOFF_SPHERICAL, "FALLOFF_SPHERICAL", 0, "Spherical Falloff", ""},
       {SCULPT_EXPAND_MODAL_SNAP_ENABLE, "SNAP_ENABLE", 0, "Snap expand to Face Sets", ""},
-      {SCULPT_EXPAND_MODAL_SNAP_DISABLE, "SNAP_DISABLE", 0, "Disable Snap expand to Face Sets", ""},
+      {SCULPT_EXPAND_MODAL_SNAP_DISABLE,
+       "SNAP_DISABLE",
+       0,
+       "Disable Snap expand to Face Sets",
+       ""},
       {SCULPT_EXPAND_MODAL_LOOP_COUNT_INCREASE,
        "LOOP_COUNT_INCREASE",
        0,
diff --git a/source/blender/editors/sculpt_paint/sculpt_face_set_topology.c b/source/blender/editors/sculpt_paint/sculpt_face_set_topology.c
index de8dae5e2cb..808515ab723 100644
--- a/source/blender/editors/sculpt_paint/sculpt_face_set_topology.c
+++ b/source/blender/editors/sculpt_paint/sculpt_face_set_topology.c
@@ -77,7 +77,6 @@ typedef enum eSculptFaceSetByTopologyMode {
   SCULPT_FACE_SET_TOPOLOGY_POLY_LOOP = 1,
 };
 
-
 static EnumPropertyItem prop_sculpt_face_set_by_topology[] = {
     {
         SCULPT_FACE_SET_TOPOLOGY_LOOSE_PART,
@@ -96,11 +95,11 @@ static EnumPropertyItem prop_sculpt_face_set_by_topology[] = {
     {0, NULL, 0, NULL, NULL},
 };
 
-
-static void sculpt_face_set_by_topology_poly_loop(Object *ob, const int next_face_set_id) {
+static void sculpt_face_set_by_topology_poly_loop(Object *ob, const int next_face_set_id)
+{
   SculptSession *ss = ob->sculpt;
   BLI_bitmap *poly_loop = sculpt_poly_loop_from_cursor(ob);
-  for (int i = 0; i < ss->totfaces; i++)  {
+  for (int i = 0; i < ss->totfaces; i++) {
     if (BLI_BITMAP_TEST(poly_loop, i)) {
       ss->face_sets[i] = next_face_set_id;
     }
@@ -134,15 +133,14 @@ static int sculpt_face_set_by_topology_invoke(bContext *C, wmOperator *op, const
   SCULPT_undo_push_begin(ob, "face set edit");
   SCULPT_undo_push_node(ob, nodes[0], SCULPT_UNDO_FACE_SETS);
 
-
   const int initial_poly = ss->active_face_index;
   const int initial_edge = sculpt_poly_loop_initial_edge_from_cursor(ob);
 
   Mesh *mesh = BKE_object_get_original_mesh(ob);
   int new_face_set = SCULPT_FACE_SET_NONE;
 
-
-  if (repeat_previous && ss->face_set_last_created != SCULPT_FACE_SET_NONE && initial_poly != ss->face_set_last_poly && initial_edge != ss->face_set_last_edge) {
+  if (repeat_previous && ss->face_set_last_created != SCULPT_FACE_SET_NONE &&
+      initial_poly != ss->face_set_last_poly && initial_edge != ss->face_set_last_edge) {
     new_face_set = ss->face_set_last_created;
   }
   else {
@@ -157,11 +155,9 @@ static int sculpt_face_set_by_topology_invoke(bContext *C, wmOperator *op, const
       break;
   }
 
-
- ss->face_set_last_created = new_face_set;
- ss->face_set_last_edge = initial_edge;
- ss->face_set_last_poly = initial_poly;
-
+  ss->face_set_last_created = new_face_set;
+  ss->face_set_last_edge = initial_edge;
+  ss->face_set_last_poly = initial_poly;
 
   /* Sync face sets visibility and vertex visibility as now all Face Sets are visible. */
   SCULPT_visibility_sync_all_face_sets_to_vertices(ob);
@@ -197,9 +193,16 @@ void SCULPT_OT_face_set_by_topology(struct wmOperatorType *ot)
 
   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
-  RNA_def_enum(
-      ot->srna, "mode", prop_sculpt_face_set_by_topology, SCULPT_FACE_SET_TOPOLOGY_POLY_LOOP, "Mode", "");
-
-  RNA_def_boolean(
-      ot->srna, "repeat_previous", true, "Repeat previous Face Set", "Repeat the latest created Face Set instead of a new one");
+  RNA_def_enum(ot->srna,
+              

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list