[Bf-blender-cvs] [25aa943e8cb] master: Cleanup: Fix/improve variable names and comments

Hans Goudey noreply at git.blender.org
Mon Sep 20 01:54:40 CEST 2021


Commit: 25aa943e8cb8d5a33beb906207255e5d0ea08544
Author: Hans Goudey
Date:   Sun Sep 19 18:54:03 2021 -0500
Branches: master
https://developer.blender.org/rB25aa943e8cb8d5a33beb906207255e5d0ea08544

Cleanup: Fix/improve variable names and comments

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

M	source/blender/blenkernel/intern/curve_eval.cc
M	source/blender/blenkernel/intern/spline_base.cc
M	source/blender/makesdna/DNA_node_types.h
M	source/blender/makesrna/intern/rna_nodetree.c
M	source/blender/nodes/geometry/nodes/node_geo_attribute_capture.cc
M	source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc
M	source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc
M	source/blender/nodes/geometry/nodes/node_geo_curve_trim.cc

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

diff --git a/source/blender/blenkernel/intern/curve_eval.cc b/source/blender/blenkernel/intern/curve_eval.cc
index 1c4f9c5a6ab..ea84766943d 100644
--- a/source/blender/blenkernel/intern/curve_eval.cc
+++ b/source/blender/blenkernel/intern/curve_eval.cc
@@ -110,7 +110,7 @@ void CurveEval::bounds_min_max(float3 &min, float3 &max, const bool use_evaluate
 }
 
 /**
- * Return the start indices for each of the curve spline's evaluated points, as if they were part
+ * Return the start indices for each of the curve spline's control points, if they were part
  * of a flattened array. This can be used to facilitate parallelism by avoiding the need to
  * accumulate an offset while doing more complex calculations.
  *
diff --git a/source/blender/blenkernel/intern/spline_base.cc b/source/blender/blenkernel/intern/spline_base.cc
index a8871777420..807019f60a8 100644
--- a/source/blender/blenkernel/intern/spline_base.cc
+++ b/source/blender/blenkernel/intern/spline_base.cc
@@ -190,7 +190,7 @@ static void accumulate_lengths(Span<float3> positions,
  * Return non-owning access to the cache of accumulated lengths along the spline. Each item is the
  * length of the subsequent segment, i.e. the first value is the length of the first segment rather
  * than 0. This calculation is rather trivial, and only depends on the evaluated positions.
- * However, the results are used often, so it makes sense to cache it.
+ * However, the results are used often, and it is necessarily single threaded, so it is cached.
  */
 Span<float> Spline::evaluated_lengths() const
 {
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index 74ed22ecafd..39af3650558 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -2039,14 +2039,14 @@ typedef enum GeometryNodeCurvePrimitiveBezierSegmentMode {
 } GeometryNodeCurvePrimitiveBezierSegmentMode;
 
 typedef enum GeometryNodeCurveResampleMode {
-  GEO_NODE_CURVE_SAMPLE_COUNT = 0,
-  GEO_NODE_CURVE_SAMPLE_LENGTH = 1,
-  GEO_NODE_CURVE_SAMPLE_EVALUATED = 2,
+  GEO_NODE_CURVE_RESAMPLE_COUNT = 0,
+  GEO_NODE_CURVE_RESAMPLE_LENGTH = 1,
+  GEO_NODE_CURVE_RESAMPLE_EVALUATED = 2,
 } GeometryNodeCurveResampleMode;
 
 typedef enum GeometryNodeCurveSampleMode {
-  GEO_NODE_CURVE_INTERPOLATE_FACTOR = 0,
-  GEO_NODE_CURVE_INTERPOLATE_LENGTH = 1,
+  GEO_NODE_CURVE_SAMPLE_FACTOR = 0,
+  GEO_NODE_CURVE_RESAMPLE_LENGTH = 1,
 } GeometryNodeCurveSampleMode;
 
 typedef enum GeometryNodeAttributeTransferMapMode {
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index d685692c8fa..76e37dbcdbc 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -10116,18 +10116,18 @@ static void def_geo_curve_resample(StructRNA *srna)
   PropertyRNA *prop;
 
   static EnumPropertyItem mode_items[] = {
-      {GEO_NODE_CURVE_SAMPLE_EVALUATED,
+      {GEO_NODE_CURVE_RESAMPLE_EVALUATED,
        "EVALUATED",
        0,
        "Evaluated",
        "Output the input spline's evaluated points, based on the resolution attribute for NURBS "
        "and Bezier splines. Poly splines are unchanged"},
-      {GEO_NODE_CURVE_SAMPLE_COUNT,
+      {GEO_NODE_CURVE_RESAMPLE_COUNT,
        "COUNT",
        0,
        "Count",
        "Sample the specified number of points along each spline"},
-      {GEO_NODE_CURVE_SAMPLE_LENGTH,
+      {GEO_NODE_CURVE_RESAMPLE_LENGTH,
        "LENGTH",
        0,
        "Length",
@@ -10161,18 +10161,18 @@ static void def_geo_curve_to_points(StructRNA *srna)
   PropertyRNA *prop;
 
   static EnumPropertyItem mode_items[] = {
-      {GEO_NODE_CURVE_SAMPLE_EVALUATED,
+      {GEO_NODE_CURVE_RESAMPLE_EVALUATED,
        "EVALUATED",
        0,
        "Evaluated",
        "Create points from the curve's evaluated points, based on the resolution attribute for "
        "NURBS and Bezier splines"},
-      {GEO_NODE_CURVE_SAMPLE_COUNT,
+      {GEO_NODE_CURVE_RESAMPLE_COUNT,
        "COUNT",
        0,
        "Count",
        "Sample each spline by evenly distributing the specified number of points"},
-      {GEO_NODE_CURVE_SAMPLE_LENGTH,
+      {GEO_NODE_CURVE_RESAMPLE_LENGTH,
        "LENGTH",
        0,
        "Length",
@@ -10193,12 +10193,12 @@ static void def_geo_curve_trim(StructRNA *srna)
   PropertyRNA *prop;
 
   static EnumPropertyItem mode_items[] = {
-      {GEO_NODE_CURVE_INTERPOLATE_FACTOR,
+      {GEO_NODE_CURVE_SAMPLE_FACTOR,
        "FACTOR",
        0,
        "Factor",
        "Find the endpoint positions using a factor of each spline's length"},
-      {GEO_NODE_CURVE_INTERPOLATE_LENGTH,
+      {GEO_NODE_CURVE_RESAMPLE_LENGTH,
        "LENGTH",
        0,
        "Length",
diff --git a/source/blender/nodes/geometry/nodes/node_geo_attribute_capture.cc b/source/blender/nodes/geometry/nodes/node_geo_attribute_capture.cc
index 1fa71d3f57d..c8a33205de4 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_attribute_capture.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_capture.cc
@@ -66,8 +66,8 @@ static void geo_node_attribute_capture_update(bNodeTree *UNUSED(ntree), bNode *n
                                                      node->storage;
   const CustomDataType data_type = static_cast<CustomDataType>(storage.data_type);
 
-  bNodeSocket *socket_value_attribute_name = (bNodeSocket *)node->inputs.first;
-  bNodeSocket *socket_value_vector = socket_value_attribute_name->next;
+  bNodeSocket *socket_value_geometry = (bNodeSocket *)node->inputs.first;
+  bNodeSocket *socket_value_vector = socket_value_geometry->next;
   bNodeSocket *socket_value_float = socket_value_vector->next;
   bNodeSocket *socket_value_color4f = socket_value_float->next;
   bNodeSocket *socket_value_boolean = socket_value_color4f->next;
@@ -79,8 +79,8 @@ static void geo_node_attribute_capture_update(bNodeTree *UNUSED(ntree), bNode *n
   nodeSetSocketAvailability(socket_value_boolean, data_type == CD_PROP_BOOL);
   nodeSetSocketAvailability(socket_value_int32, data_type == CD_PROP_INT32);
 
-  bNodeSocket *out_socket_value_attribute_name = (bNodeSocket *)node->outputs.first;
-  bNodeSocket *out_socket_value_vector = out_socket_value_attribute_name->next;
+  bNodeSocket *out_socket_value_geometry = (bNodeSocket *)node->outputs.first;
+  bNodeSocket *out_socket_value_vector = out_socket_value_geometry->next;
   bNodeSocket *out_socket_value_float = out_socket_value_vector->next;
   bNodeSocket *out_socket_value_color4f = out_socket_value_float->next;
   bNodeSocket *out_socket_value_boolean = out_socket_value_color4f->next;
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc
index f8b67cf83f2..208525f17f6 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc
@@ -50,7 +50,7 @@ static void geo_node_curve_resample_init(bNodeTree *UNUSED(tree), bNode *node)
   NodeGeometryCurveResample *data = (NodeGeometryCurveResample *)MEM_callocN(
       sizeof(NodeGeometryCurveResample), __func__);
 
-  data->mode = GEO_NODE_CURVE_SAMPLE_COUNT;
+  data->mode = GEO_NODE_CURVE_RESAMPLE_COUNT;
   node->storage = data;
 }
 
@@ -62,8 +62,8 @@ static void geo_node_curve_resample_update(bNodeTree *UNUSED(ntree), bNode *node
   bNodeSocket *count_socket = ((bNodeSocket *)node->inputs.first)->next;
   bNodeSocket *length_socket = count_socket->next;
 
-  nodeSetSocketAvailability(count_socket, mode == GEO_NODE_CURVE_SAMPLE_COUNT);
-  nodeSetSocketAvailability(length_socket, mode == GEO_NODE_CURVE_SAMPLE_LENGTH);
+  nodeSetSocketAvailability(count_socket, mode == GEO_NODE_CURVE_RESAMPLE_COUNT);
+  nodeSetSocketAvailability(length_socket, mode == GEO_NODE_CURVE_RESAMPLE_LENGTH);
 }
 
 struct SampleModeParam {
@@ -172,7 +172,7 @@ static std::unique_ptr<CurveEval> resample_curve(const CurveEval &input_curve,
   output_curve->resize(input_splines.size());
   MutableSpan<SplinePtr> output_splines = output_curve->splines();
 
-  if (mode_param.mode == GEO_NODE_CURVE_SAMPLE_COUNT) {
+  if (mode_param.mode == GEO_NODE_CURVE_RESAMPLE_COUNT) {
     threading::parallel_for(input_splines.index_range(), 128, [&](IndexRange range) {
       for (const int i : range) {
         BLI_assert(mode_param.count);
@@ -180,7 +180,7 @@ static std::unique_ptr<CurveEval> resample_curve(const CurveEval &input_curve,
       }
     });
   }
-  else if (mode_param.mode == GEO_NODE_CURVE_SAMPLE_LENGTH) {
+  else if (mode_param.mode == GEO_NODE_CURVE_RESAMPLE_LENGTH) {
     threading::parallel_for(input_splines.index_range(), 128, [&](IndexRange range) {
       for (const int i : range) {
         const float length = input_splines[i]->length();
@@ -189,7 +189,7 @@ static std::unique_ptr<CurveEval> resample_curve(const CurveEval &input_curve,
       }
     });
   }
-  else if (mode_param.mode == GEO_NODE_CURVE_SAMPLE_EVALUATED) {
+  else if (mode_param.mode == GEO_NODE_CURVE_RESAMPLE_EVALUATED) {
     threading::parallel_for(input_splines.index_range(), 128, [&](IndexRange range) {
       for (const int i : range) {
         output_splines[i] = resample_spline_evaluated(*input_splines[i]);
@@ -218,7 +218,7 @@ static void geo_node_resample_exec(GeoNodeExecParams params)
   const GeometryNodeCurveResampleMode mode = (GeometryNodeCurveResampleMode)node_storage.mode;
   SampleModeParam mode_param;
   mode_param.mode = mode;
-  if (mode == GEO_NODE_CURVE_SAMPLE_COUNT) {
+  if (mode == GEO_NODE_CURVE_RESAMPLE_COUNT) {
     const int count = params.extract_input<int>("Count");
     if (count < 1) {
       params.set_output("Geometry", GeometrySet());
@@ -226,7 +226,7 @@ static void geo_node_resample_exec(GeoNodeExecParams params)
     }
     mode_param.count.emplace(count);
   }
-  else if (mode == GEO_NODE_CURVE_SAMPLE_LENGTH) {
+  else if (mode == GEO_NODE_CURVE_RESAMPLE_LENGTH) {
     /* Don't allow asymptotic count increase for low resolution values. */
     const float resolution = std::max(params.extract_input<float>("Length"), 0.0001f);
     mode_param.length.emplace(resolution);
diff --git a/source/blender/nodes/geometry/nodes/node

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list