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
This commit is contained in:
parent
8768cd6a6a
commit
dd00e8ecd6
|
@ -969,7 +969,9 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
|
|||
col.prop(md, "factor")
|
||||
col.prop(md, "iterations")
|
||||
col.label(text="Vertex Group:")
|
||||
col.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
|
||||
row = col.row(align=True)
|
||||
row.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
|
||||
row.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT')
|
||||
|
||||
def SOFT_BODY(self, layout, _ob, _md):
|
||||
layout.label(text="Settings are inside the Physics tab")
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue