From 496f6adce29cd0da2f91cb574ca396679aa35645 Mon Sep 17 00:00:00 2001 From: Howard Trickey Date: Sun, 6 Jan 2019 18:12:00 -0500 Subject: Better bevel normal hardening when some faces were smooth. Harden normals causes normal splitting, which will not give the appearance expected due to autosmooth unless some edges are sharpened, so this change fixes that. Also bevel tool will turn on autosmooth if not already on if hardening normals. --- source/blender/modifiers/intern/MOD_bevel.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index e63b5407a74..363cdb083d4 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -116,7 +116,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes const bool loop_slide = (bmd->flags & MOD_BEVEL_EVEN_WIDTHS) == 0; const bool mark_seam = (bmd->edge_flags & MOD_BEVEL_MARK_SEAM); const bool mark_sharp = (bmd->edge_flags & MOD_BEVEL_MARK_SHARP); - const bool harden_normals = (bmd->flags & MOD_BEVEL_HARDEN_NORMALS); + bool harden_normals = (bmd->flags & MOD_BEVEL_HARDEN_NORMALS); const int face_strength_mode = bmd->face_str_mode; bm = BKE_mesh_to_bmesh_ex( @@ -187,10 +187,15 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes } } + if (harden_normals && !(((Mesh *)ctx->object->data)->flag & ME_AUTOSMOOTH)) { + modifier_setError(md, "Enable 'Auto Smooth' option in mesh settings for hardening"); + harden_normals = false; + } + BM_mesh_bevel(bm, bmd->value, offset_type, bmd->res, bmd->profile, vertex_only, bmd->lim_flags & MOD_BEVEL_WEIGHT, do_clamp, dvert, vgroup, mat, loop_slide, mark_seam, mark_sharp, - harden_normals, face_strength_mode); + harden_normals, face_strength_mode, mesh->smoothresh); result = BKE_mesh_from_bmesh_for_eval_nomain(bm, 0); -- cgit v1.2.3