diff options
author | Jacques Lucke <jacques@blender.org> | 2020-06-23 17:42:00 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-06-23 17:42:08 +0300 |
commit | 8b59b97c10ecbab6e1062335d1c376b4c0fb9879 (patch) | |
tree | b175be884162253f69b7a40d33c72affc12e8df2 /source/blender/modifiers/intern/MOD_hook.c | |
parent | f7bbc7cdbb6cb0d28504c6a8dd51bee5330d1f17 (diff) |
Refactor: move more blenloader code into modifier files
Diffstat (limited to 'source/blender/modifiers/intern/MOD_hook.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_hook.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c index 4305c32071d..c8cfc07562f 100644 --- a/source/blender/modifiers/intern/MOD_hook.c +++ b/source/blender/modifiers/intern/MOD_hook.c @@ -46,6 +46,8 @@ #include "UI_interface.h" #include "UI_resources.h" +#include "BLO_read_write.h" + #include "RNA_access.h" #include "DEG_depsgraph_query.h" @@ -468,6 +470,29 @@ static void panelRegister(ARegionType *region_type) region_type, "falloff", "Falloff", NULL, falloff_panel_draw, panel_type); } +static void blendWrite(BlendWriter *writer, const ModifierData *md) +{ + const HookModifierData *hmd = (const HookModifierData *)md; + + if (hmd->curfalloff) { + BKE_curvemapping_blend_write(writer, hmd->curfalloff); + } + + BLO_write_int32_array(writer, hmd->totindex, hmd->indexar); +} + +static void blendRead(BlendDataReader *reader, ModifierData *md) +{ + HookModifierData *hmd = (HookModifierData *)md; + + BLO_read_data_address(reader, &hmd->curfalloff); + if (hmd->curfalloff) { + BKE_curvemapping_blend_read(reader, hmd->curfalloff); + } + + BLO_read_int32_array(reader, hmd->totindex, &hmd->indexar); +} + ModifierTypeInfo modifierType_Hook = { /* name */ "Hook", /* structName */ "HookModifierData", @@ -498,6 +523,6 @@ ModifierTypeInfo modifierType_Hook = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, - /* blendWrite */ NULL, - /* blendRead */ NULL, + /* blendWrite */ blendWrite, + /* blendRead */ blendRead, }; |