From 83980506957cd4e31e8dc7041672efb256b5c28c Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Thu, 1 Oct 2020 09:38:00 -0500 Subject: Use DNA defaults system for modifiers As noted in T80164, there are quite a few area of Blender where the "Reset to Default Value" operator in button context menus doesn't work. Modifiers are one of them, because the DNA defaults system was never set up for them. Additionally, this should make modifier versioning easier. Whenever a new field is added it should be automatically initialized to the default value. I had to make some ordering changes in the following modifiers to work around an error with `-Wsign-conversion` in the macros: - Solidify Modifier - Corrective Smooth Modifier - Screw Modifier Some modifiers are special cases and are skipped in this commit: - Data Transfer Modifier - Cloth Modifier - Fluid Modifier - Softbody Modifier Differential Revision: https://developer.blender.org/D8747 --- source/blender/modifiers/intern/MOD_meshsequencecache.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'source/blender/modifiers/intern/MOD_meshsequencecache.c') diff --git a/source/blender/modifiers/intern/MOD_meshsequencecache.c b/source/blender/modifiers/intern/MOD_meshsequencecache.c index eca20c088ce..48b1a4c56a8 100644 --- a/source/blender/modifiers/intern/MOD_meshsequencecache.c +++ b/source/blender/modifiers/intern/MOD_meshsequencecache.c @@ -26,6 +26,7 @@ #include "BLT_translation.h" #include "DNA_cachefile_types.h" +#include "DNA_defaults.h" #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_modifier_types.h" @@ -64,15 +65,9 @@ static void initData(ModifierData *md) { MeshSeqCacheModifierData *mcmd = (MeshSeqCacheModifierData *)md; - mcmd->cache_file = NULL; - mcmd->object_path[0] = '\0'; - mcmd->read_flag = MOD_MESHSEQ_READ_ALL | MOD_MESHSEQ_INTERPOLATE_VERTICES; - mcmd->velocity_scale = 1.0f; - mcmd->vertex_velocities = NULL; - mcmd->num_vertices = 0; + BLI_assert(MEMCMP_STRUCT_AFTER_IS_ZERO(mcmd, modifier)); - mcmd->reader = NULL; - mcmd->reader_object_path[0] = '\0'; + MEMCPY_STRUCT_AFTER(mcmd, DNA_struct_default_get(MeshSeqCacheModifierData), modifier); } static void copyData(const ModifierData *md, ModifierData *target, const int flag) -- cgit v1.2.3