[Bf-blender-cvs] [7e15638ccea] master: Cleanup: style, always use braces

Campbell Barton noreply at git.blender.org
Mon Dec 16 23:53:51 CET 2019


Commit: 7e15638cceaf570995ebd7fcd719914885202ccc
Author: Campbell Barton
Date:   Tue Dec 17 09:51:38 2019 +1100
Branches: master
https://developer.blender.org/rB7e15638cceaf570995ebd7fcd719914885202ccc

Cleanup: style, always use braces

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

M	source/blender/blenkernel/intern/fluid.c
M	source/blender/blenkernel/intern/particle_system.c
M	source/blender/editors/physics/physics_fluid.c
M	source/blender/editors/sculpt_paint/paint_image_2d.c
M	source/blender/editors/space_image/image_draw.c
M	source/blender/makesrna/intern/rna_fluid.c
M	source/blender/makesrna/intern/rna_image.c

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

diff --git a/source/blender/blenkernel/intern/fluid.c b/source/blender/blenkernel/intern/fluid.c
index b076be7fd91..c33d38d15d6 100644
--- a/source/blender/blenkernel/intern/fluid.c
+++ b/source/blender/blenkernel/intern/fluid.c
@@ -324,32 +324,37 @@ void BKE_fluid_cache_free(FluidDomainSettings *mds, Object *ob, int cache_map)
     flags &= ~(FLUID_DOMAIN_BAKING_DATA | FLUID_DOMAIN_BAKED_DATA | FLUID_DOMAIN_OUTDATED_DATA);
     tmpDir[0] = '\0';
     BLI_path_join(tmpDir, sizeof(tmpDir), mds->cache_directory, FLUID_DOMAIN_DIR_CONFIG, NULL);
-    if (BLI_exists(tmpDir))
+    if (BLI_exists(tmpDir)) {
       BLI_delete(tmpDir, true, true);
+    }
     tmpDir[0] = '\0';
     BLI_path_join(tmpDir, sizeof(tmpDir), mds->cache_directory, FLUID_DOMAIN_DIR_DATA, NULL);
-    if (BLI_exists(tmpDir))
+    if (BLI_exists(tmpDir)) {
       BLI_delete(tmpDir, true, true);
+    }
     tmpDir[0] = '\0';
     BLI_path_join(tmpDir, sizeof(tmpDir), mds->cache_directory, FLUID_DOMAIN_DIR_SCRIPT, NULL);
-    if (BLI_exists(tmpDir))
+    if (BLI_exists(tmpDir)) {
       BLI_delete(tmpDir, true, true);
+    }
     mds->cache_frame_pause_data = 0;
   }
   if (cache_map & FLUID_DOMAIN_OUTDATED_NOISE) {
     flags &= ~(FLUID_DOMAIN_BAKING_NOISE | FLUID_DOMAIN_BAKED_NOISE | FLUID_DOMAIN_OUTDATED_NOISE);
     tmpDir[0] = '\0';
     BLI_path_join(tmpDir, sizeof(tmpDir), mds->cache_directory, FLUID_DOMAIN_DIR_NOISE, NULL);
-    if (BLI_exists(tmpDir))
+    if (BLI_exists(tmpDir)) {
       BLI_delete(tmpDir, true, true);
+    }
     mds->cache_frame_pause_noise = 0;
   }
   if (cache_map & FLUID_DOMAIN_OUTDATED_MESH) {
     flags &= ~(FLUID_DOMAIN_BAKING_MESH | FLUID_DOMAIN_BAKED_MESH | FLUID_DOMAIN_OUTDATED_MESH);
     tmpDir[0] = '\0';
     BLI_path_join(tmpDir, sizeof(tmpDir), mds->cache_directory, FLUID_DOMAIN_DIR_MESH, NULL);
-    if (BLI_exists(tmpDir))
+    if (BLI_exists(tmpDir)) {
       BLI_delete(tmpDir, true, true);
+    }
     mds->cache_frame_pause_mesh = 0;
   }
   if (cache_map & FLUID_DOMAIN_OUTDATED_PARTICLES) {
@@ -357,8 +362,9 @@ void BKE_fluid_cache_free(FluidDomainSettings *mds, Object *ob, int cache_map)
                FLUID_DOMAIN_OUTDATED_PARTICLES);
     tmpDir[0] = '\0';
     BLI_path_join(tmpDir, sizeof(tmpDir), mds->cache_directory, FLUID_DOMAIN_DIR_PARTICLES, NULL);
