[Bf-blender-cvs] [0e52777cf00] blenloader-api: add bloRead method to ModifierTypeInfo

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


Commit: 0e52777cf00e573bbd4879e6e95b456380a92780
Author: Jacques Lucke
Date:   Sat Mar 7 17:03:53 2020 +0100
Branches: blenloader-api
https://developer.blender.org/rB0e52777cf00e573bbd4879e6e95b456380a92780

add bloRead method to ModifierTypeInfo

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

M	source/blender/blenkernel/BKE_modifier.h
M	source/blender/blenloader/intern/readfile.c
M	source/blender/modifiers/intern/MOD_armature.c
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_correctivesmooth.c
M	source/blender/modifiers/intern/MOD_curve.c
M	source/blender/modifiers/intern/MOD_datatransfer.c
M	source/blender/modifiers/intern/MOD_decimate.c
M	source/blender/modifiers/intern/MOD_displace.c
M	source/blender/modifiers/intern/MOD_dynamicpaint.c
M	source/blender/modifiers/intern/MOD_edgesplit.c
M	source/blender/modifiers/intern/MOD_explode.c
M	source/blender/modifiers/intern/MOD_fluid.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_lattice.c
M	source/blender/modifiers/intern/MOD_mask.cc
M	source/blender/modifiers/intern/MOD_meshcache.c
M	source/blender/modifiers/intern/MOD_meshdeform.c
M	source/blender/modifiers/intern/MOD_meshsequencecache.c
M	source/blender/modifiers/intern/MOD_mirror.c
M	source/blender/modifiers/intern/MOD_multires.c
M	source/blender/modifiers/intern/MOD_none.c
M	source/blender/modifiers/intern/MOD_normal_edit.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_remesh.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_smooth.c
M	source/blender/modifiers/intern/MOD_softbody.c
M	source/blender/modifiers/intern/MOD_solidify.c
M	source/blender/modifiers/intern/MOD_subsurf.c
M	source/blender/modifiers/intern/MOD_surface.c
M	source/blender/modifiers/intern/MOD_surfacedeform.c
M	source/blender/modifiers/intern/MOD_triangulate.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_weighted_normal.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
M	source/blender/modifiers/intern/MOD_weld.c
M	source/blender/modifiers/intern/MOD_wireframe.c

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

diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h
index 27c45e927a5..36ee212a9e6 100644
--- a/source/blender/blenkernel/BKE_modifier.h
+++ b/source/blender/blenkernel/BKE_modifier.h
@@ -337,6 +337,7 @@ typedef struct ModifierTypeInfo {
   void (*freeRuntimeData)(void *runtime_data);
 
   void (*bloWrite)(struct BloWriter *writer, const struct ModifierData *md);
+  void (*bloRead)(struct BloReader *reader, struct ModifierData *md);
 } ModifierTypeInfo;
 
 /* Initialize modifier's global data (type info and some common global storages). */
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index f65d00b81d4..759a9ef6811 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5271,13 +5271,17 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb, Object *ob)
       is_allocated = true;
     }
     /* if modifiers disappear, or for upward compatibility */
-    if (NULL == modifierType_getInfo(md->type)) {
+    const ModifierTypeInfo *mdi = modifierType_getInfo(md->type);
+    if (mdi == NULL) {
       md->type = eModifierType_None;
     }
 
     if (is_allocated) {
       /* All the fields has been properly allocated. */
     }
+    else if (mdi && mdi->bloRead) {
+      mdi->bloRead(wrap_reader(fd), md);
+    }
     else if (md->type == eModifierType_Subsurf) {
       SubsurfModifierData *smd = (SubsurfModifierData *)md;
 
@@ -5460,19 +5464,6 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb, Object *ob)
       surmd->v = NULL;
       surmd->numverts = 0;
     }
