diff options
author | Cody Winchester <CodyWinch> | 2020-02-06 13:52:24 +0300 |
---|---|---|
committer | Bastien Montagne <b.mont29@gmail.com> | 2020-02-06 13:54:55 +0300 |
commit | dd00e8ecd642cafc6294ec7f0f31c5e0e0fe9870 (patch) | |
tree | 4a3f9cb7a409c8d00846588afc715253c4ccaa34 /source/blender | |
parent | 8768cd6a6a98a710ed2b6d8b257c43dd0e6e58ee (diff) |
Smooth Modifier add invert vgroup option
Adds the invert vertex group option to the smooth modifier.
Setup same way as previous modifiers.
Reviewed By: mont29
Differential Revision: https://developer.blender.org/D6745
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/makesdna/DNA_modifier_types.h | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_modifier.c | 5 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_smooth.c | 4 |
3 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index 135ddd8f62f..fcf41481ade 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -610,6 +610,7 @@ typedef struct SmoothModifierData { /* Smooth modifier flags */ enum { + MOD_SMOOTH_INVERT_VGROUP = (1 << 0), MOD_SMOOTH_X = (1 << 1), MOD_SMOOTH_Y = (1 << 2), MOD_SMOOTH_Z = (1 << 3), diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 5b7db50ca02..0d953728c5e 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -3040,6 +3040,11 @@ static void rna_def_modifier_smooth(BlenderRNA *brna) "Name of Vertex Group which determines influence of modifier per point"); RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SmoothModifier_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_SMOOTH_INVERT_VGROUP); + RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence"); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); } static void rna_def_modifier_correctivesmooth(BlenderRNA *brna) diff --git a/source/blender/modifiers/intern/MOD_smooth.c b/source/blender/modifiers/intern/MOD_smooth.c index c8bc3aaa484..59ed3b0b005 100644 --- a/source/blender/modifiers/intern/MOD_smooth.c +++ b/source/blender/modifiers/intern/MOD_smooth.c @@ -101,6 +101,7 @@ static void smoothModifier_do( const float fac_new = smd->fac; const float fac_orig = 1.0f - fac_new; + const bool invert_vgroup = (smd->flag & MOD_SMOOTH_INVERT_VGROUP) != 0; MEdge *medges = mesh->medge; const int num_edges = mesh->totedge; @@ -139,7 +140,8 @@ static void smoothModifier_do( } float *vco_new = accumulated_vecs[i]; - const float f_new = defvert_find_weight(dv, defgrp_index) * fac_new; + const float f_new = invert_vgroup ? (1.0f - defvert_find_weight(dv, defgrp_index)) * fac_new : + defvert_find_weight(dv, defgrp_index) * fac_new; if (f_new <= 0.0f) { continue; } |