diff options
author | Jacques Lucke <jacques@blender.org> | 2020-06-15 19:37:30 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-06-15 19:37:30 +0300 |
commit | 6a0ebb80885be1b86588af57f989cafd9e64305d (patch) | |
tree | b043d814f8a77d327ec4e0edeee85208b1c74431 /source/blender | |
parent | d97cb98b1192a71d940981997044653634a253de (diff) |
Refactor: use new blenloader api for laplacian deform modifier
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 6 | ||||
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 5 | ||||
-rw-r--r-- | source/blender/modifiers/CMakeLists.txt | 4 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_laplaciandeform.c | 21 |
4 files changed, 23 insertions, 13 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index fcbbccedcda..f3b92b1f6a4 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -5831,12 +5831,6 @@ static void direct_link_modifiers(BlendDataReader *reader, ListBase *lb, Object direct_link_curvemapping(reader, wmd->cmap_curve); } } - else if (md->type == eModifierType_LaplacianDeform) { - LaplacianDeformModifierData *lmd = (LaplacianDeformModifierData *)md; - - BLO_read_float3_array(reader, lmd->total_verts, &lmd->vertexco); - lmd->cache_system = NULL; - } else if (md->type == eModifierType_CorrectiveSmooth) { CorrectiveSmoothModifierData *csmd = (CorrectiveSmoothModifierData *)md; diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index b6f8849b46d..2cc6cecd815 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -1794,11 +1794,6 @@ static void write_modifiers(BlendWriter *writer, ListBase *modbase) write_curvemapping(writer, wmd->cmap_curve); } } - else if (md->type == eModifierType_LaplacianDeform) { - LaplacianDeformModifierData *lmd = (LaplacianDeformModifierData *)md; - - BLO_write_float3_array(writer, lmd->total_verts, lmd->vertexco); - } else if (md->type == eModifierType_CorrectiveSmooth) { CorrectiveSmoothModifierData *csmd = (CorrectiveSmoothModifierData *)md; diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt index 78db7de2ac2..460f697a0a9 100644 --- a/source/blender/modifiers/CMakeLists.txt +++ b/source/blender/modifiers/CMakeLists.txt @@ -25,6 +25,7 @@ set(INC ../blenkernel ../blentranslation ../blenlib + ../blenloader ../bmesh ../depsgraph ../editors/include @@ -34,6 +35,9 @@ set(INC ../windowmanager ../../../intern/eigen ../../../intern/guardedalloc + + # dna_type_offsets.h in BLO_read_write.h + ${CMAKE_BINARY_DIR}/source/blender/makesdna/intern ) set(INC_SYS diff --git a/source/blender/modifiers/intern/MOD_laplaciandeform.c b/source/blender/modifiers/intern/MOD_laplaciandeform.c index d0088fd2657..e2646e77af9 100644 --- a/source/blender/modifiers/intern/MOD_laplaciandeform.c +++ b/source/blender/modifiers/intern/MOD_laplaciandeform.c @@ -49,6 +49,8 @@ #include "UI_interface.h" #include "UI_resources.h" +#include "BLO_read_write.h" + #include "RNA_access.h" #include "MOD_ui_common.h" @@ -855,6 +857,21 @@ static void panelRegister(ARegionType *region_type) modifier_panel_register(region_type, eModifierType_LaplacianDeform, panel_draw); } +static void blendWrite(BlendWriter *writer, const ModifierData *md) +{ + LaplacianDeformModifierData *lmd = (LaplacianDeformModifierData *)md; + + BLO_write_float3_array(writer, lmd->total_verts, lmd->vertexco); +} + +static void blendRead(BlendDataReader *reader, ModifierData *md) +{ + LaplacianDeformModifierData *lmd = (LaplacianDeformModifierData *)md; + + BLO_read_float3_array(reader, lmd->total_verts, &lmd->vertexco); + lmd->cache_system = NULL; +} + ModifierTypeInfo modifierType_LaplacianDeform = { /* name */ "LaplacianDeform", /* structName */ "LaplacianDeformModifierData", @@ -884,6 +901,6 @@ ModifierTypeInfo modifierType_LaplacianDeform = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, - /* blendWrite */ NULL, - /* blendRead */ NULL, + /* blendWrite */ blendWrite, + /* blendRead */ blendRead, }; |