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
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_defaults.h"
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_modifier_types.h"
|
||||
@@ -316,15 +317,9 @@ static void initData(ModifierData *md)
|
||||
{
|
||||
WeightVGProximityModifierData *wmd = (WeightVGProximityModifierData *)md;
|
||||
|
||||
wmd->proximity_mode = MOD_WVG_PROXIMITY_OBJECT;
|
||||
wmd->proximity_flags = MOD_WVG_PROXIMITY_GEOM_VERTS;
|
||||
BLI_assert(MEMCMP_STRUCT_AFTER_IS_ZERO(wmd, modifier));
|
||||
|
||||
wmd->falloff_type = MOD_WVG_MAPPING_NONE;
|
||||
|
||||
wmd->mask_constant = 1.0f;
|
||||
wmd->mask_tex_use_channel = MOD_WVG_MASK_TEX_USE_INT; /* Use intensity by default. */
|
||||
wmd->mask_tex_mapping = MOD_DISP_MAP_LOCAL;
|
||||
wmd->max_dist = 1.0f; /* vert arbitrary distance, but don't use 0 */
|
||||
MEMCPY_STRUCT_AFTER(wmd, DNA_struct_default_get(WeightVGProximityModifierData), modifier);
|
||||
}
|
||||
|
||||
static void requiredDataMask(Object *UNUSED(ob),
|
||||
|
||||
Reference in New Issue
Block a user