Fix bug #34611: bevel overlap limit

The previous fix limited overlap, but is sometimes
too conservative, and artists want way to turn off
the limiting, so added 'Allow Overlap' option to
modifier.
This commit is contained in:
Howard Trickey 2013-04-24 12:39:37 +00:00
parent 245a175a00
commit d2daa230d6
4 changed files with 14 additions and 6 deletions

@ -119,13 +119,13 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
layout.prop(md, "end_cap")
def BEVEL(self, layout, ob, md):
split = layout.split()
split.prop(md, "width")
split.prop(md, "use_only_vertices")
layout.prop(md, "width")
layout.prop(md, "segments")
split = layout.split()
split.prop(md, "use_only_vertices")
split.prop(md, "overlap_ok")
layout.label(text="Limit Method:")
layout.row().prop(md, "limit_method", expand=True)
if md.limit_method == 'ANGLE':

@ -66,6 +66,8 @@
* here because they are mixed - campbell */
#define BME_BEVEL_DIST (1 << 12) /* same as above */
#define BME_BEVEL_OVERLAP_OK (1 << 13)
typedef struct BME_TransData {
struct BMesh *bm; /* the bmesh the vert belongs to */
struct BMVert *v; /* pointer to the vert this tdata applies to */

@ -2364,6 +2364,11 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
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, "overlap_ok", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", BME_BEVEL_OVERLAP_OK);
RNA_def_property_ui_text(prop, "Allow Overlap", "Do not clamp the width to avoid overlap");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
#endif
}

@ -111,6 +111,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *ob,
BevelModifierData *bmd = (BevelModifierData *) md;
const float threshold = cosf((bmd->bevel_angle + 0.00001f) * (float)M_PI / 180.0f);
const bool vertex_only = bmd->flags & BME_BEVEL_VERT;
const bool do_clamp = !(bmd->flags & BME_BEVEL_OVERLAP_OK);
bm = DM_to_bmesh(dm);
@ -160,7 +161,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *ob,
}
BM_mesh_bevel(bm, bmd->value, bmd->res,
vertex_only, bmd->lim_flags & BME_BEVEL_WEIGHT, true,
vertex_only, bmd->lim_flags & BME_BEVEL_WEIGHT, do_clamp,
dvert, vgroup);
result = CDDM_from_bmesh(bm, TRUE);