29 const int total_points = points_to_delete.
as_span().count(
false);
32 if (total_points == 0) {
36 int curr_dst_point_id = 0;
42 for (
const int curve_i :
curves.curves_range()) {
43 const IndexRange points = points_by_curve[curve_i];
44 const Span<bool> curve_points_to_delete = points_to_delete.
as_span().slice(points);
45 const bool curve_cyclic = src_cyclic[curve_i];
55 const bool is_last_segment_selected = curve_cyclic && ranges_to_keep.
first().first() == 0 &&
56 ranges_to_keep.
last().last() == points.
size() - 1;
57 const bool is_curve_self_joined = is_last_segment_selected && ranges_to_keep.
size() != 1;
58 const bool is_cyclic = ranges_to_keep.
size() == 1 && is_last_segment_selected;
63 const IndexRange range = ranges_to_keep[range_i];
65 int count = range.
size();
66 for (
const int src_point : range.
shift(points.
first())) {
67 dst_to_src_point[curr_dst_point_id++] = src_point;
71 if (is_curve_self_joined && range_i == range_ids.
last()) {
73 for (
const int src_point : first_range.
shift(points.
first())) {
74 dst_to_src_point[curr_dst_point_id++] = src_point;
76 count += first_range.
size();
79 dst_curve_counts.
append(count);
80 dst_to_src_curve.
append(curve_i);
81 dst_cyclic.
append(is_cyclic);
85 const int total_curves = dst_to_src_curve.
size();
118 if (
curves.nurbs_has_custom_knots()) {
144 for (
const int curve_i :
curves.curves_range()) {
145 const IndexRange points = points_by_curve[curve_i];
146 const Span<bool> curve_points_to_delete = points_to_delete.
as_span().slice(points);
147 const bool curve_cyclic = src_cyclic[curve_i];
151 curve_points_to_delete,
false);
157 const bool is_last_segment_selected = curve_cyclic && ranges_to_keep.
first().first() == 0 &&
158 ranges_to_keep.
last().last() == points.
size() - 1;
159 const bool is_curve_self_joined = is_last_segment_selected && ranges_to_keep.
size() != 1;
162 const int num_dst_curves = ranges_to_keep.
size() - int(is_curve_self_joined);
164 src_to_dst_curve[curve_i].resize(num_dst_curves);
166 dst_to_src_curve.
size());
176 if (dst_fill_ids.span[dst_curve_index] == 0) {
179 const int src_curve_index = dst_to_src_curve[dst_curve_index];
180 return src_to_dst_curve[src_curve_index].
first() != dst_curve_index;
183 dst_fill_ids.span.varray(), non_original_curves, dst_fill_ids.span);
185 dst_fill_ids.finish();
Low-level operations for curves.
Low-level operations for curves.
Span< T > as_span() const
MutableSpan< T > as_mutable_span()
static IndexMask from_predicate(const IndexMask &universe, LinearAllocator<> &memory, Fn &&predicate, exec_mode::Mode mode=exec_mode::parallel)
constexpr int64_t first() const
constexpr IndexRange shift(int64_t n) const
constexpr int64_t last(const int64_t n=0) const
constexpr int64_t size() const
constexpr IndexRange drop_front(int64_t n) const
constexpr MutableSpan drop_back(const int64_t n) const
void append(const T &value)
const T & last(const int64_t n=0) const
IndexRange index_range() const
Span< T > as_span() const
void append_n_times(const T &value, const int64_t n)
void update_curve_types()
void remove_attributes_based_on_types()
IndexRange curves_range() const
MutableSpan< int > offsets_for_write()
MutableSpan< bool > cyclic_for_write()
MutableAttributeAccessor attributes_for_write()
GSpanAttributeWriter lookup_for_write_span(StringRef name)
Vector< IndexRange > find_all_ranges(const Span< T > span, const T &value)
void copy(const GVArray &src, GMutableSpan dst, exec_mode::Mode mode=exec_mode::parallel)
void fill_index_range(MutableSpan< T > span, const T start=0)
void update_custom_knot_modes(const IndexMask &mask, const KnotsMode mode_for_regular, const KnotsMode mode_for_cyclic, bke::CurvesGeometry &curves)
void gather_next_available_fill_ids(const VArray< int > &fill_ids, MutableSpan< int > r_new_fill_ids)
auto attribute_filter_from_skip_ref(const Span< StringRef > skip)
void gather_attributes(AttributeAccessor src_attributes, AttrDomain src_domain, AttrDomain dst_domain, const AttributeFilter &attribute_filter, const IndexMask &selection, MutableAttributeAccessor dst_attributes)
bke::CurvesGeometry remove_points_and_split(const bke::CurvesGeometry &curves, const IndexMask &mask)
bke::CurvesGeometry grease_pencil_remove_points_and_split(const bke::CurvesGeometry &curves, const IndexMask &mask)
OffsetIndices< int > accumulate_counts_to_offsets(MutableSpan< int > counts_to_offsets, int start_offset=0)
void BKE_defgroup_copy_list(ListBaseT< bDeformGroup > *outbase, const ListBaseT< bDeformGroup > *inbase)
ListBaseT< struct bDeformGroup > vertex_group_names