Blender  V3.3
mask_select.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2012 Blender Foundation. All rights reserved. */
3 
8 #include "MEM_guardedalloc.h"
9 
10 #include "BLI_lasso_2d.h"
11 #include "BLI_listbase.h"
12 #include "BLI_math.h"
13 #include "BLI_rect.h"
14 #include "BLI_utildefines.h"
15 
16 #include "BKE_context.h"
17 #include "BKE_mask.h"
18 
19 #include "DEG_depsgraph.h"
20 #include "DEG_depsgraph_query.h"
21 
22 #include "DNA_mask_types.h"
23 
24 #include "WM_api.h"
25 #include "WM_types.h"
26 
27 #include "ED_clip.h"
28 #include "ED_mask.h" /* own include */
29 #include "ED_select_utils.h"
30 
31 #include "RNA_access.h"
32 #include "RNA_define.h"
33 
34 #include "mask_intern.h" /* own include */
35 
36 /* -------------------------------------------------------------------- */
41 {
42  for (int i = 0; i < spline->tot_point; i++) {
43  MaskSplinePoint *point = &spline->points[i];
44 
46  return true;
47  }
48  }
49 
50  return false;
51 }
52 
53 bool ED_mask_layer_select_check(const MaskLayer *mask_layer)
54 {
55  if (mask_layer->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
56  return false;
57  }
58 
59  LISTBASE_FOREACH (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  LISTBASE_FOREACH (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 
79 void ED_mask_spline_select_set(MaskSpline *spline, const bool do_select)
80 {
81  if (do_select) {
82  spline->flag |= SELECT;
83  }
84  else {
85  spline->flag &= ~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 
95 void 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  LISTBASE_FOREACH (MaskSpline *, spline, &mask_layer->splines) {
104  ED_mask_spline_select_set(spline, do_select);
105  }
106 }
107 
109 {
110  if (action == SEL_TOGGLE) {
111  if (ED_mask_select_check(mask)) {
112  action = SEL_DESELECT;
113  }
114  else {
115  action = SEL_SELECT;
116  }
117  }
118 
119  LISTBASE_FOREACH (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  LISTBASE_FOREACH (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  LISTBASE_FOREACH (MaskLayer *, mask_layer, &mask->masklayers) {
148  LISTBASE_FOREACH (MaskSpline *, spline, &mask_layer->splines) {
149  spline->flag &= ~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 (MASKPOINT_ISSEL_ANY(cur_point)) {
161  spline->flag |= 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 |= SELECT;
169  break;
170  }
171  }
172  }
173  }
174  }
175  }
176 }
177 
179 {
181  if (mask) {
186  }
187 }
188 
191 /* -------------------------------------------------------------------- */
196 {
198  int action = RNA_enum_get(op->ptr, "action");
199 
200  MaskViewLockState lock_state;
201  ED_mask_view_lock_state_store(C, &lock_state);
202 
205 
208 
210 
211  return OPERATOR_FINISHED;
212 }
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 */
224 
225  /* flags */
227 
228  /* properties */
230 }
231 
234 /* -------------------------------------------------------------------- */
238 static int select_exec(bContext *C, wmOperator *op)
239 {
241  MaskLayer *mask_layer;
242  MaskSpline *spline;
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, NULL);
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 (!MASKPOINT_ISSEL_HANDLE(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 
293  }
294  else if (deselect) {
296  }
297  else {
298  mask_layer->act_spline = spline;
299  mask_layer->act_point = point;
300 
301  if (!MASKPOINT_ISSEL_ANY(point)) {
303  }
304  else if (toggle) {
306  }
307  }
308  }
309 
310  mask_layer->act_spline = spline;
311  mask_layer->act_point = point;
312 
314 
317 
319 
321  }
322 
323  MaskSplinePointUW *uw;
324 
326  C, mask, co, threshold, &mask_layer, &spline, &point, &uw, NULL)) {
327 
328  if (extend) {
329  mask_layer->act_spline = spline;
330  mask_layer->act_point = point;
331 
332  if (uw) {
333  uw->flag |= SELECT;
334  }
335  }
336  else if (deselect) {
337  if (uw) {
338  uw->flag &= ~SELECT;
339  }
340  }
341  else {
342  mask_layer->act_spline = spline;
343  mask_layer->act_point = point;
344 
345  if (uw) {
346  if (!(uw->flag & SELECT)) {
347  uw->flag |= SELECT;
348  }
349  else if (toggle) {
350  uw->flag &= ~SELECT;
351  }
352  }
353  }
354 
356 
359 
361 
363  }
364  if (deselect_all) {
368  }
369 
370  return OPERATOR_PASS_THROUGH;
371 }
372 
373 static int select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
374 {
376  ARegion *region = CTX_wm_region(C);
377 
378  float co[2];
379 
380  ED_mask_mouse_pos(area, region, event->mval, co);
381 
382  RNA_float_set_array(op->ptr, "location", co);
383 
384  const int retval = select_exec(C, op);
385 
386  return WM_operator_flag_only_pass_through_on_press(retval, event);
387 }
388 
390 {
391  /* identifiers */
392  ot->name = "Select";
393  ot->description = "Select spline points";
394  ot->idname = "MASK_OT_select";
395 
396  /* api callbacks */
397  ot->exec = select_exec;
401 
402  /* flags */
403  ot->flag = OPTYPE_UNDO;
404 
405  /* properties */
407 
409  "location",
410  2,
411  NULL,
412  -FLT_MAX,
413  FLT_MAX,
414  "Location",
415  "Location of vertex in normalized space",
416  -1.0f,
417  1.0f);
418 }
419 
422 /* -------------------------------------------------------------------- */
427 {
429  ARegion *region = CTX_wm_region(C);
430 
431  Mask *mask_orig = CTX_data_edit_mask(C);
433  Mask *mask_eval = (Mask *)DEG_get_evaluated_id(depsgraph, &mask_orig->id);
434 
435  rcti rect;
436  rctf rectf;
437  bool changed = false;
438 
439  const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
440  const bool select = (sel_op != SEL_OP_SUB);
441  if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
443  changed = true;
444  }
445 
446  /* get rectangle from operator */
448 
449  ED_mask_point_pos(area, region, rect.xmin, rect.ymin, &rectf.xmin, &rectf.ymin);
450  ED_mask_point_pos(area, region, rect.xmax, rect.ymax, &rectf.xmax, &rectf.ymax);
451 
452  /* do actual selection */
453  for (MaskLayer *mask_layer_orig = mask_orig->masklayers.first,
454  *mask_layer_eval = mask_eval->masklayers.first;
455  mask_layer_orig != NULL;
456  mask_layer_orig = mask_layer_orig->next, mask_layer_eval = mask_layer_eval->next) {
457  if (mask_layer_orig->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
458  continue;
459  }
460  for (MaskSpline *spline_orig = mask_layer_orig->splines.first,
461  *spline_eval = mask_layer_eval->splines.first;
462  spline_orig != NULL;
463  spline_orig = spline_orig->next, spline_eval = spline_eval->next) {
464 
465  MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline_eval);
466 
467  for (int i = 0; i < spline_orig->tot_point; i++) {
468  MaskSplinePoint *point = &spline_orig->points[i];
469  MaskSplinePoint *point_deform = &points_array[i];
470 
471  /* TODO: handles? */
472  /* TODO: uw? */
473  if (BLI_rctf_isect_pt_v(&rectf, point_deform->bezt.vec[1])) {
476  changed = true;
477  }
478  }
479  }
480  }
481 
482  if (changed) {
483  ED_mask_select_flush_all(mask_orig);
484 
485  DEG_id_tag_update(&mask_orig->id, ID_RECALC_SELECT);
486  WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask_orig);
487 
488  return OPERATOR_FINISHED;
489  }
490 
491  return OPERATOR_CANCELLED;
492 }
493 
495 {
496  /* identifiers */
497  ot->name = "Box Select";
498  ot->description = "Select curve points using box selection";
499  ot->idname = "MASK_OT_select_box";
500 
501  /* api callbacks */
506 
507  /* flags */
508  ot->flag = OPTYPE_UNDO;
509 
510  /* properties */
513 }
514 
517 /* -------------------------------------------------------------------- */
522  const int mcoords[][2],
523  const int mcoords_len,
524  const eSelectOp sel_op)
525 {
527  ARegion *region = CTX_wm_region(C);
528 
529  Mask *mask_orig = CTX_data_edit_mask(C);
531  Mask *mask_eval = (Mask *)DEG_get_evaluated_id(depsgraph, &mask_orig->id);
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, mcoords_len);
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 != NULL;
549  mask_layer_orig = mask_layer_orig->next, mask_layer_eval = mask_layer_eval->next) {
550  if (mask_layer_orig->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
551  continue;
552  }
553  for (MaskSpline *spline_orig = mask_layer_orig->splines.first,
554  *spline_eval = mask_layer_eval->splines.first;
555  spline_orig != NULL;
556  spline_orig = spline_orig->next, spline_eval = spline_eval->next) {
557 
558  MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline_eval);
559 
560  for (int i = 0; i < spline_orig->tot_point; i++) {
561  MaskSplinePoint *point = &spline_orig->points[i];
562  MaskSplinePoint *point_deform = &points_array[i];
563 
564  /* TODO: handles? */
565  /* TODO: uw? */
566 
567  if (MASKPOINT_ISSEL_ANY(point) && select) {
568  continue;
569  }
570 
571  float screen_co[2];
572 
573  /* point in screen coords */
575  region,
576  point_deform->bezt.vec[1][0],
577  point_deform->bezt.vec[1][1],
578  &screen_co[0],
579  &screen_co[1]);
580 
581  if (BLI_rcti_isect_pt(&rect, screen_co[0], screen_co[1]) &&
582  BLI_lasso_is_point_inside(mcoords, mcoords_len, screen_co[0], screen_co[1], INT_MAX)) {
585  changed = true;
586  }
587  }
588  }
589  }
590 
591  if (changed) {
592  ED_mask_select_flush_all(mask_orig);
593 
594  DEG_id_tag_update(&mask_orig->id, ID_RECALC_SELECT);
595  WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask_orig);
596  }
597 
598  return changed;
599 }
600 
602 {
603  int mcoords_len;
604  const int(*mcoords)[2] = WM_gesture_lasso_path_to_array(C, op, &mcoords_len);
605 
606  if (mcoords) {
607  const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
608  do_lasso_select_mask(C, mcoords, mcoords_len, sel_op);
609 
610  MEM_freeN((void *)mcoords);
611 
612  return OPERATOR_FINISHED;
613  }
614  return OPERATOR_PASS_THROUGH;
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 
641 /* -------------------------------------------------------------------- */
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 {
661  ARegion *region = CTX_wm_region(C);
662 
663  Mask *mask_orig = CTX_data_edit_mask(C);
665  Mask *mask_eval = (Mask *)DEG_get_evaluated_id(depsgraph, &mask_orig->id);
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 */
678  ED_mask_zoom(area, region, &zoomx, &zoomy);
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(RNA_enum_get(op->ptr, "mode"),
688  const bool select = (sel_op != SEL_OP_SUB);
689  if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
691  changed = true;
692  }
693 
694  /* do actual selection */
695  for (MaskLayer *mask_layer_orig = mask_orig->masklayers.first,
696  *mask_layer_eval = mask_eval->masklayers.first;
697  mask_layer_orig != NULL;
698  mask_layer_orig = mask_layer_orig->next, mask_layer_eval = mask_layer_eval->next) {
699  if (mask_layer_orig->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
700  continue;
701  }
702  for (MaskSpline *spline_orig = mask_layer_orig->splines.first,
703  *spline_eval = mask_layer_eval->splines.first;
704  spline_orig != NULL;
705  spline_orig = spline_orig->next, spline_eval = spline_eval->next) {
706 
707  MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline_eval);
708 
709  for (int i = 0; i < spline_orig->tot_point; i++) {
710  MaskSplinePoint *point = &spline_orig->points[i];
711  MaskSplinePoint *point_deform = &points_array[i];
712 
713  if (mask_spline_point_inside_ellipse(&point_deform->bezt, offset, ellipse)) {
716 
717  changed = true;
718  }
719  }
720  }
721  }
722 
723  if (changed) {
724  ED_mask_select_flush_all(mask_orig);
725 
726  DEG_id_tag_update(&mask_orig->id, ID_RECALC_SELECT);
727  WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask_orig);
728 
729  return OPERATOR_FINISHED;
730  }
731 
732  return OPERATOR_CANCELLED;
733 }
734 
736 {
737  /* identifiers */
738  ot->name = "Circle Select";
739  ot->description = "Select curve points using circle selection";
740  ot->idname = "MASK_OT_select_circle";
741 
742  /* api callbacks */
748 
749  /* flags */
751 
752  /* properties */
755 }
756 
759 /* -------------------------------------------------------------------- */
764 {
766  ARegion *region = CTX_wm_region(C);
767 
769  MaskLayer *mask_layer;
770  MaskSpline *spline;
772  float co[2];
773  bool do_select = !RNA_boolean_get(op->ptr, "deselect");
774  const float threshold = 19;
775  bool changed = false;
776 
777  ED_mask_mouse_pos(area, region, event->mval, co);
778 
779  point = ED_mask_point_find_nearest(C, mask, co, threshold, &mask_layer, &spline, NULL, NULL);
780 
781  if (point) {
782  ED_mask_spline_select_set(spline, do_select);
783  mask_layer->act_spline = spline;
784  mask_layer->act_point = point;
785 
786  changed = true;
787  }
788 
789  if (changed) {
791 
794 
795  return OPERATOR_FINISHED;
796  }
797 
798  return OPERATOR_CANCELLED;
799 }
800 
802 {
803  /* identifiers */
804  ot->name = "Select Linked";
805  ot->idname = "MASK_OT_select_linked_pick";
806  ot->description = "(De)select all points linked to the curve under the mouse cursor";
807 
808  /* api callbacks */
811 
812  /* flags */
814 
815  RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "");
816 }
817 
820 /* -------------------------------------------------------------------- */
825 {
827 
828  bool changed = false;
829 
830  /* do actual selection */
831  LISTBASE_FOREACH (MaskLayer *, mask_layer, &mask->masklayers) {
832  if (mask_layer->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
833  continue;
834  }
835 
836  LISTBASE_FOREACH (MaskSpline *, spline, &mask_layer->splines) {
837  if (ED_mask_spline_select_check(spline)) {
838  ED_mask_spline_select_set(spline, true);
839  changed = true;
840  }
841  }
842  }
843 
844  if (changed) {
846 
849 
850  return OPERATOR_FINISHED;
851  }
852 
853  return OPERATOR_CANCELLED;
854 }
855 
857 {
858  /* identifiers */
859  ot->name = "Select Linked All";
860  ot->idname = "MASK_OT_select_linked";
861  ot->description = "Select all curve points linked to already selected ones";
862 
863  /* api callbacks */
866 
867  /* flags */
869 }
870 
873 /* -------------------------------------------------------------------- */
877 static int mask_select_more_less(bContext *C, bool more)
878 {
880 
881  LISTBASE_FOREACH (MaskLayer *, mask_layer, &mask->masklayers) {
882  if (mask_layer->visibility_flag & (MASK_HIDE_VIEW | MASK_HIDE_SELECT)) {
883  continue;
884  }
885 
886  LISTBASE_FOREACH (MaskSpline *, spline, &mask_layer->splines) {
887  const bool cyclic = (spline->flag & MASK_SPLINE_CYCLIC) != 0;
888  bool start_sel, end_sel, prev_sel, cur_sel;
889 
890  /* reselect point if any handle is selected to make the result more predictable */
891  for (int i = 0; i < spline->tot_point; i++) {
892  BKE_mask_point_select_set(spline->points + i, MASKPOINT_ISSEL_ANY(spline->points + i));
893  }
894 
895  /* select more/less does not affect empty/single point splines */
896  if (spline->tot_point < 2) {
897  continue;
898  }
899 
900  if (cyclic) {
901  start_sel = !!MASKPOINT_ISSEL_KNOT(spline->points);
902  end_sel = !!MASKPOINT_ISSEL_KNOT(&spline->points[spline->tot_point - 1]);
903  }
904  else {
905  start_sel = false;
906  end_sel = false;
907  }
908 
909  for (int i = 0; i < spline->tot_point; i++) {
910  if (i == 0 && !cyclic) {
911  continue;
912  }
913 
914  prev_sel = (i > 0) ? !!MASKPOINT_ISSEL_KNOT(&spline->points[i - 1]) : end_sel;
915  cur_sel = !!MASKPOINT_ISSEL_KNOT(&spline->points[i]);
916 
917  if (cur_sel != more) {
918  if (prev_sel == more) {
919  BKE_mask_point_select_set(&spline->points[i], more);
920  }
921  i++;
922  }
923  }
924 
925  for (int i = spline->tot_point - 1; i >= 0; i--) {
926  if (i == spline->tot_point - 1 && !cyclic) {
927  continue;
928  }
929 
930  prev_sel = (i < spline->tot_point - 1) ? !!MASKPOINT_ISSEL_KNOT(&spline->points[i + 1]) :
931  start_sel;
932  cur_sel = !!MASKPOINT_ISSEL_KNOT(&spline->points[i]);
933 
934  if (cur_sel != more) {
935  if (prev_sel == more) {
936  BKE_mask_point_select_set(&spline->points[i], more);
937  }
938  i--;
939  }
940  }
941  }
942  }
943 
946 
947  return OPERATOR_FINISHED;
948 }
949 
951 {
952  return mask_select_more_less(C, true);
953 }
954 
956 {
957  /* identifiers */
958  ot->name = "Select More";
959  ot->idname = "MASK_OT_select_more";
960  ot->description = "Select more spline points connected to initial selection";
961 
962  /* api callbacks */
965 
966  /* flags */
968 }
969 
971 {
972  return mask_select_more_less(C, false);
973 }
974 
976 {
977  /* identifiers */
978  ot->name = "Select Less";
979  ot->idname = "MASK_OT_select_less";
980  ot->description = "Deselect spline points at the boundary of each selection region";
981 
982  /* api callbacks */
985 
986  /* flags */
988 }
989 
struct ScrArea * CTX_wm_area(const bContext *C)
Definition: context.c:738
struct Mask * CTX_data_edit_mask(const bContext *C)
Definition: context.c:1390
struct Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
Definition: context.c:1528
struct ARegion * CTX_wm_region(const bContext *C)
Definition: context.c:749
#define MASKPOINT_ISSEL_ANY(p)
Definition: BKE_mask.h:296
void BKE_mask_point_select_set(struct MaskSplinePoint *point, bool do_select)
Definition: mask.c:955
eMaskWhichHandle
Definition: BKE_mask.h:31
@ MASK_WHICH_HANDLE_NONE
Definition: BKE_mask.h:32
@ MASK_WHICH_HANDLE_BOTH
Definition: BKE_mask.h:36
#define MASKPOINT_ISSEL_KNOT(p)
Definition: BKE_mask.h:297
#define MASKPOINT_ISSEL_HANDLE(point, which_handle)
Definition: BKE_mask.h:299
struct MaskSplinePoint * BKE_mask_spline_point_array(struct MaskSpline *spline)
Definition: mask.c:314
void BKE_mask_point_select_set_handle(struct MaskSplinePoint *point, eMaskWhichHandle which_handle, bool do_select)
Definition: mask.c:974
bool BLI_lasso_is_point_inside(const int mcoords[][2], unsigned int mcoords_len, int sx, int sy, int error_value)
Definition: lasso_2d.c:38
void BLI_lasso_boundbox(struct rcti *rect, const int mcoords[][2], unsigned int mcoords_len)
Definition: lasso_2d.c:15
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:336
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)
#define UNUSED(x)
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:35
void DEG_id_tag_update(struct ID *id, int flag)
struct ID * DEG_get_evaluated_id(const struct Depsgraph *depsgraph, struct ID *id)
@ ID_RECALC_SELECT
Definition: DNA_ID.h:818
#define MASK_HIDE_SELECT
#define MASK_HIDE_VIEW
@ MASK_SPLINE_CYCLIC
@ OPERATOR_CANCELLED
@ OPERATOR_FINISHED
@ OPERATOR_PASS_THROUGH
bool ED_maskedit_mask_visible_splines_poll(struct bContext *C)
Definition: mask_edit.c:77
void ED_mask_zoom(struct ScrArea *area, struct ARegion *region, float *zoomx, float *zoomy)
Definition: mask_query.c:708
void ED_mask_point_pos__reverse(struct ScrArea *area, struct ARegion *region, float x, float y, float *xr, float *yr)
Definition: mask_query.c:548
void ED_mask_mouse_pos(struct ScrArea *area, struct ARegion *region, const int mval[2], float co[2])
Definition: mask_query.c:478
void ED_mask_point_pos(struct ScrArea *area, struct ARegion *region, float x, float y, float *xr, float *yr)
Definition: mask_query.c:511
void ED_mask_get_size(struct ScrArea *area, int *width, int *height)
Definition: mask_query.c:674
eSelectOp ED_select_op_modal(eSelectOp sel_op, bool is_first)
Definition: select_utils.c:59
#define SEL_OP_USE_PRE_DESELECT(sel_op)
const char * ED_select_circle_get_name(struct wmOperatorType *ot, PointerRNA *ptr)
@ SEL_SELECT
@ SEL_INVERT
@ SEL_DESELECT
@ SEL_TOGGLE
void const char * ED_select_pick_get_name(struct wmOperatorType *ot, PointerRNA *ptr)
eSelectOp
@ SEL_OP_SUB
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
Read Guarded memory(de)allocation.
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a point
#define C
Definition: RandGen.cpp:25
@ OPTYPE_DEPENDS_ON_CURSOR
Definition: WM_types.h:184
@ OPTYPE_UNDO
Definition: WM_types.h:148
@ OPTYPE_REGISTER
Definition: WM_types.h:146
#define ND_SELECT
Definition: WM_types.h:455
#define NC_MASK
Definition: WM_types.h:348
__forceinline const avxb select(const avxb &m, const avxb &t, const avxb &f)
Definition: avxb.h:154
#define SELECT
const Depsgraph * depsgraph
ccl_gpu_kernel_postfix ccl_global float int int int int float threshold
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
void ED_mask_view_lock_state_restore_no_jump(const bContext *C, const MaskViewLockState *state)
Definition: mask_edit.c:216
void ED_mask_view_lock_state_store(const bContext *C, MaskViewLockState *state)
Definition: mask_edit.c:208
bool ED_mask_feather_find_nearest(const struct bContext *C, struct Mask *mask, const float normal_co[2], float threshold, struct MaskLayer **r_mask_layer, struct MaskSpline **r_spline, struct MaskSplinePoint **r_point, struct MaskSplinePointUW **r_uw, float *r_score)
struct MaskSplinePoint * ED_mask_point_find_nearest(const struct bContext *C, struct Mask *mask, const float normal_co[2], float threshold, struct MaskLayer **r_mask_layer, struct MaskSpline **r_spline, eMaskWhichHandle *r_which_handle, float *r_score)
void MASK_OT_select_circle(wmOperatorType *ot)
Definition: mask_select.c:735
static int mask_select_more_less(bContext *C, bool more)
Definition: mask_select.c:877
static int select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: mask_select.c:373
bool ED_mask_spline_select_check(const MaskSpline *spline)
Definition: mask_select.c:40
static int select_exec(bContext *C, wmOperator *op)
Definition: mask_select.c:238
void MASK_OT_select_more(wmOperatorType *ot)
Definition: mask_select.c:955
static int select_all_exec(bContext *C, wmOperator *op)
Definition: mask_select.c:195
static int box_select_exec(bContext *C, wmOperator *op)
Definition: mask_select.c:426
void MASK_OT_select(wmOperatorType *ot)
Definition: mask_select.c:389
bool ED_mask_select_check(const Mask *mask)
Definition: mask_select.c:68
static int mask_spline_point_inside_ellipse(BezTriple *bezt, const float offset[2], const float ellipse[2])
Definition: mask_select.c:645
static int clip_lasso_select_exec(bContext *C, wmOperator *op)
Definition: mask_select.c:601
static int mask_select_less_exec(bContext *C, wmOperator *UNUSED(op))
Definition: mask_select.c:970
void ED_mask_layer_select_set(MaskLayer *mask_layer, const bool do_select)
Definition: mask_select.c:95
static int mask_select_linked_exec(bContext *C, wmOperator *UNUSED(op))
Definition: mask_select.c:824
void MASK_OT_select_less(wmOperatorType *ot)
Definition: mask_select.c:975
static int circle_select_exec(bContext *C, wmOperator *op)
Definition: mask_select.c:658
void ED_mask_spline_select_set(MaskSpline *spline, const bool do_select)
Definition: mask_select.c:79
void MASK_OT_select_linked(wmOperatorType *ot)
Definition: mask_select.c:856
bool ED_mask_layer_select_check(const MaskLayer *mask_layer)
Definition: mask_select.c:53
void MASK_OT_select_box(wmOperatorType *ot)
Definition: mask_select.c:494
void ED_mask_select_flush_all(Mask *mask)
Definition: mask_select.c:145
void MASK_OT_select_all(wmOperatorType *ot)
Definition: mask_select.c:214
void MASK_OT_select_lasso(wmOperatorType *ot)
Definition: mask_select.c:617
static bool do_lasso_select_mask(bContext *C, const int mcoords[][2], const int mcoords_len, const eSelectOp sel_op)
Definition: mask_select.c:521
void ED_mask_select_toggle_all(Mask *mask, int action)
Definition: mask_select.c:108
void ED_mask_deselect_all(const bContext *C)
Definition: mask_select.c:178
static int mask_select_more_exec(bContext *C, wmOperator *UNUSED(op))
Definition: mask_select.c:950
static int mask_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: mask_select.c:763
void MASK_OT_select_linked_pick(wmOperatorType *ot)
Definition: mask_select.c:801
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
Definition: math_float4.h:513
static void area(int d1, int d2, int e1, int e2, float weights[2])
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
Definition: rna_access.c:4980
int RNA_int_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:4910
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:4863
void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values)
Definition: rna_access.c:4992
int RNA_enum_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:5004
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3493
PropertyRNA * RNA_def_float_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
Definition: rna_define.c:3862
float vec[3][3]
void * first
Definition: DNA_listBase.h:31
char visibility_flag
ListBase splines
struct MaskSplinePoint * act_point
struct MaskSpline * act_spline
MaskSplinePointUW * uw
MaskSplinePoint * points
ListBase masklayers
float xmax
Definition: DNA_vec_types.h:69
float xmin
Definition: DNA_vec_types.h:69
float ymax
Definition: DNA_vec_types.h:70
float ymin
Definition: DNA_vec_types.h:70
int ymin
Definition: DNA_vec_types.h:64
int ymax
Definition: DNA_vec_types.h:64
int xmin
Definition: DNA_vec_types.h:63
int xmax
Definition: DNA_vec_types.h:63
int mval[2]
Definition: WM_types.h:684
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:919
const char * name
Definition: WM_types.h:888
int(* modal)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:935
const char * idname
Definition: WM_types.h:890
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:943
void(* cancel)(struct bContext *, struct wmOperator *)
Definition: WM_types.h:927
struct StructRNA * srna
Definition: WM_types.h:969
const char * description
Definition: WM_types.h:893
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:903
const char *(* get_name)(struct wmOperatorType *, struct PointerRNA *)
Definition: WM_types.h:960
struct PointerRNA * ptr
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
wmOperatorType * ot
Definition: wm_files.c:3479
bool WM_gesture_is_modal_first(const wmGesture *gesture)
Definition: wm_gesture.c:108
int WM_gesture_box_invoke(bContext *C, wmOperator *op, const wmEvent *event)
int WM_gesture_circle_invoke(bContext *C, wmOperator *op, const wmEvent *event)
int WM_gesture_box_modal(bContext *C, wmOperator *op, const wmEvent *event)
int WM_gesture_circle_modal(bContext *C, wmOperator *op, const wmEvent *event)
int WM_gesture_lasso_modal(bContext *C, wmOperator *op, const wmEvent *event)
void WM_gesture_lasso_cancel(bContext *C, wmOperator *op)
int WM_gesture_lasso_invoke(bContext *C, wmOperator *op, const wmEvent *event)
const int(* WM_gesture_lasso_path_to_array(bContext *UNUSED(C), wmOperator *op, int *r_mcoords_len))[2]
void WM_operator_properties_border_to_rcti(struct wmOperator *op, rcti *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)
int WM_operator_flag_only_pass_through_on_press(int retval, const struct wmEvent *event)