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:
authorHans Goudey <h.goudey@me.com>2020-10-01 17:38:00 +0300
committerHans Goudey <h.goudey@me.com>2020-10-01 17:38:00 +0300
commit83980506957cd4e31e8dc7041672efb256b5c28c (patch)
tree15224c5527a82ee5db618a28bbd3e0c178e6095e /source/blender/modifiers/intern/MOD_triangulate.c
parent551204a17f14b94b4e222546231f4e5846762ce7 (diff)
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
Diffstat (limited to 'source/blender/modifiers/intern/MOD_triangulate.c')
-rw-r--r--source/blender/modifiers/intern/MOD_triangulate.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/modifiers/intern/MOD_triangulate.c b/source/blender/modifiers/intern/MOD_triangulate.c
index 3b374948349..e65761a77be 100644
--- a/source/blender/modifiers/intern/MOD_triangulate.c
+++ b/source/blender/modifiers/intern/MOD_triangulate.c
@@ -18,12 +18,15 @@
* \ingroup modifiers
*/
+#include <string.h>
+
#include "MEM_guardedalloc.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
+#include "DNA_defaults.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
@@ -107,11 +110,12 @@ static void initData(ModifierData *md)
{
TriangulateModifierData *tmd = (TriangulateModifierData *)md;
+ BLI_assert(MEMCMP_STRUCT_AFTER_IS_ZERO(tmd, modifier));
+
+ MEMCPY_STRUCT_AFTER(tmd, DNA_struct_default_get(TriangulateModifierData), modifier);
+
/* Enable in editmode by default */
md->mode |= eModifierMode_Editmode;
- tmd->quad_method = MOD_TRIANGULATE_QUAD_SHORTEDGE;
- tmd->ngon_method = MOD_TRIANGULATE_NGON_BEAUTY;
- tmd->min_vertices = 4;
}
static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *UNUSED(ctx), Mesh *mesh)