diff options
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r-- | source/blender/modifiers/intern/MOD_bevel.c | 28 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_weighted_normal.c | 9 |
2 files changed, 19 insertions, 18 deletions
diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index f1dc73436ee..ba07a3a56cc 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -111,8 +111,8 @@ static void bevel_set_weighted_normal_face_strength(BMesh *bm, Scene *scene) } static void bevel_mod_harden_normals( - BevelModifierData *bmd, BMesh *bm, const float hn_strength, - const int hnmode, MDeformVert *dvert, int vgroup) + BevelModifierData *bmd, BMesh *bm, const float hn_strength, + const int hnmode, MDeformVert *dvert, int vgroup) { if (bmd->res > 20 || bmd->value == 0) return; @@ -136,7 +136,7 @@ static void bevel_mod_harden_normals( l_cur = l_first = BM_FACE_FIRST_LOOP(f); do { if ((!BM_elem_flag_test(l_cur->e, BM_ELEM_TAG)) || - (!BM_elem_flag_test(l_cur, BM_ELEM_TAG) && BM_loop_check_cyclic_smooth_fan(l_cur))) + (!BM_elem_flag_test(l_cur, BM_ELEM_TAG) && BM_loop_check_cyclic_smooth_fan(l_cur))) { /* previous and next edge is sharp, accumulate face normals into loop */ @@ -187,8 +187,9 @@ static void bevel_mod_harden_normals( } else if (bmd->lim_flags & MOD_BEVEL_VGROUP) { const bool has_vgroup = dvert != NULL; - const bool vert_of_group = has_vgroup && - (defvert_find_index(&dvert[BM_elem_index_get(l->v)], vgroup) != NULL); + const bool vert_of_group = ( + has_vgroup && + (defvert_find_index(&dvert[BM_elem_index_get(l->v)], vgroup) != NULL)); if (vert_of_group && hnmode == MOD_BEVEL_HN_FACE) { float cur[3]; @@ -223,20 +224,21 @@ static void bevel_mod_harden_normals( /* If vertex is edge vert with 1 reconnected face */ if (recon_face_count == 1 || do_normal_to_recon) { - BKE_lnor_space_custom_normal_to_data(bm->lnor_spacearr->lspacearr[l_index], recon_face->no, - clnors); + BKE_lnor_space_custom_normal_to_data( + bm->lnor_spacearr->lspacearr[l_index], recon_face->no, clnors); } else if (vertex_only == false || recon_face_count == 0) { copy_v3_v3(n_final, l->f->no); mul_v3_fl(n_final, 1.0f - hn_strength); add_v3_v3(n_final, cn_wght); normalize_v3(n_final); - BKE_lnor_space_custom_normal_to_data(bm->lnor_spacearr->lspacearr[l_index], n_final, - clnors); + BKE_lnor_space_custom_normal_to_data( + bm->lnor_spacearr->lspacearr[l_index], n_final, clnors); + } + else if (BLI_ghash_haskey(faceHash, l->f)) { + BKE_lnor_space_custom_normal_to_data( + bm->lnor_spacearr->lspacearr[l_index], l->v->no, clnors); } - else if (BLI_ghash_haskey(faceHash, l->f)) - BKE_lnor_space_custom_normal_to_data(bm->lnor_spacearr->lspacearr[l_index], l->v->no, - clnors); } } } @@ -466,7 +468,7 @@ ModifierTypeInfo modifierType_Bevel = { eModifierTypeFlag_SupportsEditmode | eModifierTypeFlag_EnableInEditmode | eModifierTypeFlag_AcceptsCVs, - + /* copyData */ modifier_copyData_generic, /* deformVerts_DM */ NULL, diff --git a/source/blender/modifiers/intern/MOD_weighted_normal.c b/source/blender/modifiers/intern/MOD_weighted_normal.c index 3e788db9c00..69c71d34dbc 100644 --- a/source/blender/modifiers/intern/MOD_weighted_normal.c +++ b/source/blender/modifiers/intern/MOD_weighted_normal.c @@ -514,8 +514,6 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes MVert *mvert = result->mvert; MLoop *mloop = result->mloop; - bool free_polynors = false; - /* Right now: * If weight = 50 then all faces are given equal weight. * If weight > 50 then more weight given to faces with larger vals (face area / corner angle). @@ -538,7 +536,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes if (!polynors) { polynors = CustomData_add_layer(pdata, CD_NORMAL, CD_CALLOC, NULL, numPolys); } - BKE_mesh_calc_normals_poly(mvert, NULL, numVerts, mloop, mpoly, numLoops, numPolys, polynors, false); + BKE_mesh_calc_normals_poly(mvert, NULL, numVerts, mloop, mpoly, numLoops, numPolys, polynors, false); const float split_angle = mesh->smoothresh; @@ -573,8 +571,9 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes .mpoly = mpoly, .polynors = polynors, - .poly_strength = CustomData_get_layer_named(&result->pdata, CD_PROP_INT, - MOD_WEIGHTEDNORMALS_FACEWEIGHT_CDLAYER_ID), + .poly_strength = CustomData_get_layer_named( + &result->pdata, CD_PROP_INT, + MOD_WEIGHTEDNORMALS_FACEWEIGHT_CDLAYER_ID), .dvert = dvert, .defgrp_index = defgrp_index, |