38 std::optional<bke::AttributeMetaData> meta_data = attributes.
lookup_meta_data(
".selection");
55 const IndexRange points = points_by_curve[curve];
59 bool is_selected = point_selection.
as_span().contains(
true);
61 selection_left.materialize_compressed(points, point_selection);
62 is_selected |= point_selection.
as_span().contains(
true);
63 selection_right.materialize_compressed(points, point_selection);
64 is_selected |= point_selection.
as_span().contains(
true);
88 const int handle_display,
100 selection_by_attribute.
append(
115 if (attribute_name ==
".selection") {
130 static const std::array<StringRef, 1> selection_attribute_names{
".selection"};
133 selection_attribute_names;
138 static const std::array<StringRef, 3> selection_attribute_names{
139 ".selection",
".selection_handle_left",
".selection_handle_right"};
140 return selection_attribute_names;
145 static const std::array<StringRef, 2> selection_attribute_names{
".selection_handle_left",
146 ".selection_handle_right"};
148 return (attributes.
contains(
"handle_type_left") && attributes.
contains(
"handle_type_right")) ?
149 selection_attribute_names :
156 for (
const StringRef selection_name : selection_attribute_names) {
157 attributes.
remove(selection_name);
166 if (attribute_name ==
".selection") {
169 if (attribute_name ==
".selection_handle_left") {
170 return curves.handle_positions_left();
172 if (attribute_name ==
".selection_handle_right") {
173 return curves.handle_positions_right();
185 for (
const int i : selection_attribute_names.
index_range()) {
187 curves, selection_domain, create_type, selection_attribute_names[i]));
194 for (
auto &attribute_writer : attribute_writers) {
195 attribute_writer.finish();
207 if (attribute_name.
size() == selection_attribute_names[
index].
size()) {
208 return selections[
index];
212 return selections[0];
222 fn(selection_writer);
233 std::optional<std::array<
Span<float3>, 2>> &r_bezier_handle_positions,
240 r_bezier_handle_positions = {*
curves.handle_positions_left(),
241 *
curves.handle_positions_right()};
245 r_bezier_handle_positions = std::nullopt;
256 std::optional<std::array<Span<float3>, 2>> bezier_handle_positions;
262 bezier_attribute_names,
264 bezier_handle_positions,
268 range_consumer(
curves.points_range(), positions,
".selection");
275 for (
const int attribute_i : bezier_attribute_names.
index_range()) {
278 range_consumer(points_by_curve[curve],
279 (*bezier_handle_positions)[attribute_i],
280 bezier_attribute_names[attribute_i]);
293 std::optional<std::array<Span<float3>, 2>> bezier_handle_positions;
299 bezier_attribute_names,
301 bezier_handle_positions,
305 range_consumer(
curves.curves_range(), positions,
".selection");
310 for (
const int attribute_i : bezier_attribute_names.
index_range()) {
312 range_consumer(curves_range,
313 (*bezier_handle_positions)[attribute_i],
314 bezier_attribute_names[attribute_i]);
325 if (attributes.
contains(attribute_name)) {
328 if (selection_attr.
domain == selection_domain) {
329 return selection_attr;
332 attributes.
remove(attribute_name);
334 switch (create_type) {
351 if (selection.
type().
is<
bool>()) {
352 selection.
typed<
bool>().fill(
false);
354 else if (selection.
type().
is<
float>()) {
355 selection.
typed<
float>().fill(0.0f);
361 if (selection.
type().
is<
bool>()) {
362 selection.
typed<
bool>().fill(
true);
364 else if (selection.
type().
is<
float>()) {
365 selection.
typed<
float>().fill(1.0f);
371 if (selection.
type().
is<
bool>()) {
372 selection.
typed<
bool>().fill(value);
374 else if (selection.
type().
is<
float>()) {
375 selection.
typed<
float>().fill(value ? 1.0f : 0.0f);
381 if (selection.
type().
is<
bool>()) {
384 else if (selection.
type().
is<
float>()) {
391 if (selection.
type().
is<
bool>()) {
394 else if (selection.
type().
is<
float>()) {
437 if (selection.
type().
is<
bool>()) {
438 return selection.
typed<
bool>().contains(
true);
440 if (selection.
type().
is<
float>()) {
441 for (
const float elem : selection.
typed<
float>()) {
458 if (selection.
type().
is<
bool>()) {
461 else if (selection.
type().
is<
float>()) {
477 std::optional<IndexRange> range =
mask.to_range();
478 if (range.has_value() &&
503 const IndexRange selection(
curves.attributes().domain_size(selection_domain));
509 if (selection_curve.
type().
is<
bool>()) {
510 return !selection_curve.
typed<
bool>().contains(
false);
513 if (selection_curve.
type().
is<
float>()) {
514 return !selection_curve.
typed<
float>().contains(0.0f);
538 const IndexRange points = points_by_curve[curve];
539 for (
const int i : curve_writers) {
545 if (unselect == all_points_selected) {
549 for (
const int j : curve_writers) {
553 if (unselect == all_points_selected) {
572 const bool deselect_ends)
584 const IndexRange points = points_by_curve[curve];
586 bool anything_selected =
false;
590 anything_selected = anything_selected || writer_has_anything_selected;
592 if (!anything_selected) {
599 const int half_of_size = points.
size() / 2;
602 for (
const int i :
IndexRange(half_of_size)) {
603 const int index = i * 2;
604 selection_typed[selected[
index]] =
true;
605 selection_typed[deselected[
index]] =
false;
608 selection_typed[points.
first()] = !deselect_ends;
609 const bool end_parity_to_selected = bool(points.
size() % 2);
610 const bool selected_end = cyclic[curve] || end_parity_to_selected;
611 selection_typed[points.
last()] = !deselect_ends && selected_end;
614 if (!deselect_ends && cyclic[curve] && !curve_body.
is_empty()) {
615 selection_typed[curve_body.
last()] =
false;
644 const IndexRange points = points_by_curve[curve];
645 const int first_point = points.
first();
646 const int last_point = points.
last();
649 for (
int point = first_point; point < last_point; point++) {
650 if (!selection_typed[point] && selection_typed[point + 1]) {
651 selection_typed[point] =
true;
656 for (
int point = last_point; point > first_point; point--) {
657 if (!selection_typed[point] && selection_typed[point - 1]) {
658 selection_typed[point] =
true;
662 if (!selection_typed[first_point]) {
663 selection_typed[first_point] =
true;
665 if (!selection_typed[last_point]) {
666 selection_typed[last_point] =
true;
671 if (selection_typed[first_point] != selection_typed[last_point]) {
672 selection_typed[first_point] =
true;
673 selection_typed[last_point] =
true;
681 const IndexRange points = points_by_curve[curve];
682 const int first_point = points.
first();
683 const int last_point = points.
last();
686 for (
int point_i = first_point; point_i < last_point; point_i++) {
687 if ((selection_typed[point_i] == 0.0f) && (selection_typed[point_i + 1] > 0.0f)) {
688 selection_typed[point_i] = 1.0f;
693 for (
int point_i = last_point; point_i > first_point; point_i--) {
694 if ((selection_typed[point_i] == 0.0f) && (selection_typed[point_i - 1] > 0.0f)) {
695 selection_typed[point_i] = 1.0f;
701 if (selection_typed[first_point] != selection_typed[last_point]) {
702 selection_typed[first_point] = 1.0f;
703 selection_typed[last_point] = 1.0f;
725 if (selection.
type().
is<
bool>()) {
730 selection_typed[
index] =
true;
733 selection_typed[
index] =
false;
736 selection_typed[
index] = !selection_typed[
index];
742 else if (selection.
type().
is<
float>()) {
747 selection_typed[
index] = 1.0f;
750 selection_typed[
index] = 0.0f;
753 selection_typed[
index] = 1.0f - selection_typed[
index];
779 const float radius_sq =
pow2f(radius);
785 FindClosestData best_match = init;
786 points_mask.slice(range).foreach_index([&](const int point) {
787 const float3 &pos = positions[point];
788 const float2 pos_proj = ED_view3d_project_float_v2_m4(region, pos, projection);
790 const float distance_proj_sq = math::distance_squared(pos_proj, mouse_pos);
791 if (distance_proj_sq > radius_sq || distance_proj_sq > best_match.distance_sq) {
795 best_match = {point, distance_proj_sq};
801 if (new_closest_data.distance_sq < initial_closest.distance_sq) {
802 return new_closest_data;
820 const float radius_sq =
pow2f(radius);
827 FindClosestData best_match = init;
828 curves_mask.slice(range).foreach_index([&](const int curve) {
829 const IndexRange points = points_by_curve[curve];
831 if (points.size() == 1) {
832 const float3 &pos = positions[points.first()];
833 const float2 pos_proj = ED_view3d_project_float_v2_m4(region, pos, projection);
835 const float distance_proj_sq = math::distance_squared(pos_proj, mouse_pos);
836 if (distance_proj_sq > radius_sq || distance_proj_sq > best_match.distance_sq) {
840 best_match = {curve, distance_proj_sq};
844 auto process_segment = [&](const int segment_i, const int next_i) {
845 const float3 &pos1 = positions[segment_i];
846 const float3 &pos2 = positions[next_i];
847 const float2 pos1_proj = ED_view3d_project_float_v2_m4(region, pos1, projection);
848 const float2 pos2_proj = ED_view3d_project_float_v2_m4(region, pos2, projection);
850 const float distance_proj_sq = dist_squared_to_line_segment_v2(
851 mouse_pos, pos1_proj, pos2_proj);
852 if (distance_proj_sq > radius_sq || distance_proj_sq > best_match.distance_sq) {
856 best_match = {curve, distance_proj_sq};
858 for (const int segment_i : points.drop_back(1)) {
859 process_segment(segment_i, segment_i + 1);
862 process_segment(points.last(), points.first());
869 if (new_closest_data.distance_sq < initial_closest.distance_sq) {
870 return new_closest_data;
925 bool changed =
false;
939 const IndexMask &mask = (selection_attribute_name ==
".selection") ? selection_mask :
941 mask.slice_content(range).foreach_index(
942 [&](const int point) {
943 const float2 pos_proj = ED_view3d_project_float_v2_m4(
944 vc.region, positions[point], projection);
945 if (BLI_rcti_isect_pt_v(&rect, int2(pos_proj))) {
946 apply_selection_operation_at_index(
947 selection_attribute_writer_by_name(selection_writers,
948 selection_attribute_name)
961 foreach_selectable_curve_range(
968 const IndexMask &mask = selection_mask;
969 mask.slice_content(range).foreach_index(
970 [&](const int curve) {
971 const IndexRange points = points_by_curve[curve];
972 if (points.size() == 1) {
973 const float2 pos_proj = ED_view3d_project_float_v2_m4(
974 vc.region, positions[points.first()], projection);
975 if (BLI_rcti_isect_pt_v(&rect, int2(pos_proj))) {
976 for (bke::GSpanAttributeWriter &selection : selection_writers) {
977 apply_selection_operation_at_index(selection.span, curve, sel_op);
983 auto process_segment = [&](const int segment_i, const int next_i) {
984 const float3 &pos1 = positions[segment_i];
985 const float3 &pos2 = positions[next_i];
986 const float2 pos1_proj = ED_view3d_project_float_v2_m4(
987 vc.region, pos1, projection);
988 const float2 pos2_proj = ED_view3d_project_float_v2_m4(
989 vc.region, pos2, projection);
991 if (BLI_rcti_isect_segment(&rect, int2(pos1_proj), int2(pos2_proj))) {
992 for (bke::GSpanAttributeWriter &selection : selection_writers) {
993 apply_selection_operation_at_index(selection.span, curve, sel_op);
1000 bool segment_selected = false;
1001 for (const int segment_i : points.drop_back(1)) {
1002 if (process_segment(segment_i, segment_i + 1)) {
1003 segment_selected = true;
1007 if (!segment_selected && cyclic[curve]) {
1008 process_segment(points.last(), points.first());
1014 finish_attribute_writers(selection_writers);
1032 bool changed =
false;
1046 const IndexMask &mask = (selection_attribute_name ==
".selection") ? selection_mask :
1048 mask.slice_content(range).foreach_index(
1049 [&](const int point) {
1050 const float2 pos_proj = ED_view3d_project_float_v2_m4(
1051 vc.region, positions[point], projection);
1053 if (BLI_rcti_isect_pt_v(&bbox, int2(pos_proj)) &&
1054 BLI_lasso_is_point_inside(
1055 lasso_coords, int(pos_proj.x), int(pos_proj.y), IS_CLIPPED))
1057 apply_selection_operation_at_index(
1058 selection_attribute_writer_by_name(selection_writers,
1059 selection_attribute_name)
1072 foreach_selectable_curve_range(
1079 const IndexMask &mask = selection_mask;
1080 mask.slice_content(range).foreach_index(
1081 [&](const int curve) {
1082 const IndexRange points = points_by_curve[curve];
1083 if (points.size() == 1) {
1084 const float2 pos_proj = ED_view3d_project_float_v2_m4(
1085 vc.region, positions[points.first()], projection);
1087 if (BLI_rcti_isect_pt_v(&bbox, int2(pos_proj)) &&
1088 BLI_lasso_is_point_inside(
1089 lasso_coords, int(pos_proj.x), int(pos_proj.y), IS_CLIPPED))
1091 for (bke::GSpanAttributeWriter &selection : selection_writers) {
1092 apply_selection_operation_at_index(selection.span, curve, sel_op);
1098 auto process_segment = [&](const int segment_i, const int next_i) {
1099 const float3 &pos1 = positions[segment_i];
1100 const float3 &pos2 = positions[next_i];
1101 const float2 pos1_proj = ED_view3d_project_float_v2_m4(
1102 vc.region, pos1, projection);
1103 const float2 pos2_proj = ED_view3d_project_float_v2_m4(
1104 vc.region, pos2, projection);
1107 if (BLI_rcti_isect_segment(&bbox, int2(pos1_proj), int2(pos2_proj)) &&
1108 BLI_lasso_is_edge_inside(lasso_coords,
1115 for (bke::GSpanAttributeWriter &selection : selection_writers) {
1116 apply_selection_operation_at_index(selection.span, curve, sel_op);
1123 bool segment_selected = false;
1124 for (const int segment_i : points.drop_back(cyclic[curve] ? 0 : 1)) {
1125 if (process_segment(segment_i, segment_i + 1)) {
1126 segment_selected = true;
1130 if (!segment_selected && cyclic[curve]) {
1131 process_segment(points.last(), points.first());
1137 finish_attribute_writers(selection_writers);
1152 const float radius_sq =
pow2f(radius);
1155 bool changed =
false;
1169 const IndexMask &mask = (selection_attribute_name ==
".selection") ? selection_mask :
1171 mask.slice_content(range).foreach_index(
1172 [&](const int point) {
1173 const float2 pos_proj = ED_view3d_project_float_v2_m4(
1174 vc.region, positions[point], projection);
1175 if (math::distance_squared(pos_proj, float2(coord)) <= radius_sq) {
1176 apply_selection_operation_at_index(
1177 selection_attribute_writer_by_name(selection_writers,
1178 selection_attribute_name)
1191 foreach_selectable_curve_range(
1198 const IndexMask &mask = selection_mask;
1199 mask.slice_content(range).foreach_index(
1200 [&](const int curve) {
1201 const IndexRange points = points_by_curve[curve];
1202 if (points.size() == 1) {
1203 const float2 pos_proj = ED_view3d_project_float_v2_m4(
1204 vc.region, positions[points.first()], projection);
1205 if (math::distance_squared(pos_proj, float2(coord)) <= radius_sq) {
1206 for (bke::GSpanAttributeWriter &selection : selection_writers) {
1207 apply_selection_operation_at_index(selection.span, curve, sel_op);
1213 auto process_segments = [&](const int segment_i, const int next_i) {
1214 const float3 &pos1 = positions[segment_i];
1215 const float3 &pos2 = positions[next_i];
1216 const float2 pos1_proj = ED_view3d_project_float_v2_m4(
1217 vc.region, pos1, projection);
1218 const float2 pos2_proj = ED_view3d_project_float_v2_m4(
1219 vc.region, pos2, projection);
1221 const float distance_proj_sq = dist_squared_to_line_segment_v2(
1222 float2(coord), pos1_proj, pos2_proj);
1223 if (distance_proj_sq <= radius_sq) {
1224 for (bke::GSpanAttributeWriter &selection : selection_writers) {
1225 apply_selection_operation_at_index(selection.span, curve, sel_op);
1232 bool segment_selected = false;
1233 for (const int segment_i : points.drop_back(1)) {
1234 if (process_segments(segment_i, segment_i + 1)) {
1235 segment_selected = true;
1239 if (!segment_selected && cyclic[curve]) {
1240 process_segments(points.last(), points.first());
1246 finish_attribute_writers(selection_writers);
1250template<
typename Po
intSelectFn,
typename LineSelectFn>
1255 PointSelectFn &&point_predicate,
1256 LineSelectFn &&line_predicate)
1263 mask.slice_content(
curves.points_range()), memory, point_predicate);
1267 mask.slice_content(
curves.curves_range()), memory, [&](
const int curve) ->
bool {
1268 const IndexRange points = points_by_curve[curve];
1269 const bool is_cyclic = cyclic[curve];
1273 if (points.size() == 1) {
1274 return point_predicate(points.first());
1277 for (
const int point : points.drop_back(1)) {
1278 if (line_predicate(curve, point, point + 1)) {
1283 if (line_predicate(curve, points.last(), points.first())) {
1296 const bool deselect,
1308 auto is_point_changed1 = [&](
const int point,
const int neighbor) {
1309 return deselect ? (selection[point] && !selection[neighbor]) :
1310 (!selection[point] && selection[neighbor]);
1312 auto is_point_changed2 = [&](
const int point,
const int neighbor1,
const int neighbor2) {
1313 return deselect ? (selection[point] && (!selection[neighbor1] || !selection[neighbor2])) :
1314 (!selection[point] && (selection[neighbor1] || selection[neighbor2]));
1318 const IndexRange points = points_by_curve[curve];
1319 if (points.
size() == 1) {
1324 if (cyclic[curve]) {
1325 changed_points[points.
first()] = is_point_changed2(
1328 changed_points[point] = is_point_changed2(point, point - 1, point + 1);
1330 changed_points[points.
last()] = is_point_changed2(
1334 changed_points[points.
first()] = is_point_changed1(points.
first(), points.
first() + 1);
1336 changed_points[point] = is_point_changed2(point, point - 1, point + 1);
1338 changed_points[points.
last()] = is_point_changed1(points.
last(), points.
last() - 1);
1347 const bool deselect,
1365 curves, deformation, attribute_name);
1366 if (!positions_opt) {
1371 auto point_predicate = [&](
const int point) {
1376 auto line_predicate = [&](
const int ,
const int point,
const int next_point_i) {
1379 vc.
region, positions[next_point_i], projection);
1383 const IndexMask &
mask = (attribute_name ==
".selection") ? selection_mask : bezier_mask;
1385 curves,
mask, selection_domain, memory, point_predicate, line_predicate);
1402 curves, deformation, attribute_name);
1403 if (!positions_opt) {
1408 auto point_predicate = [&](
const int point) {
1414 auto line_predicate = [&](
const int ,
const int point,
const int next_point_i) {
1417 vc.
region, positions[next_point_i], projection);
1422 int(next_pos_proj.x),
1423 int(next_pos_proj.y),
1427 const IndexMask &
mask = (attribute_name ==
".selection") ? selection_mask : bezier_mask;
1429 curves,
mask, selection_domain, memory, point_predicate, line_predicate);
1444 const float radius_sq =
pow2f(radius);
1446 curves, deformation, attribute_name);
1447 if (!positions_opt) {
1452 auto point_predicate = [&](
const int point) {
1455 return distance_proj_sq <= radius_sq;
1457 auto line_predicate = [&](
const int ,
const int point,
const int next_point_i) {
1460 vc.
region, positions[next_point_i], projection);
1462 float2(coord), pos_proj, next_pos_proj);
1463 return distance_proj_sq <= radius_sq;
1466 const IndexMask &
mask = (attribute_name ==
".selection") ? selection_mask : bezier_mask;
1468 curves,
mask, selection_domain, memory, point_predicate, line_predicate);
Low-level operations for curves.
Low-level operations for curves.
#define PRF_scope(category)
#define BLI_assert_unreachable()
Span< T > as_span() const
GMutableSpan slice(const int64_t start, int64_t size) const
const CPPType & type() const
MutableSpan< T > typed() const
const CPPType & type() const
static IndexMask from_predicate(const IndexMask &universe, LinearAllocator<> &memory, Fn &&predicate, exec_mode::Mode mode=exec_mode::parallel)
static IndexMask from_bools(Span< bool > bools, LinearAllocator<> &memory)
static IndexMask from_union(const IndexMask &mask_a, const IndexMask &mask_b, LinearAllocator<> &memory)
constexpr int64_t first() const
constexpr IndexRange shift(int64_t n) const
constexpr IndexRange drop_back(int64_t n) const
constexpr int64_t last(const int64_t n=0) const
constexpr int64_t size() const
constexpr bool is_empty() const
constexpr IndexRange()=default
constexpr IndexRange drop_front(int64_t n) const
constexpr IndexRange index_range() const
constexpr int64_t size() const
constexpr IndexRange index_range() const
constexpr bool contains(const T &value) const
IndexRange index_range() const
T get_internal_single() const
void materialize_compressed(const IndexMask &mask, MutableSpan< T > r_span) const
void append(const T &value)
GAttributeReader lookup_or_default(StringRef name, AttrDomain domain, AttrType data_type, const void *default_value=nullptr) const
bool contains(StringRef name) const
std::optional< AttributeMetaData > lookup_meta_data(StringRef name) const
bool add(const StringRef name, const AttrDomain domain, const AttrType data_type, const AttributeInit &initializer)
bool remove(const StringRef name)
GSpanAttributeWriter lookup_for_write_span(StringRef name)
constexpr int64_t size() const
void foreach_range(ForeachRangeFn auto &&fn) const
IndexRange index_range() const
void foreach_index(Fn &&fn, Mode mode=exec_mode::serial) const
void invert_booleans(MutableSpan< bool > span)
bool contains(const VArray< bool > &varray, const IndexMask &indices_to_check, bool value)
IndexMask curve_type_point_selection(const bke::CurvesGeometry &curves, CurveType curve_type, LinearAllocator<> &memory)
bool has_anything_selected(const VArray< bool > &varray, const IndexRange range_to_check)
void apply_selection_operation_at_index(GMutableSpan selection, const int index, const eSelectOp sel_op)
void foreach_selectable_point_range(const bke::CurvesGeometry &curves, const bke::crazyspace::GeometryDeformation &deformation, eHandleDisplay handle_display, SelectionRangeFn range_consumer)
IndexMask select_circle_mask(const ViewContext &vc, const bke::CurvesGeometry &curves, const bke::crazyspace::GeometryDeformation &deformation, const float4x4 &projection, const IndexMask &selection_mask, const IndexMask &bezier_mask, const bke::AttrDomain selection_domain, const StringRef attribute_name, const int2 coord, const float radius, IndexMaskMemory &memory)
void remove_selection_attributes(bke::MutableAttributeAccessor &attributes, Span< StringRef > selection_attribute_names)
static std::optional< FindClosestData > find_closest_point_to_screen_co(const ARegion *region, const Span< float3 > positions, const float4x4 &projection, const IndexMask &points_mask, const float2 mouse_pos, const float radius, const FindClosestData &initial_closest)
void select_linked(bke::CurvesGeometry &curves, const IndexMask &curves_mask, const bool unselect)
static Vector< bke::GSpanAttributeWriter > init_selection_writers(bke::CurvesGeometry &curves, bke::AttrDomain selection_domain)
void select_all(bke::CurvesGeometry &curves, const IndexMask &mask, const bke::AttrDomain selection_domain, int action)
IndexMask select_mask_from_predicates(const bke::CurvesGeometry &curves, const IndexMask &mask, const bke::AttrDomain selection_domain, IndexMaskMemory &memory, PointSelectFn &&point_predicate, LineSelectFn &&line_predicate)
IndexMask retrieve_selected_points(const bke::CurvesGeometry &curves, LinearAllocator<> &memory)
void select_alternate(bke::CurvesGeometry &curves, const IndexMask &curves_mask, const bool deselect_ends)
void foreach_selectable_curve_range(const bke::CurvesGeometry &curves, const bke::crazyspace::GeometryDeformation &deformation, eHandleDisplay handle_display, SelectionRangeFn range_consumer)
static bool is_everything_selected(GMutableSpan &selection_curve)
void foreach_selection_attribute_writer(bke::CurvesGeometry &curves, bke::AttrDomain selection_domain, FunctionRef< void(bke::GSpanAttributeWriter &selection)> fn)
void select_adjacent(bke::CurvesGeometry &curves, const IndexMask &curves_mask, const bool deselect)
static bke::GSpanAttributeWriter & selection_attribute_writer_by_name(MutableSpan< bke::GSpanAttributeWriter > selections, StringRef attribute_name)
static void invert_selection(MutableSpan< float > selection, const IndexMask &mask)
Span< StringRef > get_curves_bezier_selection_attribute_names(const bke::CurvesGeometry &curves)
void fill_selection_false(GMutableSpan selection)
IndexMask select_lasso_mask(const ViewContext &vc, const bke::CurvesGeometry &curves, const bke::crazyspace::GeometryDeformation &deformation, const float4x4 &projection, const IndexMask &selection_mask, const IndexMask &bezier_mask, const bke::AttrDomain selection_domain, const StringRef attribute_name, const Span< int2 > lasso_coords, IndexMaskMemory &memory)
bool select_circle(const ViewContext &vc, bke::CurvesGeometry &curves, const bke::crazyspace::GeometryDeformation &deformation, const float4x4 &projection, const IndexMask &selection_mask, const IndexMask &bezier_mask, const bke::AttrDomain selection_domain, const int2 coord, const float radius, const eSelectOp sel_op)
static void finish_attribute_writers(MutableSpan< bke::GSpanAttributeWriter > attribute_writers)
IndexMask select_adjacent_mask(const bke::CurvesGeometry &curves, const IndexMask &curves_mask, const StringRef attribute_name, const bool deselect, IndexMaskMemory &memory)
IndexMask retrieve_selected_curves(const bke::CurvesGeometry &curves, LinearAllocator<> &memory)
void fill_selection_true(GMutableSpan selection)
Span< StringRef > get_curves_selection_attribute_names(const bke::CurvesGeometry &curves)
void fill_selection(GMutableSpan selection, bool value)
std::optional< FindClosestData > closest_elem_find_screen_space(const ViewContext &vc, const OffsetIndices< int > points_by_curve, const Span< float3 > positions, const VArray< bool > &cyclic, const float4x4 &projection, const IndexMask &mask, const bke::AttrDomain domain, const int2 coord, const FindClosestData &initial_closest)
Span< StringRef > get_curves_all_selection_attribute_names()
static void init_selectable_foreach(const bke::CurvesGeometry &curves, const bke::crazyspace::GeometryDeformation &deformation, eHandleDisplay handle_display, Span< StringRef > &r_bezier_attribute_names, Span< float3 > &r_positions, std::optional< std::array< Span< float3 >, 2 > > &r_bezier_handle_positions, IndexMaskMemory &r_memory, IndexMask &r_bezier_curves)
static std::optional< FindClosestData > find_closest_curve_to_screen_co(const ARegion *region, const OffsetIndices< int > points_by_curve, const Span< float3 > positions, const VArray< bool > &cyclic, const float4x4 &projection, const IndexMask &curves_mask, const float2 mouse_pos, float radius, const FindClosestData &initial_closest)
IndexMask select_box_mask(const ViewContext &vc, const bke::CurvesGeometry &curves, const bke::crazyspace::GeometryDeformation &deformation, const float4x4 &projection, const IndexMask &selection_mask, const IndexMask &bezier_mask, const bke::AttrDomain selection_domain, const StringRef attribute_name, const rcti &rect, IndexMaskMemory &memory)
bool select_lasso(const ViewContext &vc, bke::CurvesGeometry &curves, const bke::crazyspace::GeometryDeformation &deformation, const float4x4 &projection, const IndexMask &selection_mask, const IndexMask &bezier_mask, const bke::AttrDomain selection_domain, const Span< int2 > lasso_coords, const eSelectOp sel_op)
IndexMask retrieve_all_selected_points(const bke::CurvesGeometry &curves, const int handle_display, LinearAllocator<> &memory)
std::optional< Span< float3 > > get_selection_attribute_positions(const bke::CurvesGeometry &curves, const bke::crazyspace::GeometryDeformation &deformation, const StringRef attribute_name)
bke::GSpanAttributeWriter ensure_selection_attribute(bke::CurvesGeometry &curves, bke::AttrDomain selection_domain, bke::AttrType create_type, StringRef attribute_name)
static FindClosestData closer_elem(const FindClosestData &a, const FindClosestData &b)
FunctionRef< void( IndexRange range, Span< float3 > positions, StringRef selection_attribute_name)> SelectionRangeFn
bool select_box(const ViewContext &vc, bke::CurvesGeometry &curves, const bke::crazyspace::GeometryDeformation &deformation, const float4x4 &projection, const IndexMask &selection_mask, const IndexMask &bezier_mask, const bke::AttrDomain selection_domain, const rcti &rect, const eSelectOp sel_op)
constexpr ParallelGrainSize grain_size(int grain_size)
void masked_fill(MutableSpan< T > data, const T &value, const IndexMask &mask)
T distance_squared(const VecBase< T, Size > &a, const VecBase< T, Size > &b)
Value parallel_reduce(IndexRange range, int64_t grain_size, const Value &identity, const Function &function, const Reduction &reduction)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
float2 ED_view3d_project_float_v2_m4(const ARegion *region, const float co[3], const float4x4 &mat)
MatBase< float, 4, 4 > float4x4
bool BLI_lasso_is_point_inside(Span< int2 > mcoords, int sx, int sy, int error_value)
MINLINE float pow2f(float x)
float dist_squared_to_line_segment_v2(const float p[2], const float l1[2], const float l2[2])
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
bool BLI_rcti_isect_segment(const struct rcti *rect, const int s1[2], const int s2[2])
bool BLI_rcti_isect_pt_v(const struct rcti *rect, const int xy[2])
float ED_view3d_select_dist_px()
bool BLI_lasso_is_edge_inside(Span< int2 > mcoords, int x0, int y0, int x1, int y1, int error_value)
void BLI_lasso_boundbox(rcti *rect, Span< int2 > mcoords)
eHandleDisplay handle_display