Blender V5.3
mask_select.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2012 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include "BLI_lasso_2d.hh"
10#include "BLI_listbase.hh"
11#include "BLI_math_base_c.hh"
13#include "BLI_rect.hh"
14
15#include "BKE_context.hh"
16#include "BKE_mask.hh"
17
18#include "DEG_depsgraph.hh"
20
21#include "DNA_mask_types.h"
22
23#include "WM_api.hh"
24#include "WM_types.hh"
25
26#include "ED_mask.hh" /* own include */
27#include "ED_select_utils.hh"
28
29#include "RNA_access.hh"
30#include "RNA_define.hh"
31
32#include "mask_intern.hh" /* own include */
33
34namespace blender {
35
36/* -------------------------------------------------------------------- */
39
41{
42 for (int i = 0; i < spline->tot_point; i++) {
43 MaskSplinePoint *point = &spline->points[i];
44
45 if (BKE_mask_point_selected(point)) {
46 return true;
47 }
48 }
49
50 return false;
51}
52
54{
55 if (mask_layer->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
56 return false;
57 }
58
59 for (const MaskSpline &spline : mask_layer->splines) {
60 if (ED_mask_spline_select_check(&spline)) {
61 return true;
62 }
63 }
64
65 return false;
66}
67
69{
70 for (const MaskLayer &mask_layer : mask->masklayers) {
71 if (ED_mask_layer_select_check(&mask_layer)) {
72 return true;
73 }
74 }
75
76 return false;
77}
78
79void ED_mask_spline_select_set(MaskSpline *spline, const bool do_select)
80{
81 if (do_select) {
82 spline->flag |= MASK_SPLINE_SELECT;
83 }
84 else {
85 spline->flag &= ~MASK_SPLINE_SELECT;
86 }
87
88 for (int i = 0; i < spline->tot_point; i++) {
89 MaskSplinePoint *point = &spline->points[i];
90
91 BKE_mask_point_select_set(point, do_select);
92 }
93}
94
95void ED_mask_layer_select_set(MaskLayer *mask_layer, const bool do_select)
96{
97 if (mask_layer->visibility_flag & MASK_HIDE_SELECT) {
98 if (do_select == true) {
99 return;
100 }
101 }
102
103 for (MaskSpline &spline : mask_layer->splines) {
104 ED_mask_spline_select_set(&spline, do_select);
105 }
106}
107
109{
110 if (action == SEL_TOGGLE) {
112 action = SEL_DESELECT;
113 }
114 else {
115 action = SEL_SELECT;
116 }
117 }
118
119 for (MaskLayer &mask_layer : mask->masklayers) {
120
121 if (mask_layer.visibility_flag & MASK_HIDE_VIEW) {
122 continue;
123 }
124
125 if (action == SEL_INVERT) {
126 /* we don't have generic functions for this, its restricted to this operator
127 * if one day we need to re-use such functionality, they can be split out */
128
129 if (mask_layer.visibility_flag & MASK_HIDE_SELECT) {
130 continue;
131 }
132 for (MaskSpline &spline : mask_layer.splines) {
133 for (int i = 0; i < spline.tot_point; i++) {
134 MaskSplinePoint *point = &spline.points[i];
136 }
137 }
138 }
139 else {
140 ED_mask_layer_select_set(&mask_layer, (action == SEL_SELECT) ? true : false);
141 }
142 }
143}
144
146{
147 for (MaskLayer &mask_layer : mask->masklayers) {
148 for (MaskSpline &spline : mask_layer.splines) {
149 spline.flag &= ~MASK_SPLINE_SELECT;
150
151 /* Intentionally *don't* do this in the mask layer loop
152 * so we clear flags on all splines. */
153 if (mask_layer.visibility_flag & MASK_HIDE_VIEW) {
154 continue;
155 }
156
157 for (int i = 0; i < spline.tot_point; i++) {
158 MaskSplinePoint *cur_point = &spline.points[i];
159
160 if (BKE_mask_point_selected(cur_point)) {
161 spline.flag |= MASK_SPLINE_SELECT;
162 }
163 else {
164 int j;
165
166 for (j = 0; j < cur_point->tot_uw; j++) {
167 if (cur_point->uw[j].flag & SELECT) {
168 spline.flag |= MASK_SPLINE_SELECT;
169 break;
170 }
171 }
172 }
173 }
174 }
175 }
176}
177
188
190
191/* -------------------------------------------------------------------- */
194
213
215{
216 /* identifiers */
217 ot->name = "(De)select All";
218 ot->description = "Change selection of all curve points";
219 ot->idname = "MASK_OT_select_all";
220
221 /* API callbacks. */
222 ot->exec = select_all_exec;
224
225 /* flags */
227
228 /* properties */
230}
231
233
234/* -------------------------------------------------------------------- */
237
239{
241 MaskLayer *mask_layer;
242 MaskSpline *spline;
243 MaskSplinePoint *point = nullptr;
244 float co[2];
245 bool extend = RNA_boolean_get(op->ptr, "extend");
246 bool deselect = RNA_boolean_get(op->ptr, "deselect");
247 bool toggle = RNA_boolean_get(op->ptr, "toggle");
248 const bool deselect_all = RNA_boolean_get(op->ptr, "deselect_all");
249 eMaskWhichHandle which_handle;
250 const float threshold = 19;
251
252 MaskViewLockState lock_state;
253 ED_mask_view_lock_state_store(C, &lock_state);
254
255 RNA_float_get_array(op->ptr, "location", co);
256
258 C, mask, co, threshold, &mask_layer, &spline, &which_handle, nullptr);
259
260 if (extend == false && deselect == false && toggle == false) {
262 }
263
264 if (point) {
265 if (which_handle != MASK_WHICH_HANDLE_NONE) {
266 if (extend) {
267 mask_layer->act_spline = spline;
268 mask_layer->act_point = point;
269
270 BKE_mask_point_select_set_handle(point, which_handle, true);
271 }
272 else if (deselect) {
273 BKE_mask_point_select_set_handle(point, which_handle, false);
274 }
275 else {
276 mask_layer->act_spline = spline;
277 mask_layer->act_point = point;
278
279 if (!BKE_mask_point_is_handle_selected(point, which_handle)) {
280 BKE_mask_point_select_set_handle(point, which_handle, true);
281 }
282 else if (toggle) {
283 BKE_mask_point_select_set_handle(point, which_handle, false);
284 }
285 }
286 }
287 else {
288 if (extend) {
289 mask_layer->act_spline = spline;
290 mask_layer->act_point = point;
291
292 BKE_mask_point_select_set(point, true);
293 }
294 else if (deselect) {
295 BKE_mask_point_select_set(point, false);
296 }
297 else {
298 mask_layer->act_spline = spline;
299 mask_layer->act_point = point;
300
301 if (!BKE_mask_point_selected(point)) {
302 BKE_mask_point_select_set(point, true);
303 }
304 else if (toggle) {
305 BKE_mask_point_select_set(point, false);
306 }
307 }
308 }
309
310 mask_layer->act_spline = spline;
311 mask_layer->act_point = point;
312
314
317
319
321 }
322
324
326 C, mask, co, threshold, &mask_layer, &spline, &point, &uw, nullptr))
327 {
328
329 if (extend) {
330 mask_layer->act_spline = spline;
331 mask_layer->act_point = point;
332
333 if (uw) {
334 uw->flag |= SELECT;
335 }
336 }
337 else if (deselect) {
338 if (uw) {
339 uw->flag &= ~SELECT;
340 }
341 }
342 else {
343 mask_layer->act_spline = spline;
344 mask_layer->act_point = point;
345
346 if (uw) {
347 if (!(uw->flag & SELECT)) {
348 uw->flag |= SELECT;
349 }
350 else if (toggle) {
351 uw->flag &= ~SELECT;
352 }
353 }
354 }
355
357
360
362
364 }
365 if (deselect_all) {
369 }
370
372}
373
375{
376 ScrArea *area = CTX_wm_area(C);
377 ARegion *region = CTX_wm_region(C);
378
379 float co[2];
380
381 ED_mask_mouse_pos(area, region, event->mval, co);
382
383 RNA_float_set_array(op->ptr, "location", co);
384
385 const wmOperatorStatus retval = select_exec(C, op);
386
388}
389
391{
392 /* identifiers */
393 ot->name = "Select";
394 ot->description = "Select spline points";
395 ot->idname = "MASK_OT_select";
396
397 /* API callbacks. */
398 ot->exec = select_exec;
399 ot->invoke = select_invoke;
402
403 /* flags */
404 ot->flag = OPTYPE_UNDO;
405
406 /* properties */
408
410 "location",
411 2,
412 nullptr,
413 -FLT_MAX,
414 FLT_MAX,
415 "Location",
416 "Location of vertex in normalized space",
417 -1.0f,
418 1.0f);
419}
420
422
423/* -------------------------------------------------------------------- */
426
428{
429 ScrArea *area = CTX_wm_area(C);
430 ARegion *region = CTX_wm_region(C);
431
432 Mask *mask_orig = CTX_data_edit_mask(C);
433 Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
434 Mask *mask_eval = DEG_get_evaluated(depsgraph, mask_orig);
435
436 rcti rect;
437 rctf rectf;
438 bool changed = false;
439
440 const eSelectOp sel_op = eSelectOp(RNA_enum_get(op->ptr, "mode"));
441 const bool select = (sel_op != SEL_OP_SUB);
442 if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
444 changed = true;
445 }
446
447 /* get rectangle from operator */
449
450 ED_mask_point_pos(area, region, rect.xmin, rect.ymin, &rectf.xmin, &rectf.ymin);
451 ED_mask_point_pos(area, region, rect.xmax, rect.ymax, &rectf.xmax, &rectf.ymax);
452
453 /* do actual selection */
454 for (MaskLayer *mask_layer_orig = mask_orig->masklayers.first(),
455 *mask_layer_eval = mask_eval->masklayers.first();
456 mask_layer_orig != nullptr;
457 mask_layer_orig = mask_layer_orig->next, mask_layer_eval = mask_layer_eval->next)
458 {
459 if (mask_layer_orig->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
460 continue;
461 }
462 for (MaskSpline *spline_orig = mask_layer_orig->splines.first(),
463 *spline_eval = mask_layer_eval->splines.first();
464 spline_orig != nullptr;
465 spline_orig = spline_orig->next, spline_eval = spline_eval->next)
466 {
467
468 MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline_eval);
469
470 for (int i = 0; i < spline_orig->tot_point; i++) {
471 MaskSplinePoint *point = &spline_orig->points[i];
472 MaskSplinePoint *point_deform = &points_array[i];
473
474 /* TODO: handles? */
475 /* TODO: uw? */
476 if (BLI_rctf_isect_pt_v(&rectf, point_deform->bezt.vec[1])) {
479 changed = true;
480 }
481 }
482 }
483 }
484
485 if (changed) {
486 ED_mask_select_flush_all(mask_orig);
487
490
491 return OPERATOR_FINISHED;
492 }
493
494 return OPERATOR_CANCELLED;
495}
496
498{
499 /* identifiers */
500 ot->name = "Box Select";
501 ot->description = "Select curve points using box selection";
502 ot->idname = "MASK_OT_select_box";
503
504 /* API callbacks. */
506 ot->exec = box_select_exec;
509
510 /* flags */
511 ot->flag = OPTYPE_UNDO;
512
513 /* properties */
516}
517
519
520/* -------------------------------------------------------------------- */
523
524static bool do_lasso_select_mask(bContext *C, const Span<int2> mcoords, const eSelectOp sel_op)
525{
526 ScrArea *area = CTX_wm_area(C);
527 ARegion *region = CTX_wm_region(C);
528
529 Mask *mask_orig = CTX_data_edit_mask(C);
530 Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
531 Mask *mask_eval = DEG_get_evaluated(depsgraph, mask_orig);
532
533 rcti rect;
534 bool changed = false;
535
536 const bool select = (sel_op != SEL_OP_SUB);
537 if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
539 changed = true;
540 }
541
542 /* get rectangle from operator */
543 BLI_lasso_boundbox(&rect, mcoords);
544
545 /* do actual selection */
546 for (MaskLayer *mask_layer_orig = mask_orig->masklayers.first(),
547 *mask_layer_eval = mask_eval->masklayers.first();
548 mask_layer_orig != nullptr;
549 mask_layer_orig = mask_layer_orig->next, mask_layer_eval = mask_layer_eval->next)
550 {
551 if (mask_layer_orig->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
552 continue;
553 }
554 for (MaskSpline *spline_orig = mask_layer_orig->splines.first(),
555 *spline_eval = mask_layer_eval->splines.first();
556 spline_orig != nullptr;
557 spline_orig = spline_orig->next, spline_eval = spline_eval->next)
558 {
559
560 MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline_eval);
561
562 for (int i = 0; i < spline_orig->tot_point; i++) {
563 MaskSplinePoint *point = &spline_orig->points[i];
564 MaskSplinePoint *point_deform = &points_array[i];
565
566 /* TODO: handles? */
567 /* TODO: uw? */
568
569 if (BKE_mask_point_selected(point) && select) {
570 continue;
571 }
572
573 float screen_co[2];
574
575 /* point in screen coords */
577 region,
578 point_deform->bezt.vec[1][0],
579 point_deform->bezt.vec[1][1],
580 &screen_co[0],
581 &screen_co[1]);
582
583 if (BLI_rcti_isect_pt(&rect, screen_co[0], screen_co[1]) &&
584 BLI_lasso_is_point_inside(mcoords, screen_co[0], screen_co[1], INT_MAX))
585 {
588 changed = true;
589 }
590 }
591 }
592 }
593
594 if (changed) {
595 ED_mask_select_flush_all(mask_orig);
596
599 }
600
601 return changed;
602}
603
605{
606 const Array<int2> mcoords = WM_gesture_lasso_path_to_array(C, op);
607 if (mcoords.is_empty()) {
609 }
610
611 const eSelectOp sel_op = eSelectOp(RNA_enum_get(op->ptr, "mode"));
612 do_lasso_select_mask(C, mcoords, sel_op);
613
614 return OPERATOR_FINISHED;
615}
616
618{
619 /* identifiers */
620 ot->name = "Lasso Select";
621 ot->description = "Select curve points using lasso selection";
622 ot->idname = "MASK_OT_select_lasso";
623
624 /* API callbacks. */
630
631 /* flags */
633
634 /* properties */
637}
638
640
641/* -------------------------------------------------------------------- */
644
646 const float offset[2],
647 const float ellipse[2])
648{
649 /* normalized ellipse: ell[0] = scaleX, ell[1] = scaleY */
650 float x, y;
651
652 x = (bezt->vec[1][0] - offset[0]) * ellipse[0];
653 y = (bezt->vec[1][1] - offset[1]) * ellipse[1];
654
655 return x * x + y * y < 1.0f;
656}
657
659{
660 ScrArea *area = CTX_wm_area(C);
661 ARegion *region = CTX_wm_region(C);
662
663 Mask *mask_orig = CTX_data_edit_mask(C);
664 Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
665 Mask *mask_eval = DEG_get_evaluated(depsgraph, mask_orig);
666
667 float zoomx, zoomy, offset[2], ellipse[2];
668 int width, height;
669 bool changed = false;
670
671 /* get operator properties */
672 const int x = RNA_int_get(op->ptr, "x");
673 const int y = RNA_int_get(op->ptr, "y");
674 const int radius = RNA_int_get(op->ptr, "radius");
675
676 /* compute ellipse and position in unified coordinates */
677 ED_mask_get_size(area, &width, &height);
678 ED_mask_zoom(area, region, &zoomx, &zoomy);
679 width = height = max_ii(width, height);
680
681 ellipse[0] = width * zoomx / radius;
682 ellipse[1] = height * zoomy / radius;
683
684 ED_mask_point_pos(area, region, x, y, &offset[0], &offset[1]);
685
686 const eSelectOp sel_op = ED_select_op_modal(
687 eSelectOp(RNA_enum_get(op->ptr, "mode")),
688 WM_gesture_is_modal_first(static_cast<wmGesture *>(op->customdata)));
689 const bool select = (sel_op != SEL_OP_SUB);
690 if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
692 changed = true;
693 }
694
695 /* do actual selection */
696 for (MaskLayer *mask_layer_orig = mask_orig->masklayers.first(),
697 *mask_layer_eval = mask_eval->masklayers.first();
698 mask_layer_orig != nullptr;
699 mask_layer_orig = mask_layer_orig->next, mask_layer_eval = mask_layer_eval->next)
700 {
701 if (mask_layer_orig->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
702 continue;
703 }
704 for (MaskSpline *spline_orig = mask_layer_orig->splines.first(),
705 *spline_eval = mask_layer_eval->splines.first();
706 spline_orig != nullptr;
707 spline_orig = spline_orig->next, spline_eval = spline_eval->next)
708 {
709
710 MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline_eval);
711
712 for (int i = 0; i < spline_orig->tot_point; i++) {
713 MaskSplinePoint *point = &spline_orig->points[i];
714 MaskSplinePoint *point_deform = &points_array[i];
715
716 if (mask_spline_point_inside_ellipse(&point_deform->bezt, offset, ellipse)) {
719
720 changed = true;
721 }
722 }
723 }
724 }
725
726 if (changed) {
727 ED_mask_select_flush_all(mask_orig);
728
731
732 return OPERATOR_FINISHED;
733 }
734
735 return OPERATOR_CANCELLED;
736}
737
739{
740 /* identifiers */
741 ot->name = "Circle Select";
742 ot->description = "Select curve points using circle selection";
743 ot->idname = "MASK_OT_select_circle";
744
745 /* API callbacks. */
751
752 /* flags */
754
755 /* properties */
758}
759
761
762/* -------------------------------------------------------------------- */
765
767 wmOperator *op,
768 const wmEvent *event)
769{
770 ScrArea *area = CTX_wm_area(C);
771 ARegion *region = CTX_wm_region(C);
772
774 MaskLayer *mask_layer;
775 MaskSpline *spline;
776 MaskSplinePoint *point = nullptr;
777 float co[2];
778 bool do_select = !RNA_boolean_get(op->ptr, "deselect");
779 const float threshold = 19;
780 bool changed = false;
781
782 ED_mask_mouse_pos(area, region, event->mval, co);
783
785 C, mask, co, threshold, &mask_layer, &spline, nullptr, nullptr);
786
787 if (point) {
788 ED_mask_spline_select_set(spline, do_select);
789 mask_layer->act_spline = spline;
790 mask_layer->act_point = point;
791
792 changed = true;
793 }
794
795 if (changed) {
797
800
801 return OPERATOR_FINISHED;
802 }
803
804 return OPERATOR_CANCELLED;
805}
806
808{
809 /* identifiers */
810 ot->name = "Select Linked";
811 ot->idname = "MASK_OT_select_linked_pick";
812 ot->description = "(De)select all points linked to the curve under the mouse cursor";
813
814 /* API callbacks. */
817
818 /* flags */
820
821 RNA_def_boolean(ot->srna, "deselect", false, "Deselect", "");
822}
823
825
826/* -------------------------------------------------------------------- */
829
831{
833
834 bool changed = false;
835
836 /* do actual selection */
837 for (MaskLayer &mask_layer : mask->masklayers) {
838 if (mask_layer.visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
839 continue;
840 }
841
842 for (MaskSpline &spline : mask_layer.splines) {
843 if (ED_mask_spline_select_check(&spline)) {
844 ED_mask_spline_select_set(&spline, true);
845 changed = true;
846 }
847 }
848 }
849
850 if (changed) {
852
855
856 return OPERATOR_FINISHED;
857 }
858
859 return OPERATOR_CANCELLED;
860}
861
863{
864 /* identifiers */
865 ot->name = "Select Linked All";
866 ot->idname = "MASK_OT_select_linked";
867 ot->description = "Select all curve points linked to already selected ones";
868
869 /* API callbacks. */
872
873 /* flags */
875}
876
878
879/* -------------------------------------------------------------------- */
882
884{
886
887 for (MaskLayer &mask_layer : mask->masklayers) {
888 if (mask_layer.visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
889 continue;
890 }
891
892 for (MaskSpline &spline : mask_layer.splines) {
893 const bool cyclic = (spline.flag & MASK_SPLINE_CYCLIC) != 0;
894 bool start_sel, end_sel, prev_sel, cur_sel;
895
896 /* Re-select point if any handle is selected to make the result more predictable. */
897 for (int i = 0; i < spline.tot_point; i++) {
899 }
900
901 /* select more/less does not affect empty/single point splines */
902 if (spline.tot_point < 2) {
903 continue;
904 }
905
906 if (cyclic) {
907 start_sel = BKE_mask_point_selected_knot(spline.points);
908 end_sel = BKE_mask_point_selected_knot(&spline.points[spline.tot_point - 1]);
909 }
910 else {
911 start_sel = false;
912 end_sel = false;
913 }
914
915 for (int i = 0; i < spline.tot_point; i++) {
916 if (i == 0 && !cyclic) {
917 continue;
918 }
919
920 prev_sel = (i > 0) ? BKE_mask_point_selected_knot(&spline.points[i - 1]) : end_sel;
921 cur_sel = BKE_mask_point_selected_knot(&spline.points[i]);
922
923 if (cur_sel != more) {
924 if (prev_sel == more) {
925 BKE_mask_point_select_set(&spline.points[i], more);
926 }
927 i++;
928 }
929 }
930
931 for (int i = spline.tot_point - 1; i >= 0; i--) {
932 if (i == spline.tot_point - 1 && !cyclic) {
933 continue;
934 }
935
936 prev_sel = (i < spline.tot_point - 1) ?
937 BKE_mask_point_selected_knot(&spline.points[i + 1]) :
938 start_sel;
939 cur_sel = BKE_mask_point_selected_knot(&spline.points[i]);
940
941 if (cur_sel != more) {
942 if (prev_sel == more) {
943 BKE_mask_point_select_set(&spline.points[i], more);
944 }
945 i--;
946 }
947 }
948 }
949 }
950
953
954 return OPERATOR_FINISHED;
955}
956
958{
959 return mask_select_more_less(C, true);
960}
961
963{
964 /* identifiers */
965 ot->name = "Select More";
966 ot->idname = "MASK_OT_select_more";
967 ot->description = "Select more spline points connected to initial selection";
968
969 /* API callbacks. */
972
973 /* flags */
975}
976
978{
979 return mask_select_more_less(C, false);
980}
981
983{
984 /* identifiers */
985 ot->name = "Select Less";
986 ot->idname = "MASK_OT_select_less";
987 ot->description = "Deselect spline points at the boundary of each selection region";
988
989 /* API callbacks. */
992
993 /* flags */
995}
996
998
999} // namespace blender
#define SELECT
Definition BKE_mask.hh:19
#define SEL_OP_USE_PRE_DESELECT(sel_op)
#define C
Definition RandGen.cpp:29
#define ND_SELECT
Definition WM_types.hh:551
#define NC_MASK
Definition WM_types.hh:411
bool is_empty() const
Definition BLI_array.hh:275
#define FLT_MAX
#define INT_MAX
BMesh Iterators.
static int mask_spline_point_inside_ellipse(BezTriple *bezt, const float offset[2], const float ellipse[2])
eMaskWhichHandle
Definition BKE_mask.hh:44
@ MASK_WHICH_HANDLE_BOTH
Definition BKE_mask.hh:49
@ MASK_WHICH_HANDLE_NONE
Definition BKE_mask.hh:45
void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values)
std::string ED_select_circle_get_name(wmOperatorType *ot, PointerRNA *ptr)
ScrArea * CTX_wm_area(const bContext *C)
void BKE_mask_point_select_set_handle(MaskSplinePoint *point, eMaskWhichHandle which_handle, bool do_select)
void WM_operator_properties_gesture_circle(wmOperatorType *ot)
int RNA_enum_get(PointerRNA *ptr, const char *name)
static wmOperatorStatus mask_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmEvent *event)
bool BLI_rctf_isect_pt_v(const struct rctf *rect, const float xy[2])
wmOperatorStatus WM_gesture_box_invoke(bContext *C, wmOperator *op, const wmEvent *event)
wmOperatorStatus WM_operator_flag_only_pass_through_on_press(wmOperatorStatus retval, const wmEvent *event)
eSelectOp ED_select_op_modal(eSelectOp sel_op, bool is_first)
void MASK_OT_select_box(wmOperatorType *ot)
static wmOperatorStatus circle_select_exec(bContext *C, wmOperator *op)
void ED_mask_select_toggle_all(Mask *mask, int action)
void ED_mask_view_lock_state_store(const bContext *C, MaskViewLockState *state)
Definition mask_edit.cc:209
void WM_gesture_lasso_cancel(bContext *C, wmOperator *op)
static wmOperatorStatus select_exec(bContext *C, wmOperator *op)
int RNA_int_get(PointerRNA *ptr, const char *name)
MaskSplinePoint * ED_mask_point_find_nearest(const bContext *C, Mask *mask_orig, const float normal_co[2], float threshold, MaskLayer **r_mask_layer, MaskSpline **r_spline, eMaskWhichHandle *r_which_handle, float *r_score)
MINLINE int max_ii(int a, int b)
wmOperatorStatus WM_gesture_lasso_modal(bContext *C, wmOperator *op, const wmEvent *event)
void ED_mask_zoom(ScrArea *area, ARegion *region, float *r_zoomx, float *r_zoomy)
bool BLI_lasso_is_point_inside(Span< int2 > mcoords, int sx, int sy, int error_value)
Definition lasso_2d.cc:42
void MASK_OT_select_circle(wmOperatorType *ot)
void ED_mask_point_pos__reverse(ScrArea *area, ARegion *region, float x, float y, float *r_x, float *r_y)
void WM_operator_properties_select_all(wmOperatorType *ot)
PropertyRNA * RNA_def_float_vector(StructOrFunctionRNA *cont_, const char *identifier, const int len, const float *default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
void MASK_OT_select(wmOperatorType *ot)
static wmOperatorStatus clip_lasso_select_exec(bContext *C, wmOperator *op)
bool ED_mask_spline_select_check(const MaskSpline *spline)
bool BKE_mask_point_selected(const MaskSplinePoint *p)
Definition BKE_mask.hh:155
void DEG_id_tag_update(ID *id, unsigned int flags)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C, bool rna_write_check=false)
static wmOperatorStatus mask_select_more_exec(bContext *C, wmOperator *)
void ED_mask_deselect_all(const bContext *C)
void WM_operator_properties_border_to_rcti(wmOperator *op, rcti *r_rect)
void MASK_OT_select_less(wmOperatorType *ot)
wmOperatorStatus WM_gesture_circle_invoke(bContext *C, wmOperator *op, const wmEvent *event)
bool ED_mask_select_check(const Mask *mask)
@ MASK_SPLINE_CYCLIC
@ MASK_SPLINE_SELECT
void WM_operator_properties_mouse_select(wmOperatorType *ot)
void MASK_OT_select_linked_pick(wmOperatorType *ot)
void BKE_mask_point_select_set(MaskSplinePoint *point, bool do_select)
bool BKE_mask_point_is_handle_selected(const MaskSplinePoint *point, eMaskWhichHandle handle)
Definition BKE_mask.hh:165
void ED_mask_get_size(ScrArea *area, int *r_width, int *r_height)
bool BKE_mask_point_selected_knot(const MaskSplinePoint *p)
Definition BKE_mask.hh:160
void WM_operator_properties_gesture_box(wmOperatorType *ot)
Mask * CTX_data_edit_mask(const bContext *C)
void ED_mask_select_flush_all(Mask *mask)
void ED_mask_view_lock_state_restore_no_jump(const bContext *C, const MaskViewLockState *state)
Definition mask_edit.cc:217
static wmOperatorStatus select_all_exec(bContext *C, wmOperator *op)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
bool ED_maskedit_mask_visible_splines_poll(bContext *C)
Definition mask_edit.cc:77
wmOperatorStatus WM_gesture_box_modal(bContext *C, wmOperator *op, const wmEvent *event)
void ED_mask_layer_select_set(MaskLayer *mask_layer, bool do_select)
void MASK_OT_select_all(wmOperatorType *ot)
void MASK_OT_select_lasso(wmOperatorType *ot)
void MASK_OT_select_more(wmOperatorType *ot)
wmOperatorStatus WM_gesture_lasso_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void ED_mask_point_pos(ScrArea *area, ARegion *region, float x, float y, float *r_x, float *r_y)
void ED_mask_spline_select_set(MaskSpline *spline, bool do_select)
@ ID_RECALC_SELECT
Definition DNA_ID.h:1101
Array< int2 > WM_gesture_lasso_path_to_array(bContext *, wmOperator *op)
static wmOperatorStatus mask_select_less_exec(bContext *C, wmOperator *)
void MASK_OT_select_linked(wmOperatorType *ot)
void WM_operator_properties_select_operation_simple(wmOperatorType *ot)
static bool do_lasso_select_mask(bContext *C, const Span< int2 > mcoords, const eSelectOp sel_op)
@ OPTYPE_REGISTER
Definition WM_types.hh:188
@ OPTYPE_UNDO
Definition WM_types.hh:190
@ OPTYPE_DEPENDS_ON_CURSOR
Definition WM_types.hh:228
bool BLI_rcti_isect_pt(const struct rcti *rect, int x, int y)
static wmOperatorStatus select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
bool ED_mask_layer_select_check(const MaskLayer *mask_layer)
bool WM_gesture_is_modal_first(const wmGesture *gesture)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void ED_mask_mouse_pos(ScrArea *area, ARegion *region, const int mval[2], float r_co[2])
wmOperatorStatus WM_gesture_circle_modal(bContext *C, wmOperator *op, const wmEvent *event)
MaskSplinePoint * BKE_mask_spline_point_array(MaskSpline *spline)
std::string ED_select_pick_get_name(wmOperatorType *ot, PointerRNA *ptr)
ARegion * CTX_wm_region(const bContext *C)
void BLI_lasso_boundbox(rcti *rect, Span< int2 > mcoords)
Definition lasso_2d.cc:21
static wmOperatorStatus mask_select_more_less(bContext *C, bool more)
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
static wmOperatorStatus mask_select_linked_exec(bContext *C, wmOperator *)
void WM_operator_properties_gesture_lasso(wmOperatorType *ot)
static wmOperatorStatus box_select_exec(bContext *C, wmOperator *op)
bool ED_mask_feather_find_nearest(const bContext *C, Mask *mask_orig, const float normal_co[2], float threshold, MaskLayer **r_mask_layer, MaskSpline **r_spline, MaskSplinePoint **r_point, MaskSplinePointUW **r_uw, float *r_score)
struct MaskSplinePoint * act_point
struct MaskSpline * act_spline
MaskLayerVisibility visibility_flag
ListBaseT< MaskSpline > splines
MaskSplinePointUW * uw
MaskSplinePoint * points
struct MaskSpline * next
MaskSplineFlag flag
ListBaseT< struct MaskLayer > masklayers
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1125
const char * description
Definition WM_types.hh:1115
void(*) cancel(bContext *C, wmOperator *op)
Definition WM_types.hh:1149
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1165
wmOperatorStatus(*) invoke(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1141
wmOperatorStatus(*) modal(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1157
std::string(*) get_name(wmOperatorType *ot, PointerRNA *ptr)
Definition WM_types.hh:1191