diff options
author | Henrik Dick <hen-di@web.de> | 2022-03-24 14:30:48 +0300 |
---|---|---|
committer | Henrik Dick <hen-di@web.de> | 2022-03-24 14:30:48 +0300 |
commit | dd161ff7a40c721c16bf43c34e172c9fcf9cddf7 (patch) | |
tree | f4dfcc8707ab1cce8ee50fdf7fb06828e525e10c /source/blender/modifiers | |
parent | 4a674d08dda82bddb461101adfe789272109141f (diff) |
Complex Solidify: handle vertex creases
This implements the same interpolation method as for bevel weights
now for vertex and edge creases as well to improve the flexibility.
Differential Revision: http://developer.blender.org/D14170
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r-- | source/blender/modifiers/intern/MOD_solidify_nonmanifold.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/source/blender/modifiers/intern/MOD_solidify_nonmanifold.c b/source/blender/modifiers/intern/MOD_solidify_nonmanifold.c index ff25c1afd49..7c1cf326c60 100644 --- a/source/blender/modifiers/intern/MOD_solidify_nonmanifold.c +++ b/source/blender/modifiers/intern/MOD_solidify_nonmanifold.c @@ -1982,6 +1982,18 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md, result->dvert = dvert; } + /* Get vertex crease layer and ensure edge creases are active if vertex creases are found, since + * they will introduce edge creases in the used custom interpolation method. */ + const float *vertex_crease = CustomData_get_layer(&mesh->vdata, CD_CREASE); + if (vertex_crease) { + result->cd_flag |= ME_CDFLAG_EDGE_CREASE; + /* delete all vertex creases in the result if a rim is used. */ + if (do_rim) { + CustomData_free_layers(&result->vdata, CD_CREASE, result->totvert); + result->cd_flag &= ~ME_CDFLAG_VERT_CREASE; + } + } + /* Make_new_verts. */ { gs_ptr = orig_vert_groups_arr; @@ -2105,6 +2117,7 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md, EdgeGroup *g2 = gs; EdgeGroup *last_g = NULL; EdgeGroup *first_g = NULL; + char mv_crease = vertex_crease ? (char)(vertex_crease[i] * 255.0f) : 0; /* Data calculation cache. */ char max_crease; char last_max_crease = 0; @@ -2174,7 +2187,7 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md, medge[edge_index].v2 = g->new_vert; medge[edge_index].flag = ME_EDGEDRAW | ME_EDGERENDER | ((last_flag | flag) & (ME_SEAM | ME_SHARP)); - medge[edge_index].crease = min_cc(last_max_crease, max_crease); + medge[edge_index].crease = max_cc(mv_crease, min_cc(last_max_crease, max_crease)); medge[edge_index++].bweight = max_cc(mv->bweight, min_cc(last_max_bweight, max_bweight)); } @@ -2202,7 +2215,8 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md, medge[edge_index].v2 = first_g->new_vert; medge[edge_index].flag = ME_EDGEDRAW | ME_EDGERENDER | ((last_flag | first_flag) & (ME_SEAM | ME_SHARP)); - medge[edge_index].crease = min_cc(last_max_crease, first_max_crease); + medge[edge_index].crease = max_cc(mv_crease, + min_cc(last_max_crease, first_max_crease)); medge[edge_index++].bweight = max_cc(mv->bweight, min_cc(last_max_bweight, first_max_bweight)); |