Modifiers: Wave add invert vgroup option
Adds the invert vgroup option to the Wave modifier. Differential Revision: https://developer.blender.org/D6893
This commit is contained in:
@@ -1217,7 +1217,9 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
|
||||
layout.separator()
|
||||
|
||||
layout.prop(md, "start_position_object")
|
||||
layout.prop_search(md, "vertex_group", ob, "vertex_groups")
|
||||
row = layout.row(align=True)
|
||||
row.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
|
||||
row.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT')
|
||||
split = layout.split(factor=0.33)
|
||||
col = split.column()
|
||||
col.label(text="Texture")
|
||||
|
@@ -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),
|
||||
|
@@ -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);
|
||||
|
@@ -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) {
|
||||
|
Reference in New Issue
Block a user