32 if (std::any_of(sizes_ptr, sizes_ptr + sizes_num, [](
const int size) {
return size < 1; })) {
37 ed::curves::add_curves(curves, {sizes_ptr, sizes_num});
38 curves.tag_topology_changed();
44 const int *indices_ptr,
45 const int indices_num)
48 if (indices_ptr !=
nullptr) {
50 if (std::any_of(indices.begin(), indices.end(), [&](
const int index) {
51 return !curves.curves_range().contains(index);
57 if (!std::is_sorted(indices.begin(), indices.end())) {
61 if (std::adjacent_find(indices.begin(), indices.end(), std::greater_equal<int>()) !=
68 IndexMaskMemory memory;
69 IndexMask curves_to_delete = IndexMask::from_indices(indices, memory);
70 curves.remove_curves(curves_to_delete, {});
83 const int *indices_ptr,
84 const int indices_num)
87 const Span<int> new_sizes(sizes_ptr, sizes_num);
88 if (std::any_of(new_sizes.begin(), new_sizes.end(), [](
const int size) { return size < 1; })) {
92 IndexMaskMemory memory;
93 IndexMask curves_to_resize;
94 if (indices_ptr !=
nullptr) {
95 if (indices_num != sizes_num) {
100 if (std::any_of(indices.begin(), indices.end(), [&](
const int index) {
101 return !curves.curves_range().contains(index);
107 if (!std::is_sorted(indices.begin(), indices.end())) {
111 if (std::adjacent_find(indices.begin(), indices.end(), std::greater_equal<int>()) !=
117 curves_to_resize = IndexMask::from_indices(indices, memory);
120 if (sizes_num != curves.curves_num()) {
124 curves_to_resize = curves.curves_range();
127 ed::curves::resize_curves(curves, curves_to_resize, {sizes_ptr, sizes_num});
133static void rna_Curves_add_curves(
Curves *curves_id,
140 if (!rna_CurvesGeometry_add_curves(curves, reports, sizes, sizes_num)) {
145 if (curves_id->
id.
us > 0) {
151static void rna_Curves_remove_curves(
Curves *curves_id,
153 const int *indices_ptr,
154 const int indices_num)
158 if (!rna_CurvesGeometry_remove_curves(curves, reports, indices_ptr, indices_num)) {
163 if (curves_id->
id.
us > 0) {
169static void rna_Curves_resize_curves(
Curves *curves_id,
171 const int *sizes_ptr,
173 const int *indices_ptr,
174 const int indices_num)
178 if (!rna_CurvesGeometry_resize_curves(
179 curves, reports, sizes_ptr, sizes_num, indices_ptr, indices_num))
185 if (curves_id->
id.
us > 0) {
207 "The number of points in each curve",
214 "Remove all curves. If indices are provided, remove only the "
215 "curves with the given indices.");
224 "The indices of the curves to remove",
232 "Resize all existing curves. If indices are provided, resize only the curves with the given "
233 "indices. If the new size for a curve is smaller, the curve is trimmed. If "
234 "the new size for a curve is larger, the new end values are default initialized.");
243 "The number of points in each curve",
254 "The indices of the curves to resize",
Low-level operations for curves.
void BKE_report(ReportList *reports, eReportType type, const char *message)
void DEG_id_tag_update(ID *id, unsigned int flags)
void RNA_api_curves(StructRNA *srna)
PropertyRNA * RNA_def_int_array(StructOrFunctionRNA *cont_, const char *identifier, const int len, const int *default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
void RNA_def_function_flag(FunctionRNA *func, int flag)
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void WM_main_add_notifier(uint type, void *reference)