-    if (BLI_exists(tmpDir))
+    if (BLI_exists(tmpDir)) {
       BLI_delete(tmpDir, true, true);
+    }
     mds->cache_frame_pause_particles = 0;
   }
 
@@ -367,8 +373,9 @@ void BKE_fluid_cache_free(FluidDomainSettings *mds, Object *ob, int cache_map)
                FLUID_DOMAIN_OUTDATED_GUIDING);
     tmpDir[0] = '\0';
     BLI_path_join(tmpDir, sizeof(tmpDir), mds->cache_directory, FLUID_DOMAIN_DIR_GUIDING, NULL);
-    if (BLI_exists(tmpDir))
+    if (BLI_exists(tmpDir)) {
       BLI_delete(tmpDir, true, true);
+    }
     mds->cache_frame_pause_guiding = 0;
   }
   mds->cache_flag = flags;
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 26bfcdacc78..d4a61c83911 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -4199,19 +4199,24 @@ static void particles_fluid_step(ParticleSimulationData *sim,
         /* tottypepart is the amount of particles of a snd particle type. */
         for (p = 0; p < totpart; p++) {
           flagActivePart = manta_liquid_get_snd_particle_flag_at(mds->fluid, p);
-          if ((part->type & PART_FLUID_SPRAY) && (flagActivePart & PARTICLE_TYPE_SPRAY))
+          if ((part->type & PART_FLUID_SPRAY) && (flagActivePart & PARTICLE_TYPE_SPRAY)) {
             tottypepart++;
-          if ((part->type & PART_FLUID_BUBBLE) && (flagActivePart & PARTICLE_TYPE_BUBBLE))
+          }
+          if ((part->type & PART_FLUID_BUBBLE) && (flagActivePart & PARTICLE_TYPE_BUBBLE)) {
             tottypepart++;
-          if ((part->type & PART_FLUID_FOAM) && (flagActivePart & PARTICLE_TYPE_FOAM))
+          }
+          if ((part->type & PART_FLUID_FOAM) && (flagActivePart & PARTICLE_TYPE_FOAM)) {
             tottypepart++;
-          if ((part->type & PART_FLUID_TRACER) && (flagActivePart & PARTICLE_TYPE_TRACER))
+          }
+          if ((part->type & PART_FLUID_TRACER) && (flagActivePart & PARTICLE_TYPE_TRACER)) {
             tottypepart++;
+          }
         }
       }
       /* Sanity check: no particles present. */
-      if (!totpart || !tottypepart)
+      if (!totpart || !tottypepart) {
         return;
+      }
 
       /* How many particles to display? */
       tottypepart = (use_render_params) ? tottypepart : (part->disp * tottypepart) / 100;
