[Bf-blender-cvs] [192091903e2] blenloader-api: move hook modifier file writing into MOD_hook.c
Jacques Lucke
noreply at git.blender.org
Sat Mar 7 19:09:26 CET 2020
Commit: 192091903e2292135c3a5ac7f10872ad4481a9d9
Author: Jacques Lucke
Date: Sat Mar 7 16:49:37 2020 +0100
Branches: blenloader-api
https://developer.blender.org/rB192091903e2292135c3a5ac7f10872ad4481a9d9
move hook modifier file writing into MOD_hook.c
===================================================================
M source/blender/blenkernel/BKE_modifier.h
M source/blender/blenloader/intern/writefile.c
M source/blender/modifiers/CMakeLists.txt
M source/blender/modifiers/intern/MOD_hook.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h
index 3d7782e669b..27c45e927a5 100644
--- a/source/blender/blenkernel/BKE_modifier.h
+++ b/source/blender/blenkernel/BKE_modifier.h
@@ -336,7 +336,7 @@ typedef struct ModifierTypeInfo {
*/
void (*freeRuntimeData)(void *runtime_data);
- void (*bloWrite)(struct BloWriter *writer, struct ModifierData *md);
+ void (*bloWrite)(struct BloWriter *writer, const struct ModifierData *md);
} ModifierTypeInfo;
/* Initialize modifier's global data (type info and some common global storages). */
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index eaa014c9082..6622843a703 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1578,16 +1578,7 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
mti->bloWrite(wrap_writer(wd), md);
}
- if (md->type == eModifierType_Hook) {
- HookModifierData *hmd = (HookModifierData *)md;
-
- if (hmd->curfalloff) {
- BKE_curvemapping_blo_write_ptr(wrap_writer(wd), hmd->curfalloff);
- }
-
- writedata(wd, DATA, sizeof(int) * hmd->totindex, hmd->indexar);
- }
- else if (md->type == eModifierType_Cloth) {
+ if (md->type == eModifierType_Cloth) {
ClothModifierData *clmd = (ClothModifierData *)md;
writestruct(wd, DATA, ClothSimSettings, 1, clmd->sim_parms);
diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt
index 48acbdc17f3..3667bc18e69 100644
--- a/source/blender/modifiers/CMakeLists.txt
+++ b/source/blender/modifiers/CMakeLists.txt
@@ -24,6 +24,7 @@ set(INC
../blenfont
../blenkernel
../blenlib
+ ../blenloader
../bmesh
../depsgraph
../makesdna
diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c
index b43fc0e868e..78a7bbe8450 100644
--- a/source/blender/modifiers/intern/MOD_hook.c
+++ b/source/blender/modifiers/intern/MOD_hook.c
@@ -44,6 +44,8 @@
#include "MOD_util.h"
+#include "BLO_callback_api.h"
+
static void initData(ModifierData *md)
{
HookModifierData *hmd = (HookModifierData *)md;
@@ -123,6 +125,15 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
DEG_add_modifier_to_transform_relation(ctx->node, "Hook Modifier");
}
+static void bloWrite(BloWriter *writer, const ModifierData *md)
+{
+ HookModifierData *hmd = (HookModifierData *)md;
+ if (hmd->curfalloff) {
+ BKE_curvemapping_blo_write_ptr(writer, hmd->curfalloff);
+ }
+ BLO_write_raw(writer, sizeof(int) * hmd->totindex, hmd->indexar);
+}
+
struct HookData_cb {
float (*vertexCos)[3];
@@ -414,5 +425,5 @@ ModifierTypeInfo modifierType_Hook = {
/* foreachIDLink */ NULL,
/* foreachTexLink */ NULL,
/* freeRuntimeData */ NULL,
- /* bloWrite */ NULL,
+ /* bloWrite */ bloWrite,
};
More information about the Bf-blender-cvs
mailing list