From a8a454287a27d408668f8adc6fe1b3aa988de1ac Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Fri, 23 Sep 2022 09:02:05 -0500 Subject: 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 --- source/blender/geometry/intern/mesh_merge_by_distance.cc | 6 ------ source/blender/geometry/intern/realize_instances.cc | 1 - 2 files changed, 7 deletions(-) (limited to 'source/blender/geometry') diff --git a/source/blender/geometry/intern/mesh_merge_by_distance.cc b/source/blender/geometry/intern/mesh_merge_by_distance.cc index 17318c277aa..20de471a9e1 100644 --- a/source/blender/geometry/intern/mesh_merge_by_distance.cc +++ b/source/blender/geometry/intern/mesh_merge_by_distance.cc @@ -1232,7 +1232,6 @@ static void customdata_weld( #ifdef USE_WELD_NORMALS float no[3] = {0.0f, 0.0f, 0.0f}; #endif - int crease = 0; short flag = 0; /* interpolates a layer at a time */ @@ -1272,7 +1271,6 @@ static void customdata_weld( else if (type == CD_MEDGE) { for (j = 0; j < count; j++) { MEdge *me_src = &((MEdge *)src_data)[src_indices[j]]; - crease += me_src->crease; flag |= me_src->flag; } } @@ -1323,10 +1321,6 @@ static void customdata_weld( } else if (type == CD_MEDGE) { MEdge *me = &((MEdge *)layer_dst->data)[dest_index]; - crease *= fac; - CLAMP_MAX(crease, 255); - - me->crease = (char)crease; me->flag = flag; } else if (CustomData_layer_has_interp(dest, dest_i)) { diff --git a/source/blender/geometry/intern/realize_instances.cc b/source/blender/geometry/intern/realize_instances.cc index 8133a685eb8..99b6bb29051 100644 --- a/source/blender/geometry/intern/realize_instances.cc +++ b/source/blender/geometry/intern/realize_instances.cc @@ -809,7 +809,6 @@ static OrderedAttributes gather_generic_mesh_attributes_to_propagate( attributes_to_propagate.remove("position"); attributes_to_propagate.remove("normal"); attributes_to_propagate.remove("shade_smooth"); - attributes_to_propagate.remove("crease"); r_create_id = attributes_to_propagate.pop_try("id").has_value(); r_create_material_index = attributes_to_propagate.pop_try("material_index").has_value(); OrderedAttributes ordered_attributes; -- cgit v1.2.3