diff options
author | Bastien Montagne <bastien@blender.org> | 2022-05-16 17:55:11 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2022-05-16 17:56:27 +0300 |
commit | 5973950b2aa9dded297d8b8fe9c650018ba726b6 (patch) | |
tree | 9dd2a59611a583f53be79402320fa00a6437aa4a /source/blender/modifiers | |
parent | e9d7c05754e709e12b74855d697981ff472939ea (diff) |
LibOverride: Do not write Laplacian Deform modifier binding data.
Skip writing binding data and similar for override modifiers already
present in reference linked data, as this can use a lot of space, and
is fully useless data typically since we already skip writing Mesh
geometry data itself.
Ref. T97967.
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r-- | source/blender/modifiers/intern/MOD_laplaciandeform.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/source/blender/modifiers/intern/MOD_laplaciandeform.c b/source/blender/modifiers/intern/MOD_laplaciandeform.c index 900c94a87be..e8dc07a257a 100644 --- a/source/blender/modifiers/intern/MOD_laplaciandeform.c +++ b/source/blender/modifiers/intern/MOD_laplaciandeform.c @@ -843,13 +843,26 @@ static void panelRegister(ARegionType *region_type) modifier_panel_register(region_type, eModifierType_LaplacianDeform, panel_draw); } -static void blendWrite(BlendWriter *writer, const ID *UNUSED(id_owner), const ModifierData *md) +static void blendWrite(BlendWriter *writer, const ID *id_owner, const ModifierData *md) { - LaplacianDeformModifierData *lmd = (LaplacianDeformModifierData *)md; + LaplacianDeformModifierData lmd = *(const LaplacianDeformModifierData *)md; + + if (ID_IS_OVERRIDE_LIBRARY(id_owner)) { + BLI_assert(!ID_IS_LINKED(id_owner)); + const bool is_local = (md->flag & eModifierFlag_OverrideLibrary_Local) != 0; + if (!is_local) { + /* Modifier comming from linked data cannot be bound from an override, so we can remove all + * binding data, can save a sgnificant amout of memory. */ + lmd.verts_num = 0; + lmd.vertexco = NULL; + } + } - BLO_write_struct(writer, LaplacianDeformModifierData, lmd); + BLO_write_struct_at_address(writer, LaplacianDeformModifierData, md, &lmd); - BLO_write_float3_array(writer, lmd->verts_num, lmd->vertexco); + if (lmd.vertexco != NULL) { + BLO_write_float3_array(writer, lmd.verts_num, lmd.vertexco); + } } static void blendRead(BlendDataReader *reader, ModifierData *md) |