[Bf-blender-cvs] [a25a7714c59] master: Cleanup: style, use braces for modifiers

Campbell Barton noreply at git.blender.org
Mon Apr 22 13:15:28 CEST 2019


Commit: a25a7714c592dff1fc1b3b4b0888bf984fa9e6fd
Author: Campbell Barton
Date:   Mon Apr 22 09:15:10 2019 +1000
Branches: master
https://developer.blender.org/rBa25a7714c592dff1fc1b3b4b0888bf984fa9e6fd

Cleanup: style, use braces for modifiers

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

M	source/blender/modifiers/intern/MOD_array.c
M	source/blender/modifiers/intern/MOD_bevel.c
M	source/blender/modifiers/intern/MOD_boolean.c
M	source/blender/modifiers/intern/MOD_build.c
M	source/blender/modifiers/intern/MOD_cast.c
M	source/blender/modifiers/intern/MOD_cloth.c
M	source/blender/modifiers/intern/MOD_collision.c
M	source/blender/modifiers/intern/MOD_displace.c
M	source/blender/modifiers/intern/MOD_edgesplit.c
M	source/blender/modifiers/intern/MOD_explode.c
M	source/blender/modifiers/intern/MOD_laplaciandeform.c
M	source/blender/modifiers/intern/MOD_laplaciansmooth.c
M	source/blender/modifiers/intern/MOD_meshcache.c
M	source/blender/modifiers/intern/MOD_meshdeform.c
M	source/blender/modifiers/intern/MOD_mirror.c
M	source/blender/modifiers/intern/MOD_ocean.c
M	source/blender/modifiers/intern/MOD_particleinstance.c
M	source/blender/modifiers/intern/MOD_particlesystem.c
M	source/blender/modifiers/intern/MOD_screw.c
M	source/blender/modifiers/intern/MOD_shapekey.c
M	source/blender/modifiers/intern/MOD_shrinkwrap.c
M	source/blender/modifiers/intern/MOD_simpledeform.c
M	source/blender/modifiers/intern/MOD_skin.c
M	source/blender/modifiers/intern/MOD_smoke.c
M	source/blender/modifiers/intern/MOD_smooth.c
M	source/blender/modifiers/intern/MOD_solidify.c
M	source/blender/modifiers/intern/MOD_surface.c
M	source/blender/modifiers/intern/MOD_util.c
M	source/blender/modifiers/intern/MOD_uvproject.c
M	source/blender/modifiers/intern/MOD_uvwarp.c
M	source/blender/modifiers/intern/MOD_warp.c
M	source/blender/modifiers/intern/MOD_wave.c
M	source/blender/modifiers/intern/MOD_weightvg_util.c
M	source/blender/modifiers/intern/MOD_weightvgedit.c
M	source/blender/modifiers/intern/MOD_weightvgmix.c
M	source/blender/modifiers/intern/MOD_weightvgproximity.c

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

diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c
index c909f9dc076..3443d275c81 100644
--- a/source/blender/modifiers/intern/MOD_array.c
+++ b/source/blender/modifiers/intern/MOD_array.c
@@ -121,12 +121,15 @@ static int svert_sum_cmp(const void *e1, const void *e2)
   const SortVertsElem *sv1 = e1;
   const SortVertsElem *sv2 = e2;
 
-  if (sv1->sum_co > sv2->sum_co)
+  if (sv1->sum_co > sv2->sum_co) {
     return 1;
-  else if (sv1->sum_co < sv2->sum_co)
+  }
+  else if (sv1->sum_co < sv2->sum_co) {
     return -1;
-  else
+  }
+  else {
     return 0;
+  }
 }
 
 static void svert_from_mvert(SortVertsElem *sv,
@@ -441,10 +444,12 @@ static Mesh *arrayModifier_doArray(ArrayModifierData *amd,
     float obinv[4][4];
     float result_mat[4][4];
 
-    if (ctx->object)
+    if (ctx->object) {
       invert_m4_m4(obinv, ctx->object->obmat);
-    else
+    }
+    else {
       unit_m4(obinv);
+    }
 
     mul_m4_series(result_mat, offset, obinv, amd->offset_ob->obmat);
     copy_m4_m4(offset, result_mat);
@@ -482,8 +487,9 @@ static Mesh *arrayModifier_doArray(ArrayModifierData *amd,
     }
   }
 
-  if (count < 1)
+  if (count < 1) {
     count = 1;
+  }
 
   /* The number of verts, edges, loops, polys, before eventually merging doubles */
   result_nverts = chunk_nverts * count + start_cap_nverts + end_cap_nverts;
diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c
index 32a020a35ff..02d3bd305be 100644
--- a/source/blender/modifiers/intern/MOD_bevel.c
+++ b/source/blender/modifiers/intern/MOD_bevel.c
@@ -124,24 +124,28 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
                             .pmask = CD_MASK_ORIGINDEX},
       });
 
