[Bf-blender-cvs] [86590b90aa7] master: Cleanup: use uint, ushort, uchar for modifiers

Campbell Barton noreply at git.blender.org
Thu Sep 19 05:34:32 CEST 2019


Commit: 86590b90aa78c7087a588275030a4f1490e37297
Author: Campbell Barton
Date:   Thu Sep 19 13:32:36 2019 +1000
Branches: master
https://developer.blender.org/rB86590b90aa78c7087a588275030a4f1490e37297

Cleanup: use uint,ushort,uchar for modifiers

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

M	source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c
M	source/blender/modifiers/intern/MOD_array.c
M	source/blender/modifiers/intern/MOD_collision.c
M	source/blender/modifiers/intern/MOD_correctivesmooth.c
M	source/blender/modifiers/intern/MOD_decimate.c
M	source/blender/modifiers/intern/MOD_explode.c
M	source/blender/modifiers/intern/MOD_hook.c
M	source/blender/modifiers/intern/MOD_laplaciandeform.c
M	source/blender/modifiers/intern/MOD_laplaciansmooth.c
M	source/blender/modifiers/intern/MOD_mask.c
M	source/blender/modifiers/intern/MOD_meshcache_mdd.c
M	source/blender/modifiers/intern/MOD_meshcache_pc2.c
M	source/blender/modifiers/intern/MOD_screw.c
M	source/blender/modifiers/intern/MOD_skin.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_surfacedeform.c
M	source/blender/modifiers/intern/MOD_util.c
M	source/blender/modifiers/intern/MOD_uvproject.c
M	source/blender/modifiers/intern/MOD_weightvgproximity.c

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

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c
index 810a2ba7e25..234b4deeceb 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c
@@ -63,8 +63,8 @@ struct GPHookData_cb {
   float falloff_sq;
   float fac_orig;
 
-  unsigned int use_falloff : 1;
-  unsigned int use_uniform : 1;
+  uint use_falloff : 1;
+  uint use_uniform : 1;
 
   float cent[3];
 
diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c
index 3c3aae8fda6..644ac3a10e8 100644
--- a/source/blender/modifiers/intern/MOD_array.c
+++ b/source/blender/modifiers/intern/MOD_array.c
@@ -269,8 +269,8 @@ static void dm_mvert_map_doubles(int *doubles_map,
 static void mesh_merge_transform(Mesh *result,
                                  Mesh *cap_mesh,
                                  const float cap_offset[4][4],
-                                 unsigned int cap_verts_index,
-                                 unsigned int cap_edges_index,
+                                 uint cap_verts_index,
+                                 uint cap_edges_index,
                                  int cap_loops_index,
                                  int cap_polys_index,
                                  int cap_nverts,
diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c
index 3d43c6de88e..56e84423db4 100644
--- a/source/blender/modifiers/intern/MOD_collision.c
+++ b/source/blender/modifiers/intern/MOD_collision.c
@@ -118,7 +118,7 @@ static void deformVerts(ModifierData *md,
 
   if (mesh_src) {
     float current_time = 0;
-    unsigned int mvert_num = 0;
+    uint mvert_num = 0;
 
     BKE_mesh_vert_coords_apply(mesh_src, vertexCos);
     BKE_mesh_calc_normals(mesh_src);
diff --git a/source/blender/modifiers/intern/MOD_correctivesmooth.c b/source/blender/modifiers/intern/MOD_correctivesmooth.c
index a234f468e45..fbf955abc98 100644
--- a/source/blender/modifiers/intern/MOD_correctivesmooth.c
+++ b/source/blender/modifiers/intern/MOD_correctivesmooth.c
@@ -117,11 +117,11 @@ static void requiredDataMask(Object *UNUSED(ob),
 /* check individual weights for changes and cache values */
 static void mesh_get_weights(MDeformVert *dvert,
                              const int defgrp_index,
-                             const unsigned int numVerts,
+                             const uint numVerts,
                              const bool use_invert_vgroup,
                              float *smooth_weights)
 {
-  unsigned int i;
+  uint i;
 
   for (i = 0; i < numVerts; i++, dvert++) {
     const float w = defvert_find_weight(dvert, defgrp_index);
@@ -140,11 +140,11 @@ static void mesh_get_boundaries(Mesh *mesh, float *smooth_weights)
   const MPoly *mpoly = mesh->mpoly;
   const MLoop *mloop = mesh->mloop;
   const MEdge *medge = mesh->medge;
-  unsigned int mpoly_num, medge_num, i;
-  unsigned short *boundaries;
+  uint mpoly_num, medge_num, i;
+  ushort *boundaries;
 
-  mpoly_num = (unsigned int)mesh->totpoly;
-  medge_num = (unsigned int)mesh->totedge;
+  mpoly_num = (uint)mesh->totpoly;
+  medge_num = (uint)mesh->totedge;
 
   boundaries = MEM_calloc_arrayN(medge_num, sizeof(*boundaries), __func__);
 
@@ -176,14 +176,14 @@ static void mesh_get_boundaries(Mesh *mesh, float *smooth_weights)
 static void smooth_iter__simple(CorrectiveSmoothModifierData *csmd,
                                 Mesh *mesh,
                                 float (*vertexCos)[3],
-                                unsigned int numVerts,
+                                uint numVerts,
                                 const float *smooth_weights,
-                                unsigned int iterations)
+                                uint iterations)
 {
   const float lambda = csmd->lambda;
-  unsigned int i;
+  uint i;
 
-  const unsigned int numEdges = (unsigned int)mesh->totedge;
+  const uint numEdges = (uint)mesh->totedge;
   const MEdge *edges = mesh->medge;
   float *vertex_edge_count_div;
 
@@ -252,18 +252,18 @@ static void smooth_iter__simple(CorrectiveSmoothModifierData *csmd,
 static void smooth_iter__length_weight(CorrectiveSmoothModifierData *csmd,
                                        Mesh *mesh,
                                        float (*vertexCos)[3],
-                                       unsigned int numVerts,
+                                       uint numVerts,
                                        const float *smooth_weights,
-                                       unsigned int iterations)
+                                       uint iterations)
 {
   const float eps = FLT_EPSILON * 10.0f;
-  const unsigned int numEdges = (unsigned int)mesh->totedge;
+  const uint numEdges = (uint)mesh->totedge;
   /* note: the way this smoothing method works, its approx half as strong as the simple-smooth,
    * and 2.0 rarely spikes, double the value for consistent behavior. */
   const float lambda = csmd->lambda * 2.0f;
   const MEdge *edges = mesh->medge;
   float *vertex_edge_count;
-  unsigned int i;
+  uint i;
 
   struct SmoothingData_Weighted {
     float delta[3];
@@ -346,9 +346,9 @@ static void smooth_iter__length_weight(CorrectiveSmoothModifierData *csmd,
 static void smooth_iter(CorrectiveSmoothModifierData *csmd,
                         Mesh *mesh,
                         float (*vertexCos)[3],
-                        unsigned int numVerts,
+                        uint numVerts,
                         const float *smooth_weights,
-                        unsigned int iterations)
+                        uint iterations)
 {
   switch (csmd->smooth_type) {
     case MOD_CORRECTIVESMOOTH_SMOOTH_LENGTH_WEIGHT:
@@ -367,7 +367,7 @@ static void smooth_verts(CorrectiveSmoothModifierData *csmd,
                          MDeformVert *dvert,
                          const int defgrp_index,
                          float (*vertexCos)[3],
-                         unsigned int numVerts)
+                         uint numVerts)
 {
   float *smooth_weights = NULL;
 
@@ -391,7 +391,7 @@ static void smooth_verts(CorrectiveSmoothModifierData *csmd,
     }
   }
 
-  smooth_iter(csmd, mesh, vertexCos, numVerts, smooth_weights, (unsigned int)csmd->repeat);
+  smooth_iter(csmd, mesh, vertexCos, numVerts, smooth_weights, (uint)csmd->repeat);
 
   if (smooth_weights) {
     MEM_freeN(smooth_weights);
@@ -454,13 +454,13 @@ static void calc_tangent_loop_accum(const float v_dir_prev[3],
 
 static void calc_tangent_spaces(Mesh *mesh, float (*vertexCos)[3], float (*r_tangent_spaces)[3][3])
 {
-  const unsigned int mpoly_num = (unsigned int)mesh->totpoly;
+  const uint mpoly_num = (uint)mesh->totpoly;
 #ifndef USE_TANGENT_CALC_INLINE
-  const unsigned int mvert_num = (unsigned int)dm->getNumVerts(dm);
+  const uint mvert_num = (uint)dm->getNumVerts(dm);
 #endif
   const MPoly *mpoly = mesh->mpoly;
   const MLoop *mloop = mesh->mloop;
-  unsigned int i;
+  uint i;
 
   for (i = 0; i < mpoly_num; i++) {
     const MPoly *mp = &mpoly[i];
@@ -511,11 +511,11 @@ static void calc_deltas(CorrectiveSmoothModifierData *csmd,
                         MDeformVert *dvert,
                         const int defgrp_index,
                         const float (*rest_coords)[3],
-                        unsigned int numVerts)
+                        uint numVerts)
 {
   float(*smooth_vertex_coords)[3] = MEM_dupallocN(rest_coords);
   float(*tangent_spaces)[3][3];
-  unsigned int i;
+  uint i;
 
   tangent_spaces = MEM_calloc_arrayN(numVerts, sizeof(float[3][3]), __func__);
 
@@ -556,7 +556,7 @@ static void correctivesmooth_modifier_do(ModifierData *md,
                                          Object *ob,
                                          Mesh *mesh,
                                          float (*vertexCos)[3],
-                                         unsigned int numVerts,
+                                         uint numVerts,
                                          struct BMEditMesh *em)
 {
   CorrectiveSmoothModifierData *csmd = (CorrectiveSmoothModifierData *)md;
@@ -575,7 +575,7 @@ static void correctivesmooth_modifier_do(ModifierData *md,
   /* if rest bind_coords not are defined, set them (only run during bind) */
   if ((csmd->rest_source == MOD_CORRECTIVESMOOTH_RESTSOURCE_BIND) &&
       /* signal to recalculate, whoever sets MUST also free bind coords */
-      (csmd->bind_coords_num == (unsigned int)-1)) {
+      (csmd->bind_coords_num == (uint)-1)) {
     if (DEG_is_active(depsgraph)) {
       BLI_assert(csmd->bind_coords == NULL);
       csmd->bind_coords = MEM_dupallocN(vertexCos);
@@ -617,8 +617,7 @@ static void correctivesmooth_modifier_do(ModifierData *md,
       goto error;
     }
     else {
-      unsigned int me_numVerts = (unsigned int)((em) ? em->bm->totvert :
-                                                       ((Mesh *)ob->data)->totvert);
+      uint me_numVerts = (uint)((em) ? em->bm->totvert : ((Mesh *)ob->data)->totvert);
 
       if (me_numVerts != numVerts) {
         modifier_setError(md, "Original vertex count mismatch: %u to %u", me_numVerts, numVerts);
@@ -642,7 +641,7 @@ static void correctivesmooth_modifier_do(ModifierData *md,
       rest_coords = em ? BKE_editmesh_vert_coords_alloc_orco(em, &me_numVerts) :
                          BKE_mesh_vert_coords_alloc(ob->data, &me_numVerts);
 
-      BLI_assert((unsigned int)me_numVerts == numVerts);
+      BLI_assert((uint)me_numVerts == numVerts);
       is_rest_coords_alloc = true;
     }
 
@@ -673,7 +672,7 @@ static void correctivesmooth_modifier_do(ModifierData *md,
   smooth_verts(csmd, mesh, dvert, defgrp_index, vertexCos, numVerts);
 
   {
-    unsigned int i;
+    uint i;
 
     float(*tangent_spaces)[3][3];
 
@@ -717,7 +716,7 @@ static void deformVerts(ModifierData *md,
   Mesh *mesh_src = MOD_deform_mesh_eval_get(ctx->object, NULL, mesh, NULL, numVerts, false, false);
 
   correctivesmooth_modifier_do(
-      md, ctx->depsgraph, ctx->object, mesh_src, vertexCos, (unsigned int)numVerts, NULL);
+      md, ctx->depsgraph, ctx->object, mesh_src, vertexCos, (uint)num

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list