[Bf-blender-cvs] [7ac581cb1b0] master: Cleanup: clang format for particle loop macros

Philipp Oeser noreply at git.blender.org
Thu Sep 26 17:58:22 CEST 2019


Commit: 7ac581cb1b0070da7098d30c9437052923827048
Author: Philipp Oeser
Date:   Thu Sep 26 16:31:42 2019 +0200
Branches: master
https://developer.blender.org/rB7ac581cb1b0070da7098d30c9437052923827048

Cleanup: clang format for particle loop macros

See https://developer.blender.org/D5903

Reviewers: JacquesLucke

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

M	source/blender/editors/physics/particle_edit.c
M	source/blender/editors/physics/particle_edit_undo.c
M	source/blender/editors/physics/particle_object.c

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

diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 1e2722ae776..f0b5b5a7e54 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -151,8 +151,7 @@ void PE_free_ptcache_edit(PTCacheEdit *edit)
   }
 
   if (edit->points) {
-    LOOP_POINTS
-    {
+    LOOP_POINTS {
       if (point->keys) {
         MEM_freeN(point->keys);
       }
@@ -382,10 +381,8 @@ void PE_hide_keys_time(Scene *scene, PTCacheEdit *edit, float cfra)
   KEY_K;
 
   if (pset->flag & PE_FADE_TIME && pset->selectmode == SCE_SELECT_POINT) {
-    LOOP_POINTS
-    {
-      LOOP_KEYS
-      {
+    LOOP_POINTS {
+      LOOP_KEYS {
         if (fabsf(cfra - *key->time) < pset->fade_frames) {
           key->flag &= ~PEK_HIDE;
         }
@@ -397,10 +394,8 @@ void PE_hide_keys_time(Scene *scene, PTCacheEdit *edit, float cfra)
     }
   }
   else {
-    LOOP_POINTS
-    {
-      LOOP_KEYS
-      {
+    LOOP_POINTS {
+      LOOP_KEYS {
         key->flag &= ~PEK_HIDE;
       }
     }
@@ -636,8 +631,7 @@ static bool point_is_selected(PTCacheEditPoint *point)
     return 0;
   }
 
-  LOOP_SELECTED_KEYS
-  {
+  LOOP_SELECTED_KEYS {
     return 1;
   }
 
@@ -687,8 +681,7 @@ static void for_mouse_hit_keys(PEData *data, ForKeyFunc func, const enum ePartic
   nearest_point = -1;
   nearest_key = -1;
 
-  LOOP_VISIBLE_POINTS
-  {
+  LOOP_VISIBLE_POINTS {
     if (pset->selectmode == SCE_SELECT_END) {
       if (point->totkey) {
         /* only do end keys */
@@ -710,8 +703,7 @@ static void for_mouse_hit_keys(PEData *data, ForKeyFunc func, const enum ePartic
     }
     else {
       /* do all keys */
-      LOOP_VISIBLE_KEYS
-      {
+      LOOP_VISIBLE_KEYS {
         if (flag & PSEL_NEAREST) {
           if (key_inside_circle(data, dist, KEY_WCO, &dist)) {
             nearest_point = p;
@@ -748,8 +740,7 @@ static void foreach_mouse_hit_point(PEData *data, ForHitPointFunc func, int sele
     selected = 0;
   }
 
-  LOOP_VISIBLE_POINTS
-  {
+  LOOP_VISIBLE_POINTS {
     if (pset->selectmode == SCE_SELECT_END) {
       if (point->totkey) {
         /* only do end keys */
@@ -765,8 +756,7 @@ static void foreach_mouse_hit_point(PEData *data, ForHitPointFunc func, int sele
     }
     else {
       /* do all keys */
-      LOOP_VISIBLE_KEYS
-      {
+      LOOP_VISIBLE_KEYS {
         if (selected == 0 || key->flag & PEK_SELECT) {
           float mouse_distance;
           if (key_inside_circle(data, data->rad, KEY_WCO, &mouse_distance)) {
@@ -826,8 +816,7 @@ static void foreach_mouse_hit_key_iter(void *__restrict iter_data_v,
     /* do all keys */
     PTCacheEditKey *key;
     int k;
-    LOOP_VISIBLE_KEYS
-    {
+    LOOP_VISIBLE_KEYS {
       if (selected == 0 || key->flag & PEK_SELECT) {
         float mouse_distance;
         if (key_inside_circle(data, data->rad, KEY_WCO, &mouse_distance)) {
@@ -869,8 +858,7 @@ static void foreach_selected_point(PEData *data, ForPointFunc func)
   PTCacheEdit *edit = data->edit;
   POINT_P;
 
-  LOOP_SELECTED_POINTS
-  {
+  LOOP_SELECTED_POINTS {
     func(data, p);
   }
 }
@@ -881,10 +869,8 @@ static void foreach_selected_key(PEData *data, ForKeyFunc func)
   POINT_P;
   KEY_K;
 
-  LOOP_VISIBLE_POINTS
-  {
-    LOOP_SELECTED_KEYS
-    {
+  LOOP_VISIBLE_POINTS {
+    LOOP_SELECTED_KEYS {
       func(data, p, k, true);
     }
   }
@@ -895,8 +881,7 @@ static void foreach_point(PEData *data, ForPointFunc func)
   PTCacheEdit *edit = data->edit;
   POINT_P;
 
-  LOOP_POINTS
-  {
+  LOOP_POINTS {
     func(data, p);
   }
 }
@@ -908,11 +893,9 @@ static int count_selected_keys(Scene *scene, PTCacheEdit *edit)
   KEY_K;
   int sel = 0;
 
-  LOOP_VISIBLE_POINTS
-  {
+  LOOP_VISIBLE_POINTS {
     if (pset->selectmode == SCE_SELECT_POINT) {
-      LOOP_SELECTED_KEYS
-      {
+      LOOP_SELECTED_KEYS {
         sel++;
       }
     }
@@ -1120,8 +1103,7 @@ static void PE_apply_mirror(Object *ob, ParticleSystem *psys)
 
   /* we delay settings the PARS_EDIT_RECALC for mirrored particles
    * to avoid doing mirror twice */
-  LOOP_POINTS
-  {
+  LOOP_POINTS {
     if (point->flag & PEP_EDIT_RECALC) {
       PE_mirror_particle(ob, psmd_eval->mesh_final, psys, psys->particles + p, NULL);
 
@@ -1131,8 +1113,7 @@ static void PE_apply_mirror(Object *ob, ParticleSystem *psys)
     }
   }
 
-  LOOP_POINTS
-  {
+  LOOP_POINTS {
     if (point->flag & PEP_EDIT_RECALC) {
       if (edit->mirror_cache[p] != -1) {
         edit->points[edit->mirror_cache[p]].flag |= PEP_EDIT_RECALC;
@@ -1176,13 +1157,11 @@ static void deflect_emitter_iter(void *__restrict iter_data_v,
   psys_mat_hair_to_object(
       object, psmd_eval->mesh_final, psys->part->from, psys->particles + iter, hairmat);
 
-  LOOP_KEYS
-  {
+  LOOP_KEYS {
     mul_m4_v3(hairmat, key->co);
   }
 
-  LOOP_KEYS
-  {
+  LOOP_KEYS {
     if (k == 0) {
       dist_1st = len_v3v3((key + 1)->co, key->co);
       dist_1st *= dist * emitterdist;
@@ -1218,8 +1197,7 @@ static void deflect_emitter_iter(void *__restrict iter_data_v,
 
   invert_m4_m4(hairimat, hairmat);
 
-  LOOP_KEYS
-  {
+  LOOP_KEYS {
     mul_m4_v3(hairimat, key->co);
   }
 }
@@ -1271,8 +1249,7 @@ static void apply_lengths_iter(void *__restrict iter_data_v,
   }
   PTCacheEditKey *key;
   int k;
-  LOOP_KEYS
-  {
+  LOOP_KEYS {
     if (k) {
       float dv1[3];
       sub_v3_v3v3(dv1, key->co, (key - 1)->co);
@@ -1390,8 +1367,7 @@ void recalc_lengths(PTCacheEdit *edit)
     return;
   }
 
-  LOOP_EDITED_POINTS
-  {
+  LOOP_EDITED_POINTS {
     key = point->keys;
     for (k = 0; k < point->totkey - 1; k++, key++) {
       key->length = len_v3v3(key->co, (key + 1)->co);
@@ -1471,8 +1447,7 @@ static void PE_update_selection(Depsgraph *depsgraph, Scene *scene, Object *ob,
 
   /* flag all particles to be updated if not using flag */
   if (!useflag) {
-    LOOP_POINTS
-    {
+    LOOP_POINTS {
       point->flag |= PEP_EDIT_RECALC;
     }
   }
@@ -1480,11 +1455,9 @@ static void PE_update_selection(Depsgraph *depsgraph, Scene *scene, Object *ob,
   /* flush edit key flag to hair key flag to preserve selection
    * on save */
   if (edit->psys) {
-    LOOP_POINTS
-    {
+    LOOP_POINTS {
       hkey = edit->psys->particles[p].hair;
-      LOOP_KEYS
-      {
+      LOOP_KEYS {
         hkey->editflag = key->flag;
         hkey++;
       }
@@ -1494,8 +1467,7 @@ static void PE_update_selection(Depsgraph *depsgraph, Scene *scene, Object *ob,
   psys_cache_edit_paths(depsgraph, scene, ob, edit, CFRA, G.is_rendering);
 
   /* disable update flag */
-  LOOP_POINTS
-  {
+  LOOP_POINTS {
     point->flag &= ~PEP_EDIT_RECALC;
   }
 
@@ -1514,15 +1486,13 @@ void update_world_cos(Object *ob, PTCacheEdit *edit)
     return;
   }
 
-  LOOP_POINTS
-  {
+  LOOP_POINTS {
     if (!(psys->flag & PSYS_GLOBAL_HAIR)) {
       psys_mat_hair_to_global(
           ob, psmd_eval->mesh_final, psys->part->from, psys->particles + p, hairmat);
     }
 
-    LOOP_KEYS
-    {
+    LOOP_KEYS {
       copy_v3_v3(key->world_co, key->co);
       if (!(psys->flag & PSYS_GLOBAL_HAIR)) {
         mul_m4_v3(hairmat, key->world_co);
@@ -1544,10 +1514,8 @@ static void update_velocities(PTCacheEdit *edit)
 
   frs_sec = edit->pid.flag & PTCACHE_VEL_PER_SEC ? 25.0f : 1.0f;
 
-  LOOP_EDITED_POINTS
-  {
-    LOOP_KEYS
-    {
+  LOOP_EDITED_POINTS {
+    LOOP_KEYS {
       if (k == 0) {
         dfra = *(key + 1)->time - *key->time;
 
@@ -1608,8 +1576,7 @@ void PE_update_object(Depsgraph *depsgraph, Scene *scene, Object *ob, int usefla
 
   /* flag all particles to be updated if not using flag */
   if (!useflag) {
-    LOOP_POINTS
-    {
+    LOOP_POINTS {
       point->flag |= PEP_EDIT_RECALC;
     }
   }
@@ -1639,8 +1606,7 @@ void PE_update_object(Depsgraph *depsgraph, Scene *scene, Object *ob, int usefla
   psys_cache_edit_paths(depsgraph, scene, ob, edit, CFRA, G.is_rendering);
 
   /* disable update flag */
-  LOOP_POINTS
-  {
+  LOOP_POINTS {
     point->flag &= ~PEP_EDIT_RECALC;
   }
 
@@ -1695,8 +1661,7 @@ static void select_keys(PEData *data,
   PTCacheEditPoint *point = edit->points + point_index;
   KEY_K;
 
-  LOOP_KEYS
-  {
+  LOOP_KEYS {
     if (data->select) {
       key->flag |= PEK_SELECT;
     }
@@ -1796,10 +1761,8 @@ static int pe_select_all_exec(bContext *C, wmOperator *op)
 
   if (action == SEL_TOGGLE) {
     action = SEL_SELECT;
-    LOOP_VISIBLE_POINTS
-    {
-      LOOP_SELECTED_KEYS
-      {
+    LOOP_VISIBLE_POINTS {
+      LOOP_SELECTED_KEYS {
         action = SEL_DESELECT;
         break;
       }
@@ -1811,10 +1774,8 @@ static int pe_select_all_exec(bContext *C, wmOperator *op)
   }
 
   bool changed = false;
-  LOOP_VISIBLE_POINTS
-  {
-    LOOP_VISIBLE_KEYS
-    {
+  LOOP_VISIBLE_POINTS {
+    LOOP_VISIBLE_KEYS {
       changed |= select_action_apply(point, key, action);
     }
   }
@@ -1859,10 +1820,8 @@ bool PE_mouse_particles(bContext *C, const int mval[2], bool extend, bool desele
   }
 
   if (!extend && !deselect && !toggle) {
-    LOOP_VISIBLE_POINTS
-    {
-      LOOP_SELECTED_KEYS
-      {
+    LOOP_VISIBLE_POINTS {
+      LOOP_SELECTED_KEYS {
         key->flag &= ~PEK_SELECT;
         point->flag |= PEP_EDIT_RECALC;
       }
@@ -2064,20 +2023,16 @@ static int select_random_exec(bContext *C, wmOperator *op)
 
   switch (type) {
     case RAN_HAIR:
-      LOOP_VISIBLE_POINTS
-      {
+      LOOP_VISIBLE_POINTS {
         int flag = ((BLI_rng_get_float(rng) < randfac) == select) ? SEL_SELECT : SEL_DESELECT;
-        LOOP_KEYS
-        {
+        LOOP_KEYS {
           data.is_changed |= select_action_apply(point, key, flag);
         }
       }
       break;
     case RAN_POINTS:
-      LOOP_VISIBLE_POINTS
-      {
-        LOOP_VISIBLE_KEYS
-        {
+      LOOP_VISIBLE_POINTS {
+        LOOP_VISIBLE_KEYS {
           int flag = ((BLI_rng_get_float(rng) < randfac) == select) ? SEL_SELECT : SEL_DESELECT;
           data.is_changed |= select_action_apply(point, key, flag);
         }
@@ -2176,10 +2131,8 @@ bool PE_deselect_all_visible_ex(PTCacheEdit *edit)
   POINT_P;
   KEY_K;
 
-  LOOP_VISIBLE_POINTS
-  {
-    LOOP_SELECTED_KEYS
-    {
+  LOOP_VISIBLE_POINTS {
+    LOOP_SELECTED_KEYS {
       if ((key->flag & PEK_SELECT) != 0) {
         key

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list