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:
Diffstat (limited to 'source/blender/editors/mask')
-rw-r--r--source/blender/editors/mask/mask_add.c16
-rw-r--r--source/blender/editors/mask/mask_draw.c21
-rw-r--r--source/blender/editors/mask/mask_edit.c35
-rw-r--r--source/blender/editors/mask/mask_ops.c18
-rw-r--r--source/blender/editors/mask/mask_select.c24
5 files changed, 58 insertions, 56 deletions
diff --git a/source/blender/editors/mask/mask_add.c b/source/blender/editors/mask/mask_add.c
index 5c730c74df7..6299d6761e0 100644
--- a/source/blender/editors/mask/mask_add.c
+++ b/source/blender/editors/mask/mask_add.c
@@ -62,7 +62,7 @@ bool ED_mask_find_nearest_diff_point(const bContext *C,
float *score_r)
{
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
MaskLayer *point_mask_layer;
MaskSpline *point_spline;
@@ -76,7 +76,7 @@ bool ED_mask_find_nearest_diff_point(const bContext *C,
Mask *mask_eval = (Mask *)DEG_get_evaluated_id(depsgraph, &mask_orig->id);
ED_mask_get_size(sa, &width, &height);
- ED_mask_pixelspace_factor(sa, ar, &scalex, &scaley);
+ ED_mask_pixelspace_factor(sa, region, &scalex, &scaley);
co[0] = normal_co[0] * scalex;
co[1] = normal_co[1] * scaley;
@@ -598,10 +598,10 @@ static void mask_point_make_pixel_space(bContext *C,
float point_pixel[2])
{
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float scalex, scaley;
- ED_mask_pixelspace_factor(sa, ar, &scalex, &scaley);
+ ED_mask_pixelspace_factor(sa, region, &scalex, &scaley);
point_pixel[0] = point_normalized[0] * scalex;
point_pixel[1] = point_normalized[1] * scaley;
@@ -710,11 +710,11 @@ static int add_vertex_exec(bContext *C, wmOperator *op)
static int add_vertex_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);
@@ -802,11 +802,11 @@ static int add_feather_vertex_exec(bContext *C, wmOperator *op)
static int add_feather_vertex_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);
diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c
index 71aa860d703..3f3bf8b7510 100644
--- a/source/blender/editors/mask/mask_draw.c
+++ b/source/blender/editors/mask/mask_draw.c
@@ -677,7 +677,7 @@ static float *mask_rasterize(Mask *mask, const int width, const int height)
void ED_mask_draw_region(
Depsgraph *depsgraph,
Mask *mask_,
- ARegion *ar,
+ ARegion *region,
const char draw_flag,
const char draw_type,
const char overlay_mode,
@@ -693,7 +693,7 @@ void ED_mask_draw_region(
/* optional - only used when do_post_draw is set or called from clip editor */
const bContext *C)
{
- struct View2D *v2d = &ar->v2d;
+ struct View2D *v2d = &region->v2d;
Mask *mask_eval = (Mask *)DEG_get_evaluated_id(depsgraph, &mask_->id);
/* aspect always scales vertically in movie and image spaces */
@@ -708,13 +708,13 @@ void ED_mask_draw_region(
float xofs, yofs;
/* find window pixel coordinates of origin */
- UI_view2d_view_to_region(&ar->v2d, 0.0f, 0.0f, &x, &y);
+ UI_view2d_view_to_region(&region->v2d, 0.0f, 0.0f, &x, &y);
/* w = BLI_rctf_size_x(&v2d->tot); */
/* h = BLI_rctf_size_y(&v2d->tot); */
- zoomx = (float)(BLI_rcti_size_x(&ar->winrct) + 1) / BLI_rctf_size_x(&ar->v2d.cur);
- zoomy = (float)(BLI_rcti_size_y(&ar->winrct) + 1) / BLI_rctf_size_y(&ar->v2d.cur);
+ zoomx = (float)(BLI_rcti_size_x(&region->winrct) + 1) / BLI_rctf_size_x(&region->v2d.cur);
+ zoomy = (float)(BLI_rcti_size_y(&region->winrct) + 1) / BLI_rctf_size_y(&region->v2d.cur);
if (do_scale_applied) {
zoomx /= width;
@@ -780,22 +780,23 @@ void ED_mask_draw_region(
GPU_matrix_scale_2f(maxdim, maxdim);
if (do_draw_cb) {
- ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW);
+ ED_region_draw_cb_draw(C, region, REGION_DRAW_PRE_VIEW);
}
/* draw! */
draw_mask_layers(C, mask_eval, draw_flag, draw_type, width, height);
if (do_draw_cb) {
- ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW);
+ ED_region_draw_cb_draw(C, region, REGION_DRAW_POST_VIEW);
}
GPU_matrix_pop();
}
-void ED_mask_draw_frames(Mask *mask, ARegion *ar, const int cfra, const int sfra, const int efra)
+void ED_mask_draw_frames(
+ Mask *mask, ARegion *region, const int cfra, const int sfra, const int efra)
{
- const float framelen = ar->winx / (float)(efra - sfra + 1);
+ const float framelen = region->winx / (float)(efra - sfra + 1);
MaskLayer *mask_layer = BKE_mask_layer_active(mask);
if (mask_layer == NULL) {
@@ -808,7 +809,7 @@ void ED_mask_draw_frames(Mask *mask, ARegion *ar, const int cfra, const int sfra
}
/* Local coordinate visible rect inside region, to accommodate overlapping ui. */
- const rcti *rect_visible = ED_region_visible_rect(ar);
+ const rcti *rect_visible = ED_region_visible_rect(region);
const int region_bottom = rect_visible->ymin;
uint pos = GPU_vertformat_attr_add(
diff --git a/source/blender/editors/mask/mask_edit.c b/source/blender/editors/mask/mask_edit.c
index 56d8ef56160..88cc5e33617 100644
--- a/source/blender/editors/mask/mask_edit.c
+++ b/source/blender/editors/mask/mask_edit.c
@@ -84,23 +84,23 @@ bool ED_maskedit_mask_poll(bContext *C)
/********************** registration *********************/
/* takes event->mval */
-void ED_mask_mouse_pos(ScrArea *sa, ARegion *ar, const int mval[2], float co[2])
+void ED_mask_mouse_pos(ScrArea *sa, ARegion *region, const int mval[2], float co[2])
{
if (sa) {
switch (sa->spacetype) {
case SPACE_CLIP: {
SpaceClip *sc = sa->spacedata.first;
- ED_clip_mouse_pos(sc, ar, mval, co);
+ ED_clip_mouse_pos(sc, region, mval, co);
BKE_mask_coord_from_movieclip(sc->clip, &sc->user, co, co);
break;
}
case SPACE_SEQ: {
- UI_view2d_region_to_view(&ar->v2d, mval[0], mval[1], &co[0], &co[1]);
+ UI_view2d_region_to_view(&region->v2d, mval[0], mval[1], &co[0], &co[1]);
break;
}
case SPACE_IMAGE: {
SpaceImage *sima = sa->spacedata.first;
- ED_image_mouse_pos(sima, ar, mval, co);
+ ED_image_mouse_pos(sima, region, mval, co);
BKE_mask_coord_from_image(sima->image, &sima->iuser, co, co);
break;
}
@@ -119,7 +119,7 @@ void ED_mask_mouse_pos(ScrArea *sa, ARegion *ar, const int mval[2], float co[2])
/* input: x/y - mval space
* output: xr/yr - mask point space */
-void ED_mask_point_pos(ScrArea *sa, ARegion *ar, float x, float y, float *xr, float *yr)
+void ED_mask_point_pos(ScrArea *sa, ARegion *region, float x, float y, float *xr, float *yr)
{
float co[2];
@@ -127,7 +127,7 @@ void ED_mask_point_pos(ScrArea *sa, ARegion *ar, float x, float y, float *xr, fl
switch (sa->spacetype) {
case SPACE_CLIP: {
SpaceClip *sc = sa->spacedata.first;
- ED_clip_point_stable_pos(sc, ar, x, y, &co[0], &co[1]);
+ ED_clip_point_stable_pos(sc, region, x, y, &co[0], &co[1]);
BKE_mask_coord_from_movieclip(sc->clip, &sc->user, co, co);
break;
}
@@ -136,7 +136,7 @@ void ED_mask_point_pos(ScrArea *sa, ARegion *ar, float x, float y, float *xr, fl
break;
case SPACE_IMAGE: {
SpaceImage *sima = sa->spacedata.first;
- ED_image_point_pos(sima, ar, x, y, &co[0], &co[1]);
+ ED_image_point_pos(sima, region, x, y, &co[0], &co[1]);
BKE_mask_coord_from_image(sima->image, &sima->iuser, co, co);
break;
}
@@ -156,7 +156,8 @@ void ED_mask_point_pos(ScrArea *sa, ARegion *ar, float x, float y, float *xr, fl
*yr = co[1];
}
-void ED_mask_point_pos__reverse(ScrArea *sa, ARegion *ar, float x, float y, float *xr, float *yr)
+void ED_mask_point_pos__reverse(
+ ScrArea *sa, ARegion *region, float x, float y, float *xr, float *yr)
{
float co[2];
@@ -167,7 +168,7 @@ void ED_mask_point_pos__reverse(ScrArea *sa, ARegion *ar, float x, float y, floa
co[0] = x;
co[1] = y;
BKE_mask_coord_to_movieclip(sc->clip, &sc->user, co, co);
- ED_clip_point_stable_pos__reverse(sc, ar, co, co);
+ ED_clip_point_stable_pos__reverse(sc, region, co, co);
break;
}
case SPACE_SEQ:
@@ -178,7 +179,7 @@ void ED_mask_point_pos__reverse(ScrArea *sa, ARegion *ar, float x, float y, floa
co[0] = x;
co[1] = y;
BKE_mask_coord_to_image(sima->image, &sima->iuser, co, co);
- ED_image_point_pos__reverse(sima, ar, co, co);
+ ED_image_point_pos__reverse(sima, region, co, co);
break;
}
default:
@@ -232,13 +233,13 @@ void ED_mask_get_size(ScrArea *sa, int *width, int *height)
}
}
-void ED_mask_zoom(ScrArea *sa, ARegion *ar, float *zoomx, float *zoomy)
+void ED_mask_zoom(ScrArea *sa, ARegion *region, float *zoomx, float *zoomy)
{
if (sa && sa->spacedata.first) {
switch (sa->spacetype) {
case SPACE_CLIP: {
SpaceClip *sc = sa->spacedata.first;
- ED_space_clip_get_zoom(sc, ar, zoomx, zoomy);
+ ED_space_clip_get_zoom(sc, region, zoomx, zoomy);
break;
}
case SPACE_SEQ: {
@@ -247,7 +248,7 @@ void ED_mask_zoom(ScrArea *sa, ARegion *ar, float *zoomx, float *zoomy)
}
case SPACE_IMAGE: {
SpaceImage *sima = sa->spacedata.first;
- ED_space_image_get_zoom(sima, ar, zoomx, zoomy);
+ ED_space_image_get_zoom(sima, region, zoomx, zoomy);
break;
}
default:
@@ -263,7 +264,7 @@ void ED_mask_zoom(ScrArea *sa, ARegion *ar, float *zoomx, float *zoomy)
}
}
-void ED_mask_get_aspect(ScrArea *sa, ARegion *UNUSED(ar), float *aspx, float *aspy)
+void ED_mask_get_aspect(ScrArea *sa, ARegion *UNUSED(region), float *aspx, float *aspy)
{
if (sa && sa->spacedata.first) {
switch (sa->spacetype) {
@@ -294,7 +295,7 @@ void ED_mask_get_aspect(ScrArea *sa, ARegion *UNUSED(ar), float *aspx, float *as
}
}
-void ED_mask_pixelspace_factor(ScrArea *sa, ARegion *ar, float *scalex, float *scaley)
+void ED_mask_pixelspace_factor(ScrArea *sa, ARegion *region, float *scalex, float *scaley)
{
if (sa && sa->spacedata.first) {
switch (sa->spacetype) {
@@ -302,7 +303,7 @@ void ED_mask_pixelspace_factor(ScrArea *sa, ARegion *ar, float *scalex, float *s
SpaceClip *sc = sa->spacedata.first;
float aspx, aspy;
- UI_view2d_scale_get(&ar->v2d, scalex, scaley);
+ UI_view2d_scale_get(&region->v2d, scalex, scaley);
ED_space_clip_get_aspect(sc, &aspx, &aspy);
*scalex *= aspx;
@@ -317,7 +318,7 @@ void ED_mask_pixelspace_factor(ScrArea *sa, ARegion *ar, float *scalex, float *s
SpaceImage *sima = sa->spacedata.first;
float aspx, aspy;
- UI_view2d_scale_get(&ar->v2d, scalex, scaley);
+ UI_view2d_scale_get(&region->v2d, scalex, scaley);
ED_space_image_get_aspect(sima, &aspx, &aspy);
*scalex *= aspx;
diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c
index 3a982b255f0..cff0bcef38b 100644
--- a/source/blender/editors/mask/mask_ops.c
+++ b/source/blender/editors/mask/mask_ops.c
@@ -75,7 +75,7 @@ MaskSplinePoint *ED_mask_point_find_nearest(const bContext *C,
float *score)
{
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
MaskLayer *point_mask_layer = NULL;
MaskSpline *point_spline = NULL;
@@ -90,7 +90,7 @@ MaskSplinePoint *ED_mask_point_find_nearest(const bContext *C,
Mask *mask_eval = (Mask *)DEG_get_evaluated_id(depsgraph, &mask_orig->id);
ED_mask_get_size(sa, &width, &height);
- ED_mask_pixelspace_factor(sa, ar, &scalex, &scaley);
+ ED_mask_pixelspace_factor(sa, region, &scalex, &scaley);
co[0] = normal_co[0] * scalex;
co[1] = normal_co[1] * scaley;
@@ -230,7 +230,7 @@ bool ED_mask_feather_find_nearest(const bContext *C,
float *score)
{
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
MaskLayer *point_mask_layer = NULL;
MaskSpline *point_spline = NULL;
@@ -245,7 +245,7 @@ bool ED_mask_feather_find_nearest(const bContext *C,
Mask *mask_eval = (Mask *)DEG_get_evaluated_id(depsgraph, &mask_orig->id);
ED_mask_get_size(sa, &width, &height);
- ED_mask_pixelspace_factor(sa, ar, &scalex, &scaley);
+ ED_mask_pixelspace_factor(sa, region, &scalex, &scaley);
co[0] = normal_co[0] * scalex;
co[1] = normal_co[1] * scaley;
@@ -714,7 +714,7 @@ static void check_sliding_handle_type(MaskSplinePoint *point, eMaskWhichHandle w
static void *slide_point_customdata(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);
SlidePointData *customdata = NULL;
@@ -728,7 +728,7 @@ static void *slide_point_customdata(bContext *C, wmOperator *op, const wmEvent *
const float threshold = 19;
eMaskWhichHandle which_handle;
- ED_mask_mouse_pos(sa, ar, event->mval, co);
+ ED_mask_mouse_pos(sa, region, event->mval, co);
ED_mask_get_size(sa, &width, &height);
cv_point = ED_mask_point_find_nearest(
@@ -827,7 +827,7 @@ static void *slide_point_customdata(bContext *C, wmOperator *op, const wmEvent *
}
customdata->which_handle = which_handle;
- ED_mask_mouse_pos(sa, ar, event->mval, customdata->prev_mouse_coord);
+ ED_mask_mouse_pos(sa, region, event->mval, customdata->prev_mouse_coord);
}
return customdata;
@@ -952,10 +952,10 @@ static int slide_point_modal(bContext *C, wmOperator *op, const wmEvent *event)
ATTR_FALLTHROUGH; /* update CV position */
case MOUSEMOVE: {
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float delta[2];
- ED_mask_mouse_pos(sa, ar, event->mval, co);
+ ED_mask_mouse_pos(sa, region, event->mval, co);
sub_v2_v2v2(delta, co, data->prev_mouse_coord);
if (data->is_accurate) {
mul_v2_fl(delta, 0.2f);
diff --git a/source/blender/editors/mask/mask_select.c b/source/blender/editors/mask/mask_select.c
index 9e1aaa5e6f4..15b3ab047ee 100644
--- a/source/blender/editors/mask/mask_select.c
+++ b/source/blender/editors/mask/mask_select.c
@@ -387,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);
@@ -437,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);
@@ -455,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) {
@@ -527,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);
@@ -567,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],
@@ -653,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;
@@ -669,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));
@@ -750,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;
@@ -761,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);