Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2020-03-26 23:03:42 +0300
committerJulian Eisel <julian@blender.org>2020-03-26 23:18:45 +0300
commitc94b6209861ca7cc3985b53474feed7d94c0221a (patch)
tree752054f0dca1338cda5cf8ad4f6d18573fcca3b9 /source/blender/editors/mask/mask_select.c
parent357ed79cb93f9d655501a828c6cddd68282de62d (diff)
parentafb1a64ccb81b7ed792f64151986f40f53af8da5 (diff)
Merge branch 'master' into wm-drag-drop-rewrite
Diffstat (limited to 'source/blender/editors/mask/mask_select.c')
-rw-r--r--source/blender/editors/mask/mask_select.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/source/blender/editors/mask/mask_select.c b/source/blender/editors/mask/mask_select.c
index 656c055a7d9..53ef398ccd6 100644
--- a/source/blender/editors/mask/mask_select.c
+++ b/source/blender/editors/mask/mask_select.c
@@ -23,10 +23,10 @@
#include "MEM_guardedalloc.h"
-#include "BLI_utildefines.h"
-#include "BLI_rect.h"
#include "BLI_lasso_2d.h"
#include "BLI_math.h"
+#include "BLI_rect.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_mask.h"
@@ -37,9 +37,9 @@
#include "WM_types.h"
#include "ED_clip.h"
+#include "ED_mask.h" /* own include */
#include "ED_screen.h"
#include "ED_select_utils.h"
-#include "ED_mask.h" /* own include */
#include "RNA_access.h"
#include "RNA_define.h"
@@ -53,7 +53,7 @@
* \{ */
/* 'check' select */
-bool ED_mask_spline_select_check(MaskSpline *spline)
+bool ED_mask_spline_select_check(const MaskSpline *spline)
{
int i;
@@ -68,13 +68,13 @@ bool ED_mask_spline_select_check(MaskSpline *spline)
return false;
}
-bool ED_mask_layer_select_check(MaskLayer *mask_layer)
+bool ED_mask_layer_select_check(const MaskLayer *mask_layer)
{
if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
return false;
}
- for (MaskSpline *spline = mask_layer->splines.first; spline; spline = spline->next) {
+ for (const MaskSpline *spline = mask_layer->splines.first; spline; spline = spline->next) {
if (ED_mask_spline_select_check(spline)) {
return true;
}
@@ -83,9 +83,10 @@ bool ED_mask_layer_select_check(MaskLayer *mask_layer)
return false;
}
-bool ED_mask_select_check(Mask *mask)
+bool ED_mask_select_check(const Mask *mask)
{
- for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
+ for (const MaskLayer *mask_layer = mask->masklayers.first; mask_layer;
+ mask_layer = mask_layer->next) {
if (ED_mask_layer_select_check(mask_layer)) {
return true;
}
@@ -386,11 +387,11 @@ static int select_exec(bContext *C, wmOperator *op)
static int select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float co[2];
- ED_mask_mouse_pos(sa, ar, event->mval, co);
+ ED_mask_mouse_pos(sa, region, event->mval, co);
RNA_float_set_array(op->ptr, "location", co);
@@ -436,7 +437,7 @@ void MASK_OT_select(wmOperatorType *ot)
static int box_select_exec(bContext *C, wmOperator *op)
{
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Mask *mask = CTX_data_edit_mask(C);
@@ -454,8 +455,8 @@ static int box_select_exec(bContext *C, wmOperator *op)
/* get rectangle from operator */
WM_operator_properties_border_to_rcti(op, &rect);
- ED_mask_point_pos(sa, ar, rect.xmin, rect.ymin, &rectf.xmin, &rectf.ymin);
- ED_mask_point_pos(sa, ar, rect.xmax, rect.ymax, &rectf.xmax, &rectf.ymax);
+ ED_mask_point_pos(sa, region, rect.xmin, rect.ymin, &rectf.xmin, &rectf.ymin);
+ ED_mask_point_pos(sa, region, rect.xmax, rect.ymax, &rectf.xmax, &rectf.ymax);
/* do actual selection */
for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
@@ -526,7 +527,7 @@ static bool do_lasso_select_mask(bContext *C,
const eSelectOp sel_op)
{
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Mask *mask = CTX_data_edit_mask(C);
@@ -566,7 +567,7 @@ static bool do_lasso_select_mask(bContext *C,
/* point in screen coords */
ED_mask_point_pos__reverse(sa,
- ar,
+ region,
point_deform->bezt.vec[1][0],
point_deform->bezt.vec[1][1],
&screen_co[0],
@@ -652,7 +653,7 @@ static int mask_spline_point_inside_ellipse(BezTriple *bezt,
static int circle_select_exec(bContext *C, wmOperator *op)
{
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Mask *mask = CTX_data_edit_mask(C);
int i;
@@ -668,13 +669,13 @@ static int circle_select_exec(bContext *C, wmOperator *op)
/* compute ellipse and position in unified coordinates */
ED_mask_get_size(sa, &width, &height);
- ED_mask_zoom(sa, ar, &zoomx, &zoomy);
+ ED_mask_zoom(sa, region, &zoomx, &zoomy);
width = height = max_ii(width, height);
ellipse[0] = width * zoomx / radius;
ellipse[1] = height * zoomy / radius;
- ED_mask_point_pos(sa, ar, x, y, &offset[0], &offset[1]);
+ ED_mask_point_pos(sa, region, x, y, &offset[0], &offset[1]);
const eSelectOp sel_op = ED_select_op_modal(RNA_enum_get(op->ptr, "mode"),
WM_gesture_is_modal_first(op->customdata));
@@ -749,7 +750,7 @@ void MASK_OT_select_circle(wmOperatorType *ot)
static int mask_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Mask *mask = CTX_data_edit_mask(C);
MaskLayer *mask_layer;
@@ -760,7 +761,7 @@ static int mask_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmE
const float threshold = 19;
bool changed = false;
- ED_mask_mouse_pos(sa, ar, event->mval, co);
+ ED_mask_mouse_pos(sa, region, event->mval, co);
point = ED_mask_point_find_nearest(C, mask, co, threshold, &mask_layer, &spline, NULL, NULL);