diff options
author | Hans Goudey <h.goudey@me.com> | 2022-09-23 17:02:05 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-09-23 17:02:28 +0300 |
commit | a8a454287a27d408668f8adc6fe1b3aa988de1ac (patch) | |
tree | a0c55182e620598bb92542562d2fc134091a2c08 /source/blender/blenkernel/intern/subdiv_mesh.cc | |
parent | b197cd5821f1dfaa5168d31984dd8014f5252456 (diff) |
Mesh: Move edge crease out of MEdge
This is very similar to D14077. There are two differences though.
First is that vertex creases are already stored in a separate layer,
and second is that we can now completely remove use of `Mesh.cd_flag`,
since that information is now inherent to whether the layers exist.
There are two functional differences here:
* Operators are used to add and remove layers instead of a property.
* The "crease" attribute can be created and removed by geometry nodes.
The second change should make various geometry nodes slightly faster,
since the "crease" attribute was always processed before. Creases are
now interpolated generically in the CustomData API too, which should
help maintain the values across edits better.
Meshes get an `edge_creases` RNA property like the existing vertex
property, to provide more efficient access to the data in Cycles.
One test failure is expected, where different rounding between float
the old char storage means that 5 additional points are scattered in
a geometry nodes test.
Differential Revision: https://developer.blender.org/D15927
Diffstat (limited to 'source/blender/blenkernel/intern/subdiv_mesh.cc')
-rw-r--r-- | source/blender/blenkernel/intern/subdiv_mesh.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/subdiv_mesh.cc b/source/blender/blenkernel/intern/subdiv_mesh.cc index 44bdd6e6d06..04389b43fd9 100644 --- a/source/blender/blenkernel/intern/subdiv_mesh.cc +++ b/source/blender/blenkernel/intern/subdiv_mesh.cc @@ -518,9 +518,11 @@ static bool subdiv_mesh_topology_info(const SubdivForeachContext *foreach_contex const int *UNUSED(subdiv_polygon_offset)) { /* Multi-resolution grid data will be applied or become invalid after subdivision, - * so don't try to preserve it and use memory. */ + * 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; + 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( @@ -790,7 +792,7 @@ static void subdiv_copy_edge_data(SubdivMeshContext *ctx, { const int subdiv_edge_index = subdiv_edge - ctx->subdiv_edges; if (coarse_edge == nullptr) { - subdiv_edge->crease = 0; + /* TODO: Ensure crease layer isn't copied to result. */ subdiv_edge->flag = 0; if (!ctx->settings->use_optimal_display) { subdiv_edge->flag |= ME_EDGERENDER; |