-  if ((bmd->lim_flags & MOD_BEVEL_VGROUP) && bmd->defgrp_name[0])
+  if ((bmd->lim_flags & MOD_BEVEL_VGROUP) && bmd->defgrp_name[0]) {
     MOD_get_vgroup(ctx->object, mesh, bmd->defgrp_name, &dvert, &vgroup);
+  }
 
   if (vertex_only) {
     BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
-      if (!BM_vert_is_manifold(v))
+      if (!BM_vert_is_manifold(v)) {
         continue;
+      }
       if (bmd->lim_flags & MOD_BEVEL_WEIGHT) {
         weight = BM_elem_float_data_get(&bm->vdata, v, CD_BWEIGHT);
-        if (weight == 0.0f)
+        if (weight == 0.0f) {
           continue;
+        }
       }
       else if (vgroup != -1) {
         weight = defvert_array_find_weight_safe(dvert, BM_elem_index_get(v), vgroup);
         /* Check is against 0.5 rather than != 0.0 because cascaded bevel modifiers will
          * interpolate weights for newly created vertices, and may cause unexpected "selection" */
-        if (weight < 0.5f)
+        if (weight < 0.5f) {
           continue;
+        }
       }
       BM_elem_flag_enable(v, BM_ELEM_TAG);
     }
@@ -165,14 +169,16 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
       if (BM_edge_is_manifold(e)) {
         if (bmd->lim_flags & MOD_BEVEL_WEIGHT) {
           weight = BM_elem_float_data_get(&bm->edata, e, CD_BWEIGHT);
-          if (weight == 0.0f)
+          if (weight == 0.0f) {
             continue;
+          }
         }
         else if (vgroup != -1) {
           weight = defvert_array_find_weight_safe(dvert, BM_elem_index_get(e->v1), vgroup);
           weight2 = defvert_array_find_weight_safe(dvert, BM_elem_index_get(e->v2), vgroup);
-          if (weight < 0.5f || weight2 < 0.5f)
+          if (weight < 0.5f || weight2 < 0.5f) {
             continue;
+          }
         }
         BM_elem_flag_enable(e, BM_ELEM_TAG);
         BM_elem_flag_enable(e->v1, BM_ELEM_TAG);
diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c
index 6e6f98e9889..107622e33c0 100644
--- a/source/blender/modifiers/intern/MOD_boolean.c
+++ b/source/blender/modifiers/intern/MOD_boolean.c
@@ -323,8 +323,9 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
 
     /* if new mesh returned, return it; otherwise there was
      * an error, so delete the modifier object */
-    if (result == NULL)
+    if (result == NULL) {
       modifier_setError(md, "Cannot execute boolean operation");
+    }
   }
 
   return result;
diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c
index 7c8470b26d9..e61f6877d09 100644
--- a/source/blender/modifiers/intern/MOD_build.c
+++ b/source/blender/modifiers/intern/MOD_build.c
@@ -152,8 +152,9 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, str
     MEdge *medge, *me;
     uintptr_t hash_num;
 
-    if (bmd->flag & MOD_BUILD_FLAG_RANDOMIZE)
+    if (bmd->flag & MOD_BUILD_FLAG_RANDOMIZE) {
       BLI_array_randomize(edgeMap, sizeof(*edgeMap), numEdge_src, bmd->seed);
+    }
 
     /* get the set of all vert indices that will be in the final mesh,
      * mapped to the new indices
diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c
index b0a8a8c955f..0bf1dd8e2b3 100644
--- a/source/blender/modifiers/intern/MOD_cast.c
+++ b/source/blender/modifiers/intern/MOD_cast.c
@@ -62,8 +62,9 @@ static bool isDisabled(const struct Scene *UNUSED(scene),
 
   flag = cmd->flag & (MOD_CAST_X | MOD_CAST_Y | MOD_CAST_Z);
 
-  if ((cmd->fac == 0.0f) || flag == 0)
+  if ((cmd->fac == 0.0f) || flag == 0) {
     return true;
+  }
 
   return false;
 }
@@ -120,8 +121,9 @@ static void sphere_do(CastModifierData *cmd,
   flag = cmd->flag;
   type = cmd->type; /* projection type: sphere or cylinder */
 
-  if (type == MOD_CAST_TYPE_CYLINDER)
+  if (type == MOD_CAST_TYPE_CYLINDER) {
     flag &= ~MOD_CAST_Z;
+  }
 
   ctrl_ob = cmd->object;
 
