Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/blenloader/intern/readfile.c27
-rw-r--r--source/blender/blenloader/intern/writefile.c10
-rw-r--r--source/blender/modifiers/intern/MOD_cloth.c45
3 files changed, 44 insertions, 38 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 759a9ef6811..a5a21023517 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5292,33 +5292,6 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb, Object *ob)
amd->prevCos = NULL;
}
- else if (md->type == eModifierType_Cloth) {
- ClothModifierData *clmd = (ClothModifierData *)md;
-
- clmd->clothObject = NULL;
- clmd->hairdata = NULL;
-
- clmd->sim_parms = newdataadr(fd, clmd->sim_parms);
- clmd->coll_parms = newdataadr(fd, clmd->coll_parms);
-
- BKE_ptcache_blo_read(wrap_reader(fd), &clmd->ptcaches, &clmd->point_cache, 0);
-
- if (clmd->sim_parms) {
- if (clmd->sim_parms->presets > 10) {
- clmd->sim_parms->presets = 0;
- }
-
- clmd->sim_parms->reset = 0;
-
- clmd->sim_parms->effector_weights = newdataadr(fd, clmd->sim_parms->effector_weights);
-
- if (!clmd->sim_parms->effector_weights) {
- clmd->sim_parms->effector_weights = BKE_effector_add_weights(NULL);
- }
- }
-
- clmd->solver_result = NULL;
- }
else if (md->type == eModifierType_Fluid) {
FluidModifierData *mmd = (FluidModifierData *)md;
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 6622843a703..50bd0dcd821 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1578,15 +1578,7 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
mti->bloWrite(wrap_writer(wd), md);
}
- if (md->type == eModifierType_Cloth) {
- ClothModifierData *clmd = (ClothModifierData *)md;
-
- writestruct(wd, DATA, ClothSimSettings, 1, clmd->sim_parms);
- writestruct(wd, DATA, ClothCollSettings, 1, clmd->coll_parms);
- writestruct(wd, DATA, EffectorWeights, 1, clmd->sim_parms->effector_weights);
- BKE_ptcache_blo_write_list(wrap_writer(wd), &clmd->ptcaches);
- }
- else if (md->type == eModifierType_Fluid) {
+ if (md->type == eModifierType_Fluid) {
FluidModifierData *mmd = (FluidModifierData *)md;
if (mmd->type & MOD_FLUID_TYPE_DOMAIN) {
diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c
index eb1a837bca3..f7061b153af 100644
--- a/source/blender/modifiers/intern/MOD_cloth.c
+++ b/source/blender/modifiers/intern/MOD_cloth.c
@@ -48,6 +48,8 @@
#include "DEG_depsgraph_physics.h"
#include "DEG_depsgraph_query.h"
+#include "BLO_callback_api.h"
+
#include "MOD_util.h"
static void initData(ModifierData *md)
@@ -249,6 +251,45 @@ static void foreachIDLink(ModifierData *md, Object *ob, IDWalkFunc walk, void *u
}
}
+static void bloWrite(BloWriter *writer, const ModifierData *md)
+{
+ ClothModifierData *clmd = (ClothModifierData *)md;
+
+ BLO_write_struct(writer, ClothSimSettings, clmd->sim_parms);
+ BLO_write_struct(writer, ClothCollSettings, clmd->coll_parms);
+ BLO_write_struct(writer, EffectorWeights, clmd->sim_parms->effector_weights);
+ BKE_ptcache_blo_write_list(writer, &clmd->ptcaches);
+}
+
+static void bloRead(BloReader *reader, ModifierData *md)
+{
+ ClothModifierData *clmd = (ClothModifierData *)md;
+
+ clmd->clothObject = NULL;
+ clmd->hairdata = NULL;
+
+ BLO_read_update_address(reader, clmd->sim_parms);
+ BLO_read_update_address(reader, clmd->coll_parms);
+
+ BKE_ptcache_blo_read(reader, &clmd->ptcaches, &clmd->point_cache, 0);
+
+ if (clmd->sim_parms) {
+ if (clmd->sim_parms->presets > 10) {
+ clmd->sim_parms->presets = 0;
+ }
+
+ clmd->sim_parms->reset = 0;
+
+ BLO_read_update_address(reader, clmd->sim_parms->effector_weights);
+
+ if (clmd->sim_parms->effector_weights == NULL) {
+ clmd->sim_parms->effector_weights = BKE_effector_add_weights(NULL);
+ }
+ }
+
+ clmd->solver_result = NULL;
+}
+
ModifierTypeInfo modifierType_Cloth = {
/* name */ "Cloth",
/* structName */ "ClothModifierData",
@@ -276,6 +317,6 @@ ModifierTypeInfo modifierType_Cloth = {
/* foreachIDLink */ foreachIDLink,
/* foreachTexLink */ NULL,
/* freeRuntimeData */ NULL,
- /* bloWrite */ NULL,
- /* bloRead */ NULL,
+ /* bloWrite */ bloWrite,
+ /* bloRead */ bloRead,
};