[Bf-blender-cvs] [eed8d20b973] temp-geometry-nodes-extrude-mesh: Cleanup: Add comments

Hans Goudey noreply at git.blender.org
Fri Jan 21 07:11:01 CET 2022


Commit: eed8d20b973231efb11bad0dd690033b26825280
Author: Hans Goudey
Date:   Fri Jan 21 00:10:54 2022 -0600
Branches: temp-geometry-nodes-extrude-mesh
https://developer.blender.org/rBeed8d20b973231efb11bad0dd690033b26825280

Cleanup: Add comments

===================================================================

M	source/blender/blenkernel/intern/customdata.cc
M	source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc

===================================================================

diff --git a/source/blender/blenkernel/intern/customdata.cc b/source/blender/blenkernel/intern/customdata.cc
index 97b84802150..5c8d3988750 100644
--- a/source/blender/blenkernel/intern/customdata.cc
+++ b/source/blender/blenkernel/intern/customdata.cc
@@ -2209,6 +2209,7 @@ void CustomData_realloc(CustomData *data, int totelem)
       continue;
     }
     typeInfo = layerType_getInfo(layer->type);
+    /* Use calloc to avoid the need to manually initialize new data in layers. */
     layer->data = MEM_recallocN(layer->data, (size_t)totelem * typeInfo->size);
   }
 }
diff --git a/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc b/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc
index 7ebe24f71e3..9c9909ac222 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc
@@ -84,6 +84,9 @@ static void save_selection_as_attribute(MeshComponent &component,
 
   OutputAttribute_Typed<bool> attribute = component.attribute_try_get_for_output_only<bool>(
       id, domain);
+  /* Rely on the new attribute being zeroed by default. */
+  BLI_assert(!attribute.as_span().as_span().contains(true));
+
   if (selection.is_range()) {
     attribute.as_span().slice(selection.as_range()).fill(true);
   }
@@ -119,6 +122,10 @@ static MutableSpan<MLoop> mesh_loops(Mesh &mesh)
   return {mesh.mloop, mesh.totloop};
 }
 
+/**
+ * \note: Some areas in this file rely on the new sections of attributes in #CustomData_realloc to
+ * be zeroed.
+ */
 static void expand_mesh(Mesh &mesh,
                         const int vert_expand,
                         const int edge_expand,



More information about the Bf-blender-cvs mailing list