diff options
author | Julian Eisel <julian@blender.org> | 2020-04-03 14:25:03 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-04-03 14:34:50 +0300 |
commit | 905c0269f302e8e0e7a27dda8d5256fdcd06ce60 (patch) | |
tree | 1c720d4f0069879d5b4c0c9ea8db867106920d4f /source/blender/editors/gpencil/gpencil_paint.c | |
parent | 1a69384e76e2b1ab11c87a582eb2cdf26386ac59 (diff) |
Cleanup: Rename ScrArea variables from sa to area
Follow up of b2ee1770d4c3 and 10c2254d412d, part of T74432.
Now the area and region naming conventions should be less confusing.
Mostly a careful batch rename but had to do few smaller fixes.
Also ran clang-format on affected files.
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_paint.c')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_paint.c | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 1a169f9ec89..7f0d1029722 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -156,7 +156,7 @@ typedef struct tGPsdata { /** window where painting originated. */ wmWindow *win; /** area where painting originated. */ - ScrArea *sa; + ScrArea *area; /** region where painting originated. */ ARegion *region; /** needed for GP_STROKE_2DSPACE. */ @@ -297,9 +297,9 @@ static void gp_session_validatebuffer(tGPsdata *p); static bool gpencil_draw_poll(bContext *C) { if (ED_operator_regionactive(C)) { - ScrArea *sa = CTX_wm_area(C); + ScrArea *area = CTX_wm_area(C); /* 3D Viewport */ - if (sa->spacetype != SPACE_VIEW3D) { + if (area->spacetype != SPACE_VIEW3D) { return false; } @@ -812,7 +812,7 @@ static short gp_stroke_addpoint(tGPsdata *p, const float mval[2], float pressure pt->time = (float)(curtime - p->inittime); /* point uv (only 3d view) */ - if ((p->sa->spacetype == SPACE_VIEW3D) && (gpd->runtime.sbuffer_used > 0)) { + if ((p->area->spacetype == SPACE_VIEW3D) && (gpd->runtime.sbuffer_used > 0)) { tGPspoint *ptb = (tGPspoint *)gpd->runtime.sbuffer + gpd->runtime.sbuffer_used - 1; bGPDspoint spt, spt2; @@ -1242,7 +1242,7 @@ static bool gp_stroke_eraser_is_occluded(tGPsdata *p, gp_settings = eraser->gpencil_settings; } - if ((gp_settings != NULL) && (p->sa->spacetype == SPACE_VIEW3D) && + if ((gp_settings != NULL) && (p->area->spacetype == SPACE_VIEW3D) && (gp_settings->flag & GP_BRUSH_OCCLUDE_ERASER)) { RegionView3D *rv3d = p->region->regiondata; bGPDlayer *gpl = p->gpl; @@ -1593,9 +1593,9 @@ static void gp_stroke_doeraser(tGPsdata *p) rect.xmax = p->mval[0] + calc_radius; rect.ymax = p->mval[1] + calc_radius; - if (p->sa->spacetype == SPACE_VIEW3D) { + if (p->area->spacetype == SPACE_VIEW3D) { if ((gp_settings != NULL) && (gp_settings->flag & GP_BRUSH_OCCLUDE_ERASER)) { - View3D *v3d = p->sa->spacedata.first; + View3D *v3d = p->area->spacedata.first; view3d_region_operator_needs_opengl(p->win, p->region); ED_view3d_autodist_init(p->depsgraph, p->region, v3d, 0); } @@ -1633,7 +1633,7 @@ static void gp_stroke_doeraser(tGPsdata *p) /* Not all strokes in the datablock may be valid in the current editor/context * (e.g. 2D space strokes in the 3D view, if the same datablock is shared) */ - if (ED_gpencil_stroke_can_use_direct(p->sa, gps)) { + if (ED_gpencil_stroke_can_use_direct(p->area, gps)) { gp_stroke_eraser_dostroke(p, gpf, gps, p->mval, calc_radius, &rect); } } @@ -1816,7 +1816,7 @@ static bool gp_session_initdata(bContext *C, wmOperator *op, tGPsdata *p) * - must verify that region data is 3D-view (and not something else) */ /* CAUTION: If this is the "toolbar", then this will change on the first stroke */ - p->sa = curarea; + p->area = curarea; p->region = region; p->align_flag = &ts->gpencil_v3d_align; @@ -1831,7 +1831,7 @@ static bool gp_session_initdata(bContext *C, wmOperator *op, tGPsdata *p) } if ((!obact) || (obact->type != OB_GPENCIL)) { - View3D *v3d = p->sa->spacedata.first; + View3D *v3d = p->area->spacedata.first; /* if active object doesn't exist or isn't a GP Object, create one */ const float *cur = p->scene->cursor.location; @@ -2058,8 +2058,8 @@ static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode, Deps /* when drawing in the camera view, in 2D space, set the subrect */ p->subrect = NULL; if ((*p->align_flag & GP_PROJECT_VIEWSPACE) == 0) { - if (p->sa->spacetype == SPACE_VIEW3D) { - View3D *v3d = p->sa->spacedata.first; + if (p->area->spacetype == SPACE_VIEW3D) { + View3D *v3d = p->area->spacedata.first; RegionView3D *rv3d = p->region->regiondata; /* for camera view set the subrect */ @@ -2076,7 +2076,7 @@ static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode, Deps p->gsc.gpd = p->gpd; p->gsc.gpl = p->gpl; - p->gsc.sa = p->sa; + p->gsc.area = p->area; p->gsc.region = p->region; p->gsc.v2d = p->v2d; @@ -2087,7 +2087,7 @@ static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode, Deps /* check if points will need to be made in view-aligned space */ if (*p->align_flag & GP_PROJECT_VIEWSPACE) { - switch (p->sa->spacetype) { + switch (p->area->spacetype) { case SPACE_VIEW3D: { p->gpd->runtime.sbuffer_sflag |= GP_STROKE_3DSPACE; break; @@ -2112,7 +2112,7 @@ static void gp_paint_strokeend(tGPsdata *p) * the conversions will project the values correctly... */ if (gpencil_project_check(p)) { - View3D *v3d = p->sa->spacedata.first; + View3D *v3d = p->area->spacedata.first; /* need to restore the original projection settings before packing up */ view3d_region_operator_needs_opengl(p->win, p->region); @@ -2243,7 +2243,7 @@ static void gpencil_draw_exit(bContext *C, wmOperator *op) } /* restore cursor to indicate end of drawing */ - if (p->sa->spacetype != SPACE_VIEW3D) { + if (p->area->spacetype != SPACE_VIEW3D) { WM_cursor_modal_restore(CTX_wm_window(C)); } else { @@ -3096,10 +3096,10 @@ static int gpencil_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event } /* gpencil modal operator stores area, which can be removed while using it (like fullscreen) */ -static bool gpencil_area_exists(bContext *C, ScrArea *sa_test) +static bool gpencil_area_exists(bContext *C, ScrArea *area_test) { bScreen *sc = CTX_wm_screen(C); - return (BLI_findindex(&sc->areabase, sa_test) != -1); + return (BLI_findindex(&sc->areabase, area_test) != -1); } static tGPsdata *gpencil_stroke_begin(bContext *C, wmOperator *op) @@ -3109,7 +3109,7 @@ static tGPsdata *gpencil_stroke_begin(bContext *C, wmOperator *op) /* we must check that we're still within the area that we're set up to work from * otherwise we could crash (see bug #20586) */ - if (CTX_wm_area(C) != p->sa) { + if (CTX_wm_area(C) != p->area) { printf("\t\t\tGP - wrong area execution abort!\n"); p->status = GP_STATUS_ERROR; } @@ -3504,18 +3504,19 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) */ if ((p->region) && (p->region->regiontype == RGN_TYPE_TOOLS)) { /* Change to whatever region is now under the mouse */ - ARegion *current_region = BKE_area_find_region_xy(p->sa, RGN_TYPE_ANY, event->x, event->y); + ARegion *current_region = BKE_area_find_region_xy( + p->area, RGN_TYPE_ANY, event->x, event->y); if (G.debug & G_DEBUG) { - printf("found alternative region %p (old was %p) - at %d %d (sa: %d %d -> %d %d)\n", + printf("found alternative region %p (old was %p) - at %d %d (area: %d %d -> %d %d)\n", current_region, p->region, event->x, event->y, - p->sa->totrct.xmin, - p->sa->totrct.ymin, - p->sa->totrct.xmax, - p->sa->totrct.ymax); + p->area->totrct.xmin, + p->area->totrct.ymin, + p->area->totrct.xmax, + p->area->totrct.ymax); } if (current_region) { @@ -3660,7 +3661,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) } /* gpencil modal operator stores area, which can be removed while using it (like fullscreen) */ - if (0 == gpencil_area_exists(C, p->sa)) { + if (0 == gpencil_area_exists(C, p->area)) { estate = OPERATOR_CANCELLED; } else { |