diff options
author | Bastien Montagne <b.mont29@gmail.com> | 2020-03-03 20:41:50 +0300 |
---|---|---|
committer | Bastien Montagne <b.mont29@gmail.com> | 2020-03-03 20:41:50 +0300 |
commit | 059f3c1a7eb8a48aa06467e19cce4daa29091c1a (patch) | |
tree | 1fd631a590bcf0ea14865927c21491559c35e783 /source | |
parent | 2841b2be3949b7592b50cd2ebd03b9b32a5f2058 (diff) |
Modifiers: Wave add invert vgroup option
Adds the invert vgroup option to the Wave modifier.
Differential Revision: https://developer.blender.org/D6893
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/makesdna/DNA_modifier_types.h | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_modifier.c | 5 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_wave.c | 4 |
3 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index 572a9fd76ba..36d21b28b1f 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -673,7 +673,7 @@ typedef struct WaveModifierData { /* WaveModifierData.flag */ enum { - /* And what bout (1 << 0) flag? ;) */ + MOD_WAVE_INVERT_VGROUP = (1 << 0), MOD_WAVE_X = (1 << 1), MOD_WAVE_Y = (1 << 2), MOD_WAVE_CYCL = (1 << 3), diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index cc0ebd8e6b2..025cae42033 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -2356,6 +2356,11 @@ static void rna_def_modifier_wave(BlenderRNA *brna) RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WaveModifier_defgrp_name_set"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); + prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_INVERT_VGROUP); + RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence"); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); + prop = RNA_def_property(srna, "speed", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); RNA_def_property_ui_range(prop, -1, 1, 10, 2); diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c index ff5748b968c..d4d8d253254 100644 --- a/source/blender/modifiers/intern/MOD_wave.c +++ b/source/blender/modifiers/intern/MOD_wave.c @@ -154,6 +154,7 @@ static void waveModifier_do(WaveModifierData *md, const int wmd_axis = wmd->flag & (MOD_WAVE_X | MOD_WAVE_Y); const float falloff = wmd->falloff; float falloff_fac = 1.0f; /* when falloff == 0.0f this stays at 1.0f */ + const bool invert_group = (wmd->flag & MOD_WAVE_INVERT_VGROUP) != 0; if ((wmd->flag & MOD_WAVE_NORM) && (mesh != NULL)) { mvert = mesh->mvert; @@ -213,7 +214,8 @@ static void waveModifier_do(WaveModifierData *md, /* get weights */ if (dvert) { - def_weight = defvert_find_weight(&dvert[i], defgrp_index); + def_weight = invert_group ? 1.0f - defvert_find_weight(&dvert[i], defgrp_index) : + defvert_find_weight(&dvert[i], defgrp_index); /* if this vert isn't in the vgroup, don't deform it */ if (def_weight == 0.0f) { |