Cleanup: style, always use braces
authorCampbell Barton <ideasman42@gmail.com>
Mon, 16 Dec 2019 22:51:38 +0000 (09:51 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 16 Dec 2019 22:53:25 +0000 (09:53 +1100)
source/blender/blenkernel/intern/fluid.c
source/blender/blenkernel/intern/particle_system.c
source/blender/editors/physics/physics_fluid.c
source/blender/editors/sculpt_paint/paint_image_2d.c
source/blender/editors/space_image/image_draw.c
source/blender/makesrna/intern/rna_fluid.c
source/blender/makesrna/intern/rna_image.c

index b076be7fd91818413b916a0156babd2c04be8776..c33d38d15d6129ccff3c89a5cae22914242b7e5d 100644 (file)
@@ -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;
index 26bfcdacc787e5a19dbf01ff923e5e4e6c2093e5..d4a61c83911b3c685ef43818301ff45b701988ba 100644 (file)
@@ -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);
index 6270112677a3f017b92691a9bcdfcbb60a3c1bc9..1d5c5bf7327d45dc8a43846df21a929a7cf2314d 100644 (file)
@@ -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:
index bf198f70a67f8d9fbe2b008276a6d9483c251bd1..7f71110b3600f87eef7a66ecb8c59bbfb828dd2e 100644 (file)
@@ -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;
index 9a633427d8291436b043756433738c0fa6fe1352..3f563fe9033e531db56dfdbe8b2e13fb77e7c2a6 100644 (file)
@@ -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))
+  }
+  else if (textwidth < (stepx - 10)) {
     opacity = 2.0f - 2.0f * (textwidth / (stepx - 10));
-  else
+  }
+  else {
     opacity = 0.0f;
+  }
   BLF_color4ub(blf_mono_font, 220, 220, 220, 150 * opacity);
   BLF_position(blf_mono_font, (int)(x + 10), (int)(y + 10), 0);
   BLF_draw_ascii(blf_mono_font, label, strlen(label));
index 4cbceb86fc0055f312e3ee75aae092ef60360c5e..44cfa99aa13dd68837d1bb61a49c88866aac34a8 100644 (file)
@@ -108,8 +108,9 @@ static void rna_Fluid_reset_dependency(Main *bmain, Scene *scene, PointerRNA *pt
   fluidModifier_reset(settings->mmd);
 #  endif
 
-  if (settings->mmd && settings->mmd->domain)
+  if (settings->mmd && settings->mmd->domain) {
     settings->mmd->domain->point_cache[0]->flag |= PTCACHE_OUTDATED;
+  }
 
   rna_Fluid_dependency_update(bmain, scene, ptr);
 }
@@ -145,8 +146,9 @@ static bool rna_Fluid_parts_exists(PointerRNA *ptr, int ptype)
   ParticleSystem *psys;
 
   for (psys = ob->particlesystem.first; psys; psys = psys->next) {
-    if (psys->part->type == ptype)
+    if (psys->part->type == ptype) {
       return true;
+    }
   }
   return false;
 }
