Blender V5.0
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.h"
11#include "BLI_math_base.h"
13#include "BLI_rect.h"
14
15#include "BKE_context.hh"
16#include "BKE_mask.h"
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_clip.hh"
27#include "ED_mask.hh" /* own include */
28#include "ED_select_utils.hh"
29
30#include "RNA_access.hh"
31#include "RNA_define.hh"
32
33#include "mask_intern.hh" /* own include */
34
35using blender::Array;
36using blender::int2;
37using blender::Span;
38
39/* -------------------------------------------------------------------- */
42
44{
45 for (int i = 0; i < spline->tot_point; i++) {
46 MaskSplinePoint *point = &spline->points[i];
47
48 if (MASKPOINT_ISSEL_ANY(point)) {
49 return true;
50 }
51 }
52
53 return false;
54}
55
57{
58 if (mask_layer->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
59 return false;
60 }
61
62 LISTBASE_FOREACH (const MaskSpline *, spline, &mask_layer->splines) {
63 if (ED_mask_spline_select_check(spline)) {
64 return true;
65 }
66 }
67
68 return false;
69}
70
72{
73 LISTBASE_FOREACH (const MaskLayer *, mask_layer, &mask->masklayers) {
74 if (ED_mask_layer_select_check(mask_layer)) {
75 return true;
76 }
77 }
78
79 return false;
80}
81
82void ED_mask_spline_select_set(MaskSpline *spline, const bool do_select)
83{
84 if (do_select) {
85 spline->flag |= SELECT;
86 }
87 else {
88 spline->flag &= ~SELECT;
89 }
90
91 for (int i = 0; i < spline->tot_point; i++) {
92 MaskSplinePoint *point = &spline->points[i];
93
94 BKE_mask_point_select_set(point, do_select);
95 }
96}
97
98void ED_mask_layer_select_set(MaskLayer *mask_layer, const bool do_select)
99{
100 if (mask_layer->visibility_flag & MASK_HIDE_SELECT) {
101 if (do_select == true) {
102 return;
103 }
104 }
105
106 LISTBASE_FOREACH (MaskSpline *, spline, &mask_layer->splines) {
107 ED_mask_spline_select_set(spline, do_select);
108 }
109}
110
112{
113 if (action == SEL_TOGGLE) {
115 action = SEL_DESELECT;
116 }
117 else {
118 action = SEL_SELECT;
119 }
120 }
121
122 LISTBASE_FOREACH (MaskLayer *, mask_layer, &mask->masklayers) {
123
124 if (mask_layer->visibility_flag & MASK_HIDE_VIEW) {
125 continue;
126 }
127
128 if (action == SEL_INVERT) {
129 /* we don't have generic functions for this, its restricted to this operator
130 * if one day we need to re-use such functionality, they can be split out */
131
132 if (mask_layer->visibility_flag & MASK_HIDE_SELECT) {
133 continue;
134 }
135 LISTBASE_FOREACH (MaskSpline *, spline, &mask_layer->splines) {
136 for (int i = 0; i < spline->tot_point; i++) {
137 MaskSplinePoint *point = &spline->points[i];
139 }
140 }
141 }
142 else {
143 ED_mask_layer_select_set(mask_layer, (action == SEL_SELECT) ? true : false);
144 }
145 }
146}
147
149{
150 LISTBASE_FOREACH (MaskLayer *, mask_layer, &mask->masklayers) {
151 LISTBASE_FOREACH (MaskSpline *, spline, &mask_layer->splines) {
152 spline->flag &= ~SELECT;
153
154 /* Intentionally *don't* do this in the mask layer loop
155 * so we clear flags on all splines. */
156 if (mask_layer->visibility_flag & MASK_HIDE_VIEW) {
157 continue;
158 }
159
160 for (int i = 0; i < spline->tot_point; i++) {
161 MaskSplinePoint *cur_point = &spline->points[i];
162
163 if (MASKPOINT_ISSEL_ANY(cur_point)) {
164 spline->flag |= SELECT;
165 }
166 else {
167 int j;
168
169 for (j = 0; j < cur_point->tot_uw; j++) {
170 if (cur_point->uw[j].flag & SELECT) {
171 spline->flag |= SELECT;
172 break;
173 }
174 }
175 }
176 }
177 }
178 }
179}
180
191
193
194/* -------------------------------------------------------------------- */
197
216
218{
219 /* identifiers */
220 ot->name = "(De)select All";
221 ot->description = "Change selection of all curve points";
222 ot->idname = "MASK_OT_select_all";
223
224 /* API callbacks. */
225 ot->exec = select_all_exec;
227
228 /* flags */
230
231 /* properties */
233}
234
236
237/* -------------------------------------------------------------------- */
240
242{
244 MaskLayer *mask_layer;
245 MaskSpline *spline;
246 MaskSplinePoint *point = nullptr;
247 float co[2];
248 bool extend = RNA_boolean_get(op->ptr, "extend");
249 bool deselect = RNA_boolean_get(op->ptr, "deselect");
250 bool toggle = RNA_boolean_get(op->ptr, "toggle");
251 const bool deselect_all = RNA_boolean_get(op->ptr, "deselect_all");
252 eMaskWhichHandle which_handle;
253 const float threshold = 19;
254
255 MaskViewLockState lock_state;
256 ED_mask_view_lock_state_store(C, &lock_state);
257
258 RNA_float_get_array(op->ptr, "location", co);
259
261 C, mask, co, threshold, &mask_layer, &spline, &which_handle, nullptr);
262
263 if (extend == false && deselect == false && toggle == false) {
265 }
266
267 if (point) {
268 if (which_handle != MASK_WHICH_HANDLE_NONE) {
269 if (extend) {
270 mask_layer->act_spline = spline;
271 mask_layer->act_point = point;
272
273 BKE_mask_point_select_set_handle(point, which_handle, true);
274 }
275 else if (deselect) {
276 BKE_mask_point_select_set_handle(point, which_handle, false);
277 }
278 else {
279 mask_layer->act_spline = spline;
280 mask_layer->act_point = point;
281
282 if (!MASKPOINT_ISSEL_HANDLE(point, which_handle)) {
283 BKE_mask_point_select_set_handle(point, which_handle, true);
284 }
285 else if (toggle) {
286 BKE_mask_point_select_set_handle(point, which_handle, false);
287 }
288 }
289 }
290 else {
291 if (extend) {
292 mask_layer->act_spline = spline;
293 mask_layer->act_point = point;
294
295 BKE_mask_point_select_set(point, true);
296 }
297 else if (deselect) {
298 BKE_mask_point_select_set(point, false);
299 }
300 else {
301 mask_layer->act_spline = spline;
302 mask_layer->act_point = point;
303
304 if (!MASKPOINT_ISSEL_ANY(point)) {
305 BKE_mask_point_select_set(point, true);
306 }
307 else if (toggle) {
308 BKE_mask_point_select_set(point, false);
309 }
310 }
311 }
312
313 mask_layer->act_spline = spline;
314 mask_layer->act_point = point;
315
317
320
322
324 }
325
327
329 C, mask, co, threshold, &mask_layer, &spline, &point, &uw, nullptr))
330 {
331
332 if (extend) {
333 mask_layer->act_spline = spline;
334 mask_layer->act_point = point;
335
336 if (uw) {
337 uw->flag |= SELECT;
338 }
339 }
340 else if (deselect) {
341 if (uw) {
342 uw->flag &= ~SELECT;
343 }
344 }
345 else {
346 mask_layer->act_spline = spline;
347 mask_layer->act_point = point;
348
349 if (uw) {
350 if (!(uw->flag & SELECT)) {
351 uw->flag |= SELECT;
352 }
353 else if (toggle) {
354 uw->flag &= ~SELECT;
355 }
356 }
357 }
358
360
363
365
367 }
368 if (deselect_all) {
372 }
373
375}
376
378{
379 ScrArea *area = CTX_wm_area(C);
380 ARegion *region = CTX_wm_region(C);
381
382 float co[2];
383
384 ED_mask_mouse_pos(area, region, event->mval, co);
385
386 RNA_float_set_array(op->ptr, "location", co);
387
388 const wmOperatorStatus retval = select_exec(C, op);
389
391}
392
394{
395 /* identifiers */
396 ot->name = "Select";
397 ot->description = "Select spline points";
398 ot->idname = "MASK_OT_select";
399
400 /* API callbacks. */
401 ot->exec = select_exec;
402 ot->invoke = select_invoke;
404 ot->get_name = ED_select_pick_get_name;
405
406 /* flags */
407 ot->flag = OPTYPE_UNDO;
408
409 /* properties */
411
413 "location",
414 2,
415 nullptr,
416 -FLT_MAX,
417 FLT_MAX,
418 "Location",
419 "Location of vertex in normalized space",
420 -1.0f,
421 1.0f);
422}
423
425
426/* -------------------------------------------------------------------- */
429
431{
432 ScrArea *area = CTX_wm_area(C);
433 ARegion *region = CTX_wm_region(C);
434
435 Mask *mask_orig = CTX_data_edit_mask(C);
437 Mask *mask_eval = DEG_get_evaluated(depsgraph, mask_orig);
438
439 rcti rect;
440 rctf rectf;
441 bool changed = false;
442
443 const eSelectOp sel_op = eSelectOp(RNA_enum_get(op->ptr, "mode"));
444 const bool select = (sel_op != SEL_OP_SUB);
445 if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
447 changed = true;
448 }
449
450 /* get rectangle from operator */
452
453 ED_mask_point_pos(area, region, rect.xmin, rect.ymin, &rectf.xmin, &rectf.ymin);
454 ED_mask_point_pos(area, region, rect.xmax, rect.ymax, &rectf.xmax, &rectf.ymax);
455
456 /* do actual selection */
457 for (MaskLayer *mask_layer_orig = static_cast<MaskLayer *>(mask_orig->masklayers.first),
458 *mask_layer_eval = static_cast<MaskLayer *>(mask_eval->masklayers.first);
459 mask_layer_orig != nullptr;
460 mask_layer_orig = mask_layer_orig->next, mask_layer_eval = mask_layer_eval->next)
461 {
462 if (mask_layer_orig->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
463 continue;
464 }
465 for (MaskSpline *spline_orig = static_cast<MaskSpline *>(mask_layer_orig->splines.first),
466 *spline_eval = static_cast<MaskSpline *>(mask_layer_eval->splines.first);
467 spline_orig != nullptr;
468 spline_orig = spline_orig->next, spline_eval = spline_eval->next)
469 {
470
471 MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline_eval);
472
473 for (int i = 0; i < spline_orig->tot_point; i++) {
474 MaskSplinePoint *point = &spline_orig->points[i];
475 MaskSplinePoint *point_deform = &points_array[i];
476
477 /* TODO: handles? */
478 /* TODO: uw? */
479 if (BLI_rctf_isect_pt_v(&rectf, point_deform->bezt.vec[1])) {
482 changed = true;
483 }
484 }
485 }
486 }
487
488 if (changed) {
489 ED_mask_select_flush_all(mask_orig);
490
493
494 return OPERATOR_FINISHED;
495 }
496
497 return OPERATOR_CANCELLED;
498}
499
501{
502 /* identifiers */
503 ot->name = "Box Select";
504 ot->description = "Select curve points using box selection";
505 ot->idname = "MASK_OT_select_box";
506
507 /* API callbacks. */
508 ot->invoke = WM_gesture_box_invoke;
509 ot->exec = box_select_exec;
510 ot->modal = WM_gesture_box_modal;
512
513 /* flags */
514 ot->flag = OPTYPE_UNDO;
515
516 /* properties */
519}
520
522
523/* -------------------------------------------------------------------- */
526
527static bool do_lasso_select_mask(bContext *C, const Span<int2> mcoords, const eSelectOp sel_op)
528{
529 ScrArea *area = CTX_wm_area(C);
530 ARegion *region = CTX_wm_region(C);
531
532 Mask *mask_orig = CTX_data_edit_mask(C);
534 Mask *mask_eval = DEG_get_evaluated(depsgraph, mask_orig);
535
536 rcti rect;
537 bool changed = false;
538
539 const bool select = (sel_op != SEL_OP_SUB);
540 if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
542 changed = true;
543 }
544
545 /* get rectangle from operator */
546 BLI_lasso_boundbox(&rect, mcoords);
547
548 /* do actual selection */
549 for (MaskLayer *mask_layer_orig = static_cast<MaskLayer *>(mask_orig->masklayers.first),
550 *mask_layer_eval = static_cast<MaskLayer *>(mask_eval->masklayers.first);
551 mask_layer_orig != nullptr;
552 mask_layer_orig = mask_layer_orig->next, mask_layer_eval = mask_layer_eval->next)
553 {
554 if (mask_layer_orig->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
555 continue;
556 }
557 for (MaskSpline *spline_orig = static_cast<MaskSpline *>(mask_layer_orig->splines.first),
558 *spline_eval = static_cast<MaskSpline *>(mask_layer_eval->splines.first);
559 spline_orig != nullptr;
560 spline_orig = spline_orig->next, spline_eval = spline_eval->next)
561 {
562
563 MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline_eval);
564
565 for (int i = 0; i < spline_orig->tot_point; i++) {
566 MaskSplinePoint *point = &spline_orig->points[i];
567 MaskSplinePoint *point_deform = &points_array[i];
568
569 /* TODO: handles? */
570 /* TODO: uw? */
571
572 if (MASKPOINT_ISSEL_ANY(point) && select) {
573 continue;
574 }
575
576 float screen_co[2];
577
578 /* point in screen coords */
580 region,
581 point_deform->bezt.vec[1][0],
582 point_deform->bezt.vec[1][1],
583 &screen_co[0],
584 &screen_co[1]);
585
586 if (BLI_rcti_isect_pt(&rect, screen_co[0], screen_co[1]) &&
587 BLI_lasso_is_point_inside(mcoords, screen_co[0], screen_co[1], INT_MAX))
588 {
591 changed = true;
592 }
593 }
594 }
595 }
596
597 if (changed) {
598 ED_mask_select_flush_all(mask_orig);
599
602 }
603
604 return changed;
605}
606
608{
609 const Array<int2> mcoords = WM_gesture_lasso_path_to_array(C, op);
610 if (mcoords.is_empty()) {
612 }
613
614 const eSelectOp sel_op = eSelectOp(RNA_enum_get(op->ptr, "mode"));
615 do_lasso_select_mask(C, mcoords, sel_op);
616
617 return OPERATOR_FINISHED;
618}
619
621{
622 /* identifiers */
623 ot->name = "Lasso Select";
624 ot->description = "Select curve points using lasso selection";
625 ot->idname = "MASK_OT_select_lasso";
626
627 /* API callbacks. */
628 ot->invoke = WM_gesture_lasso_invoke;
629 ot->modal = WM_gesture_lasso_modal;
632 ot->cancel = WM_gesture_lasso_cancel;
633
634 /* flags */
636
637 /* properties */
640}
641
643
644/* -------------------------------------------------------------------- */
647
649 const float offset[2],
650 const float ellipse[2])
651{
652 /* normalized ellipse: ell[0] = scaleX, ell[1] = scaleY */
653 float x, y;
654
655 x = (bezt->vec[1][0] - offset[0]) * ellipse[0];
656 y = (bezt->vec[1][1] - offset[1]) * ellipse[1];
657
658 return x * x + y * y < 1.0f;
659}
660
662{
663 ScrArea *area = CTX_wm_area(C);
664 ARegion *region = CTX_wm_region(C);
665
666 Mask *mask_orig = CTX_data_edit_mask(C);
668 Mask *mask_eval = DEG_get_evaluated(depsgraph, mask_orig);
669
670 float zoomx, zoomy, offset[2], ellipse[2];
671 int width, height;
672 bool changed = false;
673
674 /* get operator properties */
675 const int x = RNA_int_get(op->ptr, "x");
676 const int y = RNA_int_get(op->ptr, "y");
677 const int radius = RNA_int_get(op->ptr, "radius");
678
679 /* compute ellipse and position in unified coordinates */
680 ED_mask_get_size(area, &width, &height);
681 ED_mask_zoom(area, region, &zoomx, &zoomy);
682 width = height = max_ii(width, height);
683
684 ellipse[0] = width * zoomx / radius;
685 ellipse[1] = height * zoomy / radius;
686
687 ED_mask_point_pos(area, region, x, y, &offset[0], &offset[1]);
688
689 const eSelectOp sel_op = ED_select_op_modal(
690 eSelectOp(RNA_enum_get(op->ptr, "mode")),
691 WM_gesture_is_modal_first(static_cast<wmGesture *>(op->customdata)));
692 const bool select = (sel_op != SEL_OP_SUB);
693 if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
695 changed = true;
696 }
697
698 /* do actual selection */
699 for (MaskLayer *mask_layer_orig = static_cast<MaskLayer *>(mask_orig->masklayers.first),
700 *mask_layer_eval = static_cast<MaskLayer *>(mask_eval->masklayers.first);
701 mask_layer_orig != nullptr;
702 mask_layer_orig = mask_layer_orig->next, mask_layer_eval = mask_layer_eval->next)
703 {
704 if (mask_layer_orig->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
705 continue;
706 }
707 for (MaskSpline *spline_orig = static_cast<MaskSpline *>(mask_layer_orig->splines.first),
708 *spline_eval = static_cast<MaskSpline *>(mask_layer_eval->splines.first);
709 spline_orig != nullptr;
710 spline_orig = spline_orig->next, spline_eval = spline_eval->next)
711 {
712
713 MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline_eval);
714
715 for (int i = 0; i < spline_orig->tot_point; i++) {
716 MaskSplinePoint *point = &spline_orig->points[i];
717 MaskSplinePoint *point_deform = &points_array[i];
718
719 if (mask_spline_point_inside_ellipse(&point_deform->bezt, offset, ellipse)) {
722
723 changed = true;
724 }
725 }
726 }
727 }
728
729 if (changed) {
730 ED_mask_select_flush_all(mask_orig);
731
734
735 return OPERATOR_FINISHED;
736 }
737
738 return OPERATOR_CANCELLED;
739}
740
742{
743 /* identifiers */
744 ot->name = "Circle Select";
745 ot->description = "Select curve points using circle selection";
746 ot->idname = "MASK_OT_select_circle";
747
748 /* API callbacks. */
751 ot->exec = circle_select_exec;
753 ot->get_name = ED_select_circle_get_name;
754
755 /* flags */
757
758 /* properties */
761}
762
764
765/* -------------------------------------------------------------------- */
768
770 wmOperator *op,
771 const wmEvent *event)
772{
773 ScrArea *area = CTX_wm_area(C);
774 ARegion *region = CTX_wm_region(C);
775
777 MaskLayer *mask_layer;
778 MaskSpline *spline;
779 MaskSplinePoint *point = nullptr;
780 float co[2];
781 bool do_select = !RNA_boolean_get(op->ptr, "deselect");
782 const float threshold = 19;
783 bool changed = false;
784
785 ED_mask_mouse_pos(area, region, event->mval, co);
786
788 C, mask, co, threshold, &mask_layer, &spline, nullptr, nullptr);
789
790 if (point) {
791 ED_mask_spline_select_set(spline, do_select);
792 mask_layer->act_spline = spline;
793 mask_layer->act_point = point;
794
795 changed = true;
796 }
797
798 if (changed) {
800
803
804 return OPERATOR_FINISHED;
805 }
806
807 return OPERATOR_CANCELLED;
808}
809
811{
812 /* identifiers */
813 ot->name = "Select Linked";
814 ot->idname = "MASK_OT_select_linked_pick";
815 ot->description = "(De)select all points linked to the curve under the mouse cursor";
816
817 /* API callbacks. */
820
821 /* flags */
823
824 RNA_def_boolean(ot->srna, "deselect", false, "Deselect", "");
825}
826
828
829/* -------------------------------------------------------------------- */
832
834{
836
837 bool changed = false;
838
839 /* do actual selection */
840 LISTBASE_FOREACH (MaskLayer *, mask_layer, &mask->masklayers) {
841 if (mask_layer->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
842 continue;
843 }
844
845 LISTBASE_FOREACH (MaskSpline *, spline, &mask_layer->splines) {
846 if (ED_mask_spline_select_check(spline)) {
847 ED_mask_spline_select_set(spline, true);
848 changed = true;
849 }
850 }
851 }
852
853 if (changed) {
855
858
859 return OPERATOR_FINISHED;
860 }
861
862 return OPERATOR_CANCELLED;
863}
864
866{
867 /* identifiers */
868 ot->name = "Select Linked All";
869 ot->idname = "MASK_OT_select_linked";
870 ot->description = "Select all curve points linked to already selected ones";
871
872 /* API callbacks. */
875
876 /* flags */
878}
879
881
882/* -------------------------------------------------------------------- */
885
887{
889
890 LISTBASE_FOREACH (MaskLayer *, mask_layer, &mask->masklayers) {
891 if (mask_layer->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
892 continue;
893 }
894
895 LISTBASE_FOREACH (MaskSpline *, spline, &mask_layer->splines) {
896 const bool cyclic = (spline->flag & MASK_SPLINE_CYCLIC) != 0;
897 bool start_sel, end_sel, prev_sel, cur_sel;
898
899 /* Re-select point if any handle is selected to make the result more predictable. */
900 for (int i = 0; i < spline->tot_point; i++) {
901 BKE_mask_point_select_set(spline->points + i, MASKPOINT_ISSEL_ANY(spline->points + i));
902 }
903
904 /* select more/less does not affect empty/single point splines */
905 if (spline->tot_point < 2) {
906 continue;
907 }
908
909 if (cyclic) {
910 start_sel = !!MASKPOINT_ISSEL_KNOT(spline->points);
911 end_sel = !!MASKPOINT_ISSEL_KNOT(&spline->points[spline->tot_point - 1]);
912 }
913 else {
914 start_sel = false;
915 end_sel = false;
916 }
917
918 for (int i = 0; i < spline->tot_point; i++) {
919 if (i == 0 && !cyclic) {
920 continue;
921 }
922
923 prev_sel = (i > 0) ? !!MASKPOINT_ISSEL_KNOT(&spline->points[i - 1]) : end_sel;
924 cur_sel = !!MASKPOINT_ISSEL_KNOT(&spline->points[i]);
925
926 if (cur_sel != more) {
927 if (prev_sel == more) {
928 BKE_mask_point_select_set(&spline->points[i], more);
929 }
930 i++;
931 }
932 }
933
934 for (int i = spline->tot_point - 1; i >= 0; i--) {
935 if (i == spline->tot_point - 1 && !cyclic) {
936 continue;
937 }
938
939 prev_sel = (i < spline->tot_point - 1) ? !!MASKPOINT_ISSEL_KNOT(&spline->points[i + 1]) :
940 start_sel;
941 cur_sel = !!MASKPOINT_ISSEL_KNOT(&spline->points[i]);
942
943 if (cur_sel != more) {
944 if (prev_sel == more) {
945 BKE_mask_point_select_set(&spline->points[i], more);
946 }
947 i--;
948 }
949 }
950 }
951 }
952
955
956 return OPERATOR_FINISHED;
957}
958
960{
961 return mask_select_more_less(C, true);
962}
963
965{
966 /* identifiers */
967 ot->name = "Select More";
968 ot->idname = "MASK_OT_select_more";
969 ot->description = "Select more spline points connected to initial selection";
970
971 /* API callbacks. */
974
975 /* flags */
977}
978
980{
981 return mask_select_more_less(C, false);
982}
983
985{
986 /* identifiers */
987 ot->name = "Select Less";
988 ot->idname = "MASK_OT_select_less";
989 ot->description = "Deselect spline points at the boundary of each selection region";
990
991 /* API callbacks. */
994
995 /* flags */
997}
998
Mask * CTX_data_edit_mask(const bContext *C)
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
ScrArea * CTX_wm_area(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
#define MASKPOINT_ISSEL_ANY(p)
Definition BKE_mask.h:292
void BKE_mask_point_select_set(struct MaskSplinePoint *point, bool do_select)
eMaskWhichHandle
Definition BKE_mask.h:28
@ MASK_WHICH_HANDLE_NONE
Definition BKE_mask.h:29
@ MASK_WHICH_HANDLE_BOTH
Definition BKE_mask.h:33
#define MASKPOINT_ISSEL_KNOT(p)
Definition BKE_mask.h:293
#define MASKPOINT_ISSEL_HANDLE(point, which_handle)
Definition BKE_mask.h:295
void BKE_mask_point_select_set_handle(struct MaskSplinePoint *point, eMaskWhichHandle which_handle, bool do_select)
struct MaskSplinePoint * BKE_mask_spline_point_array(struct MaskSpline *spline)
bool BLI_lasso_is_point_inside(blender::Span< blender::int2 > mcoords, int sx, int sy, int error_value)
void BLI_lasso_boundbox(rcti *rect, blender::Span< blender::int2 > mcoords)
#define LISTBASE_FOREACH(type, var, list)
MINLINE int max_ii(int a, int b)
bool BLI_rctf_isect_pt_v(const struct rctf *rect, const float xy[2])
bool BLI_rcti_isect_pt(const struct rcti *rect, int x, int y)
void DEG_id_tag_update(ID *id, unsigned int flags)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
@ ID_RECALC_SELECT
Definition DNA_ID.h:1101
@ MASK_HIDE_SELECT
@ MASK_HIDE_VIEW
@ MASK_SPLINE_CYCLIC
@ OPERATOR_CANCELLED
@ OPERATOR_FINISHED
@ OPERATOR_PASS_THROUGH
void ED_mask_mouse_pos(ScrArea *area, ARegion *region, const int mval[2], float r_co[2])
void ED_mask_point_pos(ScrArea *area, ARegion *region, float x, float y, float *r_x, float *r_y)
void ED_mask_zoom(ScrArea *area, ARegion *region, float *r_zoomx, float *r_zoomy)
void ED_mask_get_size(ScrArea *area, int *r_width, int *r_height)
void ED_mask_point_pos__reverse(ScrArea *area, ARegion *region, float x, float y, float *r_x, float *r_y)
bool ED_maskedit_mask_visible_splines_poll(bContext *C)
Definition mask_edit.cc:76
eSelectOp
@ SEL_OP_SUB
eSelectOp ED_select_op_modal(eSelectOp sel_op, bool is_first)
@ SEL_SELECT
@ SEL_INVERT
@ SEL_DESELECT
@ SEL_TOGGLE
#define SEL_OP_USE_PRE_DESELECT(sel_op)
std::string ED_select_circle_get_name(wmOperatorType *ot, PointerRNA *ptr)
std::string ED_select_pick_get_name(wmOperatorType *ot, PointerRNA *ptr)
#define C
Definition RandGen.cpp:29
@ OPTYPE_DEPENDS_ON_CURSOR
Definition WM_types.hh:218
@ OPTYPE_UNDO
Definition WM_types.hh:182
@ OPTYPE_REGISTER
Definition WM_types.hh:180
#define ND_SELECT
Definition WM_types.hh:508
#define NC_MASK
Definition WM_types.hh:398
BPy_StructRNA * depsgraph
bool is_empty() const
Definition BLI_array.hh:264
#define SELECT
#define select(A, B, C)
void ED_mask_view_lock_state_restore_no_jump(const bContext *C, const MaskViewLockState *state)
Definition mask_edit.cc:215
void ED_mask_view_lock_state_store(const bContext *C, MaskViewLockState *state)
Definition mask_edit.cc:207
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)
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)
void MASK_OT_select_circle(wmOperatorType *ot)
static wmOperatorStatus box_select_exec(bContext *C, wmOperator *op)
bool ED_mask_spline_select_check(const MaskSpline *spline)
static wmOperatorStatus mask_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus mask_select_less_exec(bContext *C, wmOperator *)
void MASK_OT_select_more(wmOperatorType *ot)
void MASK_OT_select(wmOperatorType *ot)
bool ED_mask_select_check(const Mask *mask)
static int mask_spline_point_inside_ellipse(BezTriple *bezt, const float offset[2], const float ellipse[2])
static wmOperatorStatus select_exec(bContext *C, wmOperator *op)
static wmOperatorStatus select_all_exec(bContext *C, wmOperator *op)
void ED_mask_layer_select_set(MaskLayer *mask_layer, const bool do_select)
static bool do_lasso_select_mask(bContext *C, const Span< int2 > mcoords, const eSelectOp sel_op)
void MASK_OT_select_less(wmOperatorType *ot)
void ED_mask_spline_select_set(MaskSpline *spline, const bool do_select)
void MASK_OT_select_linked(wmOperatorType *ot)
bool ED_mask_layer_select_check(const MaskLayer *mask_layer)
static wmOperatorStatus circle_select_exec(bContext *C, wmOperator *op)
void MASK_OT_select_box(wmOperatorType *ot)
static wmOperatorStatus clip_lasso_select_exec(bContext *C, wmOperator *op)
static wmOperatorStatus mask_select_more_less(bContext *C, bool more)
void ED_mask_select_flush_all(Mask *mask)
static wmOperatorStatus select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void MASK_OT_select_all(wmOperatorType *ot)
static wmOperatorStatus mask_select_more_exec(bContext *C, wmOperator *)
void MASK_OT_select_lasso(wmOperatorType *ot)
void ED_mask_select_toggle_all(Mask *mask, int action)
void ED_mask_deselect_all(const bContext *C)
static wmOperatorStatus mask_select_linked_exec(bContext *C, wmOperator *)
void MASK_OT_select_linked_pick(wmOperatorType *ot)
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
VecBase< int32_t, 2 > int2
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
int RNA_int_get(PointerRNA *ptr, const char *name)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values)
int RNA_enum_get(PointerRNA *ptr, const char *name)
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)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
#define FLT_MAX
Definition stdcycles.h:14
float vec[3][3]
void * first
struct MaskLayer * next
char visibility_flag
ListBase splines
struct MaskSplinePoint * act_point
struct MaskSpline * act_spline
MaskSplinePointUW * uw
struct MaskSpline * next
MaskSplinePoint * points
ListBase masklayers
float xmax
float xmin
float ymax
float ymin
int ymin
int ymax
int xmin
int xmax
int mval[2]
Definition WM_types.hh:763
struct PointerRNA * ptr
i
Definition text_draw.cc:230
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
wmOperatorType * ot
Definition wm_files.cc:4237
bool WM_gesture_is_modal_first(const wmGesture *gesture)
wmOperatorStatus WM_gesture_circle_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Array< int2 > WM_gesture_lasso_path_to_array(bContext *, wmOperator *op)
wmOperatorStatus WM_gesture_lasso_modal(bContext *C, wmOperator *op, const wmEvent *event)
wmOperatorStatus WM_gesture_box_modal(bContext *C, wmOperator *op, const wmEvent *event)
wmOperatorStatus WM_gesture_box_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void WM_gesture_lasso_cancel(bContext *C, wmOperator *op)
wmOperatorStatus WM_gesture_circle_modal(bContext *C, wmOperator *op, const wmEvent *event)
wmOperatorStatus WM_gesture_lasso_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void WM_operator_properties_border_to_rcti(wmOperator *op, rcti *r_rect)
void WM_operator_properties_gesture_box(wmOperatorType *ot)
void WM_operator_properties_select_operation_simple(wmOperatorType *ot)
void WM_operator_properties_gesture_lasso(wmOperatorType *ot)
void WM_operator_properties_gesture_circle(wmOperatorType *ot)
void WM_operator_properties_select_all(wmOperatorType *ot)
void WM_operator_properties_mouse_select(wmOperatorType *ot)
wmOperatorStatus WM_operator_flag_only_pass_through_on_press(wmOperatorStatus retval, const wmEvent *event)