Modifiers: Bevel modifier add invert vgroup option
Adds the invert vgroup option to the Bevel modifier. Reviewed By: mont29 Differential Revision: https://developer.blender.org/D6845
This commit is contained in:

committed by
Bastien Montagne

parent
ed8aa154a3
commit
6cd4363c0c
@@ -170,7 +170,9 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
|
|||||||
if md.limit_method == 'ANGLE':
|
if md.limit_method == 'ANGLE':
|
||||||
layout.prop(md, "angle_limit")
|
layout.prop(md, "angle_limit")
|
||||||
elif md.limit_method == 'VGROUP':
|
elif md.limit_method == 'VGROUP':
|
||||||
layout.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
|
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')
|
||||||
|
|
||||||
layout.label(text="Face Strength Mode:")
|
layout.label(text="Face Strength Mode:")
|
||||||
layout.row().prop(md, "face_strength_mode", expand=True)
|
layout.row().prop(md, "face_strength_mode", expand=True)
|
||||||
|
@@ -420,7 +420,7 @@ typedef struct BevelModifierData {
|
|||||||
/* BevelModifierData->flags and BevelModifierData->lim_flags */
|
/* BevelModifierData->flags and BevelModifierData->lim_flags */
|
||||||
enum {
|
enum {
|
||||||
MOD_BEVEL_VERT = (1 << 1),
|
MOD_BEVEL_VERT = (1 << 1),
|
||||||
/* unused = (1 << 2), */
|
MOD_BEVEL_INVERT_VGROUP = (1 << 2),
|
||||||
MOD_BEVEL_ANGLE = (1 << 3),
|
MOD_BEVEL_ANGLE = (1 << 3),
|
||||||
MOD_BEVEL_WEIGHT = (1 << 4),
|
MOD_BEVEL_WEIGHT = (1 << 4),
|
||||||
MOD_BEVEL_VGROUP = (1 << 5),
|
MOD_BEVEL_VGROUP = (1 << 5),
|
||||||
|
@@ -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_string_funcs(prop, NULL, NULL, "rna_BevelModifier_defgrp_name_set");
|
||||||
RNA_def_property_update(prop, 0, "rna_Modifier_update");
|
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);
|
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_boolean_negative_sdna(prop, NULL, "flags", MOD_BEVEL_OVERLAP_OK);
|
||||||
RNA_def_property_ui_text(prop, "Clamp Overlap", "Clamp the width to avoid overlap");
|
RNA_def_property_ui_text(prop, "Clamp Overlap", "Clamp the width to avoid overlap");
|
||||||
|
@@ -118,6 +118,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
|
|||||||
const float spread = bmd->spread;
|
const float spread = bmd->spread;
|
||||||
const bool use_custom_profile = (bmd->flags & MOD_BEVEL_CUSTOM_PROFILE);
|
const bool use_custom_profile = (bmd->flags & MOD_BEVEL_CUSTOM_PROFILE);
|
||||||
const int vmesh_method = bmd->vmesh_method;
|
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,
|
bm = BKE_mesh_to_bmesh_ex(mesh,
|
||||||
&(struct BMeshCreateParams){0},
|
&(struct BMeshCreateParams){0},
|
||||||
@@ -146,7 +147,9 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (vgroup != -1) {
|
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
|
/* 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" */
|
* interpolate weights for newly created vertices, and may cause unexpected "selection" */
|
||||||
if (weight < 0.5f) {
|
if (weight < 0.5f) {
|
||||||
@@ -180,8 +183,14 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (vgroup != -1) {
|
else if (vgroup != -1) {
|
||||||
weight = defvert_array_find_weight_safe(dvert, BM_elem_index_get(e->v1), vgroup);
|
weight = invert_vgroup ?
|
||||||
weight2 = defvert_array_find_weight_safe(dvert, BM_elem_index_get(e->v2), 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) {
|
if (weight < 0.5f || weight2 < 0.5f) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user