-    else if (md->type == eModifierType_Hook) {
-      HookModifierData *hmd = (HookModifierData *)md;
-
-      hmd->indexar = newdataadr(fd, hmd->indexar);
-      if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
-        BLI_endian_switch_int32_array(hmd->indexar, hmd->totindex);
-      }
-
-      hmd->curfalloff = newdataadr(fd, hmd->curfalloff);
-      if (hmd->curfalloff) {
-        BKE_curvemapping_blo_read_struct(wrap_reader(fd), hmd->curfalloff);
-      }
-    }
     else if (md->type == eModifierType_ParticleSystem) {
       ParticleSystemModifierData *psmd = (ParticleSystemModifierData *)md;
 
diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c
index 27852450b95..3aef3f4a4b8 100644
--- a/source/blender/modifiers/intern/MOD_armature.c
+++ b/source/blender/modifiers/intern/MOD_armature.c
@@ -267,4 +267,5 @@ ModifierTypeInfo modifierType_Armature = {
     /* foreachTexLink */ NULL,
     /* freeRuntimeData */ NULL,
     /* bloWrite */ NULL,
+    /* bloRead */ NULL,
 };
diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c
index 7151a70179e..707361a5378 100644
--- a/source/blender/modifiers/intern/MOD_array.c
+++ b/source/blender/modifiers/intern/MOD_array.c
@@ -821,4 +821,5 @@ ModifierTypeInfo modifierType_Array = {
     /* foreachTexLink */ NULL,
     /* freeRuntimeData */ NULL,
     /* bloWrite */ NULL,
+    /* bloRead */ NULL,
 };
diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c
index 8c6ba46d2b5..460f710b413 100644
--- a/source/blender/modifiers/intern/MOD_bevel.c
+++ b/source/blender/modifiers/intern/MOD_bevel.c
@@ -288,4 +288,5 @@ ModifierTypeInfo modifierType_Bevel = {
     /* foreachTexLink */ NULL,
     /* freeRuntimeData */ NULL,
     /* bloWrite */ NULL,
+    /* bloRead */ NULL,
 };
diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c
index 001ecc62aad..143421cffa6 100644
--- a/source/blender/modifiers/intern/MOD_boolean.c
+++ b/source/blender/modifiers/intern/MOD_boolean.c
@@ -373,4 +373,5 @@ ModifierTypeInfo modifierType_Boolean = {
     /* foreachTexLink */ NULL,
     /* freeRuntimeData */ NULL,
     /* bloWrite */ NULL,
+    /* bloRead */ NULL,
 };
diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c
index cae7e3f5b84..dcd0bd635b1 100644
--- a/source/blender/modifiers/intern/MOD_build.c
+++ b/source/blender/modifiers/intern/MOD_build.c
@@ -302,4 +302,5 @@ ModifierTypeInfo modifierType_Build = {
     /* foreachTexLink */ NULL,
     /* freeRuntimeData */ NULL,
     /* bloWrite */ NULL,
+    /* bloRead */ NULL,
 };
diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c
index e1c2dd58d6c..e456ea92767 100644
--- a/source/blender/modifiers/intern/MOD_cast.c
+++ b/source/blender/modifiers/intern/MOD_cast.c
@@ -536,4 +536,5 @@ ModifierTypeInfo modifierType_Cast = {
     /* foreachTexLink */ NULL,
     /* freeRuntimeData */ NULL,
     /* bloWrite */ NULL,
+    /* bloRead */ NULL,
 };
diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c
index baa3e23341c..eb1a837bca3 100644
--- a/source/blender/modifiers/intern/MOD_cloth.c
+++ b/source/blender/modifiers/intern/MOD_cloth.c
@@ -277,4 +277,5 @@ ModifierTypeInfo modifierType_Cloth = {
     /* foreachTexLink */ NULL,
     /* freeRuntimeData */ NULL,
     /* bloWrite */ NULL,
+    /* bloRead */ NULL,
 };
diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c
index ab24d3205cd..6f0e4efa4b2 100644
--- a/source/blender/modifiers/intern/MOD_collision.c
+++ b/source/blender/modifiers/intern/MOD_collision.c
@@ -268,4 +268,5 @@ ModifierTypeInfo modifierType_Collision = {
     /* foreachTexLink */ NULL,
     /* freeRuntimeData */ NULL,
     /* bloWrite */ NULL,
+    /* bloRead */ NULL,
 };
diff --git a/source/blender/modifiers/intern/MOD_correctivesmooth.c b/source/blender/modifiers/intern/MOD_correctivesmooth.c
index 7f3cc0831c5..cd08555a9a9 100644
--- a/source/blender/modifiers/intern/MOD_correctivesmooth.c
+++ b/source/blender/modifiers/intern/MOD_correctivesmooth.c
@@ -789,4 +789,5 @@ ModifierTypeInfo modifierType_CorrectiveSmooth = {
     /* foreachTexLink */ NULL,
     /* freeRuntimeData */ NULL,
     /* bloWrite */ NULL,
+    /* bloRead */ NULL,
 };
diff --git a/source/blender/modifiers/intern/MOD_curve.c b/source/blender/modifiers/intern/MOD_curve.c
index f0409380c3d..d9b14210211 100644
--- a/source/blender/modifiers/intern/MOD_curve.c
+++ b/source/blender/modifiers/intern/MOD_curve.c
@@ -177,4 +177,5 @@ ModifierTypeInfo modifierType_Curve = {
     /* foreachTexLink */ NULL,
     /* freeRuntimeData */ NULL,
     /* bloWrite */ NULL,
+    /* bloRead */ NULL,
 };
diff --git a/source/blender/modifiers/intern/MOD_datatransfer.c b/source/blender/modifiers/intern/MOD_datatransfer.c
index 1bd45bb7ffb..2ef24c3d4db 100644
--- a/source/blender/modifiers/intern/MOD_datatransfer.c
+++ b/source/blender/modifiers/intern/MOD_datatransfer.c
@@ -263,4 +263,5 @@ ModifierTypeInfo modifierType_DataTransfer = {
     /* foreachTexLink */ NULL,
     /* freeRuntimeData */ NULL,
     /* bloWrite */ NULL,
+    /* bloRead */ NULL,
 };
diff --git a/source/blender/modifiers/intern/MOD_decimate.c b/source/blender/modifiers/intern/MOD_decimate.c
index f5987d05c72..e7ee2f00aba 100644
--- a/source/blender/modifiers/intern/MOD_decimate.c
+++ b/source/blender/modifiers/intern/MOD_decimate.c
@@ -242,4 +242,5 @@ ModifierTypeInfo modifierType_Decimate = {
     /* foreachTexLink */ NULL,
     /* freeRuntimeData */ NULL,
     /* bloWrite */ NULL,
+    /* bloRead */ NULL,
 };
diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c
index 8927cd1e8be..e61134c9174 100644
--- a/source/blender/modifiers/intern/MOD_displace.c
+++ b/source/blender/modifiers/intern/MOD_displace.c
@@ -432,4 +432,5 @@ ModifierTypeInfo modifierType_Displace = {
     /* foreachTexLink */ foreachTexLink,
     /* freeRuntimeData */ NULL,
     /* bloWrite */ NULL,
+    /* bloRead */ NULL,
 };
diff --git a/source/blender/modifiers/intern/MOD_dynamicpaint.c b/source/blender/modifiers/intern/MOD_dynamicpaint.c
index 4395987b2bf..9e4ded21d06 100644
--- a/source/blender/modifiers/intern/MOD_dynamicpaint.c
+++ b/source/blender/modifiers/intern/MOD_dynamicpaint.c
@@ -201,4 +201,5 @@ ModifierTypeInfo modifierType_DynamicPaint = {
     /* foreachTexLink */ foreachTexLink,
     /* freeRuntimeData */ freeRuntimeData,
     /* bloWrite */ NULL,
+    /* bloRead */ NULL,
 };
diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c
index 25cf51ab252..b47c1f08792 100644
--- a/source/blender/modifiers/intern/MOD_edgesplit.c
+++ b/source/blender/modifiers/intern/MOD_edgesplit.c
@@ -156,4 +156,5 @@ ModifierTypeInfo modifierType_EdgeSplit = {
     /* foreachTexLink */ NULL,
     /* freeRuntimeData */ NULL,
     /* bloWrite */ NULL,
+    /* bloRead */ NULL,
 };
diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c
index eaf53e50bda..885d2ecfd47 100644
--- a/source/blender/modifiers/intern/MOD_explode.c
+++ b/source/blender/modifiers/intern/MOD_explode.c
@@ -1200,4 +1200,5 @@ ModifierTypeInfo modifierType_Explode = {
     /* foreachTexLink */ NULL,
     /* freeRuntimeData */ NULL,
     /* bloWrite */ NULL,
+    /* bloRead */ NULL,
 };
diff --git a/source/blender/modifiers/intern/MOD_fluid.c b/source/blender/modifiers/intern/MOD_fluid.c
index 63882970fb1..ee13e463c25 100644
--- a/source/blender/modifiers/intern/MOD_fluid.c
+++ b/source/blender/modifiers/intern/MOD_fluid.c
@@ -221,4 +221,5 @@ ModifierTypeInfo modifierType_Fluid = {
     /* foreachTexLink */ NULL,
     /* freeRuntimeData */ NULL,
     /* bloWrite */ NULL,
+    /* bloRead */ NULL,
 };
diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c
index 89c9e03e512..d90157e4b70 100644
--- a/source/blender/modifiers/intern/MOD_hook.c
+++ b/source/blender/modifiers/intern/MOD_hook.c
@@ -24,6 +24,7 @@
 #include "BLI_utildefines.h"
 
 #include "BLI_math.h"
+#include "BLI_endian_switch.h"
 
 #include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
@@ -134,6 +135,21 @@ static void bloWrite(BloWriter *writer, const ModifierData *md)
   BLO_write_raw_array(writer, sizeof(int), hmd->totindex, hmd->index

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list