[Bf-blender-cvs] [c29afa51565] master: Cleanup: Expose function publicly, rename

Hans Goudey noreply at git.blender.org
Tue Jun 15 23:31:18 CEST 2021


Commit: c29afa5156596addf2b9aa61d2f58da6db0b4ec4
Author: Hans Goudey
Date:   Tue Jun 15 16:31:08 2021 -0500
Branches: master
https://developer.blender.org/rBc29afa5156596addf2b9aa61d2f58da6db0b4ec4

Cleanup: Expose function publicly, rename

There is no particular reason these two functions shouldn't be used
outside of the bezier spline implementation since they don't do anything
particularly controversial.

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

M	source/blender/blenkernel/BKE_spline.hh
M	source/blender/blenkernel/intern/spline_bezier.cc

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

diff --git a/source/blender/blenkernel/BKE_spline.hh b/source/blender/blenkernel/BKE_spline.hh
index ac970b23f14..5e88dd02bdd 100644
--- a/source/blender/blenkernel/BKE_spline.hh
+++ b/source/blender/blenkernel/BKE_spline.hh
@@ -337,13 +337,14 @@ class BezierSpline final : public Spline {
   virtual blender::fn::GVArrayPtr interpolate_to_evaluated_points(
       const blender::fn::GVArray &source_data) const override;
 
+  void evaluate_segment(const int index,
+                        const int next_index,
+                        blender::MutableSpan<blender::float3> positions) const;
+  bool segment_is_vector(const int start_index) const;
+
  private:
   void ensure_auto_handles() const;
   void correct_end_tangents() const final;
-  bool segment_is_vector(const int start_index) const;
-  void evaluate_bezier_segment(const int index,
-                               const int next_index,
-                               blender::MutableSpan<blender::float3> positions) const;
 };
 
 /**
diff --git a/source/blender/blenkernel/intern/spline_bezier.cc b/source/blender/blenkernel/intern/spline_bezier.cc
index 3e421dcfc13..bd68d49df21 100644
--- a/source/blender/blenkernel/intern/spline_bezier.cc
+++ b/source/blender/blenkernel/intern/spline_bezier.cc
@@ -352,9 +352,9 @@ static void bezier_forward_difference_3d(const float3 &point_0,
   }
 }
 
-void BezierSpline::evaluate_bezier_segment(const int index,
-                                           const int next_index,
-                                           MutableSpan<float3> positions) const
+void BezierSpline::evaluate_segment(const int index,
+                                    const int next_index,
+                                    MutableSpan<float3> positions) const
 {
   if (this->segment_is_vector(index)) {
     BLI_assert(positions.size() == 1);
@@ -499,12 +499,11 @@ Span<float3> BezierSpline::evaluated_positions() const
   const int grain_size = std::max(512 / resolution_, 1);
   parallel_for(IndexRange(size - 1), grain_size, [&](IndexRange range) {
     for (const int i : range) {
-      this->evaluate_bezier_segment(
-          i, i + 1, positions.slice(offsets[i], offsets[i + 1] - offsets[i]));
+      this->evaluate_segment(i, i + 1, positions.slice(offsets[i], offsets[i + 1] - offsets[i]));
     }
   });
   if (is_cyclic_) {
-    this->evaluate_bezier_segment(
+    this->evaluate_segment(
         size - 1, 0, positions.slice(offsets[size - 1], offsets[size] - offsets[size - 1]));
   }
   else {



More information about the Bf-blender-cvs mailing list