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_correctivesmooth.c | |
parent | f7bbc7cdbb6cb0d28504c6a8dd51bee5330d1f17 (diff) |
Refactor: move more blenloader code into modifier files
Diffstat (limited to 'source/blender/modifiers/intern/MOD_correctivesmooth.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_correctivesmooth.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/source/blender/modifiers/intern/MOD_correctivesmooth.c b/source/blender/modifiers/intern/MOD_correctivesmooth.c index ba343854d41..ac91056ed7d 100644 --- a/source/blender/modifiers/intern/MOD_correctivesmooth.c +++ b/source/blender/modifiers/intern/MOD_correctivesmooth.c @@ -54,6 +54,8 @@ #include "MOD_ui_common.h" #include "MOD_util.h" +#include "BLO_read_write.h" + #include "BLI_strict_flags.h" #include "DEG_depsgraph_query.h" @@ -817,6 +819,28 @@ static void panelRegister(ARegionType *region_type) modifier_panel_register(region_type, eModifierType_CorrectiveSmooth, panel_draw); } +static void blendWrite(BlendWriter *writer, const ModifierData *md) +{ + const CorrectiveSmoothModifierData *csmd = (const CorrectiveSmoothModifierData *)md; + + if (csmd->bind_coords) { + BLO_write_float3_array(writer, (int)csmd->bind_coords_num, (float *)csmd->bind_coords); + } +} + +static void blendRead(BlendDataReader *reader, ModifierData *md) +{ + CorrectiveSmoothModifierData *csmd = (CorrectiveSmoothModifierData *)md; + + if (csmd->bind_coords) { + BLO_read_float3_array(reader, (int)csmd->bind_coords_num, (float **)&csmd->bind_coords); + } + + /* runtime only */ + csmd->delta_cache.deltas = NULL; + csmd->delta_cache.totverts = 0; +} + ModifierTypeInfo modifierType_CorrectiveSmooth = { /* name */ "CorrectiveSmooth", /* structName */ "CorrectiveSmoothModifierData", @@ -847,6 +871,6 @@ ModifierTypeInfo modifierType_CorrectiveSmooth = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, - /* blendWrite */ NULL, - /* blendRead */ NULL, + /* blendWrite */ blendWrite, + /* blendRead */ blendRead, }; |