[Bf-blender-cvs] [b9a4a3ece5e] blenloader-api: improve parameter order

Jacques Lucke noreply at git.blender.org
Sat Mar 7 19:09:28 CET 2020


Commit: b9a4a3ece5e5f45c12a542926d2019c1554589c1
Author: Jacques Lucke
Date:   Sat Mar 7 18:37:37 2020 +0100
Branches: blenloader-api
https://developer.blender.org/rBb9a4a3ece5e5f45c12a542926d2019c1554589c1

improve parameter order

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

M	source/blender/blenloader/BLO_callback_api.h
M	source/blender/modifiers/intern/MOD_correctivesmooth.c
M	source/blender/modifiers/intern/MOD_hook.c
M	source/blender/modifiers/intern/MOD_laplaciandeform.c
M	source/blender/modifiers/intern/MOD_meshdeform.c
M	source/blender/modifiers/intern/MOD_surfacedeform.c

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

diff --git a/source/blender/blenloader/BLO_callback_api.h b/source/blender/blenloader/BLO_callback_api.h
index 3889e7088ed..e31498f09ff 100644
--- a/source/blender/blenloader/BLO_callback_api.h
+++ b/source/blender/blenloader/BLO_callback_api.h
@@ -50,20 +50,20 @@ bool BLO_read_requires_endian_switch(BloReader *reader);
 typedef void (*BloLinkListFn)(BloReader *reader, void *data);
 void BLO_read_list(BloReader *reader, struct ListBase *list, BloLinkListFn callback);
 
-#define BLO_read_array_endian_corrected(reader, type_name, ptr, array_size) \
+#define BLO_read_array_endian_corrected(reader, type_name, array_size, ptr) \
   BLO_read_update_address(reader, ptr); \
   if (BLO_read_requires_endian_switch(reader)) { \
     BLI_endian_switch_##type_name##_array((void *)ptr, array_size); \
   }
 
-#define BLO_read_int32_array(reader, ptr, array_size) \
-  BLO_read_array_endian_corrected(reader, int32, ptr, array_size)
-#define BLO_read_uint32_array(reader, ptr, array_size) \
-  BLO_read_array_endian_corrected(reader, uint32, ptr, array_size)
-#define BLO_read_float_array(reader, ptr, array_size) \
-  BLO_read_array_endian_corrected(reader, float, ptr, array_size)
-#define BLO_read_float3_array(reader, ptr, array_size) \
-  BLO_read_float_array(reader, ptr, 3 * (int)(array_size))
+#define BLO_read_int32_array(reader, array_size, ptr) \
+  BLO_read_array_endian_corrected(reader, int32, array_size, ptr)
+#define BLO_read_uint32_array(reader, array_size, ptr) \
+  BLO_read_array_endian_corrected(reader, uint32, array_size, ptr)
+#define BLO_read_float_array(reader, array_size, ptr) \
+  BLO_read_array_endian_corrected(reader, float, array_size, ptr)
+#define BLO_read_float3_array(reader, array_size, ptr) \
+  BLO_read_float_array(reader, 3 * (int)(array_size), ptr)
 
 #ifdef __cplusplus
 }
diff --git a/source/blender/modifiers/intern/MOD_correctivesmooth.c b/source/blender/modifiers/intern/MOD_correctivesmooth.c
index 23c2b712425..c5b2b0dfaa2 100644
--- a/source/blender/modifiers/intern/MOD_correctivesmooth.c
+++ b/source/blender/modifiers/intern/MOD_correctivesmooth.c
@@ -130,7 +130,7 @@ static void bloRead(BloReader *reader, ModifierData *md)
   CorrectiveSmoothModifierData *csmd = (CorrectiveSmoothModifierData *)md;
 
   if (csmd->bind_coords) {
-    BLO_read_float3_array(reader, csmd->bind_coords, csmd->bind_coords_num);
+    BLO_read_float3_array(reader, csmd->bind_coords_num, csmd->bind_coords);
   }
 
   /* runtime only */
diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c
index fab48e7d9cf..431e9433f5d 100644
--- a/source/blender/modifiers/intern/MOD_hook.c
+++ b/source/blender/modifiers/intern/MOD_hook.c
@@ -138,7 +138,7 @@ static void bloWrite(BloWriter *writer, const ModifierData *md)
 static void bloRead(BloReader *reader, ModifierData *md)
 {
   HookModifierData *hmd = (HookModifierData *)md;
-  BLO_read_int32_array(reader, hmd->indexar, hmd->totindex);
+  BLO_read_int32_array(reader, hmd->totindex, hmd->indexar);
 
   BLO_read_update_address(reader, hmd->curfalloff);
   if (hmd->curfalloff) {
diff --git a/source/blender/modifiers/intern/MOD_laplaciandeform.c b/source/blender/modifiers/intern/MOD_laplaciandeform.c
index 752c0cffe8a..943fbc6cb68 100644
--- a/source/blender/modifiers/intern/MOD_laplaciandeform.c
+++ b/source/blender/modifiers/intern/MOD_laplaciandeform.c
@@ -770,7 +770,7 @@ static void bloRead(BloReader *reader, ModifierData *md)
 {
   LaplacianDeformModifierData *lmd = (LaplacianDeformModifierData *)md;
 
-  BLO_read_float3_array(reader, lmd->vertexco, lmd->total_verts);
+  BLO_read_float3_array(reader, lmd->total_verts, lmd->vertexco);
   lmd->cache_system = NULL;
 }
 
diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c
index 9ef35697123..6b5d0a02291 100644
--- a/source/blender/modifiers/intern/MOD_meshdeform.c
+++ b/source/blender/modifiers/intern/MOD_meshdeform.c
@@ -184,15 +184,15 @@ static void bloRead(BloReader *reader, ModifierData *md)
   MeshDeformModifierData *mmd = (MeshDeformModifierData *)md;
 
   BLO_read_update_address(reader, mmd->bindinfluences);
-  BLO_read_int32_array(reader, mmd->bindoffsets, mmd->totvert + 1);
-  BLO_read_float3_array(reader, mmd->bindcagecos, mmd->totcagevert);
+  BLO_read_int32_array(reader, mmd->totvert + 1, mmd->bindoffsets);
+  BLO_read_float3_array(reader, mmd->totcagevert, mmd->bindcagecos);
 
   BLO_read_update_address(reader, mmd->dyngrid);
   BLO_read_update_address(reader, mmd->dyninfluences);
-  BLO_read_int32_array(reader, mmd->dynverts, mmd->totvert);
+  BLO_read_int32_array(reader, mmd->totvert, mmd->dynverts);
 
-  BLO_read_float_array(reader, mmd->bindweights, mmd->totvert);
-  BLO_read_float3_array(reader, mmd->bindcos, mmd->totcagevert);
+  BLO_read_float_array(reader, mmd->totvert, mmd->bindweights);
+  BLO_read_float3_array(reader, mmd->totcagevert, mmd->bindcos);
 }
 
 static float meshdeform_dynamic_bind(MeshDeformModifierData *mmd, float (*dco)[3], float vec[3])
diff --git a/source/blender/modifiers/intern/MOD_surfacedeform.c b/source/blender/modifiers/intern/MOD_surfacedeform.c
index d912359571f..cced419189b 100644
--- a/source/blender/modifiers/intern/MOD_surfacedeform.c
+++ b/source/blender/modifiers/intern/MOD_surfacedeform.c
@@ -243,13 +243,13 @@ static void bloRead(BloReader *reader, ModifierData *md)
       if (smd->verts[i].binds) {
         for (int j = 0; j < smd->verts[i].numbinds; j++) {
           SDefBind *bind = &smd->verts[i].binds[j];
-          BLO_read_uint32_array(reader, bind->vert_inds, bind->numverts);
+          BLO_read_uint32_array(reader, bind->numverts, bind->vert_inds);
 
           if (ELEM(bind->mode, MOD_SDEF_MODE_CENTROID, MOD_SDEF_MODE_LOOPTRI)) {
-            BLO_read_float3_array(reader, bind->vert_weights, 1);
+            BLO_read_float3_array(reader, 1, bind->vert_weights);
           }
           else {
-            BLO_read_float_array(reader, bind->vert_weights, bind->numverts);
+            BLO_read_float_array(reader, bind->numverts, bind->vert_weights);
           }
         }
       }



More information about the Bf-blender-cvs mailing list