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.h8
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c5
-rw-r--r--source/blender/modifiers/intern/MOD_weld.c4
4 files changed, 19 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 7dadbd427fd..996d6add629 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1498,7 +1498,9 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
def WELD(self, layout, ob, md):
layout.prop(md, "merge_threshold", text="Distance")
layout.prop(md, "max_interactions")
- layout.prop_search(md, "vertex_group", ob, "vertex_groups")
+ row = layout.row(align=True)
+ row.prop_search(md, "vertex_group", ob, "vertex_groups")
+ row.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT')
def DATA_TRANSFER(self, layout, ob, md):
row = layout.row(align=True)
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index 918b4a2a7ea..1b0b3d9e08e 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -1862,8 +1862,16 @@ typedef struct WeldModifierData {
unsigned int max_interactions;
/* Name of vertex group to use to mask, MAX_VGROUP_NAME. */
char defgrp_name[64];
+
+ short flag;
+ char _pad[6];
} WeldModifierData;
+/* WeldModifierData->flag */
+enum {
+ MOD_WELD_INVERT_VGROUP = (1 << 0),
+};
+
typedef struct DataTransferModifierData {
ModifierData modifier;
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index c6898120bfa..65963798e08 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -5717,6 +5717,11 @@ static void rna_def_modifier_weld(BlenderRNA *brna)
prop, "Vertex Group", "Vertex group name for selecting the affected areas");
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WeldModifier_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_WELD_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_datatransfer(BlenderRNA *brna)
diff --git a/source/blender/modifiers/intern/MOD_weld.c b/source/blender/modifiers/intern/MOD_weld.c
index bd567c52d88..64a0667a41a 100644
--- a/source/blender/modifiers/intern/MOD_weld.c
+++ b/source/blender/modifiers/intern/MOD_weld.c
@@ -1623,6 +1623,7 @@ static Mesh *weldModifier_doWeld(WeldModifierData *wmd, const ModifierEvalContex
const MPoly *mpoly, *mp;
uint totvert, totedge, totloop, totpoly;
uint i;
+ const bool invert_vgroup = (wmd->flag & MOD_WELD_INVERT_VGROUP) != 0;
mvert = mesh->mvert;
totvert = mesh->totvert;
@@ -1636,7 +1637,8 @@ static Mesh *weldModifier_doWeld(WeldModifierData *wmd, const ModifierEvalContex
dv = &dvert[0];
v_mask = BLI_BITMAP_NEW(totvert, __func__);
for (i = 0; i < totvert; i++, dv++) {
- const bool found = defvert_find_weight(dv, defgrp_index) > 0.0f;
+ const bool found = invert_vgroup ? 1.0f - defvert_find_weight(dv, defgrp_index) > 0.0f :
+ defvert_find_weight(dv, defgrp_index) > 0.0f;
if (found) {
BLI_BITMAP_ENABLE(v_mask, i);
v_mask_act++;