diff options
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_curves_utils.hh | 20 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/curves_utils.cc | 15 |
2 files changed, 32 insertions, 3 deletions
diff --git a/source/blender/blenkernel/BKE_curves_utils.hh b/source/blender/blenkernel/BKE_curves_utils.hh index 7d81847f4c1..f9155023db7 100644 --- a/source/blender/blenkernel/BKE_curves_utils.hh +++ b/source/blender/blenkernel/BKE_curves_utils.hh @@ -326,8 +326,8 @@ void copy_point_data(const CurvesGeometry &src_curves, template<typename T> void copy_point_data(const CurvesGeometry &src_curves, const CurvesGeometry &dst_curves, - const IndexMask src_curve_selection, - const Span<T> src, + IndexMask src_curve_selection, + Span<T> src, MutableSpan<T> dst) { copy_point_data(src_curves, dst_curves, src_curve_selection, GSpan(src), GMutableSpan(dst)); @@ -340,13 +340,27 @@ void fill_points(const CurvesGeometry &curves, template<typename T> void fill_points(const CurvesGeometry &curves, - const IndexMask curve_selection, + IndexMask curve_selection, const T &value, MutableSpan<T> dst) { fill_points(curves, curve_selection, &value, dst); } +void fill_points(const CurvesGeometry &curves, + Span<IndexRange> curve_ranges, + GPointer value, + GMutableSpan dst); + +template<typename T> +void fill_points(const CurvesGeometry &curves, + Span<IndexRange> curve_ranges, + const T &value, + MutableSpan<T> dst) +{ + fill_points(curves, curve_ranges, &value, dst); +} + /** * Copy only the information on the point domain, but not the offsets or any point attributes, * meant for operations that change the number of points but not the number of curves. diff --git a/source/blender/blenkernel/intern/curves_utils.cc b/source/blender/blenkernel/intern/curves_utils.cc index d98832e796c..f5a69a995a3 100644 --- a/source/blender/blenkernel/intern/curves_utils.cc +++ b/source/blender/blenkernel/intern/curves_utils.cc @@ -84,6 +84,21 @@ void fill_points(const CurvesGeometry &curves, }); } +void fill_points(const CurvesGeometry &curves, + Span<IndexRange> curve_ranges, + GPointer value, + GMutableSpan dst) +{ + BLI_assert(*value.type() == dst.type()); + const CPPType &type = dst.type(); + threading::parallel_for(curve_ranges.index_range(), 512, [&](IndexRange range) { + for (const IndexRange range : curve_ranges.slice(range)) { + const IndexRange points = curves.points_for_curves(range); + type.fill_assign_n(value.get(), dst.slice(points).data(), points.size()); + } + }); +} + bke::CurvesGeometry copy_only_curve_domain(const bke::CurvesGeometry &src_curves) { bke::CurvesGeometry dst_curves(0, src_curves.curves_num()); |