@@ -318,9 +320,10 @@ static void rna_Fluid_combined_export_update(Main *bmain, Scene *scene, PointerR
     }
   }
   else if (mmd->domain->sndparticle_combined_export == SNDPARTICLE_COMBINED_EXPORT_SPRAY_FOAM) {
-    if (ob->type == OB_MESH && !rna_Fluid_parts_exists(ptr, (PART_FLUID_SPRAY | PART_FLUID_FOAM)))
-
+    if (ob->type == OB_MESH &&
+        !rna_Fluid_parts_exists(ptr, (PART_FLUID_SPRAY | PART_FLUID_FOAM))) {
       rna_Fluid_parts_delete(ptr, (PART_FLUID_SPRAY | PART_FLUID_FOAM));
+    }
     rna_Fluid_parts_create(bmain,
                            ptr,
                            "SprayFoamParticleSettings",
@@ -338,9 +341,9 @@ static void rna_Fluid_combined_export_update(Main *bmain, Scene *scene, PointerR
   }
   else if (mmd->domain->sndparticle_combined_export == SNDPARTICLE_COMBINED_EXPORT_SPRAY_BUBBLE) {
     if (ob->type == OB_MESH &&
-        !rna_Fluid_parts_exists(ptr, (PART_FLUID_SPRAY | PART_FLUID_BUBBLE)))
-
+        !rna_Fluid_parts_exists(ptr, (PART_FLUID_SPRAY | PART_FLUID_BUBBLE))) {
       rna_Fluid_parts_delete(ptr, (PART_FLUID_SPRAY | PART_FLUID_BUBBLE));
+    }
     rna_Fluid_parts_create(bmain,
                            ptr,
                            "SprayBubbleParticleSettings",
@@ -357,9 +360,10 @@ static void rna_Fluid_combined_export_update(Main *bmain, Scene *scene, PointerR
     }
   }
   else if (mmd->domain->sndparticle_combined_export == SNDPARTICLE_COMBINED_EXPORT_FOAM_BUBBLE) {
-    if (ob->type == OB_MESH && !rna_Fluid_parts_exists(ptr, (PART_FLUID_FOAM | PART_FLUID_BUBBLE)))
-
+    if (ob->type == OB_MESH &&
+        !rna_Fluid_parts_exists(ptr, (PART_FLUID_FOAM | PART_FLUID_BUBBLE))) {
       rna_Fluid_parts_delete(ptr, (PART_FLUID_FOAM | PART_FLUID_BUBBLE));
+    }
     rna_Fluid_parts_create(bmain,
                            ptr,
                            "FoamBubbleParticleSettings",
@@ -378,9 +382,9 @@ static void rna_Fluid_combined_export_update(Main *bmain, Scene *scene, PointerR
   else if (mmd->domain->sndparticle_combined_export ==
            SNDPARTICLE_COMBINED_EXPORT_SPRAY_FOAM_BUBBLE) {
     if (ob->type == OB_MESH &&
-        !rna_Fluid_parts_exists(ptr, (PART_FLUID_SPRAY | PART_FLUID_FOAM | PART_FLUID_BUBBLE)))
-
+        !rna_Fluid_parts_exists(ptr, (PART_FLUID_SPRAY | PART_FLUID_FOAM | PART_FLUID_BUBBLE))) {
       rna_Fluid_parts_delete(ptr, (PART_FLUID_SPRAY | PART_FLUID_FOAM | PART_FLUID_BUBBLE));
+    }
     rna_Fluid_parts_create(bmain,
                            ptr,
                            "SprayFoamBubbleParticleSettings",
@@ -737,10 +741,12 @@ static void rna_FluidModifier_density_grid_get(PointerRNA *ptr, float *values)
 
   BLI_rw_mutex_lock(mds->fluid_mutex, THREAD_LOCK_READ);
 
-  if (mds->flags & FLUID_DOMAIN_USE_NOISE && mds->fluid)
+  if (mds->flags & FLUID_DOMAIN_USE_NOISE && mds->fluid) {
     density = manta_smoke_turbulence_get_density(mds->fluid);
-  else
+  }
+  else {
     density = manta_smoke_get_density(mds->fluid);
+  }
 
   memcpy(values, density, size * sizeof(float));
 
@@ -783,16 +789,20 @@ static void rna_FluidModifier_color_grid_get(PointerRNA *ptr, float *values)
   }
   else {
     if (mds->flags & FLUID_DOMAIN_USE_NOISE) {
-      if (manta_smoke_turbulence_has_colors(mds->fluid))
+      if (manta_smoke_turbulence_has_colors(mds->fluid)) {
         manta_smoke_turbulence_get_rgba(mds->fluid, values, 0);
-      else
+      }
+      else {
         manta_smoke_turbulence_get_rgba_from_density(mds->fluid, mds->active_color, values, 0);
+      }
     }
     else {
-      if (manta_smoke_has_colors(mds->fluid))
+      if (manta_smoke_has_colors(mds->fluid)) {
         manta_smoke_get_rgba(mds->fluid, values, 0);
-      else
+      }
+      else {
         manta_smoke_get_rgba_from_density(mds->fluid, mds->active_color, values, 0);
+      }
     }
   }
 
@@ -808,15 +818,19 @@ static void rna_FluidModifier_flame_grid_get(PointerRNA *ptr, float *values)
 
   BLI_rw_mutex_lock(mds->fluid_mutex, THREAD_LOCK_READ);
 
-  if (mds->flags & FLUID_DOMAIN_USE_NOISE && mds->fluid)
+  if (mds->flags & FLUID_DOMAIN_USE_NOISE && mds->fluid) {
     flame = manta_smoke_turbulence_get_flame(mds->fluid);
-  else
+  }
+  else {
     flame = manta_smoke_get_flame(mds->fluid);
+  }
 
-  if (flame)
+  if (flame) {
     memcpy(values, flame, size * sizeof(float));
-  else
+  }
+  else {
     memset(values, 0, size * sizeof(float));
+  }
 
   BLI_rw_mutex_unlock(mds->fluid_mutex);
 }
index 7a03bdb952b36a0e5640473d61f6845d86872de7..d07bf542954bba33ea1ac6b9b702a4e34ff8c195 100644 (file)
@@ -317,8 +317,9 @@ static void rna_Image_active_tile_set(PointerRNA *ptr,
   Image *image = (Image *)ptr->data;
   ImageTile *tile = (ImageTile *)value.data;
   const int index = BLI_findindex(&image->tiles, tile);
-  if (index != -1)
+  if (index != -1) {
     image->active_tile_index = index;
+  }
 }
 
 static bool rna_Image_has_data_get(PointerRNA *ptr)