[Bf-blender-cvs] [0835996cc92] master: Cleanup: Rename "spline" variables to "curve"

Hans Goudey noreply at git.blender.org
Thu Mar 17 23:08:45 CET 2022


Commit: 0835996cc92896b21e3b5b7c9b6f22c2ca4f1db5
Author: Hans Goudey
Date:   Thu Mar 17 17:08:36 2022 -0500
Branches: master
https://developer.blender.org/rB0835996cc92896b21e3b5b7c9b6f22c2ca4f1db5

Cleanup: Rename "spline" variables to "curve"

Ref T95355

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

M	source/blender/draw/intern/draw_cache_impl_curves.cc
M	source/blender/geometry/intern/mesh_to_curve_convert.cc
M	source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc

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

diff --git a/source/blender/draw/intern/draw_cache_impl_curves.cc b/source/blender/draw/intern/draw_cache_impl_curves.cc
index aea71d965d1..f772f132b13 100644
--- a/source/blender/draw/intern/draw_cache_impl_curves.cc
+++ b/source/blender/draw/intern/draw_cache_impl_curves.cc
@@ -140,18 +140,18 @@ static void curves_batch_cache_fill_segments_proc_pos(Curves *curves,
   for (const int i : IndexRange(curve_size)) {
     const IndexRange curve_range = geometry.range_for_curve(i);
 
-    Span<float3> spline_positions = positions.slice(curve_range);
+    Span<float3> curve_positions = positions.slice(curve_range);
     float total_len = 0.0f;
     float *seg_data_first;
-    for (const int i_spline : spline_positions.index_range()) {
+    for (const int i_curve : curve_positions.index_range()) {
       float *seg_data = (float *)GPU_vertbuf_raw_step(attr_step);
-      copy_v3_v3(seg_data, spline_positions[i_spline]);
-      if (i_spline == 0) {
+      copy_v3_v3(seg_data, curve_positions[i_curve]);
+      if (i_curve == 0) {
         seg_data_first = seg_data;
       }
       else {
-        total_len += blender::math::distance(spline_positions[i_spline - 1],
-                                             spline_positions[i_spline]);
+        total_len += blender::math::distance(curve_positions[i_curve - 1],
+                                             curve_positions[i_curve]);
       }
       seg_data[3] = total_len;
     }
@@ -159,7 +159,7 @@ static void curves_batch_cache_fill_segments_proc_pos(Curves *curves,
     *(float *)GPU_vertbuf_raw_step(length_step) = total_len;
     if (total_len > 0.0f) {
       /* Divide by total length to have a [0-1] number. */
-      for ([[maybe_unused]] const int i_spline : spline_positions.index_range()) {
+      for ([[maybe_unused]] const int i_curve : curve_positions.index_range()) {
         seg_data_first[3] /= total_len;
         seg_data_first += 4;
       }
diff --git a/source/blender/geometry/intern/mesh_to_curve_convert.cc b/source/blender/geometry/intern/mesh_to_curve_convert.cc
index 0c2377fde6d..dad2612cabd 100644
--- a/source/blender/geometry/intern/mesh_to_curve_convert.cc
+++ b/source/blender/geometry/intern/mesh_to_curve_convert.cc
@@ -32,7 +32,7 @@ static void copy_with_map(const VArray<T> &src, Span<int> map, MutableSpan<T> ds
 static Curves *create_curve_from_vert_indices(const MeshComponent &mesh_component,
                                               const Span<int> vert_indices,
                                               const Span<int> curve_offsets,
-                                              const IndexRange cyclic_splines)
+                                              const IndexRange cyclic_curves)
 {
   Curves *curves_id = bke::curves_new_nomain(vert_indices.size(), curve_offsets.size());
   bke::CurvesGeometry &curves = bke::CurvesGeometry::wrap(curves_id->geometry);
@@ -41,7 +41,7 @@ static Curves *create_curve_from_vert_indices(const MeshComponent &mesh_componen
   curves.curve_types().fill(CURVE_TYPE_POLY);
 
   curves.cyclic().fill(false);
-  curves.cyclic().slice(cyclic_splines).fill(true);
+  curves.cyclic().slice(cyclic_curves).fill(true);
 
   Set<bke::AttributeIDRef> source_attribute_ids = mesh_component.attribute_ids();
 
@@ -67,7 +67,7 @@ static Curves *create_curve_from_vert_indices(const MeshComponent &mesh_componen
       continue;
     }
 
-    /* Copy attribute based on the map for this spline. */
+    /* Copy attribute based on the map for this curve. */
     attribute_math::convert_to_static_type(mesh_attribute.type(), [&](auto dummy) {
       using T = decltype(dummy);
       bke::OutputAttribute_Typed<T> attribute =
@@ -81,12 +81,12 @@ static Curves *create_curve_from_vert_indices(const MeshComponent &mesh_componen
 }
 
 struct CurveFromEdgesOutput {
-  /** The indices in the mesh for each control point of each result splines. */
+  /** The indices in the mesh for each control point of each result curves. */
   Vector<int> vert_indices;
   /** The first index of each curve in the result. */
   Vector<int> curve_offsets;
-  /** A subset of splines that should be set cyclic. */
-  IndexRange cyclic_splines;
+  /** A subset of curves that should be set cyclic. */
+  IndexRange cyclic_curves;
 };
 
 static CurveFromEdgesOutput edges_to_curve_point_indices(Span<MVert> verts,
@@ -128,7 +128,7 @@ static CurveFromEdgesOutput edges_to_curve_point_indices(Span<MVert> verts,
   Array<int> unused_edges = std::move(used_slots);
 
   for (const int start_vert : verts.index_range()) {
-    /* The vertex will be part of a cyclic spline. */
+    /* The vertex will be part of a cyclic curve. */
     if (neighbor_count[start_vert] == 2) {
       continue;
     }
@@ -171,10 +171,10 @@ static CurveFromEdgesOutput edges_to_curve_point_indices(Span<MVert> verts,
     }
   }
 
-  /* All splines added after this are cyclic. */
+  /* All curves added after this are cyclic. */
   const int cyclic_start = curve_offsets.size();
 
-  /* All remaining edges are part of cyclic splines (we skipped vertices with two edges before). */
+  /* All remaining edges are part of cyclic curves (we skipped vertices with two edges before). */
   for (const int start_vert : verts.index_range()) {
     if (unused_edges[start_vert] != 2) {
       continue;
@@ -230,7 +230,7 @@ Curves *mesh_to_curve_convert(const MeshComponent &mesh_component, const IndexMa
                                                              selected_edges);
 
   return create_curve_from_vert_indices(
-      mesh_component, output.vert_indices, output.curve_offsets, output.cyclic_splines);
+      mesh_component, output.vert_indices, output.curve_offsets, output.cyclic_curves);
 }
 
 }  // namespace blender::geometry
diff --git a/source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc b/source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc
index bfa19bd650e..39e5748daa5 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc
@@ -224,20 +224,20 @@ static void copy_point_attributes_without_id(GeometrySet &geometry_set,
 /** \} */
 
 /* -------------------------------------------------------------------- */
-/** \name Duplicate Splines
+/** \name Duplicate Curves
  * \{ */
 
 /**
- * Copies the attributes for spline duplicates. If copying the spline domain, the attributes are
+ * Copies the attributes for curve duplicates. If copying the curve domain, the attributes are
  * copied with an offset fill, otherwise a mapping is used.
  */
-static void copy_spline_attributes_without_id(const GeometrySet &geometry_set,
-                                              const CurveComponent &src_component,
-                                              const bke::CurvesGeometry &src_curves,
-                                              const IndexMask selection,
-                                              const Span<int> curve_offsets,
-                                              bke::CurvesGeometry &dst_curves,
-                                              CurveComponent &dst_component)
+static void copy_curve_attributes_without_id(const GeometrySet &geometry_set,
+                                             const CurveComponent &src_component,
+                                             const bke::CurvesGeometry &src_curves,
+                                             const IndexMask selection,
+                                             const Span<int> curve_offsets,
+                                             bke::CurvesGeometry &dst_curves,
+                                             CurveComponent &dst_component)
 {
   Map<AttributeIDRef, AttributeKind> gathered_attributes;
   gather_attributes_without_id(
@@ -290,16 +290,16 @@ static void copy_spline_attributes_without_id(const GeometrySet &geometry_set,
 
 /**
  * Copy the stable ids to the first duplicate and create new ids based on a hash of the original id
- * and the duplicate number. In the spline case, copy the entire spline's points to the
+ * and the duplicate number. In the curve case, copy the entire curve's points to the
  * destination,
  * then loop over the remaining ones point by point, hashing their ids to the new ids.
  */
-static void copy_stable_id_splines(const bke::CurvesGeometry &src_curves,
-                                   const IndexMask selection,
-                                   const Span<int> curve_offsets,
-                                   const CurveComponent &src_component,
-                                   bke::CurvesGeometry &dst_curves,
-                                   CurveComponent &dst_component)
+static void copy_stable_id_curves(const bke::CurvesGeometry &src_curves,
+                                  const IndexMask selection,
+                                  const Span<int> curve_offsets,
+                                  const CurveComponent &src_component,
+                                  bke::CurvesGeometry &dst_curves,
+                                  CurveComponent &dst_component)
 {
   ReadAttributeLookup src_attribute = src_component.attribute_try_get_for_read("id");
   if (!src_attribute) {
@@ -329,10 +329,10 @@ static void copy_stable_id_splines(const bke::CurvesGeometry &src_curves,
   dst_attribute.save();
 }
 
-static void duplicate_splines(GeometrySet &geometry_set,
-                              const Field<int> &count_field,
-                              const Field<bool> &selection_field,
-                              const IndexAttributes &attributes)
+static void duplicate_curves(GeometrySet &geometry_set,
+                             const Field<int> &count_field,
+                             const Field<bool> &selection_field,
+                             const IndexAttributes &attributes)
 {
   if (!geometry_set.has_curves()) {
     geometry_set.keep_only({GEO_COMPONENT_TYPE_INSTANCES});
@@ -356,19 +356,19 @@ static void duplicate_splines(GeometrySet &geometry_set,
   Array<int> curve_offsets(selection.size() + 1);
   Array<int> point_offsets(selection.size() + 1);
 
-  int dst_splines_size = 0;
+  int dst_curves_size = 0;
   int dst_points_size = 0;
-  for (c

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list