@@ -144,8 +146,9 @@ static void sphere_do(CastModifierData *cmd,
   /* 1) (flag was checked in the "if (ctrl_ob)" block above) */
   /* 2) cmd->radius > 0.0f: only the vertices within this radius from
    * the center of the effect should be deformed */
-  if (cmd->radius > FLT_EPSILON)
+  if (cmd->radius > FLT_EPSILON) {
     has_radius = 1;
+  }
 
   /* 3) if we were given a vertex group name,
    * only those vertices should be affected */
@@ -164,8 +167,9 @@ static void sphere_do(CastModifierData *cmd,
     }
     len /= numVerts;
 
-    if (len == 0.0f)
+    if (len == 0.0f) {
       len = 10.0f;
+    }
   }
 
   for (i = 0; i < numVerts; i++) {
@@ -183,12 +187,14 @@ static void sphere_do(CastModifierData *cmd,
 
     copy_v3_v3(vec, tmp_co);
 
-    if (type == MOD_CAST_TYPE_CYLINDER)
+    if (type == MOD_CAST_TYPE_CYLINDER) {
       vec[2] = 0.0f;
+    }
 
     if (has_radius) {
-      if (len_v3(vec) > cmd->radius)
+      if (len_v3(vec) > cmd->radius) {
         continue;
+      }
     }
 
     if (dvert) {
@@ -203,12 +209,15 @@ static void sphere_do(CastModifierData *cmd,
 
     normalize_v3(vec);
 
-    if (flag & MOD_CAST_X)
+    if (flag & MOD_CAST_X) {
       tmp_co[0] = fac * vec[0] * len + facm * tmp_co[0];
-    if (flag & MOD_CAST_Y)
+    }
+    if (flag & MOD_CAST_Y) {
       tmp_co[1] = fac * vec[1] * len + facm * tmp_co[1];
-    if (flag & MOD_CAST_Z)
+    }
+    if (flag & MOD_CAST_Z) {
       tmp_co[2] = fac * vec[2] * len + facm * tmp_co[2];
+    }
 
     if (ctrl_ob) {
       if (flag & MOD_CAST_USE_OB_TRANSFORM) {
@@ -252,8 +261,9 @@ static void cuboid_do(CastModifierData *cmd,
   /* 1) (flag was checked in the "if (ctrl_ob)" block above) */
   /* 2) cmd->radius > 0.0f: only the vertices within this radius from
    * the center of the effect should be deformed */
-  if (cmd->radius > FLT_EPSILON)
+  if (cmd->radius > FLT_EPSILON) {
     has_radius = 1;
+  }
 
   /* 3) if we were given a vertex group name,
    * only those vertices should be affected */
@@ -309,12 +319,15 @@ static void cuboid_do(CastModifierData *cmd,
     }
 
     /* we want a symmetric bound box around the origin */
-    if (fabsf(min[0]) > fabsf(max[0]))
+    if (fabsf(min[0]) > fabsf(max[0])) {
       max[0] = fabsf(min[0]);
-    if (fabsf(min[1]) > fabsf(max[1]))
+    }
+    if (fabsf(min[1]) > fabsf(max[1])) {
       max[1] = fabsf(min[1]);
-    if (fabsf(min[2]) > fabsf(max[2]))
+    }
+    if (fabsf(min[2]) > fabsf(max[2])) {
       max[2] = fabsf(min[2]);
+    }
     min[0] = -max[0];
     min[1] = -max[1];
     min[2] = -max[2];
@@ -371,12 +384,15 @@ static void cuboid_do(CastModifierData *cmd,
 
     /* find in which octant this vertex is in */
     octant = 0;
-    if (tmp_co[0] > 0.0f)
+    if (tmp_co[0] > 0.0f) {
       octant += 1;
-    if (tmp_co[1] > 0.0f)
+    }
+    if (tmp_co[1] > 0.0f) {
       octant += 2;
-    if (tmp_co[2] > 0.0f)
+    }
+    if (tmp_co[2] > 0.0f) {
       octant += 4;
+    }
 
     /* apex is the bb's vertex at the chosen octant */
     copy_v3_v3(apex, bb[octant]);
@@ -400,20 +416,24 @@ static void cuboid_do(CastModifierData *cmd,
 
     /* ok, now we know which coordinate of the vertex to use */
 
-    if (fabsf(tmp_co[coord]) < FLT_EPSILON) /* avoid division by zero */
+    if (fabsf(tmp_co[coord]) < FLT_EPSILON) { /* avoid division by zero */
       continue;
+    }
 
     /* finally, this is the factor we wanted, to project the vertex
      * to its bounding box (bb) */
     fbb = apex[coord] / tmp_co[coord];
 
     /* calculate the new vertex position */
-    if (flag & MOD_CAST_X)
+    if (flag & MOD_CAST_X) {
       tmp_co[0] = facm * tmp_co[0] + fac * tmp_co[0] * fbb;
-    if (flag & MOD_CAST_Y)
+    }
+    if (flag & MOD_CAST_Y) {
       tmp_co[1] = facm * tmp_co[1] + fac * tmp_co[1] * fbb;
-    if (flag & MOD_CAST_Z)
+    }
+    if (flag & MOD_CAST_Z) {
       tmp_co[2] = facm * tmp_co[2] + fac * tmp_co[2] * fbb;
+    }
 
     if (ctrl_ob) {
       if (flag & MOD_CAST_USE_OB_TRANSFORM) {
diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c
index 9eeef583e44..3c4dd9f2c56 100644
--- a/source/blender/modifiers/intern/MOD_cloth.c
+++ b/source/blender/modifiers/intern/MOD_cloth.c
@@ -59,8 +59,9 @@ static void initData(ModifierData *md)
   clmd->point_cache = BKE_ptcache_add(&clmd->ptcaches);
 
   /* check for alloc failing */
-  if (!clmd->sim_parms || !clmd->coll_parm

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list