[Bf-blender-cvs] [d807418a456] blenloader-api: update warp modifier

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


Commit: d807418a456d4f2af423b85ca1309baae08855cd
Author: Jacques Lucke
Date:   Sat Mar 7 18:47:04 2020 +0100
Branches: blenloader-api
https://developer.blender.org/rBd807418a456d4f2af423b85ca1309baae08855cd

update warp modifier

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

M	source/blender/blenloader/intern/readfile.c
M	source/blender/blenloader/intern/writefile.c
M	source/blender/modifiers/intern/MOD_warp.c

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

diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 3d6bc2ada6e..63fadc9d54b 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5456,14 +5456,6 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb, Object *ob)
       omd->oceancache = NULL;
       omd->ocean = NULL;
     }
-    else if (md->type == eModifierType_Warp) {
-      WarpModifierData *tmd = (WarpModifierData *)md;
-
-      tmd->curfalloff = newdataadr(fd, tmd->curfalloff);
-      if (tmd->curfalloff) {
-        BKE_curvemapping_blo_read_struct(wrap_reader(fd), tmd->curfalloff);
-      }
-    }
     else if (md->type == eModifierType_MeshSequenceCache) {
       MeshSeqCacheModifierData *msmcd = (MeshSeqCacheModifierData *)md;
       msmcd->reader = NULL;
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 431cfff4a73..fbe59c84ecd 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1652,12 +1652,6 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
       writestruct(wd, DATA, MFace, collmd->numfaces, collmd->mfaces);
 #endif
     }
-    else if (md->type == eModifierType_Warp) {
-      WarpModifierData *tmd = (WarpModifierData *)md;
-      if (tmd->curfalloff) {
-        BKE_curvemapping_blo_write_ptr(wrap_writer(wd), tmd->curfalloff);
-      }
-    }
   }
 }
 
diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c
index 50d949057ba..9ffda106246 100644
--- a/source/blender/modifiers/intern/MOD_warp.c
+++ b/source/blender/modifiers/intern/MOD_warp.c
@@ -44,6 +44,8 @@
 
 #include "RE_shader_ext.h"
 
+#include "BLO_callback_api.h"
+
 #include "MOD_util.h"
 
 static void initData(ModifierData *md)
@@ -153,6 +155,24 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
   }
 }
 
+static void bloWrite(BloWriter *writer, const ModifierData *md)
+{
+  WarpModifierData *tmd = (WarpModifierData *)md;
+  if (tmd->curfalloff) {
+    BKE_curvemapping_blo_write_ptr(writer, tmd->curfalloff);
+  }
+}
+
+static void bloRead(BloReader *reader, ModifierData *md)
+{
+  WarpModifierData *tmd = (WarpModifierData *)md;
+
+  BLO_read_update_address(reader, tmd->curfalloff);
+  if (tmd->curfalloff) {
+    BKE_curvemapping_blo_read_struct(reader, tmd->curfalloff);
+  }
+}
+
 static void warpModifier_do(WarpModifierData *wmd,
                             const ModifierEvalContext *ctx,
                             Mesh *mesh,
@@ -383,6 +403,6 @@ ModifierTypeInfo modifierType_Warp = {
     /* foreachIDLink */ foreachIDLink,
     /* foreachTexLink */ foreachTexLink,
     /* freeRuntimeData */ NULL,
-    /* bloWrite */ NULL,
-    /* bloRead */ NULL,
+    /* bloWrite */ bloWrite,
+    /* bloRead */ bloRead,
 };



More information about the Bf-blender-cvs mailing list