22 point_ranges[
pos] = points_by_curve[curve];
33 curves.curve_type_counts(),
66 const std::array<int, CURVE_TYPES_NUM> &type_counts,
71 if (type_counts[type] ==
types.size()) {
74 if (
types.is_single()) {
79 return types_span[index] == type;
84 const std::array<int, CURVE_TYPES_NUM> &counts,
94 if (!
mask.is_empty()) {
120 const Fn unselected_fn)
125 int curve_i =
mask.is_empty() ? -1 : 0;
127 int range_first =
mask.is_empty() ? 0 :
mask.first();
128 int range_last = range_first - 1;
131 if (offset_data[curve_i + 1] <= index) {
132 int first_unselected_curve = curve_i;
133 if (range_last >= range_first) {
135 selected_fn(curve_i, points_by_curve[curve_i], ranges);
137 first_unselected_curve++;
141 }
while (offset_data[curve_i + 1] <= index);
142 if constexpr (std::is_invocable_r_v<void, Fn, IndexRange, IndexRange>) {
147 else if (range_last + 1 != index) {
154 if (range_last - range_first >= 0) {
156 selected_fn(curve_i, points_by_curve[curve_i], ranges);
158 if constexpr (std::is_invocable_r_v<void, Fn, IndexRange, IndexRange>) {
176 mask, points_by_curve, selected_fn, unselected_fn);
189 const std::optional<Span<float3>> handle_positions_left =
curves.handle_positions_left();
190 const std::optional<Span<float3>> handle_positions_right =
curves.handle_positions_right();
191 if (!handle_positions_left || !handle_positions_right) {
197 const IndexRange points = points_by_curve[curve];
198 for (
const int point : points) {
199 const int index = point * 3;
200 all_positions[index] = (*handle_positions_left)[point];
201 all_positions[index + 1] = positions[point];
202 all_positions[index + 2] = (*handle_positions_right)[point];
206 return all_positions;
225 const IndexRange points = points_by_curve[curve];
226 for (
const int point : points) {
227 const int index = point * 3;
228 handle_positions_left[point] = all_positions[index];
229 positions[point] = all_positions[index + 1];
230 handle_positions_right[point] = all_positions[index + 2];
241 const int dst_curve_offset,
249 src_knots_by_curve, src_curves, start_offset, dst_offsets);
266 int8_t &knot_mode = knot_modes[curve];
268 knot_mode = cyclic[curve] ? mode_for_cyclic : mode_for_regular;
271 curves.nurbs_custom_knots_update_size();
Low-level operations for curves.
CustomData interface, see also DNA_customdata_types.h.
Span< T > as_span() const
void fill_assign_n(const void *value, void *dst, int64_t n) const
GMutableSpan slice(const int64_t start, int64_t size) const
const CPPType & type() const
const CPPType * type() const
static IndexMask from_predicate(const IndexMask &universe, GrainSize grain_size, IndexMaskMemory &memory, Fn &&predicate)
static IndexMask from_initializers(const Span< Initializer > initializers, IndexMaskMemory &memory)
static IndexMask from_difference(const IndexMask &mask_a, const IndexMask &mask_b, IndexMaskMemory &memory)
constexpr int64_t size() const
static constexpr IndexRange from_begin_end(const int64_t begin, const int64_t end)
static constexpr IndexRange from_begin_end_inclusive(const int64_t begin, const int64_t last)
constexpr int64_t size() const
void append(const T &value)
MutableSpan< float > nurbs_custom_knots_for_write()
MutableAttributeAccessor attributes_for_write()
Span< float > nurbs_custom_knots() const
AttributeAccessor attributes() const
IndexMask nurbs_custom_knot_curves(IndexMaskMemory &memory) const
bool nurbs_has_custom_knots() const
OffsetIndices< int > nurbs_custom_knots_by_curve() const
void foreach_index(Fn &&fn) const
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
void gather_group_to_group(const OffsetIndices< int > src_offsets, const OffsetIndices< int > dst_offsets, const IndexMask &selection, const Span< T > src, MutableSpan< T > dst)
Array< float3 > retrieve_all_positions(const bke::CurvesGeometry &curves, const IndexMask &curves_selection)
void write_all_positions(bke::CurvesGeometry &curves, const IndexMask &curves_selection, Span< float3 > all_positions)
void gather_custom_knots(const bke::CurvesGeometry &src, const IndexMask &src_curves, int dst_curve_offset, bke::CurvesGeometry &dst)
void update_custom_knot_modes(const IndexMask &mask, const KnotsMode mode_for_regular, const KnotsMode mode_for_cyclic, bke::CurvesGeometry &curves)
void copy_custom_knots(const bke::CurvesGeometry &src_curves, const IndexMask &exclude_curves, bke::CurvesGeometry &dst_curves)
void foreach_selected_point_ranges_per_curve(const IndexMask &mask, OffsetIndices< int > points_by_curve, SelectedCallback selected_fn)
bke::CurvesGeometry copy_only_curve_domain(const bke::CurvesGeometry &src_curves)
FunctionRef< void( int curve_i, IndexRange curve_points, Span< IndexRange > selected_point_ranges)> SelectedCallback
IndexMask indices_for_type(const VArray< int8_t > &types, const std::array< int, CURVE_TYPES_NUM > &type_counts, const CurveType type, const IndexMask &selection, IndexMaskMemory &memory)
static void foreach_selected_point_ranges_per_curve_(const IndexMask &mask, const OffsetIndices< int > points_by_curve, const SelectedCallback selected_fn, const Fn unselected_fn)
IndexMask curve_type_point_selection(const bke::CurvesGeometry &curves, CurveType curve_type, IndexMaskMemory &memory)
static void if_has_data_call_callback(const Span< int > offset_data, const int begin, const int end, UnselectedCallback callback)
IndexMask curve_to_point_selection(OffsetIndices< int > points_by_curve, const IndexMask &curve_selection, IndexMaskMemory &memory)
FunctionRef< void(IndexRange curves, IndexRange unselected_points)> UnselectedCallback
void fill_points(OffsetIndices< int > points_by_curve, const IndexMask &curve_selection, GPointer value, GMutableSpan dst)
void foreach_curve_by_type(const VArray< int8_t > &types, const std::array< int, CURVE_TYPES_NUM > &type_counts, const IndexMask &selection, FunctionRef< void(IndexMask)> catmull_rom_fn, FunctionRef< void(IndexMask)> poly_fn, FunctionRef< void(IndexMask)> bezier_fn, FunctionRef< void(IndexMask)> nurbs_fn)
void copy_attributes(const AttributeAccessor src_attributes, AttrDomain src_domain, AttrDomain dst_domain, const AttributeFilter &attribute_filter, MutableAttributeAccessor dst_attributes)
OffsetIndices< int > gather_selected_offsets(OffsetIndices< int > src_offsets, const IndexMask &selection, int start_offset, MutableSpan< int > dst_offsets)
CurvesGeometryRuntimeHandle * runtime