diff options
author | Cody Winchester <CodyWinch> | 2020-02-12 13:04:20 +0300 |
---|---|---|
committer | Bastien Montagne <b.mont29@gmail.com> | 2020-02-12 13:05:35 +0300 |
commit | cd57c9e310e2482298ac61fc9424551bbe6eb61c (patch) | |
tree | 543a9f4e956dcf7b9833ff998f9667e9c5b63e1f /source | |
parent | 0e15850a7eedbdf236e977c663efaceff23572e1 (diff) |
Modifiers: Weld Modifier add invert vgroup option
Adds the invert vgroup option to the weld modifier.
Differential Revision: https://developer.blender.org/D6818
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/makesdna/DNA_modifier_types.h | 8 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_modifier.c | 5 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_weld.c | 4 |
3 files changed, 16 insertions, 1 deletions
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++; |