Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--release/scripts/startup/bl_ui/properties_data_modifier.py4
-rw-r--r--source/blender/makesdna/DNA_modifier_types.h7
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c5
-rw-r--r--source/blender/modifiers/intern/MOD_displace.c4
4 files changed, 18 insertions, 2 deletions
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 197566f16f3..ae450f17e09 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -381,7 +381,9 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
col.label(text="Space:")
col.prop(md, "space", text="")
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')
col = split.column(align=True)
col.active = has_texture
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index 62817c3b563..a203e77ab26 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -492,8 +492,15 @@ typedef struct DisplaceModifierData {
char defgrp_name[64];
float midlevel;
int space;
+ short flag;
+ char _pad[6];
} DisplaceModifierData;
+/* DisplaceModifierData->flag */
+enum {
+ MOD_DISP_INVERT_VGROUP = (1 << 0),
+};
+
/* DisplaceModifierData->direction */
enum {
MOD_DISP_DIR_X = 0,
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 8117085974c..394f74f3675 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -2889,6 +2889,11 @@ static void rna_def_modifier_displace(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Space", "");
RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+ prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_DISP_INVERT_VGROUP);
+ RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
rna_def_modifier_generic_map_info(srna);
}
diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c
index 9cb694be88b..7f65b3bb5ae 100644
--- a/source/blender/modifiers/intern/MOD_displace.c
+++ b/source/blender/modifiers/intern/MOD_displace.c
@@ -174,6 +174,7 @@ static void displaceModifier_do_task(void *__restrict userdata,
DisplaceUserdata *data = (DisplaceUserdata *)userdata;
DisplaceModifierData *dmd = data->dmd;
MDeformVert *dvert = data->dvert;
+ const bool invert_vgroup = (dmd->flag & MOD_DISP_INVERT_VGROUP) != 0;
float weight = data->weight;
int defgrp_index = data->defgrp_index;
int direction = data->direction;
@@ -192,7 +193,8 @@ static void displaceModifier_do_task(void *__restrict userdata,
float local_vec[3];
if (dvert) {
- weight = defvert_find_weight(dvert + iter, defgrp_index);
+ weight = invert_vgroup ? 1.0f - defvert_find_weight(dvert + iter, defgrp_index) :
+ defvert_find_weight(dvert + iter, defgrp_index);
if (weight == 0.0f) {
return;
}