Fix: bevel weights in Simple mode of Solidify

In Simple Solidify's mode  edge weights created by "Bevel Convex"
disappear, if edge weight is added to original mesh. From technical
side problem is identical to the one in #114860.

If original mesh doesn't have layer "bevel_weight_edge" option "Bevel
Convex" works fine. All bevels disappear after one edge gets bevel
weight. Except ones corresponding newly added weight. In patched
version weights created by "Convex Bevel" stay. Also manually added
weight can be observed on the edge of inner cube.

Second problem is when am original plane has one vertex with bevel
weight 1.0, but no bevel in result. If to change Solidify's mode from
"Simple" to "Complex" bevel appears. Patch adds this behavior to the
"Simple" mode.

Pull Request: https://projects.blender.org/blender/blender/pulls/115258
This commit is contained in:
laurynas
2023-11-22 13:42:01 +01:00
committed by Hans Goudey
parent 48d7d60c96
commit 0ff1a8825e

View File

@@ -386,8 +386,11 @@ Mesh *MOD_solidify_extrude_modifyMesh(ModifierData *md, const ModifierEvalContex
face_offsets.take_front(faces_num).copy_from(mesh->face_offsets().drop_back(1));
}
float *result_edge_bweight = nullptr;
if (do_bevel_convex) {
const float *orig_vert_bweight = static_cast<const float *>(
CustomData_get_layer_named(&mesh->vert_data, CD_PROP_FLOAT, "bevel_weight_vert"));
float *result_edge_bweight = static_cast<float *>(CustomData_get_layer_named_for_write(
&result->edge_data, CD_PROP_FLOAT, "bevel_weight_edge", result->totedge));
if (!result_edge_bweight && (do_bevel_convex || orig_vert_bweight)) {
result_edge_bweight = static_cast<float *>(CustomData_add_layer_named(
&result->edge_data, CD_PROP_FLOAT, CD_SET_DEFAULT, result->totedge, "bevel_weight_edge"));
}
@@ -1027,6 +1030,10 @@ Mesh *MOD_solidify_extrude_modifyMesh(ModifierData *md, const ModifierEvalContex
edges[new_edge_index][0] = new_vert_arr[i];
edges[new_edge_index][1] = (do_shell ? new_vert_arr[i] : i) + verts_num;
if (orig_vert_bweight) {
result_edge_bweight[new_edge_index] = orig_vert_bweight[new_vert_arr[i]];
}
if (orig_ed) {
*orig_ed = ORIGINDEX_NONE;
orig_ed++;