Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-03-30 04:11:38 +0300
committerHans Goudey <h.goudey@me.com>2022-03-30 04:11:38 +0300
commitf4f89a76a8f4ca77bc59c9572cd2aab6da1e9023 (patch)
tree8633173b659decf46f0a5911b66016c1ff738357 /source/blender/blenkernel/intern
parent87e9451d660e8288d70aa781530b69f4005bf0ea (diff)
Curves: Port parameter node to the new data-block
Using the evaluated lengths cache from 72d25fa41d8c575, re-implement the curve parameter node with the new data structure. Conceptually it works the same way, but the code is restructured and cleaned up a bit as well. This also adds support for Catmull Rom curves. Differential Revision: https://developer.blender.org/D14461
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/curves_geometry.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/curves_geometry.cc b/source/blender/blenkernel/intern/curves_geometry.cc
index c4e9a06aad0..94402f0e548 100644
--- a/source/blender/blenkernel/intern/curves_geometry.cc
+++ b/source/blender/blenkernel/intern/curves_geometry.cc
@@ -548,6 +548,12 @@ Span<int> CurvesGeometry::evaluated_offsets() const
return this->runtime->evaluated_offsets_cache;
}
+Span<int> CurvesGeometry::bezier_evaluated_offsets_for_curve(const int curve_index) const
+{
+ const IndexRange points = this->points_for_curve(curve_index);
+ return this->runtime->bezier_evaluated_offsets.as_span().slice(points);
+}
+
IndexMask CurvesGeometry::indices_for_curve_type(const CurveType type,
Vector<int64_t> &r_indices) const
{
@@ -779,6 +785,12 @@ Span<float> CurvesGeometry::evaluated_lengths_for_curve(const int curve_index,
return this->runtime->evaluated_length_cache.as_span().slice(range);
}
+float CurvesGeometry::evaluated_length_total_for_curve(const int curve_index,
+ const bool cyclic) const
+{
+ return this->evaluated_lengths_for_curve(curve_index, cyclic).last();
+}
+
/** \} */
/* -------------------------------------------------------------------- */