From b2ee1770d4c31078518f4ec9edd5196a41345162 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Fri, 6 Mar 2020 16:56:42 +0100 Subject: 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. --- source/blender/editors/mesh/editmesh_add_gizmo.c | 12 ++--- source/blender/editors/mesh/editmesh_bevel.c | 8 ++-- source/blender/editors/mesh/editmesh_bisect.c | 10 ++-- source/blender/editors/mesh/editmesh_extrude.c | 12 ++--- .../editors/mesh/editmesh_extrude_spin_gizmo.c | 20 ++++---- source/blender/editors/mesh/editmesh_inset.c | 8 ++-- source/blender/editors/mesh/editmesh_knife.c | 54 +++++++++++----------- .../blender/editors/mesh/editmesh_knife_project.c | 6 +-- source/blender/editors/mesh/editmesh_loopcut.c | 36 +++++++-------- source/blender/editors/mesh/editmesh_polybuild.c | 14 +++--- .../blender/editors/mesh/editmesh_preselect_elem.c | 4 +- source/blender/editors/mesh/editmesh_rip.c | 50 ++++++++++---------- source/blender/editors/mesh/editmesh_rip_edge.c | 12 ++--- source/blender/editors/mesh/editmesh_select.c | 18 ++++---- source/blender/editors/mesh/editmesh_tools.c | 22 ++++----- source/blender/editors/mesh/editmesh_utils.c | 8 ++-- source/blender/editors/mesh/meshtools.c | 35 ++++++++------ 17 files changed, 168 insertions(+), 161 deletions(-) (limited to 'source/blender/editors/mesh') diff --git a/source/blender/editors/mesh/editmesh_add_gizmo.c b/source/blender/editors/mesh/editmesh_add_gizmo.c index c748560ae1b..e7a99ca9e08 100644 --- a/source/blender/editors/mesh/editmesh_add_gizmo.c +++ b/source/blender/editors/mesh/editmesh_add_gizmo.c @@ -69,8 +69,8 @@ static void calc_initial_placement_point_from_view(bContext *C, { Scene *scene = CTX_data_scene(C); - ARegion *ar = CTX_wm_region(C); - RegionView3D *rv3d = ar->regiondata; + ARegion *region = CTX_wm_region(C); + RegionView3D *rv3d = region->regiondata; bool use_mouse_project = true; /* TODO: make optional */ @@ -99,7 +99,7 @@ static void calc_initial_placement_point_from_view(bContext *C, if (use_mouse_project) { float plane[4]; plane_from_point_normal_v3(plane, cursor_matrix[3], orient_matrix[2]); - if (ED_view3d_win_to_3d_on_plane(ar, plane, mval, true, r_location)) { + if (ED_view3d_win_to_3d_on_plane(region, plane, mval, true, r_location)) { copy_m3_m3(r_rotation, orient_matrix); return; } @@ -212,7 +212,7 @@ static void gizmo_mesh_placement_modal_from_setup(const bContext *C, wmGizmoGrou /* Start off dragging. */ { wmWindow *win = CTX_wm_window(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); wmGizmo *gz = ggd->cage; { @@ -220,8 +220,8 @@ static void gizmo_mesh_placement_modal_from_setup(const bContext *C, wmGizmoGrou float location[3]; calc_initial_placement_point_from_view((bContext *)C, (float[2]){ - win->eventstate->x - ar->winrct.xmin, - win->eventstate->y - ar->winrct.ymin, + win->eventstate->x - region->winrct.xmin, + win->eventstate->y - region->winrct.ymin, }, location, mat3); diff --git a/source/blender/editors/mesh/editmesh_bevel.c b/source/blender/editors/mesh/editmesh_bevel.c index 42fa3db7c57..123672a977b 100644 --- a/source/blender/editors/mesh/editmesh_bevel.c +++ b/source/blender/editors/mesh/editmesh_bevel.c @@ -299,7 +299,7 @@ static bool edbm_bevel_init(bContext *C, wmOperator *op, const bool is_modal) /* avoid the cost of allocating a bm copy */ if (is_modal) { View3D *v3d = CTX_wm_view3d(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); for (uint ob_index = 0; ob_index < opdata->ob_store_len; ob_index++) { Object *obedit = opdata->ob_store[ob_index].ob; @@ -307,7 +307,7 @@ static bool edbm_bevel_init(bContext *C, wmOperator *op, const bool is_modal) opdata->ob_store[ob_index].mesh_backup = EDBM_redo_state_store(em); } opdata->draw_handle_pixel = ED_region_draw_cb_activate( - ar->type, ED_region_draw_mouse_line_cb, opdata->mcenter, REGION_DRAW_POST_PIXEL); + region->type, ED_region_draw_mouse_line_cb, opdata->mcenter, REGION_DRAW_POST_PIXEL); G.moving = G_TRANSFORM_EDIT; if (v3d) { @@ -433,11 +433,11 @@ static void edbm_bevel_exit(bContext *C, wmOperator *op) if (opdata->is_modal) { View3D *v3d = CTX_wm_view3d(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); for (uint ob_index = 0; ob_index < opdata->ob_store_len; ob_index++) { EDBM_redo_state_free(&opdata->ob_store[ob_index].mesh_backup, NULL, false); } - ED_region_draw_cb_exit(ar->type, opdata->draw_handle_pixel); + ED_region_draw_cb_exit(region->type, opdata->draw_handle_pixel); if (v3d) { v3d->gizmo_flag = opdata->gizmo_flag; } diff --git a/source/blender/editors/mesh/editmesh_bisect.c b/source/blender/editors/mesh/editmesh_bisect.c index b2af58e47f2..e0a4195a668 100644 --- a/source/blender/editors/mesh/editmesh_bisect.c +++ b/source/blender/editors/mesh/editmesh_bisect.c @@ -81,8 +81,8 @@ static void mesh_bisect_interactive_calc(bContext *C, float plane_no[3]) { View3D *v3d = CTX_wm_view3d(C); - ARegion *ar = CTX_wm_region(C); - RegionView3D *rv3d = ar->regiondata; + ARegion *region = CTX_wm_region(C); + RegionView3D *rv3d = region->regiondata; int x_start = RNA_int_get(op->ptr, "xstart"); int y_start = RNA_int_get(op->ptr, "ystart"); @@ -96,18 +96,18 @@ static void mesh_bisect_interactive_calc(bContext *C, const float zfac = ED_view3d_calc_zfac(rv3d, co_ref, NULL); /* view vector */ - ED_view3d_win_to_vector(ar, co_a_ss, co_a); + ED_view3d_win_to_vector(region, co_a_ss, co_a); /* view delta */ sub_v2_v2v2(co_delta_ss, co_a_ss, co_b_ss); - ED_view3d_win_to_delta(ar, co_delta_ss, co_b, zfac); + ED_view3d_win_to_delta(region, co_delta_ss, co_b, zfac); /* cross both to get a normal */ cross_v3_v3v3(plane_no, co_a, co_b); normalize_v3(plane_no); /* not needed but nicer for user */ /* point on plane, can use either start or endpoint */ - ED_view3d_win_to_3d(v3d, ar, co_ref, co_a_ss, plane_co); + ED_view3d_win_to_3d(v3d, region, co_ref, co_a_ss, plane_co); } static int mesh_bisect_invoke(bContext *C, wmOperator *op, const wmEvent *event) diff --git a/source/blender/editors/mesh/editmesh_extrude.c b/source/blender/editors/mesh/editmesh_extrude.c index b653484322a..3e79b7f1b9d 100644 --- a/source/blender/editors/mesh/editmesh_extrude.c +++ b/source/blender/editors/mesh/editmesh_extrude.c @@ -746,9 +746,9 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) { float co1[2], co2[2]; - if ((ED_view3d_project_float_object(vc.ar, eed->v1->co, co1, V3D_PROJ_TEST_NOP) == + if ((ED_view3d_project_float_object(vc.region, eed->v1->co, co1, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) && - (ED_view3d_project_float_object(vc.ar, eed->v2->co, co2, V3D_PROJ_TEST_NOP) == + (ED_view3d_project_float_object(vc.region, eed->v2->co, co2, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK)) { /* 2D rotate by 90d while adding. * (x, y) = (y, -x) @@ -786,7 +786,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w copy_v3_v3(ofs, local_center); mul_m4_v3(vc.obedit->obmat, ofs); /* view space */ - ED_view3d_win_to_3d_int(vc.v3d, vc.ar, ofs, event->mval, ofs); + ED_view3d_win_to_3d_int(vc.v3d, vc.region, ofs, event->mval, ofs); mul_m4_v3(vc.obedit->imat, ofs); // back in object space sub_v3_v3(ofs, local_center); @@ -820,7 +820,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w /* also project the source, for retopo workflow */ if (use_proj) { - EDBM_project_snap_verts(C, depsgraph, vc.ar, vc.obedit, vc.em); + EDBM_project_snap_verts(C, depsgraph, vc.region, vc.obedit, vc.em); } } @@ -836,7 +836,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w BMOIter oiter; copy_v3_v3(local_center, cursor); - ED_view3d_win_to_3d_int(vc.v3d, vc.ar, local_center, event->mval, local_center); + ED_view3d_win_to_3d_int(vc.v3d, vc.region, local_center, event->mval, local_center); mul_m4_v3(vc.obedit->imat, local_center); // back in object space @@ -853,7 +853,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w } if (use_proj) { - EDBM_project_snap_verts(C, depsgraph, vc.ar, vc.obedit, vc.em); + EDBM_project_snap_verts(C, depsgraph, vc.region, vc.obedit, vc.em); } /* This normally happens when pushing undo but modal operators diff --git a/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c b/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c index af46d83265e..979c59632e1 100644 --- a/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c +++ b/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c @@ -429,11 +429,11 @@ static void gizmo_mesh_spin_init_message_subscribe(const bContext *C, { GizmoGroupData_SpinInit *ggd = gzgroup->customdata; Scene *scene = CTX_data_scene(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); /* Subscribe to view properties */ wmMsgSubscribeValue msg_sub_value_gz_tag_refresh = { - .owner = ar, + .owner = region, .user_data = gzgroup->parent_gzmap, .notify = WM_gizmo_do_msg_notify_tag_refresh, }; @@ -905,8 +905,8 @@ static void gizmo_mesh_spin_redo_setup(const bContext *C, wmGizmoGroup *gzgroup) * Initialize the orientation from the spin gizmo if possible. */ { - ARegion *ar = CTX_wm_region(C); - wmGizmoMap *gzmap = ar->gizmo_map; + ARegion *region = CTX_wm_region(C); + wmGizmoMap *gzmap = region->gizmo_map; wmGizmoGroup *gzgroup_init = WM_gizmomap_group_find(gzmap, "MESH_GGT_spin"); if (gzgroup_init) { GizmoGroupData_SpinInit *ggd_init = gzgroup_init->customdata; @@ -926,7 +926,7 @@ static void gizmo_mesh_spin_redo_setup(const bContext *C, wmGizmoGroup *gzgroup) { wmWindow *win = CTX_wm_window(C); View3D *v3d = CTX_wm_view3d(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); const wmEvent *event = win->eventstate; float plane_co[3], plane_no[3]; RNA_property_float_get_array(op->ptr, ggd->data.prop_axis_co, plane_co); @@ -937,11 +937,11 @@ static void gizmo_mesh_spin_redo_setup(const bContext *C, wmGizmoGroup *gzgroup) /* Use cursor as fallback if it's not set by the 'ortho_axis_active'. */ if (is_zero_v3(ggd->data.orient_axis_relative)) { float cursor_co[3]; - const int mval[2] = {event->x - ar->winrct.xmin, event->y - ar->winrct.ymin}; + const int mval[2] = {event->x - region->winrct.xmin, event->y - region->winrct.ymin}; float plane[4]; plane_from_point_normal_v3(plane, plane_co, plane_no); - if (UNLIKELY(!ED_view3d_win_to_3d_on_plane_int(ar, plane, mval, false, cursor_co))) { - ED_view3d_win_to_3d_int(v3d, ar, plane, mval, cursor_co); + if (UNLIKELY(!ED_view3d_win_to_3d_on_plane_int(region, plane, mval, false, cursor_co))) { + ED_view3d_win_to_3d_int(v3d, region, plane, mval, cursor_co); } sub_v3_v3v3(ggd->data.orient_axis_relative, cursor_co, plane_co); } @@ -1010,8 +1010,8 @@ static void gizmo_mesh_spin_redo_setup(const bContext *C, wmGizmoGroup *gzgroup) if (win && win->active) { bScreen *screen = WM_window_get_active_screen(win); if (screen->active_region) { - ARegion *ar = CTX_wm_region(C); - if (screen->active_region == ar) { + ARegion *region = CTX_wm_region(C); + if (screen->active_region == region) { /* Become modal as soon as it's started. */ gizmo_mesh_spin_redo_modal_from_setup(C, gzgroup); } diff --git a/source/blender/editors/mesh/editmesh_inset.c b/source/blender/editors/mesh/editmesh_inset.c index a1b1ea31ead..23a108e816a 100644 --- a/source/blender/editors/mesh/editmesh_inset.c +++ b/source/blender/editors/mesh/editmesh_inset.c @@ -166,7 +166,7 @@ static bool edbm_inset_init(bContext *C, wmOperator *op, const bool is_modal) if (is_modal) { View3D *v3d = CTX_wm_view3d(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); for (uint ob_index = 0; ob_index < opdata->ob_store_len; ob_index++) { Object *obedit = opdata->ob_store[ob_index].ob; @@ -175,7 +175,7 @@ static bool edbm_inset_init(bContext *C, wmOperator *op, const bool is_modal) } opdata->draw_handle_pixel = ED_region_draw_cb_activate( - ar->type, ED_region_draw_mouse_line_cb, opdata->mcenter, REGION_DRAW_POST_PIXEL); + region->type, ED_region_draw_mouse_line_cb, opdata->mcenter, REGION_DRAW_POST_PIXEL); G.moving = G_TRANSFORM_EDIT; if (v3d) { opdata->gizmo_flag = v3d->gizmo_flag; @@ -195,11 +195,11 @@ static void edbm_inset_exit(bContext *C, wmOperator *op) if (opdata->is_modal) { View3D *v3d = CTX_wm_view3d(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); for (uint ob_index = 0; ob_index < opdata->ob_store_len; ob_index++) { EDBM_redo_state_free(&opdata->ob_store[ob_index].mesh_backup, NULL, false); } - ED_region_draw_cb_exit(ar->type, opdata->draw_handle_pixel); + ED_region_draw_cb_exit(region->type, opdata->draw_handle_pixel); if (v3d) { v3d->gizmo_flag = opdata->gizmo_flag; } diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 705ebd324eb..b951c06ba8c 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -153,7 +153,7 @@ typedef struct KnifePosData { /* struct for properties used while drawing */ typedef struct KnifeTool_OpData { - ARegion *ar; /* region that knifetool was activated in */ + ARegion *region; /* region that knifetool was activated in */ void *draw_handle; /* for drawing preview loop */ ViewContext vc; /* note: _don't_ use 'mval', instead use the one we define below */ float mval[2]; /* mouse value with snapping applied */ @@ -307,7 +307,7 @@ static void knife_update_header(bContext *C, wmOperator *op, KnifeTool_OpData *k static void knife_project_v2(const KnifeTool_OpData *kcd, const float co[3], float sco[2]) { - ED_view3d_project_float_v2_m4(kcd->ar, co, sco, (float(*)[4])kcd->projmat); + ED_view3d_project_float_v2_m4(kcd->region, co, sco, (float(*)[4])kcd->projmat); } /* use when lambda is in screen-space */ @@ -997,7 +997,7 @@ static void knifetool_draw_angle_snapping(const KnifeTool_OpData *kcd) copy_v3_v3(co_depth, kcd->prev.cage); mul_m4_v3(kcd->ob->obmat, co_depth); - ED_view3d_win_to_3d(kcd->vc.v3d, kcd->ar, co_depth, kcd->curr.mval, curr_cage_adjust); + ED_view3d_win_to_3d(kcd->vc.v3d, kcd->region, co_depth, kcd->curr.mval, curr_cage_adjust); mul_m4_v3(kcd->ob->imat, curr_cage_adjust); sub_v3_v3v3(ray_dir, curr_cage_adjust, kcd->prev.cage); @@ -1058,7 +1058,7 @@ static void knife_init_colors(KnifeColors *colors) } /* modal loop selection drawing callback */ -static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *arg) +static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(region), void *arg) { const KnifeTool_OpData *kcd = arg; GPU_depth_test(false); @@ -1475,7 +1475,7 @@ static bool point_is_visible(KnifeTool_OpData *kcd, float view[3], p_ofs[3]; /* TODO: I think there's a simpler way to get the required raycast ray */ - ED_view3d_unproject(kcd->vc.ar, s[0], s[1], 0.0f, view); + ED_view3d_unproject(kcd->vc.region, s[0], s[1], 0.0f, view); mul_m4_v3(kcd->ob->imat, view); @@ -1609,8 +1609,8 @@ static void knife_find_line_hits(KnifeTool_OpData *kcd) } /* unproject screen line */ - ED_view3d_win_to_segment_clipped(kcd->vc.depsgraph, kcd->ar, kcd->vc.v3d, s1, v1, v3, true); - ED_view3d_win_to_segment_clipped(kcd->vc.depsgraph, kcd->ar, kcd->vc.v3d, s2, v2, v4, true); + ED_view3d_win_to_segment_clipped(kcd->vc.depsgraph, kcd->region, kcd->vc.v3d, s1, v1, v3, true); + ED_view3d_win_to_segment_clipped(kcd->vc.depsgraph, kcd->region, kcd->vc.v3d, s2, v2, v4, true); mul_m4_v3(kcd->ob->imat, v1); mul_m4_v3(kcd->ob->imat, v2); @@ -1856,8 +1856,8 @@ static void knife_input_ray_segment(KnifeTool_OpData *kcd, float r_origin_ofs[3]) { /* unproject to find view ray */ - ED_view3d_unproject(kcd->vc.ar, mval[0], mval[1], 0.0f, r_origin); - ED_view3d_unproject(kcd->vc.ar, mval[0], mval[1], ofs, r_origin_ofs); + ED_view3d_unproject(kcd->vc.region, mval[0], mval[1], 0.0f, r_origin); + ED_view3d_unproject(kcd->vc.region, mval[0], mval[1], ofs, r_origin_ofs); /* transform into object space */ invert_m4_m4(kcd->ob->imat, kcd->ob->obmat); @@ -2582,7 +2582,7 @@ static void knifetool_finish(wmOperator *op) static void knife_recalc_projmat(KnifeTool_OpData *kcd) { invert_m4_m4(kcd->ob->imat, kcd->ob->obmat); - ED_view3d_ob_project_mat_get(kcd->ar->regiondata, kcd->ob, kcd->projmat); + ED_view3d_ob_project_mat_get(kcd->region->regiondata, kcd->ob, kcd->projmat); invert_m4_m4(kcd->projmat_inv, kcd->projmat); mul_v3_mat3_m4v3(kcd->proj_zaxis, kcd->ob->imat, kcd->vc.rv3d->viewinv[2]); @@ -2603,7 +2603,7 @@ static void knifetool_exit_ex(bContext *C, KnifeTool_OpData *kcd) WM_cursor_modal_restore(CTX_wm_window(C)); /* deactivate the extra drawing stuff in 3D-View */ - ED_region_draw_cb_exit(kcd->ar->type, kcd->draw_handle); + ED_region_draw_cb_exit(kcd->region->type, kcd->draw_handle); } /* free the custom data */ @@ -2623,7 +2623,7 @@ static void knifetool_exit_ex(bContext *C, KnifeTool_OpData *kcd) BLI_gset_free(kcd->edgenet.edge_visit, NULL); /* tag for redraw */ - ED_region_tag_redraw(kcd->ar); + ED_region_tag_redraw(kcd->region); knifetool_free_bmbvh(kcd); @@ -2647,7 +2647,7 @@ static void knifetool_update_mval(KnifeTool_OpData *kcd, const float mval[2]) copy_v2_v2(kcd->mval, mval); if (knife_update_active(kcd)) { - ED_region_tag_redraw(kcd->ar); + ED_region_tag_redraw(kcd->region); } } @@ -2702,7 +2702,7 @@ static void knifetool_init(bContext *C, /* assign the drawing handle for drawing preview line... */ kcd->scene = scene; kcd->ob = obedit; - kcd->ar = CTX_wm_region(C); + kcd->region = CTX_wm_region(C); em_setup_viewcontext(C, &kcd->vc); @@ -2726,7 +2726,7 @@ static void knifetool_init(bContext *C, knife_recalc_projmat(kcd); - ED_region_tag_redraw(kcd->ar); + ED_region_tag_redraw(kcd->region); kcd->refs = BLI_mempool_create(sizeof(Ref), 0, 2048, 0); kcd->kverts = BLI_mempool_create(sizeof(KnifeVert), 0, 512, BLI_MEMPOOL_ALLOW_ITER); @@ -2745,7 +2745,7 @@ static void knifetool_init(bContext *C, if (is_interactive) { kcd->draw_handle = ED_region_draw_cb_activate( - kcd->ar->type, knifetool_draw, kcd, REGION_DRAW_POST_VIEW); + kcd->region->type, knifetool_draw, kcd, REGION_DRAW_POST_VIEW); knife_init_colors(&kcd->colors); } @@ -2851,7 +2851,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event) } em_setup_viewcontext(C, &kcd->vc); - kcd->ar = kcd->vc.ar; + kcd->region = kcd->vc.region; view3d_operator_needs_opengl(C); ED_view3d_init_mats_rv3d(obedit, kcd->vc.rv3d); /* needed to initialize clipping */ @@ -2865,7 +2865,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event) switch (event->val) { case KNF_MODAL_CANCEL: /* finish */ - ED_region_tag_redraw(kcd->ar); + ED_region_tag_redraw(kcd->region); knifetool_exit(C, op); ED_workspace_status_text(C, NULL); @@ -2873,7 +2873,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_CANCELLED; case KNF_MODAL_CONFIRM: /* finish */ - ED_region_tag_redraw(kcd->ar); + ED_region_tag_redraw(kcd->region); knifetool_finish(op); knifetool_exit(C, op); @@ -2886,7 +2886,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event) knife_recalc_projmat(kcd); knife_update_active(kcd); knife_update_header(C, op, kcd); - ED_region_tag_redraw(kcd->ar); + ED_region_tag_redraw(kcd->region); do_refresh = true; break; case KNF_MODAL_MIDPOINT_OFF: @@ -2895,17 +2895,17 @@ static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event) knife_recalc_projmat(kcd); knife_update_active(kcd); knife_update_header(C, op, kcd); - ED_region_tag_redraw(kcd->ar); + ED_region_tag_redraw(kcd->region); do_refresh = true; break; case KNF_MODEL_IGNORE_SNAP_ON: - ED_region_tag_redraw(kcd->ar); + ED_region_tag_redraw(kcd->region); kcd->ignore_vert_snapping = kcd->ignore_edge_snapping = true; knife_update_header(C, op, kcd); do_refresh = true; break; case KNF_MODEL_IGNORE_SNAP_OFF: - ED_region_tag_redraw(kcd->ar); + ED_region_tag_redraw(kcd->region); kcd->ignore_vert_snapping = kcd->ignore_edge_snapping = false; knife_update_header(C, op, kcd); do_refresh = true; @@ -2921,7 +2921,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event) do_refresh = true; break; case KNF_MODAL_NEW_CUT: - ED_region_tag_redraw(kcd->ar); + ED_region_tag_redraw(kcd->region); knife_finish_cut(kcd); kcd->mode = MODE_IDLE; break; @@ -2951,7 +2951,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event) knifetool_update_mval(kcd, kcd->curr.mval); } - ED_region_tag_redraw(kcd->ar); + ED_region_tag_redraw(kcd->region); break; case KNF_MODAL_ADD_CUT_CLOSED: if (kcd->mode == MODE_DRAGGING) { @@ -2986,7 +2986,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event) kcd->mode = kcd->prevmode; } - ED_region_tag_redraw(kcd->ar); + ED_region_tag_redraw(kcd->region); return OPERATOR_PASS_THROUGH; } } @@ -3153,7 +3153,7 @@ void EDBM_mesh_knife(bContext *C, LinkNode *polys, bool use_tag, bool cut_throug knifetool_init_bmbvh(kcd); } - ED_view3d_ob_project_mat_get(kcd->ar->regiondata, kcd->ob, projmat); + ED_view3d_ob_project_mat_get(kcd->region->regiondata, kcd->ob, projmat); /* use face-loop tag to store if we have intersected */ #define F_ISECT_IS_UNKNOWN(f) BM_elem_flag_test(BM_FACE_FIRST_LOOP(f), BM_ELEM_TAG) diff --git a/source/blender/editors/mesh/editmesh_knife_project.c b/source/blender/editors/mesh/editmesh_knife_project.c index 21de89d33dd..ce0d5d9f7a7 100644 --- a/source/blender/editors/mesh/editmesh_knife_project.c +++ b/source/blender/editors/mesh/editmesh_knife_project.c @@ -58,7 +58,7 @@ static LinkNode *knifeproject_poly_from_object(const bContext *C, LinkNode *polys) { Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); struct Mesh *me_eval; bool me_eval_needs_free; @@ -87,7 +87,7 @@ static LinkNode *knifeproject_poly_from_object(const bContext *C, BKE_mesh_to_curve_nurblist(me_eval, &nurbslist, 0); /* wire */ BKE_mesh_to_curve_nurblist(me_eval, &nurbslist, 1); /* boundary */ - ED_view3d_ob_project_mat_get(ar->regiondata, ob, projmat); + ED_view3d_ob_project_mat_get(region->regiondata, ob, projmat); if (nurbslist.first) { Nurb *nu; @@ -99,7 +99,7 @@ static LinkNode *knifeproject_poly_from_object(const bContext *C, float(*mval)[2] = MEM_mallocN(sizeof(*mval) * (nu->pntsu + is_cyclic), __func__); for (bp = nu->bp, a = 0; a < nu->pntsu; a++, bp++) { - ED_view3d_project_float_v2_m4(ar, bp->vec, mval[a], projmat); + ED_view3d_project_float_v2_m4(region, bp->vec, mval[a], projmat); } if (is_cyclic) { copy_v2_v2(mval[a], mval[0]); diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c index ef05eb4ffda..9509a0af2bc 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -66,7 +66,7 @@ /* struct for properties used while drawing */ typedef struct RingSelOpData { - ARegion *ar; /* region that ringsel was activated in */ + ARegion *region; /* region that ringsel was activated in */ void *draw_handle; /* for drawing preview loop */ struct EditMesh_PreSelEdgeRing *presel_edgering; @@ -94,7 +94,7 @@ typedef struct RingSelOpData { } RingSelOpData; /* modal loop selection drawing callback */ -static void ringsel_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *arg) +static void ringsel_draw(const bContext *UNUSED(C), ARegion *UNUSED(region), void *arg) { RingSelOpData *lcd = arg; EDBM_preselect_edgering_draw(lcd->presel_edgering, lcd->ob->obmat); @@ -244,13 +244,13 @@ static void ringsel_exit(bContext *UNUSED(C), wmOperator *op) RingSelOpData *lcd = op->customdata; /* deactivate the extra drawing stuff in 3D-View */ - ED_region_draw_cb_exit(lcd->ar->type, lcd->draw_handle); + ED_region_draw_cb_exit(lcd->region->type, lcd->draw_handle); EDBM_preselect_edgering_destroy(lcd->presel_edgering); MEM_freeN(lcd->bases); - ED_region_tag_redraw(lcd->ar); + ED_region_tag_redraw(lcd->region); /* free the custom data */ MEM_freeN(lcd); @@ -271,9 +271,9 @@ static int ringsel_init(bContext *C, wmOperator *op, bool do_cut) lcd->depsgraph = CTX_data_ensure_evaluated_depsgraph(C); /* assign the drawing handle for drawing preview line... */ - lcd->ar = CTX_wm_region(C); + lcd->region = CTX_wm_region(C); lcd->draw_handle = ED_region_draw_cb_activate( - lcd->ar->type, ringsel_draw, lcd, REGION_DRAW_POST_VIEW); + lcd->region->type, ringsel_draw, lcd, REGION_DRAW_POST_VIEW); lcd->presel_edgering = EDBM_preselect_edgering_create(); /* Initialize once the cursor is over a mesh. */ lcd->ob = NULL; @@ -291,7 +291,7 @@ static int ringsel_init(bContext *C, wmOperator *op, bool do_cut) lcd->num.unit_type[0] = B_UNIT_NONE; lcd->num.unit_type[1] = B_UNIT_NONE; - ED_region_tag_redraw(lcd->ar); + ED_region_tag_redraw(lcd->region); return 1; } @@ -461,8 +461,8 @@ static int ringcut_invoke(bContext *C, wmOperator *op, const wmEvent *event) { /* When accessed as a tool, get the active edge from the preselection gizmo. */ { - ARegion *ar = CTX_wm_region(C); - wmGizmoMap *gzmap = ar->gizmo_map; + ARegion *region = CTX_wm_region(C); + wmGizmoMap *gzmap = region->gizmo_map; wmGizmoGroup *gzgroup = gzmap ? WM_gizmomap_group_find(gzmap, "VIEW3D_GGT_mesh_preselect_edgering") : NULL; @@ -491,7 +491,7 @@ static int loopcut_exec(bContext *C, wmOperator *op) static int loopcut_finish(RingSelOpData *lcd, bContext *C, wmOperator *op) { /* finish */ - ED_region_tag_redraw(lcd->ar); + ED_region_tag_redraw(lcd->region); ED_workspace_status_text(C, NULL); if (lcd->eed) { @@ -521,7 +521,7 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event) const bool has_numinput = hasNumInput(&lcd->num); em_setup_viewcontext(C, &lcd->vc); - lcd->ar = lcd->vc.ar; + lcd->region = lcd->vc.region; view3d_operator_needs_opengl(C); @@ -543,11 +543,11 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event) return loopcut_finish(lcd, C, op); } - ED_region_tag_redraw(lcd->ar); + ED_region_tag_redraw(lcd->region); handled = true; break; case RIGHTMOUSE: /* abort */ // XXX hardcoded - ED_region_tag_redraw(lcd->ar); + ED_region_tag_redraw(lcd->region); ringsel_exit(C, op); ED_workspace_status_text(C, NULL); @@ -555,14 +555,14 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event) case ESCKEY: if (event->val == KM_RELEASE) { /* cancel */ - ED_region_tag_redraw(lcd->ar); + ED_region_tag_redraw(lcd->region); ED_workspace_status_text(C, NULL); ringcut_cancel(C, op); return OPERATOR_CANCELLED; } - ED_region_tag_redraw(lcd->ar); + ED_region_tag_redraw(lcd->region); handled = true; break; case MOUSEPAN: @@ -619,7 +619,7 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event) lcd->vc.mval[1] = event->mval[1]; loopcut_mouse_move(lcd, (int)lcd->cuts); - ED_region_tag_redraw(lcd->ar); + ED_region_tag_redraw(lcd->region); handled = true; } break; } @@ -640,14 +640,14 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event) RNA_int_set(op->ptr, "number_cuts", (int)lcd->cuts); ringsel_find_edge(lcd, (int)lcd->cuts); show_cuts = true; - ED_region_tag_redraw(lcd->ar); + ED_region_tag_redraw(lcd->region); } if (smoothness != lcd->smoothness) { lcd->smoothness = clamp_f(smoothness, -SUBD_SMOOTH_MAX, SUBD_SMOOTH_MAX); RNA_float_set(op->ptr, "smoothness", lcd->smoothness); show_cuts = true; - ED_region_tag_redraw(lcd->ar); + ED_region_tag_redraw(lcd->region); } if (show_cuts) { diff --git a/source/blender/editors/mesh/editmesh_polybuild.c b/source/blender/editors/mesh/editmesh_polybuild.c index c9438f43e04..fac0fc72c0b 100644 --- a/source/blender/editors/mesh/editmesh_polybuild.c +++ b/source/blender/editors/mesh/editmesh_polybuild.c @@ -87,10 +87,10 @@ static void edbm_flag_disable_all_multi(ViewLayer *view_layer, View3D *v3d, cons /* When accessed as a tool, get the active edge from the preselection gizmo. */ static bool edbm_preselect_or_active(bContext *C, const View3D *v3d, Base **r_base, BMElem **r_ele) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); const bool show_gizmo = !((v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_TOOL))); - wmGizmoMap *gzmap = show_gizmo ? ar->gizmo_map : NULL; + wmGizmoMap *gzmap = show_gizmo ? region->gizmo_map : NULL; wmGizmoGroup *gzgroup = gzmap ? WM_gizmomap_group_find(gzmap, "VIEW3D_GGT_mesh_preselect_elem") : NULL; if (gzgroup != NULL) { @@ -296,7 +296,7 @@ static int edbm_polybuild_face_at_cursor_invoke(bContext *C, wmOperator *op, con /* Just add vert */ copy_v3_v3(center, vc.scene->cursor.location); mul_v3_m4v3(center, vc.obedit->obmat, center); - ED_view3d_win_to_3d_int(vc.v3d, vc.ar, center, event->mval, center); + ED_view3d_win_to_3d_int(vc.v3d, vc.region, center, event->mval, center); mul_m4_v3(vc.obedit->imat, center); BMVert *v_new = BM_vert_create(bm, center, NULL, BM_CREATE_NOP); @@ -311,7 +311,7 @@ static int edbm_polybuild_face_at_cursor_invoke(bContext *C, wmOperator *op, con mid_v3_v3v3(center, e_act->v1->co, e_act->v2->co); mul_m4_v3(vc.obedit->obmat, center); - ED_view3d_win_to_3d_int(vc.v3d, vc.ar, center, event->mval, center); + ED_view3d_win_to_3d_int(vc.v3d, vc.region, center, event->mval, center); mul_m4_v3(vc.obedit->imat, center); if (f_reference->len == 3 && RNA_boolean_get(op->ptr, "create_quads")) { const float fac = line_point_factor_v3(center, e_act->v1->co, e_act->v2->co); @@ -366,7 +366,7 @@ static int edbm_polybuild_face_at_cursor_invoke(bContext *C, wmOperator *op, con BMFace *f_reference = e_pair[0]->l ? e_pair[0]->l->f : NULL; mul_v3_m4v3(center, vc.obedit->obmat, v_act->co); - ED_view3d_win_to_3d_int(vc.v3d, vc.ar, center, event->mval, center); + ED_view3d_win_to_3d_int(vc.v3d, vc.region, center, event->mval, center); mul_m4_v3(vc.obedit->imat, center); BMVert *v_quad[4]; @@ -388,7 +388,7 @@ static int edbm_polybuild_face_at_cursor_invoke(bContext *C, wmOperator *op, con else { /* Just add edge */ mul_m4_v3(vc.obedit->obmat, center); - ED_view3d_win_to_3d_int(vc.v3d, vc.ar, v_act->co, event->mval, center); + ED_view3d_win_to_3d_int(vc.v3d, vc.region, v_act->co, event->mval, center); mul_m4_v3(vc.obedit->imat, center); BMVert *v_new = BM_vert_create(bm, center, NULL, BM_CREATE_NOP); @@ -474,7 +474,7 @@ static int edbm_polybuild_split_at_cursor_invoke(bContext *C, BMEdge *e_act = (BMEdge *)ele_act; mid_v3_v3v3(center, e_act->v1->co, e_act->v2->co); mul_m4_v3(vc.obedit->obmat, center); - ED_view3d_win_to_3d_int(vc.v3d, vc.ar, center, event->mval, center); + ED_view3d_win_to_3d_int(vc.v3d, vc.region, center, event->mval, center); mul_m4_v3(vc.obedit->imat, center); const float fac = line_point_factor_v3(center, e_act->v1->co, e_act->v2->co); diff --git a/source/blender/editors/mesh/editmesh_preselect_elem.c b/source/blender/editors/mesh/editmesh_preselect_elem.c index 05c4da68355..d53a1e2b55c 100644 --- a/source/blender/editors/mesh/editmesh_preselect_elem.c +++ b/source/blender/editors/mesh/editmesh_preselect_elem.c @@ -258,7 +258,7 @@ static void view3d_preselect_update_preview_triangle_from_vert(struct EditMesh_P if (e_pair[1] != NULL) { mul_v3_m4v3(center, vc->obedit->obmat, v_act->co); - ED_view3d_win_to_3d_int(vc->v3d, vc->ar, center, mval, center); + ED_view3d_win_to_3d_int(vc->v3d, vc->region, center, mval, center); mul_m4_v3(vc->obedit->imat, center); psel->preview_tris = MEM_mallocN(sizeof(*psel->preview_tris) * 2, __func__); @@ -326,7 +326,7 @@ static void view3d_preselect_update_preview_triangle_from_edge(struct EditMesh_P psel->preview_lines = MEM_mallocN(sizeof(*psel->preview_lines) * 3, __func__); mid_v3_v3v3(center, eed->v1->co, eed->v2->co); mul_m4_v3(vc->obedit->obmat, center); - ED_view3d_win_to_3d_int(vc->v3d, vc->ar, center, mval, center); + ED_view3d_win_to_3d_int(vc->v3d, vc->region, center, mval, center); mul_m4_v3(vc->obedit->imat, center); copy_v3_v3(psel->preview_tris[0][0], eed->v1->co); diff --git a/source/blender/editors/mesh/editmesh_rip.c b/source/blender/editors/mesh/editmesh_rip.c index 71bf77cc788..3fa6569e3e9 100644 --- a/source/blender/editors/mesh/editmesh_rip.c +++ b/source/blender/editors/mesh/editmesh_rip.c @@ -56,7 +56,7 @@ * point and would result in the same distance. */ #define INSET_DEFAULT 0.00001f -static float edbm_rip_edgedist_squared(ARegion *ar, +static float edbm_rip_edgedist_squared(ARegion *region, float mat[4][4], const float co1[3], const float co2[3], @@ -65,8 +65,8 @@ static float edbm_rip_edgedist_squared(ARegion *ar, { float vec1[2], vec2[2], dist_sq; - ED_view3d_project_float_v2_m4(ar, co1, vec1, mat); - ED_view3d_project_float_v2_m4(ar, co2, vec2, mat); + ED_view3d_project_float_v2_m4(region, co1, vec1, mat); + ED_view3d_project_float_v2_m4(region, co2, vec2, mat); if (inset != 0.0f) { const float dist_2d = len_v2v2(vec1, vec2); @@ -86,12 +86,12 @@ static float edbm_rip_edgedist_squared(ARegion *ar, #if 0 static float edbm_rip_linedist( - ARegion *ar, float mat[4][4], const float co1[3], const float co2[3], const float mvalf[2]) + ARegion *region, float mat[4][4], const float co1[3], const float co2[3], const float mvalf[2]) { float vec1[2], vec2[2]; - ED_view3d_project_float_v2_m4(ar, co1, vec1, mat); - ED_view3d_project_float_v2_m4(ar, co2, vec2, mat); + ED_view3d_project_float_v2_m4(region, co1, vec1, mat); + ED_view3d_project_float_v2_m4(region, co2, vec2, mat); return dist_to_line_v2(mvalf, vec1, vec2); } @@ -110,7 +110,7 @@ static void edbm_calc_loop_co(BMLoop *l, float l_mid_co[3]) } static float edbm_rip_edge_side_measure( - BMEdge *e, BMLoop *e_l, ARegion *ar, float projectMat[4][4], const float fmval[2]) + BMEdge *e, BMLoop *e_l, ARegion *region, float projectMat[4][4], const float fmval[2]) { float cent[3] = {0, 0, 0}, mid[3]; @@ -137,11 +137,11 @@ static float edbm_rip_edge_side_measure( mid_v3_v3v3(cent, v1_other->co, v2_other->co); mid_v3_v3v3(mid, e->v1->co, e->v2->co); - ED_view3d_project_float_v2_m4(ar, cent, cent, projectMat); - ED_view3d_project_float_v2_m4(ar, mid, mid, projectMat); + ED_view3d_project_float_v2_m4(region, cent, cent, projectMat); + ED_view3d_project_float_v2_m4(region, mid, mid, projectMat); - ED_view3d_project_float_v2_m4(ar, e->v1->co, e_v1_co, projectMat); - ED_view3d_project_float_v2_m4(ar, e->v2->co, e_v2_co, projectMat); + ED_view3d_project_float_v2_m4(region, e->v1->co, e_v1_co, projectMat); + ED_view3d_project_float_v2_m4(region, e->v2->co, e_v2_co, projectMat); sub_v2_v2v2(vec, cent, mid); normalize_v2_length(vec, 0.01f); @@ -346,7 +346,7 @@ static BMVert *edbm_ripsel_edloop_pair_start_vert(BMEdge *e) } static void edbm_ripsel_deselect_helper( - BMesh *bm, EdgeLoopPair *eloop_pairs, ARegion *ar, float projectMat[4][4], float fmval[2]) + BMesh *bm, EdgeLoopPair *eloop_pairs, ARegion *region, float projectMat[4][4], float fmval[2]) { EdgeLoopPair *lp; @@ -360,12 +360,12 @@ static void edbm_ripsel_deselect_helper( e = lp->l_a->e; v_prev = edbm_ripsel_edloop_pair_start_vert(e); for (; e; e = edbm_ripsel_edge_uid_step(e, &v_prev)) { - score_a += edbm_rip_edge_side_measure(e, e->l, ar, projectMat, fmval); + score_a += edbm_rip_edge_side_measure(e, e->l, region, projectMat, fmval); } e = lp->l_b->e; v_prev = edbm_ripsel_edloop_pair_start_vert(e); for (; e; e = edbm_ripsel_edge_uid_step(e, &v_prev)) { - score_b += edbm_rip_edge_side_measure(e, e->l, ar, projectMat, fmval); + score_b += edbm_rip_edge_side_measure(e, e->l, region, projectMat, fmval); } e = (score_a > score_b) ? lp->l_a->e : lp->l_b->e; @@ -514,7 +514,7 @@ static void edbm_tagged_loop_pairs_do_fill_faces(BMesh *bm, UnorderedLoopPair *u static int edbm_rip_invoke__vert(bContext *C, const wmEvent *event, Object *obedit, bool do_fill) { UnorderedLoopPair *fill_uloop_pairs = NULL; - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); RegionView3D *rv3d = CTX_wm_region_view3d(C); BMEditMesh *em = BKE_editmesh_from_object(obedit); BMesh *bm = em->bm; @@ -568,7 +568,7 @@ static int edbm_rip_invoke__vert(bContext *C, const wmEvent *event, Object *obed if (!BM_elem_flag_test(e, BM_ELEM_HIDDEN)) { if ((is_manifold_region == false) || BM_edge_is_manifold(e)) { d = edbm_rip_edgedist_squared( - ar, projectMat, e->v1->co, e->v2->co, fmval, INSET_DEFAULT); + region, projectMat, e->v1->co, e->v2->co, fmval, INSET_DEFAULT); if ((e_best == NULL) || (d < dist_sq)) { dist_sq = d; e_best = e; @@ -619,7 +619,7 @@ static int edbm_rip_invoke__vert(bContext *C, const wmEvent *event, Object *obed float l_mid_co[3]; l = l_all[i1]; edbm_calc_loop_co(l, l_mid_co); - d = edbm_rip_edgedist_squared(ar, projectMat, l->v->co, l_mid_co, fmval, INSET_DEFAULT); + d = edbm_rip_edgedist_squared(region, projectMat, l->v->co, l_mid_co, fmval, INSET_DEFAULT); if ((e_best == NULL) || (d < dist_sq)) { dist_sq = d; @@ -678,7 +678,8 @@ static int edbm_rip_invoke__vert(bContext *C, const wmEvent *event, Object *obed float l_mid_co[3]; edbm_calc_loop_co(l, l_mid_co); - d = edbm_rip_edgedist_squared(ar, projectMat, v->co, l_mid_co, fmval, INSET_DEFAULT); + d = edbm_rip_edgedist_squared( + region, projectMat, v->co, l_mid_co, fmval, INSET_DEFAULT); if (d < dist_sq) { dist_sq = d; @@ -695,7 +696,8 @@ static int edbm_rip_invoke__vert(bContext *C, const wmEvent *event, Object *obed float e_mid_co[3]; mid_v3_v3v3(e_mid_co, e->v1->co, e->v2->co); - d = edbm_rip_edgedist_squared(ar, projectMat, v->co, e_mid_co, fmval, INSET_DEFAULT); + d = edbm_rip_edgedist_squared( + region, projectMat, v->co, e_mid_co, fmval, INSET_DEFAULT); if (d < dist_sq) { dist_sq = d; @@ -837,7 +839,7 @@ static int edbm_rip_invoke__vert(bContext *C, const wmEvent *event, Object *obed /* check if v_best is null in the _rare_ case there are numeric issues */ edbm_calc_loop_co(l, l_corner_co); d = edbm_rip_edgedist_squared( - ar, projectMat, l->v->co, l_corner_co, fmval, INSET_DEFAULT); + region, projectMat, l->v->co, l_corner_co, fmval, INSET_DEFAULT); if ((v_best == NULL) || (d < dist_sq)) { v_best = v; dist_sq = d; @@ -872,7 +874,7 @@ static int edbm_rip_invoke__vert(bContext *C, const wmEvent *event, Object *obed static int edbm_rip_invoke__edge(bContext *C, const wmEvent *event, Object *obedit, bool do_fill) { UnorderedLoopPair *fill_uloop_pairs = NULL; - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); RegionView3D *rv3d = CTX_wm_region_view3d(C); BMEditMesh *em = BKE_editmesh_from_object(obedit); BMesh *bm = em->bm; @@ -933,8 +935,8 @@ static int edbm_rip_invoke__edge(bContext *C, const wmEvent *event, Object *obed /* find the best face to follow, this way the edge won't point away from * the mouse when there are more than 4 (takes the shortest face fan around) */ - l = (edbm_rip_edge_side_measure(e_best, l_a, ar, projectMat, fmval) < - edbm_rip_edge_side_measure(e_best, l_b, ar, projectMat, fmval)) ? + l = (edbm_rip_edge_side_measure(e_best, l_a, region, projectMat, fmval) < + edbm_rip_edge_side_measure(e_best, l_b, region, projectMat, fmval)) ? l_a : l_b; @@ -977,7 +979,7 @@ static int edbm_rip_invoke__edge(bContext *C, const wmEvent *event, Object *obed * edge did not split even though it was tagged which would not work * as expected (but not crash), however there are checks to ensure * tagged edges will split. So far its not been an issue. */ - edbm_ripsel_deselect_helper(bm, eloop_pairs, ar, projectMat, fmval); + edbm_ripsel_deselect_helper(bm, eloop_pairs, region, projectMat, fmval); MEM_freeN(eloop_pairs); /* deselect loose verts */ diff --git a/source/blender/editors/mesh/editmesh_rip_edge.c b/source/blender/editors/mesh/editmesh_rip_edge.c index 5dd3c85f34f..e2aca1e6831 100644 --- a/source/blender/editors/mesh/editmesh_rip_edge.c +++ b/source/blender/editors/mesh/editmesh_rip_edge.c @@ -47,7 +47,7 @@ static int edbm_rip_edge_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); RegionView3D *rv3d = CTX_wm_region_view3d(C); ViewLayer *view_layer = CTX_data_view_layer(C); uint objects_len = 0; @@ -86,7 +86,7 @@ static int edbm_rip_edge_invoke(bContext *C, wmOperator *UNUSED(op), const wmEve if (BM_elem_flag_test(v, BM_ELEM_SELECT)) { float v_sco[2]; - ED_view3d_project_float_v2_m4(ar, v->co, v_sco, projectMat); + ED_view3d_project_float_v2_m4(region, v->co, v_sco, projectMat); add_v2_v2(cent_sco, v_sco); cent_tot += 1; @@ -108,8 +108,8 @@ static int edbm_rip_edge_invoke(bContext *C, wmOperator *UNUSED(op), const wmEve float cent_sco_test[2]; float dist_sq_test; - ED_view3d_project_float_v2_m4(ar, e->v1->co, e_sco[0], projectMat); - ED_view3d_project_float_v2_m4(ar, e->v2->co, e_sco[1], projectMat); + ED_view3d_project_float_v2_m4(region, e->v1->co, e_sco[0], projectMat); + ED_view3d_project_float_v2_m4(region, e->v2->co, e_sco[1], projectMat); closest_to_line_segment_v2(cent_sco_test, mval_fl, e_sco[0], e_sco[1]); dist_sq_test = len_squared_v2v2(cent_sco_test, mval_fl); @@ -167,7 +167,7 @@ static int edbm_rip_edge_invoke(bContext *C, wmOperator *UNUSED(op), const wmEve goto found_edge; } #endif - ED_view3d_project_float_v2_m4(ar, v->co, v_sco, projectMat); + ED_view3d_project_float_v2_m4(region, v->co, v_sco, projectMat); BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) { if (!BM_elem_flag_test(e, BM_ELEM_HIDDEN)) { @@ -175,7 +175,7 @@ static int edbm_rip_edge_invoke(bContext *C, wmOperator *UNUSED(op), const wmEve float v_other_sco[2]; float angle_test; - ED_view3d_project_float_v2_m4(ar, v_other->co, v_other_sco, projectMat); + ED_view3d_project_float_v2_m4(region, v_other->co, v_other_sco, projectMat); /* avoid comparing with view-axis aligned edges (less than a pixel) */ if (len_squared_v2v2(v_sco, v_other_sco) > 1.0f) { diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index 6eabb079f4e..1635aa72ee0 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -286,7 +286,7 @@ BMVert *EDBM_vert_find_nearest_ex(ViewContext *vc, uint base_index = 0; if (!XRAY_FLAG_ENABLED(vc->v3d)) { - uint dist_px = (uint)ED_view3d_backbuf_sample_size_clamp(vc->ar, *r_dist); + uint dist_px = (uint)ED_view3d_backbuf_sample_size_clamp(vc->region, *r_dist); uint index; BMVert *eve; @@ -295,7 +295,7 @@ BMVert *EDBM_vert_find_nearest_ex(ViewContext *vc, DRW_select_buffer_context_create(bases, bases_len, SCE_SELECT_VERTEX); index = DRW_select_buffer_find_nearest_to_point( - vc->depsgraph, vc->ar, vc->v3d, vc->mval, 1, UINT_MAX, &dist_px); + vc->depsgraph, vc->region, vc->v3d, vc->mval, 1, UINT_MAX, &dist_px); if (index) { eve = (BMVert *)edbm_select_id_bm_elem_get(bases, index, &base_index); @@ -509,7 +509,7 @@ BMEdge *EDBM_edge_find_nearest_ex(ViewContext *vc, uint base_index = 0; if (!XRAY_FLAG_ENABLED(vc->v3d)) { - uint dist_px = (uint)ED_view3d_backbuf_sample_size_clamp(vc->ar, *r_dist); + uint dist_px = (uint)ED_view3d_backbuf_sample_size_clamp(vc->region, *r_dist); uint index; BMEdge *eed; @@ -518,7 +518,7 @@ BMEdge *EDBM_edge_find_nearest_ex(ViewContext *vc, DRW_select_buffer_context_create(bases, bases_len, SCE_SELECT_EDGE); index = DRW_select_buffer_find_nearest_to_point( - vc->depsgraph, vc->ar, vc->v3d, vc->mval, 1, UINT_MAX, &dist_px); + vc->depsgraph, vc->region, vc->v3d, vc->mval, 1, UINT_MAX, &dist_px); if (index) { eed = (BMEdge *)edbm_select_id_bm_elem_get(bases, index, &base_index); @@ -724,7 +724,7 @@ BMFace *EDBM_face_find_nearest_ex(ViewContext *vc, { DRW_select_buffer_context_create(bases, bases_len, SCE_SELECT_FACE); - index = DRW_select_buffer_sample_point(vc->depsgraph, vc->ar, vc->v3d, vc->mval); + index = DRW_select_buffer_sample_point(vc->depsgraph, vc->region, vc->v3d, vc->mval); if (index) { efa = (BMFace *)edbm_select_id_bm_elem_get(bases, index, &base_index); @@ -1042,7 +1042,7 @@ bool EDBM_unified_findnearest_from_raycast(ViewContext *vc, } best_face = {0, NULL}; if (ED_view3d_win_to_ray_clipped( - vc->depsgraph, vc->ar, vc->v3d, mval_fl, ray_origin, ray_direction, true)) { + vc->depsgraph, vc->region, vc->v3d, mval_fl, ray_origin, ray_direction, true)) { float dist_sq_best = FLT_MAX; float dist_sq_best_vert = FLT_MAX; float dist_sq_best_edge = FLT_MAX; @@ -1733,12 +1733,12 @@ static bool mouse_mesh_loop( /* We can't be sure this has already been set... */ ED_view3d_init_mats_rv3d(vc.obedit, vc.rv3d); - if (ED_view3d_project_float_object(vc.ar, eed->v1->co, v1_co, V3D_PROJ_TEST_CLIP_NEAR) == + if (ED_view3d_project_float_object(vc.region, eed->v1->co, v1_co, V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK) { length_1 = len_squared_v2v2(mvalf, v1_co); } - if (ED_view3d_project_float_object(vc.ar, eed->v2->co, v2_co, V3D_PROJ_TEST_CLIP_NEAR) == + if (ED_view3d_project_float_object(vc.region, eed->v2->co, v2_co, V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK) { length_2 = len_squared_v2v2(mvalf, v2_co); } @@ -1768,7 +1768,7 @@ static bool mouse_mesh_loop( float co[2], tdist; BM_face_calc_center_median(f, cent); - if (ED_view3d_project_float_object(vc.ar, cent, co, V3D_PROJ_TEST_CLIP_NEAR) == + if (ED_view3d_project_float_object(vc.region, cent, co, V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK) { tdist = len_squared_v2v2(mvalf, co); if (tdist < best_dist) { diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 91ffe0ce05c..e38bb90fd08 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -411,21 +411,21 @@ void MESH_OT_unsubdivide(wmOperatorType *ot) } void EDBM_project_snap_verts( - bContext *C, Depsgraph *depsgraph, ARegion *ar, Object *obedit, BMEditMesh *em) + bContext *C, Depsgraph *depsgraph, ARegion *region, Object *obedit, BMEditMesh *em) { Main *bmain = CTX_data_main(C); BMIter iter; BMVert *eve; - ED_view3d_init_mats_rv3d(obedit, ar->regiondata); + ED_view3d_init_mats_rv3d(obedit, region->regiondata); struct SnapObjectContext *snap_context = ED_transform_snap_object_context_create_view3d( - bmain, CTX_data_scene(C), depsgraph, 0, ar, CTX_wm_view3d(C)); + bmain, CTX_data_scene(C), depsgraph, 0, region, CTX_wm_view3d(C)); BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) { if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) { float mval[2], co_proj[3]; - if (ED_view3d_project_float_object(ar, eve->co, mval, V3D_PROJ_TEST_NOP) == + if (ED_view3d_project_float_object(region, eve->co, mval, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) { if (ED_transform_snap_object_project_view3d(snap_context, SCE_SNAP_MODE_FACE, @@ -3750,7 +3750,7 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op) Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BKE_editmesh_from_object(obedit); BMesh *bm = em->bm; - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); BMVert *bv; BMIter iter; BMEdge *be; @@ -3764,8 +3764,8 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op) /* allocd vars */ float(*screen_vert_coords)[2], (*sco)[2], (*mouse_path)[2]; - /* edit-object needed for matrix, and ar->regiondata for projections to work */ - if (ELEM(NULL, obedit, ar, ar->regiondata)) { + /* edit-object needed for matrix, and region->regiondata for projections to work */ + if (ELEM(NULL, obedit, region, region->regiondata)) { return OPERATOR_CANCELLED; } @@ -3790,7 +3790,7 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op) RNA_END; /* for ED_view3d_project_float_object */ - ED_view3d_init_mats_rv3d(obedit, ar->regiondata); + ED_view3d_init_mats_rv3d(obedit, region->regiondata); /* TODO, investigate using index lookup for screen_vert_coords() rather then a hash table */ @@ -3799,7 +3799,7 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op) screen_vert_coords = sco = MEM_mallocN(bm->totvert * sizeof(float) * 2, __func__); BM_ITER_MESH_INDEX (bv, &iter, bm, BM_VERTS_OF_MESH, i) { - if (ED_view3d_project_float_object(ar, bv->co, *sco, V3D_PROJ_TEST_CLIP_NEAR) != + if (ED_view3d_project_float_object(region, bv->co, *sco, V3D_PROJ_TEST_CLIP_NEAR) != V3D_PROJ_RET_OK) { copy_v2_fl(*sco, FLT_MAX); /* set error value */ } @@ -8020,12 +8020,12 @@ static int edbm_point_normals_modal(bContext *C, wmOperator *op, const wmEvent * /* Only handle mousemove event in case we are in mouse mode. */ if (event->type == MOUSEMOVE || force_mousemove) { if (mode == EDBM_CLNOR_POINTTO_MODE_MOUSE) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); float center[3]; bmesh_selected_verts_center_calc(bm, center); - ED_view3d_win_to_3d_int(v3d, ar, center, event->mval, target); + ED_view3d_win_to_3d_int(v3d, region, center, event->mval, target); ret = OPERATOR_RUNNING_MODAL; } diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index f7092a8c6ab..e5f436bbe48 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -1577,7 +1577,7 @@ static void scale_point(float c1[3], const float p[3], const float s) bool BMBVH_EdgeVisible(struct BMBVHTree *tree, BMEdge *e, struct Depsgraph *depsgraph, - ARegion *ar, + ARegion *region, View3D *v3d, Object *obedit) { @@ -1587,11 +1587,11 @@ bool BMBVH_EdgeVisible(struct BMBVHTree *tree, float epsilon = 0.01f; float end[3]; const float mval_f[2] = { - ar->winx / 2.0f, - ar->winy / 2.0f, + region->winx / 2.0f, + region->winy / 2.0f, }; - ED_view3d_win_to_segment_clipped(depsgraph, ar, v3d, mval_f, origin, end, false); + ED_view3d_win_to_segment_clipped(depsgraph, region, v3d, mval_f, origin, end, false); invert_m4_m4(invmat, obedit->obmat); mul_m4_v3(invmat, origin); diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index 3ba8780c18a..dc825871bb7 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -1167,11 +1167,11 @@ bool ED_mesh_pick_face(bContext *C, Object *ob, const int mval[2], uint dist_px, /* sample rect to increase chances of selecting, so that when clicking * on an edge in the backbuf, we can still select a face */ *r_index = DRW_select_buffer_find_nearest_to_point( - vc.depsgraph, vc.ar, vc.v3d, mval, 1, me->totpoly + 1, &dist_px); + vc.depsgraph, vc.region, vc.v3d, mval, 1, me->totpoly + 1, &dist_px); } else { /* sample only on the exact position */ - *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)me->totpoly) { @@ -1185,7 +1185,7 @@ bool ED_mesh_pick_face(bContext *C, Object *ob, const int mval[2], uint dist_px, static void ed_mesh_pick_face_vert__mpoly_find( /* context */ - struct ARegion *ar, + struct ARegion *region, const float mval[2], /* mesh data (evaluated) */ const MPoly *mp, @@ -1201,7 +1201,7 @@ static void ed_mesh_pick_face_vert__mpoly_find( float sco[2]; const int v_idx = ml->v; const float *co = mvert[v_idx].co; - if (ED_view3d_project_float_object(ar, co, sco, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) { + if (ED_view3d_project_float_object(region, co, sco, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) { const float len_test = len_manhattan_v2v2(mval, sco); if (len_test < *r_len_best) { *r_len_best = len_test; @@ -1226,7 +1226,7 @@ bool ED_mesh_pick_face_vert( if (ED_mesh_pick_face(C, ob, mval, dist_px, &poly_index)) { Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); - struct ARegion *ar = CTX_wm_region(C); + struct ARegion *region = CTX_wm_region(C); /* derived mesh to find deformed locations */ Mesh *me_eval = mesh_get_eval_final( @@ -1258,14 +1258,19 @@ bool ED_mesh_pick_face_vert( for (i = 0; i < me_eval_mpoly_len; i++) { if (index_mp_to_orig[i] == poly_index) { - ed_mesh_pick_face_vert__mpoly_find( - ar, mval_f, &me_eval_mpoly[i], me_eval_mvert, me_eval_mloop, &len_best, &v_idx_best); + ed_mesh_pick_face_vert__mpoly_find(region, + mval_f, + &me_eval_mpoly[i], + me_eval_mvert, + me_eval_mloop, + &len_best, + &v_idx_best); } } } else { if (poly_index < me_eval_mpoly_len) { - ed_mesh_pick_face_vert__mpoly_find(ar, + ed_mesh_pick_face_vert__mpoly_find(region, mval_f, &me_eval_mpoly[poly_index], me_eval_mvert, @@ -1302,7 +1307,7 @@ bool ED_mesh_pick_face_vert( typedef struct VertPickData { const MVert *mvert; const float *mval_f; /* [2] */ - ARegion *ar; + ARegion *region; /* runtime */ float len_best; @@ -1319,7 +1324,7 @@ static void ed_mesh_pick_vert__mapFunc(void *userData, if ((data->mvert[index].flag & ME_HIDE) == 0) { float sco[2]; - if (ED_view3d_project_float_object(data->ar, co, sco, V3D_PROJ_TEST_CLIP_DEFAULT) == + if (ED_view3d_project_float_object(data->region, co, sco, V3D_PROJ_TEST_CLIP_DEFAULT) == V3D_PROJ_RET_OK) { const float len = len_manhattan_v2v2(data->mval_f, sco); if (len < data->len_best) { @@ -1350,11 +1355,11 @@ bool ED_mesh_pick_vert( /* sample rect to increase chances of selecting, so that when clicking * on an face in the backbuf, we can still select a vert */ *r_index = DRW_select_buffer_find_nearest_to_point( - vc.depsgraph, vc.ar, vc.v3d, mval, 1, me->totvert + 1, &dist_px); + vc.depsgraph, vc.region, vc.v3d, mval, 1, me->totvert + 1, &dist_px); } else { /* sample only on the exact position */ - *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) > (uint)me->totvert) { @@ -1369,8 +1374,8 @@ bool ED_mesh_pick_vert( /* derived mesh to find deformed locations */ Mesh *me_eval = mesh_get_eval_final(vc.depsgraph, scene_eval, ob_eval, &CD_MASK_BAREMESH); - ARegion *ar = vc.ar; - RegionView3D *rv3d = ar->regiondata; + ARegion *region = vc.region; + RegionView3D *rv3d = region->regiondata; /* find the vert closest to 'mval' */ const float mval_f[2] = {(float)mval[0], (float)mval[1]}; @@ -1385,7 +1390,7 @@ bool ED_mesh_pick_vert( /* setup data */ data.mvert = me->mvert; - data.ar = ar; + data.region = region; data.mval_f = mval_f; data.len_best = FLT_MAX; data.v_idx_best = -1; -- cgit v1.2.3