Fix T102772: Propagate edge creases in subdivision surface modifier
Before rBa8a454287a27, edge creases were copied to the result mesh as part of `MEdge`. Now they are stored in a separate `CD_CREASE` layer, which I mistakenly disabled for interpolation. However, to maintain the geometry node uses a field input, remove the interpolated attribute there.
This commit is contained in:
parent
1bacd09abb
commit
745851e26b
Notes:
blender-bot
2023-04-14 09:18:04 +02:00
Referenced by issue #102772, Regression: creases lost with two subsurf modifier
|
@ -520,8 +520,10 @@ static bool subdiv_mesh_topology_info(const SubdivForeachContext *foreach_contex
|
|||
* so don't try to preserve it and use memory. Crease values should also not be interpolated. */
|
||||
CustomData_MeshMasks mask = CD_MASK_EVERYTHING;
|
||||
mask.lmask &= ~CD_MASK_MULTIRES_GRIDS;
|
||||
/* Propagate edge creases so they can be used in another subdivision modifier (maintaining
|
||||
* existing behavior), but don't propagate vertex creases to avoid extra work when the result
|
||||
* isn't useful anyway. */
|
||||
mask.vmask &= ~CD_MASK_CREASE;
|
||||
mask.emask &= ~CD_MASK_CREASE;
|
||||
|
||||
SubdivMeshContext *subdiv_context = static_cast<SubdivMeshContext *>(foreach_context->user_data);
|
||||
subdiv_context->subdiv_mesh = BKE_mesh_new_nomain_from_template_ex(
|
||||
|
@ -791,7 +793,6 @@ static void subdiv_copy_edge_data(SubdivMeshContext *ctx,
|
|||
{
|
||||
const int subdiv_edge_index = subdiv_edge - ctx->subdiv_edges;
|
||||
if (coarse_edge == nullptr) {
|
||||
/* TODO: Ensure crease layer isn't copied to result. */
|
||||
subdiv_edge->flag = 0;
|
||||
if (!ctx->settings->use_optimal_display) {
|
||||
subdiv_edge->flag |= ME_EDGERENDER;
|
||||
|
|
|
@ -170,6 +170,13 @@ static void node_geo_exec(GeoNodeExecParams params)
|
|||
|
||||
Mesh *mesh_out = BKE_subdiv_to_mesh(subdiv, &mesh_settings, &mesh);
|
||||
|
||||
if (use_creases) {
|
||||
/* Remove the layer in case it was created by the node from the field input. The fact
|
||||
* that this node uses #CD_CREASE to input creases to the subvision code is meant to be
|
||||
* an implementation detail ideally. */
|
||||
CustomData_free_layers(&mesh_out->edata, CD_CREASE, mesh_out->totedge);
|
||||
}
|
||||
|
||||
geometry_set.replace_mesh(mesh_out);
|
||||
|
||||
BKE_subdiv_free(subdiv);
|
||||
|
|
Loading…
Reference in New Issue