diff options
author | Julian Eisel <julian@blender.org> | 2020-03-06 18:56:42 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-03-06 19:19:23 +0300 |
commit | b2ee1770d4c31078518f4ec9edd5196a41345162 (patch) | |
tree | 6b7f6ff9057322245fc3b3407bece3f1c0cb3eb5 /source/blender/editors/sculpt_paint | |
parent | b825a95ec311a169d33fe21e28418f11a516c82f (diff) |
Cleanup: Rename ARegion variables from ar to region
The old convention was easy to confuse with ScrArea.
Part of https://developer.blender.org/T74432.
This is mostly a batch rename with some manual fixing. Only single word
variable names are changed, no prefixed/suffixed names.
Brecht van Lommel and Campbell Barton both gave me a green light for
this convention change.
Also ran clan clang format on affected files.
Diffstat (limited to 'source/blender/editors/sculpt_paint')
16 files changed, 206 insertions, 199 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index 07dfa970404..dd922834d9e 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -125,7 +125,7 @@ static int same_tex_snap(TexSnapshot *snap, MTex *mtex, ViewContext *vc, bool co //(BKE_brush_size_get(vc->scene, brush) <= snap->BKE_brush_size_get)) && (mtex->brush_map_mode != MTEX_MAP_MODE_TILED || - (vc->ar->winx == snap->winx && vc->ar->winy == snap->winy)) && + (vc->region->winx == snap->winx && vc->region->winy == snap->winy)) && (mtex->brush_map_mode == MTEX_MAP_MODE_STENCIL || snap->old_zoom == zoom) && snap->old_col == col); } @@ -133,8 +133,8 @@ static int same_tex_snap(TexSnapshot *snap, MTex *mtex, ViewContext *vc, bool co static void make_tex_snap(TexSnapshot *snap, ViewContext *vc, float zoom) { snap->old_zoom = zoom; - snap->winx = vc->ar->winx; - snap->winy = vc->ar->winy; + snap->winx = vc->region->winx; + snap->winy = vc->region->winy; } typedef struct LoadTexData { @@ -191,8 +191,8 @@ static void load_tex_task_cb_ex(void *__restrict userdata, float len; if (mtex->brush_map_mode == MTEX_MAP_MODE_TILED) { - x *= vc->ar->winx / radius; - y *= vc->ar->winy / radius; + x *= vc->region->winx / radius; + y *= vc->region->winy / radius; } else { x = (x - 0.5f) * 2.0f; @@ -549,9 +549,10 @@ static int project_brush_radius(ViewContext *vc, float radius, const float locat add_v3_v3v3(offset, location, ortho); /* Project the center of the brush, and the tangent point to the view onto the screen. */ - if ((ED_view3d_project_float_global(vc->ar, location, p1, V3D_PROJ_TEST_NOP) == + if ((ED_view3d_project_float_global(vc->region, location, p1, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) && - (ED_view3d_project_float_global(vc->ar, offset, p2, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK)) { + (ED_view3d_project_float_global(vc->region, offset, p2, V3D_PROJ_TEST_NOP) == + V3D_PROJ_RET_OK)) { /* The distance between these points is the size of the projected brush in pixels. */ return len_v2v2(p1, p2); } @@ -675,8 +676,8 @@ static bool paint_draw_tex_overlay(UnifiedPaintSettings *ups, else if (mtex->brush_map_mode == MTEX_MAP_MODE_TILED) { quad.xmin = 0; quad.ymin = 0; - quad.xmax = BLI_rcti_size_x(&vc->ar->winrct); - quad.ymax = BLI_rcti_size_y(&vc->ar->winrct); + quad.xmax = BLI_rcti_size_x(&vc->region->winrct); + quad.ymax = BLI_rcti_size_y(&vc->region->winrct); } /* Stencil code goes here. */ else { @@ -844,9 +845,9 @@ static bool paint_draw_alpha_overlay(UnifiedPaintSettings *ups, /* Translate to region. */ GPU_matrix_push(); - GPU_matrix_translate_2f(vc->ar->winrct.xmin, vc->ar->winrct.ymin); - x -= vc->ar->winrct.xmin; - y -= vc->ar->winrct.ymin; + GPU_matrix_translate_2f(vc->region->winrct.xmin, vc->region->winrct.ymin); + x -= vc->region->winrct.xmin; + y -= vc->region->winrct.ymin; /* Colored overlay should be drawn separately. */ if (col) { @@ -973,7 +974,7 @@ BLI_INLINE void draw_bezier_handle_lines(unsigned int pos, float sel_col[4], Bez static void paint_draw_curve_cursor(Brush *brush, ViewContext *vc) { GPU_matrix_push(); - GPU_matrix_translate_2f(vc->ar->winrct.xmin, vc->ar->winrct.ymin); + GPU_matrix_translate_2f(vc->region->winrct.xmin, vc->region->winrct.ymin); if (brush->paint_curve && brush->paint_curve->points) { int i; @@ -1100,7 +1101,7 @@ static bool ommit_cursor_drawing(Paint *paint, ePaintMode mode, Brush *brush) } static void cursor_draw_point_screen_space(const uint gpuattr, - const ARegion *ar, + const ARegion *region, const float true_location[3], const float obmat[4][4], const int size) @@ -1108,7 +1109,7 @@ static void cursor_draw_point_screen_space(const uint gpuattr, float translation_vertex_cursor[3], location[3]; copy_v3_v3(location, true_location); mul_m4_v3(obmat, location); - ED_view3d_project(ar, location, translation_vertex_cursor); + ED_view3d_project(region, location, translation_vertex_cursor); /* Do not draw points behind the view. Z [near, far] is mapped to [-1, 1]. */ if (translation_vertex_cursor[2] <= 1.0f) { imm_draw_circle_fill_3d( @@ -1117,7 +1118,7 @@ static void cursor_draw_point_screen_space(const uint gpuattr, } static void cursor_draw_tiling_preview(const uint gpuattr, - const ARegion *ar, + const ARegion *region, const float true_location[3], Sculpt *sd, Object *ob, @@ -1155,14 +1156,14 @@ static void cursor_draw_tiling_preview(const uint gpuattr, for (int dim = 0; dim < 3; dim++) { location[dim] = cur[dim] * step[dim] + orgLoc[dim]; } - cursor_draw_point_screen_space(gpuattr, ar, location, ob->obmat, 3); + cursor_draw_point_screen_space(gpuattr, region, location, ob->obmat, 3); } } } } static void cursor_draw_point_with_symmetry(const uint gpuattr, - const ARegion *ar, + const ARegion *region, const float true_location[3], Sculpt *sd, Object *ob, @@ -1176,10 +1177,10 @@ static void cursor_draw_point_with_symmetry(const uint gpuattr, /* Axis Symmetry. */ flip_v3_v3(location, true_location, (char)i); - cursor_draw_point_screen_space(gpuattr, ar, location, ob->obmat, 3); + cursor_draw_point_screen_space(gpuattr, region, location, ob->obmat, 3); /* Tiling. */ - cursor_draw_tiling_preview(gpuattr, ar, location, sd, ob, radius); + cursor_draw_tiling_preview(gpuattr, region, location, sd, ob, radius); /* Radial Symmetry. */ for (char raxis = 0; raxis < 3; raxis++) { @@ -1190,8 +1191,8 @@ static void cursor_draw_point_with_symmetry(const uint gpuattr, rotate_m4(symm_rot_mat, raxis + 'X', angle); mul_m4_v3(symm_rot_mat, location); - cursor_draw_tiling_preview(gpuattr, ar, location, sd, ob, radius); - cursor_draw_point_screen_space(gpuattr, ar, location, ob->obmat, 3); + cursor_draw_tiling_preview(gpuattr, region, location, sd, ob, radius); + cursor_draw_point_screen_space(gpuattr, region, location, ob->obmat, 3); } } } @@ -1233,8 +1234,8 @@ static bool paint_use_2d_cursor(ePaintMode mode) static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused)) { - ARegion *ar = CTX_wm_region(C); - if (ar && ar->regiontype != RGN_TYPE_WINDOW) { + ARegion *region = CTX_wm_region(C); + if (region && region->regiontype != RGN_TYPE_WINDOW) { return; } @@ -1291,8 +1292,8 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused)) if (ups->draw_anchored) { final_radius = ups->anchored_size; copy_v2_fl2(translation, - ups->anchored_initial_mouse[0] + ar->winrct.xmin, - ups->anchored_initial_mouse[1] + ar->winrct.ymin); + ups->anchored_initial_mouse[0] + region->winrct.xmin, + ups->anchored_initial_mouse[1] + region->winrct.ymin); } /* Make lines pretty. */ @@ -1368,7 +1369,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused)) bool is_multires = ss && ss->pbvh && BKE_pbvh_type(ss->pbvh) == PBVH_GRIDS; SculptCursorGeometryInfo gi; - float mouse[2] = {x - ar->winrct.xmin, y - ar->winrct.ymin}; + float mouse[2] = {x - region->winrct.xmin, y - region->winrct.ymin}; int prev_active_vertex_index = -1; bool is_cursor_over_mesh = false; @@ -1403,11 +1404,11 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused)) rds = BKE_brush_unprojected_radius_get(scene, brush); } - wmViewport(&ar->winrct); + wmViewport(®ion->winrct); /* Draw 3D active vertex preview with symmetry. */ if (len_v3v3(gi.active_vertex_co, gi.location) < rds) { - cursor_draw_point_with_symmetry(pos, ar, gi.active_vertex_co, sd, vc.obact, rds); + cursor_draw_point_with_symmetry(pos, region, gi.active_vertex_co, sd, vc.obact, rds); } /* Draw pose brush origins. */ @@ -1433,7 +1434,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused)) /* Draw the pose brush rotation origins. */ for (int i = 0; i < ss->pose_ik_chain_preview->tot_segments; i++) { cursor_draw_point_screen_space(pos, - ar, + region, ss->pose_ik_chain_preview->segments[i].initial_orig, vc.obact->obmat, 3); @@ -1445,7 +1446,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused)) ED_view3d_draw_setup_view(CTX_wm_window(C), CTX_data_depsgraph_pointer(C), CTX_data_scene(C), - ar, + region, CTX_wm_view3d(C), NULL, NULL, @@ -1529,7 +1530,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused)) } else { if (vc.obact->sculpt->cache && !vc.obact->sculpt->cache->first_time) { - wmViewport(&ar->winrct); + wmViewport(®ion->winrct); /* Draw cached dynamic mesh preview lines. */ if (brush->sculpt_tool == SCULPT_TOOL_GRAB && (brush->flag & BRUSH_GRAB_ACTIVE_VERTEX) && @@ -1539,7 +1540,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused)) ED_view3d_draw_setup_view(CTX_wm_window(C), CTX_data_depsgraph_pointer(C), CTX_data_scene(C), - ar, + region, CTX_wm_view3d(C), NULL, NULL, @@ -1558,7 +1559,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused)) ED_view3d_draw_setup_view(CTX_wm_window(C), CTX_data_depsgraph_pointer(C), CTX_data_scene(C), - ar, + region, CTX_wm_view3d(C), NULL, NULL, @@ -1575,7 +1576,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused)) ED_view3d_draw_setup_view(CTX_wm_window(C), CTX_data_depsgraph_pointer(C), CTX_data_scene(C), - ar, + region, CTX_wm_view3d(C), NULL, NULL, diff --git a/source/blender/editors/sculpt_paint/paint_curve.c b/source/blender/editors/sculpt_paint/paint_curve.c index 8a98b15088f..4578e211c97 100644 --- a/source/blender/editors/sculpt_paint/paint_curve.c +++ b/source/blender/editors/sculpt_paint/paint_curve.c @@ -196,7 +196,7 @@ static void paintcurve_point_add(bContext *C, wmOperator *op, const int loc[2]) PaintCurve *pc; PaintCurvePoint *pcp; wmWindow *window = CTX_wm_window(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); float vec[3] = {loc[0], loc[1], 0.0}; int add_index; int i; @@ -250,7 +250,7 @@ static void paintcurve_point_add(bContext *C, wmOperator *op, const int loc[2]) ED_paintcurve_undo_push_end(); - WM_paint_cursor_tag_redraw(window, ar); + WM_paint_cursor_tag_redraw(window, region); } static int paintcurve_add_point_invoke(bContext *C, wmOperator *op, const wmEvent *event) @@ -309,7 +309,7 @@ static int paintcurve_delete_point_exec(bContext *C, wmOperator *op) PaintCurve *pc; PaintCurvePoint *pcp; wmWindow *window = CTX_wm_window(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); int i; int tot_del = 0; pc = br->paint_curve; @@ -361,7 +361,7 @@ static int paintcurve_delete_point_exec(bContext *C, wmOperator *op) ED_paintcurve_undo_push_end(); - WM_paint_cursor_tag_redraw(window, ar); + WM_paint_cursor_tag_redraw(window, region); return OPERATOR_FINISHED; } @@ -385,7 +385,7 @@ static bool paintcurve_point_select( bContext *C, wmOperator *op, const int loc[2], bool toggle, bool extend) { wmWindow *window = CTX_wm_window(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); Paint *p = BKE_paint_get_active_from_context(C); Brush *br = p->brush; PaintCurve *pc; @@ -477,7 +477,7 @@ static bool paintcurve_point_select( ED_paintcurve_undo_push_end(); - WM_paint_cursor_tag_redraw(window, ar); + WM_paint_cursor_tag_redraw(window, region); return true; } @@ -586,7 +586,7 @@ static int paintcurve_slide_invoke(bContext *C, wmOperator *op, const wmEvent *e } if (pcp) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); wmWindow *window = CTX_wm_window(C); PointSlideData *psd = MEM_mallocN(sizeof(PointSlideData), "PointSlideData"); copy_v2_v2_int(psd->initial_loc, event->mval); @@ -609,7 +609,7 @@ static int paintcurve_slide_invoke(bContext *C, wmOperator *op, const wmEvent *e BKE_paint_curve_clamp_endpoint_add_index(pc, pcp - pc->points); WM_event_add_modal_handler(C, op); - WM_paint_cursor_tag_redraw(window, ar); + WM_paint_cursor_tag_redraw(window, region); return OPERATOR_RUNNING_MODAL; } @@ -629,7 +629,7 @@ static int paintcurve_slide_modal(bContext *C, wmOperator *op, const wmEvent *ev switch (event->type) { case MOUSEMOVE: { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); wmWindow *window = CTX_wm_window(C); float diff[2] = {event->mval[0] - psd->initial_loc[0], event->mval[1] - psd->initial_loc[1]}; if (psd->select == 1) { @@ -648,7 +648,7 @@ static int paintcurve_slide_modal(bContext *C, wmOperator *op, const wmEvent *ev add_v2_v2v2(psd->pcp->bez.vec[opposite], psd->pcp->bez.vec[1], diff); } } - WM_paint_cursor_tag_redraw(window, ar); + WM_paint_cursor_tag_redraw(window, region); break; } default: @@ -727,7 +727,7 @@ static int paintcurve_cursor_invoke(bContext *C, wmOperator *UNUSED(op), const w switch (mode) { case PAINT_MODE_TEXTURE_2D: { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); SpaceImage *sima = CTX_wm_space_image(C); float location[2]; @@ -736,7 +736,7 @@ static int paintcurve_cursor_invoke(bContext *C, wmOperator *UNUSED(op), const w } UI_view2d_region_to_view( - &ar->v2d, event->mval[0], event->mval[1], &location[0], &location[1]); + ®ion->v2d, event->mval[0], event->mval[1], &location[0], &location[1]); copy_v2_v2(sima->cursor, location); WM_event_add_notifier(C, NC_SPACE | ND_SPACE_IMAGE, NULL); break; diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c index fe091dee4f8..32b0965363a 100644 --- a/source/blender/editors/sculpt_paint/paint_hide.c +++ b/source/blender/editors/sculpt_paint/paint_hide.c @@ -307,7 +307,7 @@ static void clip_planes_from_rect(bContext *C, view3d_operator_needs_opengl(C); ED_view3d_viewcontext_init(C, &vc, depsgraph); - ED_view3d_clipping_calc(&bb, clip_planes, vc.ar, vc.obact, rect); + ED_view3d_clipping_calc(&bb, clip_planes, vc.region, vc.obact, rect); } /* If mode is inside, get all PBVH nodes that lie at least partially @@ -338,7 +338,7 @@ static void get_pbvh_nodes( static int hide_show_exec(bContext *C, wmOperator *op) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); Object *ob = CTX_data_active_object(C); Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); Mesh *me = ob->data; @@ -403,7 +403,7 @@ static int hide_show_exec(bContext *C, wmOperator *op) BKE_mesh_flush_hidden_from_verts(me); } - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index a36da7a17e6..8f4f304b3a1 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -289,9 +289,9 @@ static bool image_paint_poll_ex(bContext *C, bool check_tool) SpaceImage *sima = CTX_wm_space_image(C); if (sima) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); - if ((sima->mode == SI_MODE_PAINT) && ar->regiontype == RGN_TYPE_WINDOW) { + if ((sima->mode == SI_MODE_PAINT) && region->regiontype == RGN_TYPE_WINDOW) { return 1; } } @@ -440,7 +440,7 @@ static void gradient_draw_line(bContext *UNUSED(C), int x, int y, void *customda GPUVertFormat *format = immVertexFormat(); uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); - ARegion *ar = pop->vc.ar; + ARegion *region = pop->vc.region; immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -449,7 +449,8 @@ static void gradient_draw_line(bContext *UNUSED(C), int x, int y, void *customda immBegin(GPU_PRIM_LINES, 2); immVertex2i(pos, x, y); - immVertex2i(pos, pop->startmouse[0] + ar->winrct.xmin, pop->startmouse[1] + ar->winrct.ymin); + immVertex2i( + pos, pop->startmouse[0] + region->winrct.xmin, pop->startmouse[1] + region->winrct.ymin); immEnd(); GPU_line_width(2.0); @@ -457,7 +458,8 @@ static void gradient_draw_line(bContext *UNUSED(C), int x, int y, void *customda immBegin(GPU_PRIM_LINES, 2); immVertex2i(pos, x, y); - immVertex2i(pos, pop->startmouse[0] + ar->winrct.xmin, pop->startmouse[1] + ar->winrct.ymin); + immVertex2i( + pos, pop->startmouse[0] + region->winrct.xmin, pop->startmouse[1] + region->winrct.ymin); immEnd(); immUnbindProgram(); @@ -766,8 +768,8 @@ bool get_imapaint_zoom(bContext *C, float *zoomx, float *zoomy) if (sa && sa->spacetype == SPACE_IMAGE) { SpaceImage *sima = sa->spacedata.first; if (sima->mode == SI_MODE_PAINT) { - ARegion *ar = CTX_wm_region(C); - ED_space_image_get_zoom(sima, ar, zoomx, zoomy); + ARegion *region = CTX_wm_region(C); + ED_space_image_get_zoom(sima, region, zoomx, zoomy); return 1; } } @@ -871,10 +873,10 @@ static int grab_clone_invoke(bContext *C, wmOperator *op, const wmEvent *event) static int grab_clone_modal(bContext *C, wmOperator *op, const wmEvent *event) { Brush *brush = image_paint_brush(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); GrabClone *cmv = op->customdata; float startfx, startfy, fx, fy, delta[2]; - int xmin = ar->winrct.xmin, ymin = ar->winrct.ymin; + int xmin = region->winrct.xmin, ymin = region->winrct.ymin; switch (event->type) { case LEFTMOUSE: @@ -885,8 +887,8 @@ static int grab_clone_modal(bContext *C, wmOperator *op, const wmEvent *event) case MOUSEMOVE: /* mouse moved, so move the clone image */ UI_view2d_region_to_view( - &ar->v2d, cmv->startx - xmin, cmv->starty - ymin, &startfx, &startfy); - UI_view2d_region_to_view(&ar->v2d, event->x - xmin, event->y - ymin, &fx, &fy); + ®ion->v2d, cmv->startx - xmin, cmv->starty - ymin, &startfx, &startfy); + UI_view2d_region_to_view(®ion->v2d, event->x - xmin, event->y - ymin, &fx, &fy); delta[0] = fx - startfx; delta[1] = fy - startfy; @@ -965,14 +967,14 @@ static int sample_color_exec(bContext *C, wmOperator *op) Paint *paint = BKE_paint_get_active_from_context(C); Brush *brush = BKE_paint_brush(paint); ePaintMode mode = BKE_paintmode_get_active_from_context(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); wmWindow *win = CTX_wm_window(C); const bool show_cursor = ((paint->flags & PAINT_SHOW_BRUSH) != 0); int location[2]; paint->flags &= ~PAINT_SHOW_BRUSH; /* force redraw without cursor */ - WM_paint_cursor_tag_redraw(win, ar); + WM_paint_cursor_tag_redraw(win, region); WM_redraw_windows(C); RNA_int_get_array(op->ptr, "location", location); @@ -980,7 +982,7 @@ static int sample_color_exec(bContext *C, wmOperator *op) const bool use_sample_texture = (mode == PAINT_MODE_TEXTURE_3D) && !RNA_boolean_get(op->ptr, "merged"); - paint_sample_color(C, ar, location[0], location[1], use_sample_texture, use_palette); + paint_sample_color(C, region, location[0], location[1], use_sample_texture, use_palette); if (show_cursor) { paint->flags |= PAINT_SHOW_BRUSH; @@ -997,7 +999,7 @@ static int sample_color_invoke(bContext *C, wmOperator *op, const wmEvent *event Paint *paint = BKE_paint_get_active_from_context(C); Brush *brush = BKE_paint_brush(paint); SampleColorData *data = MEM_mallocN(sizeof(SampleColorData), "sample color custom data"); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); wmWindow *win = CTX_wm_window(C); data->launch_event = WM_userdef_event_type_from_keymap_type(event->type); @@ -1012,7 +1014,7 @@ static int sample_color_invoke(bContext *C, wmOperator *op, const wmEvent *event WM_event_add_modal_handler(C, op); /* force redraw without cursor */ - WM_paint_cursor_tag_redraw(win, ar); + WM_paint_cursor_tag_redraw(win, region); WM_redraw_windows(C); RNA_int_set_array(op->ptr, "location", event->mval); @@ -1021,7 +1023,7 @@ static int sample_color_invoke(bContext *C, wmOperator *op, const wmEvent *event const bool use_sample_texture = (mode == PAINT_MODE_TEXTURE_3D) && !RNA_boolean_get(op->ptr, "merged"); - paint_sample_color(C, ar, event->mval[0], event->mval[1], use_sample_texture, false); + paint_sample_color(C, region, event->mval[0], event->mval[1], use_sample_texture, false); WM_cursor_modal_set(win, WM_CURSOR_EYEDROPPER); WM_event_add_notifier(C, NC_BRUSH | NA_EDITED, brush); @@ -1058,18 +1060,18 @@ static int sample_color_modal(bContext *C, wmOperator *op, const wmEvent *event) switch (event->type) { case MOUSEMOVE: { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); RNA_int_set_array(op->ptr, "location", event->mval); - paint_sample_color(C, ar, event->mval[0], event->mval[1], use_sample_texture, false); + paint_sample_color(C, region, event->mval[0], event->mval[1], use_sample_texture, false); WM_event_add_notifier(C, NC_BRUSH | NA_EDITED, brush); break; } case LEFTMOUSE: if (event->val == KM_PRESS) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); RNA_int_set_array(op->ptr, "location", event->mval); - paint_sample_color(C, ar, event->mval[0], event->mval[1], use_sample_texture, true); + paint_sample_color(C, region, event->mval[0], event->mval[1], use_sample_texture, true); if (!data->sample_palette) { data->sample_palette = true; sample_color_update_header(data, C); diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 163111ce32f..0f5ebcf9f71 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -244,7 +244,7 @@ typedef struct LoopSeamData { typedef struct ProjPaintState { View3D *v3d; RegionView3D *rv3d; - ARegion *ar; + ARegion *region; Depsgraph *depsgraph; Scene *scene; /* PROJ_SRC_**** */ @@ -3719,8 +3719,8 @@ static void proj_paint_state_viewport_init(ProjPaintState *ps, const char symmet if (ELEM(ps->source, PROJ_SRC_VIEW, PROJ_SRC_VIEW_FILL)) { /* normal drawing */ - ps->winx = ps->ar->winx; - ps->winy = ps->ar->winy; + ps->winx = ps->region->winx; + ps->winy = ps->region->winy; copy_m4_m4(viewmat, ps->rv3d->viewmat); copy_m4_m4(viewinv, ps->rv3d->viewinv); @@ -5782,18 +5782,18 @@ void paint_proj_stroke(const bContext *C, Scene *scene = ps_handle->scene; struct Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); View3D *v3d = CTX_wm_view3d(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); float *cursor = scene->cursor.location; int mval_i[2] = {(int)pos[0], (int)pos[1]}; view3d_operator_needs_opengl(C); - if (!ED_view3d_autodist(depsgraph, ar, v3d, mval_i, cursor, false, NULL)) { + if (!ED_view3d_autodist(depsgraph, region, v3d, mval_i, cursor, false, NULL)) { return; } DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE); - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); return; } @@ -5847,7 +5847,7 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps, int /* these can be NULL */ ps->v3d = CTX_wm_view3d(C); ps->rv3d = CTX_wm_region_view3d(C); - ps->ar = CTX_wm_region(C); + ps->region = CTX_wm_region(C); ps->depsgraph = CTX_data_ensure_evaluated_depsgraph(C); ps->scene = scene; @@ -6230,12 +6230,12 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - ARegion *ar = BKE_area_find_region_active_win(sa); - if (!ar) { + ARegion *region = BKE_area_find_region_active_win(sa); + if (!region) { BKE_report(op->reports, RPT_ERROR, "No 3D viewport found to create image from"); return OPERATOR_CANCELLED; } - RegionView3D *rv3d = ar->regiondata; + RegionView3D *rv3d = region->regiondata; RNA_string_get(op->ptr, "filepath", filename); @@ -6267,7 +6267,7 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op) scene, v3d_copy.shading.type, &v3d_copy, - ar, + region, w, h, IB_rect, diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h index 2fe585aa9ea..018d7f72bb6 100644 --- a/source/blender/editors/sculpt_paint/paint_intern.h +++ b/source/blender/editors/sculpt_paint/paint_intern.h @@ -174,7 +174,7 @@ struct VertProjHandle *ED_vpaint_proj_handle_create(struct Depsgraph *depsgraph, void ED_vpaint_proj_handle_update(struct Depsgraph *depsgraph, struct VertProjHandle *vp_handle, /* runtime vars */ - struct ARegion *ar, + struct ARegion *region, const float mval_fl[2]); void ED_vpaint_proj_handle_free(struct VertProjHandle *vp_handle); @@ -261,7 +261,7 @@ void SCULPT_OT_uv_sculpt_stroke(struct wmOperatorType *ot); bool paint_convert_bb_to_rect(struct rcti *rect, const float bb_min[3], const float bb_max[3], - const struct ARegion *ar, + const struct ARegion *region, struct RegionView3D *rv3d, struct Object *ob); @@ -269,7 +269,7 @@ bool paint_convert_bb_to_rect(struct rcti *rect, * screen_rect from screen into object-space (essentially converting a * 2D screens-space bounding box into four 3D planes) */ void paint_calc_redraw_planes(float planes[4][4], - const struct ARegion *ar, + const struct ARegion *region, struct Object *ob, const struct rcti *screen_rect); @@ -288,7 +288,7 @@ void paint_get_tex_pixel_col(const struct MTex *mtex, struct ColorSpace *colorspace); void paint_sample_color( - struct bContext *C, struct ARegion *ar, int x, int y, bool texpaint_proj, bool palette); + struct bContext *C, struct ARegion *region, int x, int y, bool texpaint_proj, bool palette); void paint_stroke_operator_properties(struct wmOperatorType *ot); diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c index c8f4bdc0522..d6e5559b810 100644 --- a/source/blender/editors/sculpt_paint/paint_mask.c +++ b/source/blender/editors/sculpt_paint/paint_mask.c @@ -137,7 +137,7 @@ static void mask_flood_fill_task_cb(void *__restrict userdata, static int mask_flood_fill_exec(bContext *C, wmOperator *op) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); Object *ob = CTX_data_active_object(C); Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); PaintMaskFloodMode mode; @@ -184,7 +184,7 @@ static int mask_flood_fill_exec(bContext *C, wmOperator *op) MEM_freeN(nodes); } - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); @@ -298,7 +298,7 @@ bool ED_sculpt_mask_box_select(struct bContext *C, ViewContext *vc, const rcti * BoundBox bb; float clip_planes[4][4]; float clip_planes_final[4][4]; - ARegion *ar = vc->ar; + ARegion *region = vc->region; Object *ob = vc->obact; PaintMaskFloodMode mode; bool multires; @@ -311,7 +311,7 @@ bool ED_sculpt_mask_box_select(struct bContext *C, ViewContext *vc, const rcti * float value = select ? 1.0f : 0.0f; /* Transform the clip planes in object space. */ - ED_view3d_clipping_calc(&bb, clip_planes, vc->ar, vc->obact, rect); + ED_view3d_clipping_calc(&bb, clip_planes, vc->region, vc->obact, rect); BKE_sculpt_update_object_for_edit(depsgraph, ob, false, true); pbvh = ob->sculpt->pbvh; @@ -361,7 +361,7 @@ bool ED_sculpt_mask_box_select(struct bContext *C, ViewContext *vc, const rcti * SCULPT_undo_push_end(); - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); @@ -392,7 +392,7 @@ static bool is_effected_lasso(LassoMaskData *data, float co[3]) flip_v3_v3(co_final, co, data->symmpass); /* First project point to 2d space. */ - ED_view3d_project_float_v2_m4(data->vc->ar, co_final, scr_co_f, data->projviewobjmat); + ED_view3d_project_float_v2_m4(data->vc->region, co_final, scr_co_f, data->projviewobjmat); scr_co_s[0] = scr_co_f[0]; scr_co_s[1] = scr_co_f[1]; @@ -498,7 +498,7 @@ static int paint_mask_gesture_lasso_exec(bContext *C, wmOperator *op) mask_lasso_px_cb, &data); - ED_view3d_clipping_calc(&bb, clip_planes, vc.ar, vc.obact, &data.rect); + ED_view3d_clipping_calc(&bb, clip_planes, vc.region, vc.obact, &data.rect); BKE_sculpt_update_object_for_edit(depsgraph, ob, false, true); pbvh = ob->sculpt->pbvh; @@ -550,7 +550,7 @@ static int paint_mask_gesture_lasso_exec(bContext *C, wmOperator *op) SCULPT_undo_push_end(); - ED_region_tag_redraw(vc.ar); + ED_region_tag_redraw(vc.region); MEM_freeN((void *)mcords); MEM_freeN(data.px); diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index 6ed0bf1b7ba..ee1cb09ae94 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -602,7 +602,7 @@ static int stencil_control_invoke(bContext *C, wmOperator *op, const wmEvent *ev Paint *paint = BKE_paint_get_active_from_context(C); Brush *br = BKE_paint_brush(paint); float mvalf[2] = {event->mval[0], event->mval[1]}; - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); StencilControlData *scd; int mask = RNA_enum_get(op->ptr, "texmode"); @@ -627,8 +627,8 @@ static int stencil_control_invoke(bContext *C, wmOperator *op, const wmEvent *ev scd->mode = RNA_enum_get(op->ptr, "mode"); scd->launch_event = WM_userdef_event_type_from_keymap_type(event->type); - scd->area_size[0] = ar->winx; - scd->area_size[1] = ar->winy; + scd->area_size[0] = region->winx; + scd->area_size[1] = region->winy; op->customdata = scd; WM_event_add_modal_handler(C, op); diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 90341fa8248..72422770587 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -145,7 +145,7 @@ static void paint_draw_smooth_cursor(bContext *C, int x, int y, void *customdata GPU_line_smooth(true); GPU_blend(true); - ARegion *ar = stroke->vc.ar; + ARegion *region = stroke->vc.region; uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -154,8 +154,8 @@ static void paint_draw_smooth_cursor(bContext *C, int x, int y, void *customdata immBegin(GPU_PRIM_LINES, 2); immVertex2f(pos, x, y); immVertex2f(pos, - stroke->last_mouse_position[0] + ar->winrct.xmin, - stroke->last_mouse_position[1] + ar->winrct.ymin); + stroke->last_mouse_position[0] + region->winrct.xmin, + stroke->last_mouse_position[1] + region->winrct.ymin); immEnd(); @@ -191,21 +191,21 @@ static void paint_draw_line_cursor(bContext *C, int x, int y, void *customdata) immBegin(GPU_PRIM_LINES, 2); - ARegion *ar = stroke->vc.ar; + ARegion *region = stroke->vc.region; if (stroke->constrain_line) { immVertex2f(shdr_pos, - stroke->last_mouse_position[0] + ar->winrct.xmin, - stroke->last_mouse_position[1] + ar->winrct.ymin); + stroke->last_mouse_position[0] + region->winrct.xmin, + stroke->last_mouse_position[1] + region->winrct.ymin); immVertex2f(shdr_pos, - stroke->constrained_pos[0] + ar->winrct.xmin, - stroke->constrained_pos[1] + ar->winrct.ymin); + stroke->constrained_pos[0] + region->winrct.xmin, + stroke->constrained_pos[1] + region->winrct.ymin); } else { immVertex2f(shdr_pos, - stroke->last_mouse_position[0] + ar->winrct.xmin, - stroke->last_mouse_position[1] + ar->winrct.ymin); + stroke->last_mouse_position[0] + region->winrct.xmin, + stroke->last_mouse_position[1] + region->winrct.ymin); immVertex2f(shdr_pos, x, y); } @@ -796,7 +796,7 @@ static int paint_space_stroke(bContext *C, float final_pressure) { const Scene *scene = CTX_data_scene(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); PaintStroke *stroke = op->customdata; UnifiedPaintSettings *ups = stroke->ups; Paint *paint = BKE_paint_get_active_from_context(C); @@ -847,7 +847,7 @@ static int paint_space_stroke(bContext *C, add_v3_v3v3(final_world_space_position, stroke->last_world_space_position, final_world_space_position); - ED_view3d_project(ar, final_world_space_position, mouse); + ED_view3d_project(region, final_world_space_position, mouse); } else { mouse[0] = stroke->last_mouse_position[0] + dmouse[0] * spacing; @@ -1511,11 +1511,11 @@ int paint_stroke_modal(bContext *C, wmOperator *op, const wmEvent *event) * coming, so postpone potentially slow redraw updates until all are done */ if (event->type != INBETWEEN_MOUSEMOVE) { wmWindow *window = CTX_wm_window(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); /* At the very least, invalidate the cursor */ - if (ar && (p->flags & PAINT_SHOW_BRUSH)) { - WM_paint_cursor_tag_redraw(window, ar); + if (region && (p->flags & PAINT_SHOW_BRUSH)) { + WM_paint_cursor_tag_redraw(window, region); } if (redraw && stroke->redraw) { @@ -1598,10 +1598,10 @@ bool paint_poll(bContext *C) Paint *p = BKE_paint_get_active_from_context(C); Object *ob = CTX_data_active_object(C); ScrArea *sa = CTX_wm_area(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); if (p && ob && BKE_paint_brush(p) && (sa && ELEM(sa->spacetype, SPACE_VIEW3D, SPACE_IMAGE)) && - (ar && ar->regiontype == RGN_TYPE_WINDOW)) { + (region && region->regiontype == RGN_TYPE_WINDOW)) { /* Check the current tool is a brush. */ bToolRef *tref = sa->runtime.tool; if (tref && tref->runtime && tref->runtime->data_block[0]) { diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index 19d890eeac3..bd43fddb652 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -84,7 +84,7 @@ bool paint_convert_bb_to_rect(rcti *rect, const float bb_min[3], const float bb_max[3], - const ARegion *ar, + const ARegion *region, RegionView3D *rv3d, Object *ob) { @@ -109,7 +109,7 @@ bool paint_convert_bb_to_rect(rcti *rect, vec[1] = j ? bb_min[1] : bb_max[1]; vec[2] = k ? bb_min[2] : bb_max[2]; /* convert corner to screen space */ - ED_view3d_project_float_v2_m4(ar, vec, proj, projection_mat); + ED_view3d_project_float_v2_m4(region, vec, proj, projection_mat); /* expand 2D rectangle */ /* we could project directly to int? */ @@ -129,7 +129,7 @@ bool paint_convert_bb_to_rect(rcti *rect, * screen_rect from screen into object-space (essentially converting a * 2D screens-space bounding box into four 3D planes) */ void paint_calc_redraw_planes(float planes[4][4], - const ARegion *ar, + const ARegion *region, Object *ob, const rcti *screen_rect) { @@ -143,7 +143,7 @@ void paint_calc_redraw_planes(float planes[4][4], rect.ymin -= 2; rect.ymax += 2; - ED_view3d_clipping_calc(&bb, planes, ar, ob, &rect); + ED_view3d_clipping_calc(&bb, planes, region, ob, &rect); } float paint_calc_object_space_radius(ViewContext *vc, const float center[3], float pixel_radius) @@ -156,7 +156,7 @@ float paint_calc_object_space_radius(ViewContext *vc, const float center[3], flo mul_v3_m4v3(loc, ob->obmat, center); zfac = ED_view3d_calc_zfac(vc->rv3d, loc, NULL); - ED_view3d_win_to_delta(vc->ar, mval_f, delta, zfac); + ED_view3d_win_to_delta(vc->region, mval_f, delta, zfac); scale = fabsf(mat4_to_scale(ob->obmat)); scale = (scale == 0.0f) ? 1.0f : scale; @@ -387,7 +387,7 @@ static int imapaint_pick_face(ViewContext *vc, /* sample only on the exact position */ ED_view3d_select_id_validate(vc); - *r_index = DRW_select_buffer_sample_point(vc->depsgraph, vc->ar, vc->v3d, mval); + *r_index = DRW_select_buffer_sample_point(vc->depsgraph, vc->region, vc->v3d, mval); if ((*r_index) == 0 || (*r_index) > (unsigned int)totpoly) { return 0; @@ -456,7 +456,7 @@ void flip_qt_qt(float out[4], const float in[4], const ePaintSymmetryFlags symm) /* used for both 3d view and image window */ void paint_sample_color( - bContext *C, ARegion *ar, int x, int y, bool texpaint_proj, bool use_palette) + bContext *C, ARegion *region, int x, int y, bool texpaint_proj, bool use_palette) { Scene *scene = CTX_data_scene(C); Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); @@ -467,8 +467,8 @@ void paint_sample_color( unsigned int col; const unsigned char *cp; - CLAMP(x, 0, ar->winx); - CLAMP(y, 0, ar->winy); + CLAMP(x, 0, region->winx); + CLAMP(y, 0, region->winy); if (use_palette) { if (!palette) { @@ -583,7 +583,7 @@ void paint_sample_color( if (!sample_success) { glReadBuffer(GL_FRONT); glReadPixels( - x + ar->winrct.xmin, y + ar->winrct.ymin, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &col); + x + region->winrct.xmin, y + region->winrct.ymin, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &col); glReadBuffer(GL_BACK); } else { @@ -592,7 +592,8 @@ void paint_sample_color( } else { glReadBuffer(GL_FRONT); - glReadPixels(x + ar->winrct.xmin, y + ar->winrct.ymin, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &col); + glReadPixels( + x + region->winrct.xmin, y + region->winrct.ymin, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &col); glReadBuffer(GL_BACK); } cp = (unsigned char *)&col; diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 1b04ce5f97f..f957f2287f0 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -216,8 +216,8 @@ static bool vertex_paint_poll_ex(bContext *C, bool check_tool) if (vertex_paint_mode_poll(C) && BKE_paint_brush(&CTX_data_tool_settings(C)->vpaint->paint)) { ScrArea *sa = CTX_wm_area(C); if (sa && sa->spacetype == SPACE_VIEW3D) { - ARegion *ar = CTX_wm_region(C); - if (ar->regiontype == RGN_TYPE_WINDOW) { + ARegion *region = CTX_wm_region(C); + if (region->regiontype == RGN_TYPE_WINDOW) { if (!check_tool || WM_toolsystem_active_tool_is_brush(C)) { return 1; } @@ -252,8 +252,8 @@ static bool weight_paint_poll_ex(bContext *C, bool check_tool) if ((ob != NULL) && (ob->mode & OB_MODE_WEIGHT_PAINT) && (BKE_paint_brush(&CTX_data_tool_settings(C)->wpaint->paint) != NULL) && (sa = CTX_wm_area(C)) && (sa->spacetype == SPACE_VIEW3D)) { - ARegion *ar = CTX_wm_region(C); - if (ELEM(ar->regiontype, RGN_TYPE_WINDOW, RGN_TYPE_HUD)) { + ARegion *region = CTX_wm_region(C); + if (ELEM(region->regiontype, RGN_TYPE_WINDOW, RGN_TYPE_HUD)) { if (!check_tool || WM_toolsystem_active_tool_is_brush(C)) { return 1; } @@ -349,7 +349,7 @@ static void tex_color_alpha(VPaint *vp, const ViewContext *vc, const float co[3] else { float co_ss[2]; /* screenspace */ if (ED_view3d_project_float_object( - vc->ar, co, co_ss, V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_NEAR) == + vc->region, co, co_ss, V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK) { const float co_ss_3d[3] = {co_ss[0], co_ss[1], 0.0f}; /* we need a 3rd empty value */ BKE_brush_sample_tex_3d(vc->scene, brush, co_ss_3d, r_rgba, 0, NULL); @@ -2345,7 +2345,7 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P swap_m4m4(wpd->vc.rv3d->persmat, mat); rcti r; - if (SCULPT_get_redraw_rect(vc->ar, CTX_wm_region_view3d(C), ob, &r)) { + if (SCULPT_get_redraw_rect(vc->region, CTX_wm_region_view3d(C), ob, &r)) { if (ss->cache) { ss->cache->current_r = r; } @@ -2358,12 +2358,12 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P } } - r.xmin += vc->ar->winrct.xmin - 2; - r.xmax += vc->ar->winrct.xmin + 2; - r.ymin += vc->ar->winrct.ymin - 2; - r.ymax += vc->ar->winrct.ymin + 2; + r.xmin += vc->region->winrct.xmin - 2; + r.xmax += vc->region->winrct.xmin + 2; + r.ymin += vc->region->winrct.ymin - 2; + r.ymax += vc->region->winrct.ymin + 2; } - ED_region_tag_redraw_partial(vc->ar, &r, true); + ED_region_tag_redraw_partial(vc->region, &r, true); } static void wpaint_stroke_done(const bContext *C, struct PaintStroke *stroke) @@ -3318,7 +3318,7 @@ static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P mul_v3_m4v3(loc_world, ob->obmat, ss->cache->true_location); paint_last_stroke_update(scene, loc_world); - ED_region_tag_redraw(vc->ar); + ED_region_tag_redraw(vc->region); if (vpd->use_fast_update == false) { /* recalculate modifier stack to get new colors, slow, diff --git a/source/blender/editors/sculpt_paint/paint_vertex_proj.c b/source/blender/editors/sculpt_paint/paint_vertex_proj.c index 7bca7745ca0..e9935ff3eeb 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex_proj.c +++ b/source/blender/editors/sculpt_paint/paint_vertex_proj.c @@ -65,7 +65,7 @@ struct VertProjUpdate { struct VertProjHandle *vp_handle; /* runtime */ - ARegion *ar; + ARegion *region; const float *mval_fl; }; @@ -130,7 +130,7 @@ static void vpaint_proj_dm_map_cosnos_update__map_cb( float co_ss[2]; /* screenspace */ if (ED_view3d_project_float_object( - vp_update->ar, co, co_ss, V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_NEAR) == + vp_update->region, co, co_ss, V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK) { const float dist_sq = len_squared_v2v2(vp_update->mval_fl, co_ss); if (dist_sq > vp_handle->dists_sq[index]) { @@ -158,10 +158,10 @@ static void vpaint_proj_dm_map_cosnos_update__map_cb( static void vpaint_proj_dm_map_cosnos_update(struct Depsgraph *depsgraph, struct VertProjHandle *vp_handle, - ARegion *ar, + ARegion *region, const float mval_fl[2]) { - struct VertProjUpdate vp_update = {vp_handle, ar, mval_fl}; + struct VertProjUpdate vp_update = {vp_handle, region, mval_fl}; Object *ob = vp_handle->ob; Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); @@ -216,11 +216,11 @@ struct VertProjHandle *ED_vpaint_proj_handle_create(struct Depsgraph *depsgraph, void ED_vpaint_proj_handle_update(struct Depsgraph *depsgraph, struct VertProjHandle *vp_handle, - ARegion *ar, + ARegion *region, const float mval_fl[2]) { if (vp_handle->use_update) { - vpaint_proj_dm_map_cosnos_update(depsgraph, vp_handle, ar, mval_fl); + vpaint_proj_dm_map_cosnos_update(depsgraph, vp_handle, region, mval_fl); } } diff --git a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c index 0d4fcd3e87d..4b8990c1b5d 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c +++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c @@ -318,8 +318,8 @@ static const EnumPropertyItem *weight_paint_sample_enum_itemf(bContext *C, uint index; const int mval[2] = { - win->eventstate->x - vc.ar->winrct.xmin, - win->eventstate->y - vc.ar->winrct.ymin, + win->eventstate->x - vc.region->winrct.xmin, + win->eventstate->y - vc.region->winrct.ymin, }; view3d_operator_needs_opengl(C); @@ -563,7 +563,7 @@ typedef struct WPGradient_vertStoreBase { } WPGradient_vertStoreBase; typedef struct WPGradient_userData { - struct ARegion *ar; + struct ARegion *region; Scene *scene; Mesh *me; Brush *brush; @@ -671,7 +671,7 @@ static void gradientVertInit__mapFunc(void *userData, } if (ED_view3d_project_float_object( - grad_data->ar, co, vs->sco, V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_NEAR) != + grad_data->region, co, vs->sco, V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_NEAR) != V3D_PROJ_RET_OK) { copy_v2_fl(vs->sco, FLT_MAX); return; @@ -733,7 +733,7 @@ static int paint_weight_gradient_exec(bContext *C, wmOperator *op) { wmGesture *gesture = op->customdata; WPGradient_vertStoreBase *vert_cache; - struct ARegion *ar = CTX_wm_region(C); + struct ARegion *region = CTX_wm_region(C); Scene *scene = CTX_data_scene(C); Object *ob = CTX_data_active_object(C); Mesh *me = ob->data; @@ -778,7 +778,7 @@ static int paint_weight_gradient_exec(bContext *C, wmOperator *op) sizeof(WPGradient_vertStoreBase) + (sizeof(WPGradient_vertStore) * me->totvert), __func__); } - data.ar = ar; + data.region = region; data.scene = scene; data.me = ob->data; data.sco_start = sco_start; @@ -801,7 +801,7 @@ static int paint_weight_gradient_exec(bContext *C, wmOperator *op) data.weightpaint = BKE_brush_weight_get(scene, brush); } - ED_view3d_init_mats_rv3d(ob, ar->regiondata); + ED_view3d_init_mats_rv3d(ob, region->regiondata); Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); @@ -843,8 +843,8 @@ static int paint_weight_gradient_invoke(bContext *C, wmOperator *op, const wmEve ret = WM_gesture_straightline_invoke(C, op, event); if (ret & OPERATOR_RUNNING_MODAL) { - struct ARegion *ar = CTX_wm_region(C); - if (ar->regiontype == RGN_TYPE_WINDOW) { + struct ARegion *region = CTX_wm_region(C); + if (region->regiontype == RGN_TYPE_WINDOW) { /* TODO, hardcoded, extend WM_gesture_straightline_ */ if (event->type == LEFTMOUSE && event->val == KM_PRESS) { wmGesture *gesture = op->customdata; diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 3f60d96b7ce..9241287ab5d 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -1161,7 +1161,7 @@ static void sculpt_extend_redraw_rect_previous(Object *ob, rcti *rect) } /* Get a screen-space rectangle of the modified area. */ -bool SCULPT_get_redraw_rect(ARegion *ar, RegionView3D *rv3d, Object *ob, rcti *rect) +bool SCULPT_get_redraw_rect(ARegion *region, RegionView3D *rv3d, Object *ob, rcti *rect) { PBVH *pbvh = ob->sculpt->pbvh; float bb_min[3], bb_max[3]; @@ -1173,14 +1173,14 @@ bool SCULPT_get_redraw_rect(ARegion *ar, RegionView3D *rv3d, Object *ob, rcti *r BKE_pbvh_redraw_BB(pbvh, bb_min, bb_max); /* Convert 3D bounding box to screen space. */ - if (!paint_convert_bb_to_rect(rect, bb_min, bb_max, ar, rv3d, ob)) { + if (!paint_convert_bb_to_rect(rect, bb_min, bb_max, region, rv3d, ob)) { return false; } return true; } -void ED_sculpt_redraw_planes_get(float planes[4][4], ARegion *ar, Object *ob) +void ED_sculpt_redraw_planes_get(float planes[4][4], ARegion *region, Object *ob) { PBVH *pbvh = ob->sculpt->pbvh; /* Copy here, original will be used below. */ @@ -1188,7 +1188,7 @@ void ED_sculpt_redraw_planes_get(float planes[4][4], ARegion *ar, Object *ob) sculpt_extend_redraw_rect_previous(ob, &rect); - paint_calc_redraw_planes(planes, ar, ob, &rect); + paint_calc_redraw_planes(planes, region, ob, &rect); /* We will draw this rect, so now we can set it as the previous partial rect. * Note that we don't update with the union of previous/current (rect), only with @@ -2186,7 +2186,7 @@ float SCULPT_brush_strength_factor(SculptSession *ss, mul_m4_v3(cache->symm_rot_mat_inv, symm_point); } - ED_view3d_project_float_v2_m4(cache->vc->ar, symm_point, point_2d, cache->projection_mat); + ED_view3d_project_float_v2_m4(cache->vc->region, symm_point, point_2d, cache->projection_mat); /* Still no symmetry supported for other paint modes. * Sculpt does it DIY. */ @@ -2457,7 +2457,7 @@ static void calc_local_y(ViewContext *vc, const float center[3], float y[3]) mul_v3_m4v3(loc, ob->imat, center); zfac = ED_view3d_calc_zfac(vc->rv3d, loc, NULL); - ED_view3d_win_to_delta(vc->ar, mval_f, y, zfac); + ED_view3d_win_to_delta(vc->region, mval_f, y, zfac); normalize_v3(y); add_v3_v3(y, ob->loc); @@ -6691,7 +6691,7 @@ static void sculpt_update_brush_delta(UnifiedPaintSettings *ups, Object *ob, Bru /* Compute 3d coordinate at same z from original location + mouse. */ mul_v3_m4v3(loc, ob->obmat, cache->orig_grab_location); - ED_view3d_win_to_3d(cache->vc->v3d, cache->vc->ar, loc, mouse, grab_location); + ED_view3d_win_to_3d(cache->vc->v3d, cache->vc->region, loc, mouse, grab_location); /* Compute delta to move verts by. */ if (!cache->first_time) { @@ -7033,12 +7033,12 @@ static float sculpt_raycast_init(ViewContext *vc, float obimat[4][4]; float dist; Object *ob = vc->obact; - RegionView3D *rv3d = vc->ar->regiondata; + RegionView3D *rv3d = vc->region->regiondata; View3D *v3d = vc->v3d; /* TODO: what if the segment is totally clipped? (return == 0). */ ED_view3d_win_to_segment_clipped( - vc->depsgraph, vc->ar, vc->v3d, mouse, ray_start, ray_end, true); + vc->depsgraph, vc->region, vc->v3d, mouse, ray_start, ray_end, true); invert_m4_m4(obimat, ob->obmat); mul_m4_v3(obimat, ray_start); @@ -7328,7 +7328,7 @@ static void sculpt_flush_update_step(bContext *C, SculptUpdateType update_flags) Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); Object *ob = CTX_data_active_object(C); SculptSession *ss = ob->sculpt; - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); MultiresModifierData *mmd = ss->multires; View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d = CTX_wm_region_view3d(C); @@ -7350,7 +7350,7 @@ static void sculpt_flush_update_step(bContext *C, SculptUpdateType update_flags) /* Slow update with full dependency graph update and all that comes with it. * Needed when there are modifiers or full shading in the 3D viewport. */ DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); } else { /* Fast path where we just update the BVH nodes that changed, and redraw @@ -7365,7 +7365,7 @@ static void sculpt_flush_update_step(bContext *C, SculptUpdateType update_flags) SCULPT_update_object_bounding_box(ob); } - if (SCULPT_get_redraw_rect(ar, CTX_wm_region_view3d(C), ob, &r)) { + if (SCULPT_get_redraw_rect(region, CTX_wm_region_view3d(C), ob, &r)) { if (ss->cache) { ss->cache->current_r = r; } @@ -7374,11 +7374,11 @@ static void sculpt_flush_update_step(bContext *C, SculptUpdateType update_flags) * the partial rect will always grow */ sculpt_extend_redraw_rect_previous(ob, &r); - r.xmin += ar->winrct.xmin - 2; - r.xmax += ar->winrct.xmin + 2; - r.ymin += ar->winrct.ymin - 2; - r.ymax += ar->winrct.ymin + 2; - ED_region_tag_redraw_partial(ar, &r, true); + r.xmin += region->winrct.xmin - 2; + r.xmax += region->winrct.xmin + 2; + r.ymin += region->winrct.ymin - 2; + r.ymax += region->winrct.ymin + 2; + ED_region_tag_redraw_partial(region, &r, true); } } } @@ -7413,9 +7413,9 @@ static void sculpt_flush_update_done(const bContext *C, Object *ob, SculptUpdate /* Tag all 3D viewports for redraw now that we are done. Others * viewports did not get a full redraw, and anti-aliasing for the * current viewport was deactivated. */ - for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) { - if (ar->regiontype == RGN_TYPE_WINDOW) { - ED_region_tag_redraw(ar); + for (ARegion *region = sa->regionbase.first; region; region = region->next) { + if (region->regiontype == RGN_TYPE_WINDOW) { + ED_region_tag_redraw(region); } } } @@ -8650,7 +8650,7 @@ static void sample_detail_voxel(bContext *C, ViewContext *vc, int mx, int my) } } -static void sample_detail_dyntopo(bContext *C, ViewContext *vc, ARegion *ar, int mx, int my) +static void sample_detail_dyntopo(bContext *C, ViewContext *vc, ARegion *region, int mx, int my) { Sculpt *sd = CTX_data_tool_settings(C)->sculpt; Object *ob = vc->obact; @@ -8658,7 +8658,7 @@ static void sample_detail_dyntopo(bContext *C, ViewContext *vc, ARegion *ar, int sculpt_stroke_modifiers_check(C, ob, brush); - float mouse[2] = {mx - ar->winrct.xmin, my - ar->winrct.ymin}; + float mouse[2] = {mx - region->winrct.xmin, my - region->winrct.ymin}; float ray_start[3], ray_end[3], ray_normal[3]; float depth = sculpt_raycast_init(vc, mouse, ray_start, ray_end, ray_normal, false); @@ -8682,8 +8682,8 @@ static int sample_detail(bContext *C, int mx, int my, int mode) /* Find 3D view to pick from. */ bScreen *screen = CTX_wm_screen(C); ScrArea *sa = BKE_screen_find_area_xy(screen, SPACE_VIEW3D, mx, my); - ARegion *ar = (sa) ? BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my) : NULL; - if (ar == NULL) { + ARegion *region = (sa) ? BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my) : NULL; + if (region == NULL) { return OPERATOR_CANCELLED; } @@ -8691,7 +8691,7 @@ static int sample_detail(bContext *C, int mx, int my, int mode) ScrArea *prev_sa = CTX_wm_area(C); ARegion *prev_ar = CTX_wm_region(C); CTX_wm_area_set(C, sa); - CTX_wm_region_set(C, ar); + CTX_wm_region_set(C, region); Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); ViewContext vc; @@ -8712,7 +8712,7 @@ static int sample_detail(bContext *C, int mx, int my, int mode) CTX_wm_region_set(C, prev_ar); return OPERATOR_CANCELLED; } - sample_detail_dyntopo(C, &vc, ar, mx, my); + sample_detail_dyntopo(C, &vc, region, mx, my); break; case SAMPLE_DETAIL_VOXEL: if (BKE_pbvh_type(ss->pbvh) != PBVH_FACES) { @@ -9389,7 +9389,7 @@ static void mask_filter_task_cb(void *__restrict userdata, static int sculpt_mask_filter_exec(bContext *C, wmOperator *op) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); Object *ob = CTX_data_active_object(C); SculptSession *ss = ob->sculpt; Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); @@ -9456,7 +9456,7 @@ static int sculpt_mask_filter_exec(bContext *C, wmOperator *op) SCULPT_undo_push_end(); - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); return OPERATOR_FINISHED; } @@ -9604,7 +9604,7 @@ static void dirty_mask_apply_task_cb(void *__restrict userdata, static int sculpt_dirty_mask_exec(bContext *C, wmOperator *op) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); Object *ob = CTX_data_active_object(C); SculptSession *ss = ob->sculpt; Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); @@ -9657,7 +9657,7 @@ static int sculpt_dirty_mask_exec(bContext *C, wmOperator *op) SCULPT_undo_push_end(); - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); @@ -9775,7 +9775,7 @@ static int sculpt_mask_expand_modal(bContext *C, wmOperator *op, const wmEvent * Object *ob = CTX_data_active_object(C); SculptSession *ss = ob->sculpt; Sculpt *sd = CTX_data_tool_settings(C)->sculpt; - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); float prevclick_f[2]; copy_v2_v2(prevclick_f, op->customdata); int prevclick[2] = {(int)prevclick_f[0], (int)prevclick_f[1]}; @@ -9882,7 +9882,7 @@ static int sculpt_mask_expand_modal(bContext *C, wmOperator *op, const wmEvent * } if (mask_expand_update_it == ss->filter_cache->mask_update_current_it) { - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); return OPERATOR_RUNNING_MODAL; } @@ -10390,7 +10390,7 @@ static int sculpt_set_pivot_position_exec(bContext *C, wmOperator *op) Sculpt *sd = CTX_data_tool_settings(C)->sculpt; Object *ob = CTX_data_active_object(C); SculptSession *ss = ob->sculpt; - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); const char symm = sd->paint.symmetry_flags & PAINT_SYMM_AXIS_ALL; @@ -10470,7 +10470,7 @@ static int sculpt_set_pivot_position_exec(bContext *C, wmOperator *op) MEM_SAFE_FREE(nodes); } - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); WM_event_add_notifier(C, NC_GEOM | ND_SELECT, ob->data); return OPERATOR_FINISHED; @@ -10558,7 +10558,7 @@ static int sculpt_face_set_create_invoke(bContext *C, wmOperator *op, const wmEv { Object *ob = CTX_data_active_object(C); SculptSession *ss = ob->sculpt; - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); const int mode = RNA_enum_get(op->ptr, "mode"); @@ -10617,7 +10617,7 @@ static int sculpt_face_set_create_invoke(bContext *C, wmOperator *op, const wmEv SCULPT_undo_push_end(); - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); return OPERATOR_FINISHED; @@ -10693,7 +10693,7 @@ static int sculpt_face_sets_change_visibility_invoke(bContext *C, { Object *ob = CTX_data_active_object(C); SculptSession *ss = ob->sculpt; - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); /* Dyntopo and Multires not supported for now. */ @@ -10787,7 +10787,7 @@ static int sculpt_face_sets_change_visibility_invoke(bContext *C, BKE_mesh_flush_hidden_from_verts(ob->data); } - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); View3D *v3d = CTX_wm_view3d(C); if (!BKE_sculptsession_use_pbvh_draw(ob, v3d)) { @@ -10825,7 +10825,7 @@ static int sculpt_face_sets_randomize_colors_invoke(bContext *C, Object *ob = CTX_data_active_object(C); SculptSession *ss = ob->sculpt; - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); /* Dyntopo and Multires not supported for now. */ if (BKE_pbvh_type(ss->pbvh) != PBVH_FACES) { @@ -10853,7 +10853,7 @@ static int sculpt_face_sets_randomize_colors_invoke(bContext *C, DEG_id_tag_update(&ob->id, ID_RECALC_SHADING); } - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data); return OPERATOR_FINISHED; diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h index 612908edfa1..3d1c84511e6 100644 --- a/source/blender/editors/sculpt_paint/sculpt_intern.h +++ b/source/blender/editors/sculpt_paint/sculpt_intern.h @@ -666,6 +666,9 @@ void SCULPT_vertcos_to_key(Object *ob, KeyBlock *kb, const float (*vertCos)[3]); void SCULPT_update_object_bounding_box(struct Object *ob); -bool SCULPT_get_redraw_rect(struct ARegion *ar, struct RegionView3D *rv3d, Object *ob, rcti *rect); +bool SCULPT_get_redraw_rect(struct ARegion *region, + struct RegionView3D *rv3d, + Object *ob, + rcti *rect); #endif diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c index 5beaff5ef00..b652c509db9 100644 --- a/source/blender/editors/sculpt_paint/sculpt_uv.c +++ b/source/blender/editors/sculpt_paint/sculpt_uv.c @@ -313,7 +313,7 @@ static void uv_sculpt_stroke_apply(bContext *C, { float co[2], radius, radius_root; Scene *scene = CTX_data_scene(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); BMEditMesh *em = BKE_editmesh_from_object(obedit); unsigned int tool; UvSculptData *sculptdata = (UvSculptData *)op->customdata; @@ -327,11 +327,11 @@ static void uv_sculpt_stroke_apply(bContext *C, tool = sculptdata->tool; invert = sculptdata->invert ? -1 : 1; alpha = BKE_brush_alpha_get(scene, brush); - UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]); + UI_view2d_region_to_view(®ion->v2d, event->mval[0], event->mval[1], &co[0], &co[1]); sima = CTX_wm_space_image(C); ED_space_image_get_size(sima, &width, &height); - ED_space_image_get_zoom(sima, ar, &zoomx, &zoomy); + ED_space_image_get_zoom(sima, region, &zoomx, &zoomy); radius = BKE_brush_size_get(scene, brush) / (width * zoomx); aspectRatio = width / (float)height; @@ -496,7 +496,7 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wm if (data) { int counter = 0, i; - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); float co[2]; BMFace *efa; MLoopUV *luv; @@ -542,7 +542,7 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wm } /* Mouse coordinates, useful for some functions like grab and sculpt all islands */ - UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]); + UI_view2d_region_to_view(®ion->v2d, event->mval[0], event->mval[1], &co[0], &co[1]); /* we need to find the active island here */ if (do_island_optimization) { @@ -704,7 +704,7 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wm radius = BKE_brush_size_get(scene, brush); sima = CTX_wm_space_image(C); ED_space_image_get_size(sima, &width, &height); - ED_space_image_get_zoom(sima, ar, &zoomx, &zoomy); + ED_space_image_get_zoom(sima, region, &zoomx, &zoomy); aspectRatio = width / (float)height; radius /= (width * zoomx); |