Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2022-05-16 17:53:26 +0300
committerBastien Montagne <bastien@blender.org>2022-05-16 17:56:27 +0300
commite9d7c05754e709e12b74855d697981ff472939ea (patch)
treecba14ca5badb791148b99030653a044a3110811a /source/blender/modifiers
parentb66368f3fd9c17e969fe1fd9d3f341eca7750183 (diff)
LibOverride: Do not write Corrective Smooth 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_correctivesmooth.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/source/blender/modifiers/intern/MOD_correctivesmooth.c b/source/blender/modifiers/intern/MOD_correctivesmooth.c
index e8a07f75b0f..70ab6559b65 100644
--- a/source/blender/modifiers/intern/MOD_correctivesmooth.c
+++ b/source/blender/modifiers/intern/MOD_correctivesmooth.c
@@ -798,14 +798,25 @@ static void panelRegister(ARegionType *region_type)
modifier_panel_register(region_type, eModifierType_CorrectiveSmooth, 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)
{
- const CorrectiveSmoothModifierData *csmd = (const CorrectiveSmoothModifierData *)md;
+ CorrectiveSmoothModifierData csmd = *(const CorrectiveSmoothModifierData *)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. */
+ csmd.bind_coords_num = 0;
+ csmd.bind_coords = NULL;
+ }
+ }
- BLO_write_struct(writer, CorrectiveSmoothModifierData, csmd);
+ BLO_write_struct_at_address(writer, CorrectiveSmoothModifierData, md, &csmd);
- if (csmd->bind_coords) {
- BLO_write_float3_array(writer, csmd->bind_coords_num, (float *)csmd->bind_coords);
+ if (csmd.bind_coords != NULL) {
+ BLO_write_float3_array(writer, csmd.bind_coords_num, (float *)csmd.bind_coords);
}
}