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/editors/mesh | |
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/editors/mesh')
-rw-r--r-- | source/blender/editors/mesh/editmesh_bevel.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/source/blender/editors/mesh/editmesh_bevel.c b/source/blender/editors/mesh/editmesh_bevel.c index ff259f01f64..0d99c433c11 100644 --- a/source/blender/editors/mesh/editmesh_bevel.c +++ b/source/blender/editors/mesh/editmesh_bevel.c @@ -41,6 +41,8 @@ #include "BKE_layer.h" #include "BKE_mesh.h" +#include "DNA_mesh_types.h" + #include "RNA_define.h" #include "RNA_access.h" @@ -231,6 +233,7 @@ static bool edbm_bevel_calc(wmOperator *op) const bool harden_normals = RNA_boolean_get(op->ptr, "harden_normals"); const int face_strength_mode = RNA_enum_get(op->ptr, "face_strength_mode"); + for (uint ob_index = 0; ob_index < opdata->ob_store_len; ob_index++) { em = opdata->ob_store[ob_index].em; @@ -243,12 +246,21 @@ static bool edbm_bevel_calc(wmOperator *op) material = CLAMPIS(material, -1, em->ob->totcol - 1); } + Mesh *me = em->ob->data; + + if (harden_normals && !(me->flag & ME_AUTOSMOOTH)) { + /* harden_normals only has a visible effect if autosmooth is on, so turn it on */ + me->flag |= ME_AUTOSMOOTH; + } + EDBM_op_init( em, &bmop, op, "bevel geom=%hev offset=%f segments=%i vertex_only=%b offset_type=%i profile=%f clamp_overlap=%b " - "material=%i loop_slide=%b mark_seam=%b mark_sharp=%b harden_normals=%b face_strength_mode=%i", + "material=%i loop_slide=%b mark_seam=%b mark_sharp=%b harden_normals=%b face_strength_mode=%i " + "smoothresh=%f", BM_ELEM_SELECT, offset, segments, vertex_only, offset_type, profile, - clamp_overlap, material, loop_slide, mark_seam, mark_sharp, harden_normals, face_strength_mode); + clamp_overlap, material, loop_slide, mark_seam, mark_sharp, harden_normals, face_strength_mode, + me->smoothresh); BMO_op_exec(em->bm, &bmop); |