diff options
author | Howard Trickey <howard.trickey@gmail.com> | 2019-01-07 02:12:00 +0300 |
---|---|---|
committer | Howard Trickey <howard.trickey@gmail.com> | 2019-01-07 02:12:00 +0300 |
commit | 496f6adce29cd0da2f91cb574ca396679aa35645 (patch) | |
tree | b854406a89fc31d7dfcaf754a42a020ad53b33f6 /source/blender/modifiers/intern/MOD_bevel.c | |
parent | b4a77a351e31256c91e573b85b7252e3ca6d61e7 (diff) |
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.
Diffstat (limited to 'source/blender/modifiers/intern/MOD_bevel.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_bevel.c | 9 |
1 files changed, 7 insertions, 2 deletions
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); |