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:
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/makesdna/DNA_modifier_types.h2
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c5
-rw-r--r--source/blender/modifiers/intern/MOD_bevel.c15
3 files changed, 18 insertions, 4 deletions
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index 502b66536fd..2abe1b38a8d 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -420,7 +420,7 @@ typedef struct BevelModifierData {
/* BevelModifierData->flags and BevelModifierData->lim_flags */
enum {
MOD_BEVEL_VERT = (1 << 1),
- /* unused = (1 << 2), */
+ MOD_BEVEL_INVERT_VGROUP = (1 << 2),
MOD_BEVEL_ANGLE = (1 << 3),
MOD_BEVEL_WEIGHT = (1 << 4),
MOD_BEVEL_VGROUP = (1 << 5),
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index eafc5b5407e..24b7c968707 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -3860,6 +3860,11 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_BevelModifier_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, "flags", MOD_BEVEL_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, "use_clamp_overlap", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flags", MOD_BEVEL_OVERLAP_OK);
RNA_def_property_ui_text(prop, "Clamp Overlap", "Clamp the width to avoid overlap");
diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c
index f5bb1cb0ef8..14f1650d690 100644
--- a/source/blender/modifiers/intern/MOD_bevel.c
+++ b/source/blender/modifiers/intern/MOD_bevel.c
@@ -118,6 +118,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
const float spread = bmd->spread;
const bool use_custom_profile = (bmd->flags & MOD_BEVEL_CUSTOM_PROFILE);
const int vmesh_method = bmd->vmesh_method;
+ const bool invert_vgroup = (bmd->flags & MOD_BEVEL_INVERT_VGROUP) != 0;
bm = BKE_mesh_to_bmesh_ex(mesh,
&(struct BMeshCreateParams){0},
@@ -146,7 +147,9 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
}
}
else if (vgroup != -1) {
- weight = defvert_array_find_weight_safe(dvert, BM_elem_index_get(v), vgroup);
+ weight = invert_vgroup ?
+ 1.0f - defvert_array_find_weight_safe(dvert, BM_elem_index_get(v), vgroup) :
+ defvert_array_find_weight_safe(dvert, BM_elem_index_get(v), vgroup);
/* Check is against 0.5 rather than != 0.0 because cascaded bevel modifiers will
* interpolate weights for newly created vertices, and may cause unexpected "selection" */
if (weight < 0.5f) {
@@ -180,8 +183,14 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
}
}
else if (vgroup != -1) {
- weight = defvert_array_find_weight_safe(dvert, BM_elem_index_get(e->v1), vgroup);
- weight2 = defvert_array_find_weight_safe(dvert, BM_elem_index_get(e->v2), vgroup);
+ weight = invert_vgroup ?
+ 1.0f - defvert_array_find_weight_safe(
+ dvert, BM_elem_index_get(e->v1), vgroup) :
+ defvert_array_find_weight_safe(dvert, BM_elem_index_get(e->v1), vgroup);
+ weight2 = invert_vgroup ?
+ 1.0f - defvert_array_find_weight_safe(
+ dvert, BM_elem_index_get(e->v2), vgroup) :
+ defvert_array_find_weight_safe(dvert, BM_elem_index_get(e->v2), vgroup);
if (weight < 0.5f || weight2 < 0.5f) {
continue;
}