@@ -4232,8 +4237,9 @@ static void particles_fluid_step(ParticleSimulationData *sim,
 
         /* Apply some randomness and determine which particles to skip. */
         r = BLI_rng_get_double(sim->rng);
-        if (r > dispProb)
+        if (r > dispProb) {
           continue;
+        }
 
         /* flag, res, upres, pos, vel for FLIP and snd particles have different getters. */
         if (part->type & PART_FLUID_FLIP) {
@@ -4284,22 +4290,27 @@ static void particles_fluid_step(ParticleSimulationData *sim,
 
         /* Type of particle must matche current particle system type (only important for snd
          * particles). */
-        if ((flagActivePart & PARTICLE_TYPE_SPRAY) && (part->type & PART_FLUID_SPRAY) == 0)
+        if ((flagActivePart & PARTICLE_TYPE_SPRAY) && (part->type & PART_FLUID_SPRAY) == 0) {
           continue;
-        if ((flagActivePart & PARTICLE_TYPE_BUBBLE) && (part->type & PART_FLUID_BUBBLE) == 0)
+        }
+        if ((flagActivePart & PARTICLE_TYPE_BUBBLE) && (part->type & PART_FLUID_BUBBLE) == 0) {
           continue;
-        if ((flagActivePart & PARTICLE_TYPE_FOAM) && (part->type & PART_FLUID_FOAM) == 0)
+        }
+        if ((flagActivePart & PARTICLE_TYPE_FOAM) && (part->type & PART_FLUID_FOAM) == 0) {
           continue;
-        if ((flagActivePart & PARTICLE_TYPE_TRACER) && (part->type & PART_FLUID_TRACER) == 0)
+        }
+        if ((flagActivePart & PARTICLE_TYPE_TRACER) && (part->type & PART_FLUID_TRACER) == 0) {
           continue;
+        }
 #  if 0
         /* Debugging: Print type of particle system and current particles. */
         printf("system type is %d and particle type is %d\n", part->type, flagActivePart);
 #  endif
         /* Particle system has allocated tottypeparts particles - so break early before exceeded.
          */
-        if (activeParts >= tottypepart)
+        if (activeParts >= tottypepart) {
           break;
+        }
 
         /* Only show active particles, i.e. filter out dead particles that just Mantaflow needs.
          * Mantaflow convention: PARTICLE_TYPE_DELETE == inactive particle. */
@@ -4308,8 +4319,9 @@ static void particles_fluid_step(ParticleSimulationData *sim,
 
           /* Use particle system settings for particle size. */
           pa->size = part->size;
-          if (part->randsize > 0.0f)
+          if (part->randsize > 0.0f) {
             pa->size *= 1.0f - part->randsize * psys_frand(psys, p + 1);
+          }
 
           /* Get size (dimension) but considering scaling */
           copy_v3_v3(cell_size_scaled, mds->cell_size);
diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c
index 6270112677a..1d5c5bf7327 100644
--- a/source/blender/editors/physics/physics_fluid.c
+++ b/source/blender/editors/physics/physics_fluid.c
@@ -259,8 +259,9 @@ static void fluid_bake_sequence(FluidJob *job)
   }
 
   /* Show progress bar. */
-  if (job->do_update)
+  if (job->do_update) {
     *(job->do_update) = true;
+  }
 
   /* Get current pause frame (pointer) - depending on bake type */
   pause_frame = job->pause_frame;
@@ -287,10 +288,12 @@ static void fluid_bake_sequence(FluidJob *job)
     }
 
     /* Update progress bar */
-    if (job->do_update)
+    if (job->do_update) {
       *(job->do_update) = true;
-    if (job->progress)
+    }
+    if (job->progress) {
       *(job->progress) = progress;
+    }
 
     CFRA = frame;
 
@@ -425,10 +428,12 @@ static void fluid_bake_startjob(void *customdata, short *stop, short *do_update,
 
   fluid_bake_sequence(job);
 
-  if (do_update)
+  if (do_update) {
     *do_update = true;
-  if (stop)
+  }
+  if (stop) {
     *stop = 0;
+  }
 }
 
 static void fluid_free_endjob(void *customdata)
@@ -571,8 +576,9 @@ static int fluid_bake_invoke(struct bContext *C,
 static int fluid_bake_modal(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
 {
   /* no running blender, remove handler and pass through */
-  if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C), WM_JOB_TYPE_OBJECT_SIM_FLUID))
+  if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C), WM_JOB_TYPE_OBJECT_SIM_FLUID)) {
     return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
+  }
 
   switch (event->type) {
     case ESCKEY:
diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c
index bf198f70a67..7f71110b360 100644
--- a/source/blender/editors/sculpt_paint/paint_image_2d.c
+++ b/source/blender/editors/sculpt_paint/paint_image_2d.c
@@ -1656,8 +1656,9 @@ void paint_2d_stroke(void *ps,
 
     brush_painter_2d_refresh_cache(s, painter, tile, new_coord, mval, pressure, distance, size);
 
-    if (paint_2d_op(s, tile, old_coord, new_coord))
+    if (paint_2d_op(s, tile, old_coord, new_coord)) {
       tile->need_redraw = true;
+    }
   }
 
   painter->firsttouch = 0;
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index 9a633427d82..3f563fe9033 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -549,12 +549,15 @@ static void draw_udim_label(ARegion *ar, float fx, float fy, const char *label)
   int textwidth = BLF_width(blf_mono_font, label, strlen(label)) + 10;
   float stepx = BLI_rcti_size_x(&ar->v2d.mask) / BLI_rctf_size_x(&ar->v2d.cur);
   float opacity;
-  if (textwidth < 0.5f * (stepx - 10))
+  if (textwidth < 0.5f * (stepx - 10)) {
     opacity = 1.0f;
-  else if (textwidth < (stepx - 10))
+  }
+ 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list