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
path: root/source
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-05-16 01:50:29 +0300
committerHans Goudey <h.goudey@me.com>2021-05-16 01:50:29 +0300
commit4da16a0707bbb1feb03e728eb89eb773871f978c (patch)
treefcef65e6d70a6bd1c8ac9a8529c7a1dc55971416 /source
parent038c6e229c4fb1518f726d7f6a828be026bae857 (diff)
Cleanup: Use helper function
Use the `CurveEval` function introduced in the last commit.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/geometry_component_curve.cc21
1 files changed, 3 insertions, 18 deletions
diff --git a/source/blender/blenkernel/intern/geometry_component_curve.cc b/source/blender/blenkernel/intern/geometry_component_curve.cc
index e4417276243..b0d2d661cd5 100644
--- a/source/blender/blenkernel/intern/geometry_component_curve.cc
+++ b/source/blender/blenkernel/intern/geometry_component_curve.cc
@@ -294,21 +294,6 @@ static GVMutableArrayPtr make_cyclic_write_attribute(CurveEval &curve)
* array implementations try to make it workable in common situations.
* \{ */
-static Array<int> control_point_offsets(const CurveEval &curve)
-{
- Span<SplinePtr> splines = curve.splines();
- Array<int> offsets(splines.size() + 1);
-
- int size = 0;
- for (const int spline_index : splines.index_range()) {
- offsets[spline_index] = size;
- size += splines[spline_index]->size();
- }
- offsets.last() = size;
-
- return offsets;
-}
-
namespace {
struct PointIndices {
int spline_index;
@@ -590,7 +575,7 @@ template<typename T> class BuiltinPointAttributeProvider : public BuiltinAttribu
return std::make_unique<fn::GVArray_For_GSpan>(get_span_(*splines.first()));
}
- Array<int> offsets = control_point_offsets(*curve);
+ Array<int> offsets = curve->control_point_offsets();
Array<Span<T>> spans(splines.size());
for (const int i : splines.index_range()) {
spans[i] = get_span_(*splines[i]);
@@ -613,7 +598,7 @@ template<typename T> class BuiltinPointAttributeProvider : public BuiltinAttribu
get_mutable_span_(*splines.first()));
}
- Array<int> offsets = control_point_offsets(*curve);
+ Array<int> offsets = curve->control_point_offsets();
Array<MutableSpan<T>> spans(splines.size());
for (const int i : splines.index_range()) {
spans[i] = get_mutable_span_(*splines[i]);
@@ -688,7 +673,7 @@ class PositionAttributeProvider final : public BuiltinPointAttributeProvider<flo
spline->mark_cache_invalid();
}
- Array<int> offsets = control_point_offsets(*curve);
+ Array<int> offsets = curve->control_point_offsets();
return std::make_unique<
fn::GVMutableArray_For_EmbeddedVMutableArray<float3, VMutableArray_For_SplinePosition>>(
offsets.last(), curve->splines(), std::move(offsets));