[Bf-blender-cvs] [f086cf3cea9] master: Cleanup: remove redundant parenthesis

Campbell Barton noreply at git.blender.org
Tue Feb 7 07:41:48 CET 2023


Commit: f086cf3cea9523a3bfe445b04d758961d6a4511e
Author: Campbell Barton
Date:   Tue Feb 7 17:34:20 2023 +1100
Branches: master
https://developer.blender.org/rBf086cf3cea9523a3bfe445b04d758961d6a4511e

Cleanup: remove redundant parenthesis

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

M	source/blender/blenkernel/intern/dynamicpaint.cc
M	source/blender/blenkernel/intern/fluid.cc
M	source/blender/blenkernel/intern/mesh_convert.cc
M	source/blender/blenkernel/intern/mesh_normals.cc
M	source/blender/blenkernel/intern/multires_reshape_ccg.cc
M	source/blender/blenkernel/intern/multires_reshape_util.cc
M	source/blender/editors/armature/meshlaplacian.cc
M	source/blender/editors/undo/ed_undo.cc
M	source/blender/modifiers/intern/MOD_solidify_nonmanifold.cc
M	source/blender/windowmanager/intern/wm_files.cc

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

diff --git a/source/blender/blenkernel/intern/dynamicpaint.cc b/source/blender/blenkernel/intern/dynamicpaint.cc
index 9b30d34aabb..bfd391c4cc9 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.cc
+++ b/source/blender/blenkernel/intern/dynamicpaint.cc
@@ -2245,13 +2245,13 @@ static void dynamic_paint_create_uv_surface_direct_cb(void *__restrict userdata,
      * A pixel middle sample isn't enough to find very narrow polygons
      * So using 4 samples of each corner too
      */
-    point[1][0] = (float(tx)) / w;
-    point[1][1] = (float(ty)) / h;
+    point[1][0] = float(tx) / w;
+    point[1][1] = float(ty) / h;
 
     point[2][0] = (float(tx) + 1) / w;
-    point[2][1] = (float(ty)) / h;
+    point[2][1] = float(ty) / h;
 
-    point[3][0] = (float(tx)) / w;
+    point[3][0] = float(tx) / w;
     point[3][1] = (float(ty) + 1) / h;
 
     point[4][0] = (float(tx) + 1) / w;
@@ -6386,7 +6386,7 @@ int dynamicPaint_calculateFrame(
     timescale = 1.0f / (surface->substeps + 1);
 
     for (st = 1; st <= surface->substeps; st++) {
-      float subframe = (float(st)) / (surface->substeps + 1);
+      float subframe = float(st) / (surface->substeps + 1);
       if (!dynamicPaint_doStep(depsgraph, scene, cObject, surface, timescale, subframe)) {
         return 0;
       }
diff --git a/source/blender/blenkernel/intern/fluid.cc b/source/blender/blenkernel/intern/fluid.cc
index 47099b1714e..70a5c90269b 100644
--- a/source/blender/blenkernel/intern/fluid.cc
+++ b/source/blender/blenkernel/intern/fluid.cc
@@ -93,8 +93,8 @@ static CLG_LogRef LOG = {"bke.fluid"};
 
 static ThreadMutex object_update_lock = BLI_MUTEX_INITIALIZER;
 
-#  define ADD_IF_LOWER_POS(a, b) (min_ff((a) + (b), max_ff((a), (b))))
-#  define ADD_IF_LOWER_NEG(a, b) (max_ff((a) + (b), min_ff((a), (b))))
+#  define ADD_IF_LOWER_POS(a, b) min_ff((a) + (b), max_ff((a), (b)))
+#  define ADD_IF_LOWER_NEG(a, b) max_ff((a) + (b), min_ff((a), (b)))
 #  define ADD_IF_LOWER(a, b) (((b) > 0) ? ADD_IF_LOWER_POS((a), (b)) : ADD_IF_LOWER_NEG((a), (b)))
 
 bool BKE_fluid_reallocate_fluid(FluidDomainSettings *fds, int res[3], int free_old)
@@ -1484,7 +1484,7 @@ static void emit_from_particles_task_cb(void *__restrict userdata,
     for (int y = data->min[1]; y < data->max[1]; y++) {
       const int index = manta_get_index(
           x - bb->min[0], bb->res[0], y - bb->min[1], bb->res[1], z - bb->min[2]);
-      const float ray_start[3] = {(float(x)) + 0.5f, (float(y)) + 0.5f, (float(z)) + 0.5f};
+      const float ray_start[3] = {float(x) + 0.5f, float(y) + 0.5f, float(z) + 0.5f};
 
       /* Find particle distance from the kdtree. */
       KDTreeNearest_3d nearest;
@@ -2008,7 +2008,7 @@ static void emit_from_mesh_task_cb(void *__restrict userdata,
     for (int y = data->min[1]; y < data->max[1]; y++) {
       const int index = manta_get_index(
           x - bb->min[0], bb->res[0], y - bb->min[1], bb->res[1], z - bb->min[2]);
-      const float ray_start[3] = {(float(x)) + 0.5f, (float(y)) + 0.5f, (float(z)) + 0.5f};
+      const float ray_start[3] = {float(x) + 0.5f, float(y) + 0.5f, float(z) + 0.5f};
 
       /* Compute emission only for flow objects that produce fluid (i.e. skip outflow objects).
        * Result in bb->influence. Also computes initial velocities. Result in bb->velocity. */
@@ -4394,9 +4394,9 @@ float BKE_fluid_get_velocity_at(Object *ob, float position[3], float velocity[3]
     }
 
     /* map pos between 0.0 - 1.0 */
-    pos[0] = (pos[0] - fds->res_min[0]) / (float(fds->res[0]));
-    pos[1] = (pos[1] - fds->res_min[1]) / (float(fds->res[1]));
-    pos[2] = (pos[2] - fds->res_min[2]) / (float(fds->res[2]));
+    pos[0] = (pos[0] - fds->res_min[0]) / float(fds->res[0]);
+    pos[1] = (pos[1] - fds->res_min[1]) / float(fds->res[1]);
+    pos[2] = (pos[2] - fds->res_min[2]) / float(fds->res[2]);
 
     /* Check if position is outside active area. */
     if (fds->type == FLUID_DOMAIN_TYPE_GAS && fds->flags & FLUID_DOMAIN_USE_ADAPTIVE_DOMAIN) {
diff --git a/source/blender/blenkernel/intern/mesh_convert.cc b/source/blender/blenkernel/intern/mesh_convert.cc
index 3d868d243ae..0a2c8a714e3 100644
--- a/source/blender/blenkernel/intern/mesh_convert.cc
+++ b/source/blender/blenkernel/intern/mesh_convert.cc
@@ -359,10 +359,10 @@ static Mesh *mesh_nurbs_displist_to_mesh(const Curve *cu, const ListBase *dispba
               (*mloopuv)[1] = (v % dl->nr) / float(orco_sizeu);
 
               /* cyclic correction */
-              if ((ELEM(i, 1, 2)) && (*mloopuv)[0] == 0.0f) {
+              if (ELEM(i, 1, 2) && (*mloopuv)[0] == 0.0f) {
                 (*mloopuv)[0] = 1.0f;
               }
-              if ((ELEM(i, 0, 1)) && (*mloopuv)[1] == 0.0f) {
+              if (ELEM(i, 0, 1) && (*mloopuv)[1] == 0.0f) {
                 (*mloopuv)[1] = 1.0f;
               }
             }
diff --git a/source/blender/blenkernel/intern/mesh_normals.cc b/source/blender/blenkernel/intern/mesh_normals.cc
index db700ec3e12..22b6ce5222c 100644
--- a/source/blender/blenkernel/intern/mesh_normals.cc
+++ b/source/blender/blenkernel/intern/mesh_normals.cc
@@ -919,7 +919,7 @@ static void loop_manifold_fan_around_vert_next(const Span<MLoop> loops,
   const uint vert_fan_next = loops[*r_mlfan_curr_index].v;
   const MPoly &mpfan_next = polys[*r_mpfan_curr_index];
   if ((vert_fan_orig == vert_fan_next && vert_fan_orig == mv_pivot_index) ||
-      (!ELEM(vert_fan_orig, vert_fan_next, mv_pivot_index))) {
+      !ELEM(vert_fan_orig, vert_fan_next, mv_pivot_index)) {
     /* We need the previous loop, but current one is our vertex's loop. */
     *r_mlfan_vert_index = *r_mlfan_curr_index;
     if (--(*r_mlfan_curr_index) < mpfan_next.loopstart) {
diff --git a/source/blender/blenkernel/intern/multires_reshape_ccg.cc b/source/blender/blenkernel/intern/multires_reshape_ccg.cc
index 6f63c336abb..97be97ae3c1 100644
--- a/source/blender/blenkernel/intern/multires_reshape_ccg.cc
+++ b/source/blender/blenkernel/intern/multires_reshape_ccg.cc
@@ -21,7 +21,7 @@ bool multires_reshape_assign_final_coords_from_ccg(const MultiresReshapeContext
   BKE_subdiv_ccg_key(&reshape_level_key, subdiv_ccg, reshape_context->reshape.level);
 
   const int reshape_grid_size = reshape_context->reshape.grid_size;
-  const float reshape_grid_size_1_inv = 1.0f / ((float(reshape_grid_size)) - 1.0f);
+  const float reshape_grid_size_1_inv = 1.0f / (float(reshape_grid_size) - 1.0f);
 
   int num_grids = subdiv_ccg->num_grids;
   for (int grid_index = 0; grid_index < num_grids; ++grid_index) {
diff --git a/source/blender/blenkernel/intern/multires_reshape_util.cc b/source/blender/blenkernel/intern/multires_reshape_util.cc
index 3020d6cd1c5..93d1662de14 100644
--- a/source/blender/blenkernel/intern/multires_reshape_util.cc
+++ b/source/blender/blenkernel/intern/multires_reshape_util.cc
@@ -667,7 +667,7 @@ static void foreach_grid_face_coordinate_task(void *__restrict userdata_v,
 
   const MPoly *mpoly = reshape_context->base_polys;
   const int grid_size = data->grid_size;
-  const float grid_size_1_inv = 1.0f / ((float(grid_size)) - 1.0f);
+  const float grid_size_1_inv = 1.0f / (float(grid_size) - 1.0f);
 
   const int num_corners = mpoly[face_index].totloop;
   int grid_index = reshape_context->face_start_grid_index[face_index];
@@ -697,7 +697,7 @@ static void foreach_grid_coordinate(const MultiresReshapeContext *reshape_contex
   ForeachGridCoordinateTaskData data;
   data.reshape_context = reshape_context;
   data.grid_size = BKE_subdiv_grid_size_from_level(level);
-  data.grid_size_1_inv = 1.0f / ((float(data.grid_size)) - 1.0f);
+  data.grid_size_1_inv = 1.0f / (float(data.grid_size) - 1.0f);
   data.callback = callback;
   data.callback_userdata_v = userdata_v;
 
diff --git a/source/blender/editors/armature/meshlaplacian.cc b/source/blender/editors/armature/meshlaplacian.cc
index d29338a3eb4..7cd25577ad2 100644
--- a/source/blender/editors/armature/meshlaplacian.cc
+++ b/source/blender/editors/armature/meshlaplacian.cc
@@ -111,7 +111,7 @@ static void laplacian_increase_edge_count(EdgeHash *edgehash, int v1, int v2)
     *p = (void *)(intptr_t(*p) + intptr_t(1));
   }
   else {
-    *p = (void *)(intptr_t(1));
+    *p = (void *)intptr_t(1);
   }
 }
 
diff --git a/source/blender/editors/undo/ed_undo.cc b/source/blender/editors/undo/ed_undo.cc
index a6e78d15744..0b51fe24fc4 100644
--- a/source/blender/editors/undo/ed_undo.cc
+++ b/source/blender/editors/undo/ed_undo.cc
@@ -214,7 +214,7 @@ static void ed_undo_step_post(bContext *C,
     Object *obact = CTX_data_active_object(C);
     if (obact && (obact->type == OB_GPENCIL)) {
       /* set cursor */
-      if ((obact->mode & OB_MODE_ALL_PAINT_GPENCIL)) {
+      if (obact->mode & OB_MODE_ALL_PAINT_GPENCIL) {
         ED_gpencil_toggle_brush_cursor(C, true, nullptr);
       }
       else {
diff --git a/source/blender/modifiers/intern/MOD_solidify_nonmanifold.cc b/source/blender/modifiers/intern/MOD_solidify_nonmanifold.cc
index 18d62b8b327..02d1119faaf 100644
--- a/source/blender/modifiers/intern/MOD_solidify_nonmanifold.cc
+++ b/source/blender/modifiers/intern/MOD_solidify_nonmanifold.cc
@@ -460,7 +460,7 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
             if (!face_singularity[face]) {
               bool is_singularity = true;
               for (uint k = 0; k < orig_mpoly[face].totloop; k++) {
-                if (vm[orig_mloop[(uint(orig_mpoly[face].loopstart)) + k].v] != v1) {
+                if (vm[orig_mloop[uint(orig_mpoly[face].loopstart) + k].v] != v1) {
                   is_singularity = false;
                   break;
                 }
diff --git a/source/blender/windowmanager/intern/wm_files.cc b/source/blender/windowmanager/intern/wm_files.cc
index e5d94fdd9b2..c5ad58d96ef 100644
--- a/source/blender/windowmanager/intern/wm_files.cc
+++ b/source/blender/windowmanager/intern/wm_files.cc
@@ -482,7 +482,7 @@ static void wm_init_userdef(Main *bmain)
     SET_FLAG_FROM_TEST(G.f, (U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0, G_FLAG_SCRIPT_AUTOEXEC);
   }
 
-  MEM_CacheLimiter_set_maximum((size_t(U.memcachelimit)) * 1024 * 1024);
+  MEM_CacheLimiter_set_maximum(size_t(U.memcachelimit) * 1024 * 1024);
   BKE_sound_init(bmain);
 
   /* Update the tem

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list