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/draw/DRW_engine.h | 18 ++--- source/blender/draw/DRW_select_buffer.h | 12 ++-- source/blender/draw/engines/eevee/eevee_lookdev.c | 2 +- .../blender/draw/engines/eevee/eevee_motion_blur.c | 12 ++-- .../draw/engines/external/external_engine.c | 8 +-- .../draw/engines/gpencil/gpencil_draw_cache_impl.c | 26 ++++---- .../blender/draw/engines/gpencil/gpencil_engine.c | 2 +- .../draw/engines/overlay/overlay_edit_mesh.c | 2 +- source/blender/draw/engines/select/select_engine.c | 2 +- source/blender/draw/intern/DRW_render.h | 2 +- source/blender/draw/intern/draw_manager.c | 78 +++++++++++----------- source/blender/draw/intern/draw_manager_text.c | 14 ++-- source/blender/draw/intern/draw_manager_text.h | 4 +- source/blender/draw/intern/draw_select_buffer.c | 32 ++++----- source/blender/draw/intern/draw_view.c | 20 +++--- 15 files changed, 117 insertions(+), 117 deletions(-) (limited to 'source/blender/draw') diff --git a/source/blender/draw/DRW_engine.h b/source/blender/draw/DRW_engine.h index 2462603632f..c6aedd40afb 100644 --- a/source/blender/draw/DRW_engine.h +++ b/source/blender/draw/DRW_engine.h @@ -63,7 +63,7 @@ typedef struct DRWUpdateContext { struct Depsgraph *depsgraph; struct Scene *scene; struct ViewLayer *view_layer; - struct ARegion *ar; + struct ARegion *region; struct View3D *v3d; struct RenderEngineType *engine_type; } DRWUpdateContext; @@ -81,24 +81,24 @@ void DRW_draw_region_engine_info(int xoffset, int yoffset); void DRW_draw_render_loop_ex(struct Depsgraph *depsgraph, struct RenderEngineType *engine_type, - struct ARegion *ar, + struct ARegion *region, struct View3D *v3d, struct GPUViewport *viewport, const struct bContext *evil_C); void DRW_draw_render_loop(struct Depsgraph *depsgraph, - struct ARegion *ar, + struct ARegion *region, struct View3D *v3d, struct GPUViewport *viewport); void DRW_draw_render_loop_offscreen(struct Depsgraph *depsgraph, struct RenderEngineType *engine_type, - struct ARegion *ar, + struct ARegion *region, struct View3D *v3d, const bool draw_background, const bool do_color_management, struct GPUOffScreen *ofs, struct GPUViewport *viewport); void DRW_draw_select_loop(struct Depsgraph *depsgraph, - struct ARegion *ar, + struct ARegion *region, struct View3D *v3d, bool use_obedit_skip, bool draw_surface, @@ -109,20 +109,20 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph, DRW_ObjectFilterFn object_filter_fn, void *object_filter_user_data); void DRW_draw_depth_loop(struct Depsgraph *depsgraph, - struct ARegion *ar, + struct ARegion *region, struct View3D *v3d, struct GPUViewport *viewport, bool use_opengl_context); void DRW_draw_depth_loop_gpencil(struct Depsgraph *depsgraph, - struct ARegion *ar, + struct ARegion *region, struct View3D *v3d, struct GPUViewport *viewport); -void DRW_draw_depth_object(struct ARegion *ar, +void DRW_draw_depth_object(struct ARegion *region, struct View3D *v3d, struct GPUViewport *viewport, struct Object *object); void DRW_draw_select_id(struct Depsgraph *depsgraph, - struct ARegion *ar, + struct ARegion *region, struct View3D *v3d, const struct rcti *rect); diff --git a/source/blender/draw/DRW_select_buffer.h b/source/blender/draw/DRW_select_buffer.h index 0ad13af81ba..6ebc30d0382 100644 --- a/source/blender/draw/DRW_select_buffer.h +++ b/source/blender/draw/DRW_select_buffer.h @@ -90,34 +90,34 @@ uint DRW_select_buffer_context_offset_for_object_elem(struct Depsgraph *depsgrap struct Object *object, char elem_type); uint *DRW_select_buffer_read(struct Depsgraph *depsgraph, - struct ARegion *ar, + struct ARegion *region, struct View3D *v3d, const rcti *rect, uint *r_buf_len); uint *DRW_select_buffer_bitmap_from_rect(struct Depsgraph *depsgraph, - struct ARegion *ar, + struct ARegion *region, struct View3D *v3d, const struct rcti *rect, uint *r_bitmap_len); uint *DRW_select_buffer_bitmap_from_circle(struct Depsgraph *depsgraph, - struct ARegion *ar, + struct ARegion *region, struct View3D *v3d, const int center[2], const int radius, uint *r_bitmap_len); uint *DRW_select_buffer_bitmap_from_poly(struct Depsgraph *depsgraph, - struct ARegion *ar, + struct ARegion *region, struct View3D *v3d, const int poly[][2], const int poly_len, const struct rcti *rect, uint *r_bitmap_len); uint DRW_select_buffer_sample_point(struct Depsgraph *depsgraph, - struct ARegion *ar, + struct ARegion *region, struct View3D *v3d, const int center[2]); uint DRW_select_buffer_find_nearest_to_point(struct Depsgraph *depsgraph, - struct ARegion *ar, + struct ARegion *region, struct View3D *v3d, const int center[2], const uint id_min, diff --git a/source/blender/draw/engines/eevee/eevee_lookdev.c b/source/blender/draw/engines/eevee/eevee_lookdev.c index b5ec5ce21a9..7be6fc2d030 100644 --- a/source/blender/draw/engines/eevee/eevee_lookdev.c +++ b/source/blender/draw/engines/eevee/eevee_lookdev.c @@ -88,7 +88,7 @@ void EEVEE_lookdev_cache_init(EEVEE_Data *vedata, rect = &fallback_rect; } else { - rect = ED_region_visible_rect(draw_ctx->ar); + rect = ED_region_visible_rect(draw_ctx->region); } /* Make the viewport width scale the lookdev spheres a bit. diff --git a/source/blender/draw/engines/eevee/eevee_motion_blur.c b/source/blender/draw/engines/eevee/eevee_motion_blur.c index fc5af62d45f..80c38839b71 100644 --- a/source/blender/draw/engines/eevee/eevee_motion_blur.c +++ b/source/blender/draw/engines/eevee/eevee_motion_blur.c @@ -48,7 +48,7 @@ static struct { extern char datatoc_effect_motion_blur_frag_glsl[]; static void eevee_motion_blur_camera_get_matrix_at_time(Scene *scene, - ARegion *ar, + ARegion *region, RegionView3D *rv3d, View3D *v3d, Object *camera, @@ -83,7 +83,7 @@ static void eevee_motion_blur_camera_get_matrix_at_time(Scene *scene, if (v3d != NULL) { BKE_camera_params_from_view3d(¶ms, draw_ctx->depsgraph, v3d, rv3d); - BKE_camera_params_compute_viewplane(¶ms, ar->winx, ar->winy, 1.0f, 1.0f); + BKE_camera_params_compute_viewplane(¶ms, region->winx, region->winy, 1.0f, 1.0f); } else { BKE_camera_params_from_object(¶ms, &cam_cpy); @@ -115,7 +115,7 @@ int EEVEE_motion_blur_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *veda View3D *v3d = draw_ctx->v3d; RegionView3D *rv3d = draw_ctx->rv3d; - ARegion *ar = draw_ctx->ar; + ARegion *region = draw_ctx->region; if (scene_eval->eevee.flag & SCE_EEVEE_MOTION_BLUR_ENABLED) { /* Update Motion Blur Matrices */ @@ -151,7 +151,7 @@ int EEVEE_motion_blur_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *veda /* Current matrix */ if (effects->motion_blur_mat_cached == false) { eevee_motion_blur_camera_get_matrix_at_time( - scene, ar, rv3d, v3d, ob_camera_eval, ctime, effects->current_world_to_ndc); + scene, region, rv3d, v3d, ob_camera_eval, ctime, effects->current_world_to_ndc); } /* Only continue if camera is not being keyed */ @@ -160,12 +160,12 @@ int EEVEE_motion_blur_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *veda /* Past matrix */ if (effects->motion_blur_mat_cached == false) { eevee_motion_blur_camera_get_matrix_at_time( - scene, ar, rv3d, v3d, ob_camera_eval, ctime - delta, effects->past_world_to_ndc); + scene, region, rv3d, v3d, ob_camera_eval, ctime - delta, effects->past_world_to_ndc); #if 0 /* for future high quality blur */ /* Future matrix */ eevee_motion_blur_camera_get_matrix_at_time( - scene, ar, rv3d, v3d, ob_camera_eval, ctime + delta, effects->future_world_to_ndc); + scene, region, rv3d, v3d, ob_camera_eval, ctime + delta, effects->future_world_to_ndc); #endif invert_m4_m4(effects->current_ndc_to_world, effects->current_world_to_ndc); } diff --git a/source/blender/draw/engines/external/external_engine.c b/source/blender/draw/engines/external/external_engine.c index ac3e5550030..bef49efd3f9 100644 --- a/source/blender/draw/engines/external/external_engine.c +++ b/source/blender/draw/engines/external/external_engine.c @@ -100,7 +100,7 @@ static void external_engine_init(void *vedata) { EXTERNAL_StorageList *stl = ((EXTERNAL_Data *)vedata)->stl; const DRWContextState *draw_ctx = DRW_context_state_get(); - ARegion *ar = draw_ctx->ar; + ARegion *region = draw_ctx->region; /* Depth prepass */ if (!e_data.depth_sh) { @@ -117,7 +117,7 @@ static void external_engine_init(void *vedata) /* Progressive render samples are tagged with no rebuild, in that case we * can skip updating the depth buffer */ - if (ar && (ar->do_draw & RGN_DRAW_NO_REBUILD)) { + if (region && (region->do_draw & RGN_DRAW_NO_REBUILD)) { stl->g_data->update_depth = false; } } @@ -182,7 +182,7 @@ static void external_draw_scene_do(void *vedata) const DRWContextState *draw_ctx = DRW_context_state_get(); Scene *scene = draw_ctx->scene; RegionView3D *rv3d = draw_ctx->rv3d; - ARegion *ar = draw_ctx->ar; + ARegion *region = draw_ctx->region; RenderEngineType *type; DRW_state_reset_ex(DRW_STATE_DEFAULT & ~DRW_STATE_DEPTH_LESS_EQUAL); @@ -205,7 +205,7 @@ static void external_draw_scene_do(void *vedata) /* Rendered draw. */ GPU_matrix_push_projection(); GPU_matrix_push(); - ED_region_pixelspace(ar); + ED_region_pixelspace(region); /* Render result draw. */ type = rv3d->render_engine->type; diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c index 51a63a00c24..a2016b9c1e6 100644 --- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c +++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c @@ -379,7 +379,7 @@ GPUBatch *gpencil_get_buffer_stroke_geom(bGPdata *gpd, short thickness) { const DRWContextState *draw_ctx = DRW_context_state_get(); Scene *scene = draw_ctx->scene; - ARegion *ar = draw_ctx->ar; + ARegion *region = draw_ctx->region; RegionView3D *rv3d = draw_ctx->rv3d; ToolSettings *ts = scene->toolsettings; Object *ob = draw_ctx->obact; @@ -413,13 +413,13 @@ GPUBatch *gpencil_get_buffer_stroke_geom(bGPdata *gpd, short thickness) ED_gp_get_drawing_reference(scene, ob, gpl, ts->gpencil_v3d_align, origin); for (int i = 0; i < totpoints; i++, tpt++) { - ED_gpencil_tpoint_to_point(ar, origin, tpt, &pt); + ED_gpencil_tpoint_to_point(region, origin, tpt, &pt); ED_gp_project_point_to_plane(scene, ob, rv3d, origin, ts->gp_sculpt.lock_axis - 1, &pt); /* first point for adjacency (not drawn) */ if (i == 0) { if (gpd->runtime.sbuffer_sflag & GP_STROKE_CYCLIC && totpoints > 2) { - ED_gpencil_tpoint_to_point(ar, origin, &points[totpoints - 1], &pt2); + ED_gpencil_tpoint_to_point(region, origin, &points[totpoints - 1], &pt2); gpencil_set_stroke_point(vbo, &pt2, idx, @@ -432,7 +432,7 @@ GPUBatch *gpencil_get_buffer_stroke_geom(bGPdata *gpd, short thickness) idx++; } else { - ED_gpencil_tpoint_to_point(ar, origin, &points[1], &pt2); + ED_gpencil_tpoint_to_point(region, origin, &points[1], &pt2); gpencil_set_stroke_point(vbo, &pt2, idx, @@ -455,19 +455,19 @@ GPUBatch *gpencil_get_buffer_stroke_geom(bGPdata *gpd, short thickness) /* last adjacency point (not drawn) */ if (gpd->runtime.sbuffer_sflag & GP_STROKE_CYCLIC && totpoints > 2) { /* draw line to first point to complete the cycle */ - ED_gpencil_tpoint_to_point(ar, origin, &points[0], &pt2); + ED_gpencil_tpoint_to_point(region, origin, &points[0], &pt2); gpencil_set_stroke_point( vbo, &pt2, idx, pos_id, color_id, thickness_id, uvdata_id, thickness, gpd->runtime.scolor); idx++; /* now add adjacency point (not drawn) */ - ED_gpencil_tpoint_to_point(ar, origin, &points[1], &pt3); + ED_gpencil_tpoint_to_point(region, origin, &points[1], &pt3); gpencil_set_stroke_point( vbo, &pt3, idx, pos_id, color_id, thickness_id, uvdata_id, thickness, gpd->runtime.scolor); idx++; } /* last adjacency point (not drawn) */ else { - ED_gpencil_tpoint_to_point(ar, origin, &points[totpoints - 2], &pt2); + ED_gpencil_tpoint_to_point(region, origin, &points[totpoints - 2], &pt2); gpencil_set_stroke_point( vbo, &pt2, idx, pos_id, color_id, thickness_id, uvdata_id, thickness, gpd->runtime.scolor); idx++; @@ -481,7 +481,7 @@ GPUBatch *gpencil_get_buffer_point_geom(bGPdata *gpd, short thickness) { const DRWContextState *draw_ctx = DRW_context_state_get(); Scene *scene = draw_ctx->scene; - ARegion *ar = draw_ctx->ar; + ARegion *region = draw_ctx->region; RegionView3D *rv3d = draw_ctx->rv3d; ToolSettings *ts = scene->toolsettings; Object *ob = draw_ctx->obact; @@ -513,7 +513,7 @@ GPUBatch *gpencil_get_buffer_point_geom(bGPdata *gpd, short thickness) ED_gp_get_drawing_reference(scene, ob, gpl, ts->gpencil_v3d_align, origin); for (int i = 0; i < totpoints; i++, tpt++) { - ED_gpencil_tpoint_to_point(ar, origin, tpt, &pt); + ED_gpencil_tpoint_to_point(region, origin, tpt, &pt); ED_gp_project_point_to_plane(scene, ob, rv3d, origin, ts->gp_sculpt.lock_axis - 1, &pt); /* use previous point to determine stroke direction (drawing path) */ @@ -524,7 +524,7 @@ GPUBatch *gpencil_get_buffer_point_geom(bGPdata *gpd, short thickness) if (totpoints > 1) { /* extrapolate a point before first point */ tGPspoint *tpt2 = &points[1]; - ED_gpencil_tpoint_to_point(ar, origin, tpt2, &pt2); + ED_gpencil_tpoint_to_point(region, origin, tpt2, &pt2); ED_gp_project_point_to_plane(scene, ob, rv3d, origin, ts->gp_sculpt.lock_axis - 1, &pt2); interp_v3_v3v3(ref_pt, &pt2.x, &pt.x, 1.5f); @@ -535,7 +535,7 @@ GPUBatch *gpencil_get_buffer_point_geom(bGPdata *gpd, short thickness) } else { tGPspoint *tpt2 = &points[i - 1]; - ED_gpencil_tpoint_to_point(ar, origin, tpt2, &pt2); + ED_gpencil_tpoint_to_point(region, origin, tpt2, &pt2); ED_gp_project_point_to_plane(scene, ob, rv3d, origin, ts->gp_sculpt.lock_axis - 1, &pt2); copy_v3_v3(ref_pt, &pt2.x); @@ -638,7 +638,7 @@ GPUBatch *gpencil_get_buffer_fill_geom(bGPdata *gpd) const DRWContextState *draw_ctx = DRW_context_state_get(); Scene *scene = draw_ctx->scene; - ARegion *ar = draw_ctx->ar; + ARegion *region = draw_ctx->region; ToolSettings *ts = scene->toolsettings; Object *ob = draw_ctx->obact; @@ -684,7 +684,7 @@ GPUBatch *gpencil_get_buffer_fill_geom(bGPdata *gpd) for (int i = 0; i < tot_triangles; i++) { for (int j = 0; j < 3; j++) { tpt = &points[tmp_triangles[i][j]]; - ED_gpencil_tpoint_to_point(ar, origin, tpt, &pt); + ED_gpencil_tpoint_to_point(region, origin, tpt, &pt); GPU_vertbuf_attr_set(vbo, pos_id, idx, &pt.x); GPU_vertbuf_attr_set(vbo, color_id, idx, gpd->runtime.sfill); idx++; diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c index fc5f04e658d..96560d986a0 100644 --- a/source/blender/draw/engines/gpencil/gpencil_engine.c +++ b/source/blender/draw/engines/gpencil/gpencil_engine.c @@ -739,7 +739,7 @@ void GPENCIL_cache_populate(void *vedata, Object *ob) bGPdata *gpd_orig = (bGPdata *)DEG_get_original_id(&gpd->id); if ((draw_ctx->obact == ob) && - ((gpd_orig->runtime.ar == NULL) || (gpd_orig->runtime.ar == draw_ctx->ar))) { + ((gpd_orig->runtime.ar == NULL) || (gpd_orig->runtime.ar == draw_ctx->region))) { gpencil_populate_buffer_strokes(&e_data, vedata, ts, ob); } diff --git a/source/blender/draw/engines/overlay/overlay_edit_mesh.c b/source/blender/draw/engines/overlay/overlay_edit_mesh.c index ee1b606bee5..6c838568260 100644 --- a/source/blender/draw/engines/overlay/overlay_edit_mesh.c +++ b/source/blender/draw/engines/overlay/overlay_edit_mesh.c @@ -333,7 +333,7 @@ void OVERLAY_edit_mesh_cache_populate(OVERLAY_Data *vedata, Object *ob) if (DRW_state_show_text() && (pd->edit_mesh.flag & OVERLAY_EDIT_TEXT)) { const DRWContextState *draw_ctx = DRW_context_state_get(); - DRW_text_edit_mesh_measure_stats(draw_ctx->ar, draw_ctx->v3d, ob, &draw_ctx->scene->unit); + DRW_text_edit_mesh_measure_stats(draw_ctx->region, draw_ctx->v3d, ob, &draw_ctx->scene->unit); } } diff --git a/source/blender/draw/engines/select/select_engine.c b/source/blender/draw/engines/select/select_engine.c index f56482235b3..389133b0d84 100644 --- a/source/blender/draw/engines/select/select_engine.c +++ b/source/blender/draw/engines/select/select_engine.c @@ -136,7 +136,7 @@ static void select_engine_init(void *vedata) DRW_view_viewmat_get(view_default, viewmat, false); DRW_view_winmat_get(view_default, winmat, false); projmat_from_subregion(winmat, - (int[2]){draw_ctx->ar->winx, draw_ctx->ar->winy}, + (int[2]){draw_ctx->region->winx, draw_ctx->region->winy}, e_data.context.last_rect.xmin, e_data.context.last_rect.xmax, e_data.context.last_rect.ymin, diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h index 4f7554006cb..fc7ca6c7d67 100644 --- a/source/blender/draw/intern/DRW_render.h +++ b/source/blender/draw/intern/DRW_render.h @@ -634,7 +634,7 @@ bool DRW_state_draw_background(void); /* Avoid too many lookups while drawing */ typedef struct DRWContextState { - struct ARegion *ar; /* 'CTX_wm_region(C)' */ + struct ARegion *region; /* 'CTX_wm_region(C)' */ struct RegionView3D *rv3d; /* 'CTX_wm_region_view3d(C)' */ struct View3D *v3d; /* 'CTX_wm_view3d(C)' */ diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index cd9420feb77..4ec49536211 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -1061,7 +1061,7 @@ static void drw_engines_draw_text(void) PROFILE_START(stime); if (data->text_draw_cache) { - DRW_text_cache_draw(data->text_draw_cache, DST.draw_ctx.ar, DST.draw_ctx.v3d); + DRW_text_cache_draw(data->text_draw_cache, DST.draw_ctx.region, DST.draw_ctx.v3d); } PROFILE_END_UPDATE(data->render_time, stime); @@ -1226,9 +1226,9 @@ static bool drw_gpencil_engine_needed(Depsgraph *depsgraph, View3D *v3d) void DRW_notify_view_update(const DRWUpdateContext *update_ctx) { RenderEngineType *engine_type = update_ctx->engine_type; - ARegion *ar = update_ctx->ar; + ARegion *region = update_ctx->region; View3D *v3d = update_ctx->v3d; - RegionView3D *rv3d = ar->regiondata; + RegionView3D *rv3d = region->regiondata; Depsgraph *depsgraph = update_ctx->depsgraph; Scene *scene = update_ctx->scene; ViewLayer *view_layer = update_ctx->view_layer; @@ -1237,7 +1237,7 @@ void DRW_notify_view_update(const DRWUpdateContext *update_ctx) /* Separate update for each stereo view. */ for (int view = 0; view < 2; view++) { - GPUViewport *viewport = WM_draw_region_get_viewport(ar, view); + GPUViewport *viewport = WM_draw_region_get_viewport(region, view); if (!viewport) { continue; } @@ -1252,7 +1252,7 @@ void DRW_notify_view_update(const DRWUpdateContext *update_ctx) DST.viewport = viewport; DST.draw_ctx = (DRWContextState){ - .ar = ar, + .region = region, .rv3d = rv3d, .v3d = v3d, .scene = scene, @@ -1297,7 +1297,7 @@ void DRW_draw_callbacks_pre_scene(void) GPU_matrix_set(rv3d->viewmat); if (DST.draw_ctx.evil_C) { - ED_region_draw_cb_draw(DST.draw_ctx.evil_C, DST.draw_ctx.ar, REGION_DRAW_PRE_VIEW); + ED_region_draw_cb_draw(DST.draw_ctx.evil_C, DST.draw_ctx.region, REGION_DRAW_PRE_VIEW); DRW_state_reset(); } } @@ -1305,7 +1305,7 @@ void DRW_draw_callbacks_pre_scene(void) void DRW_draw_callbacks_post_scene(void) { RegionView3D *rv3d = DST.draw_ctx.rv3d; - ARegion *ar = DST.draw_ctx.ar; + ARegion *region = DST.draw_ctx.region; View3D *v3d = DST.draw_ctx.v3d; Depsgraph *depsgraph = DST.draw_ctx.depsgraph; @@ -1330,14 +1330,14 @@ void DRW_draw_callbacks_post_scene(void) if (do_annotations) { GPU_depth_test(false); /* XXX: as scene->gpd is not copied for COW yet */ - ED_annotation_draw_view3d(DEG_get_input_scene(depsgraph), depsgraph, v3d, ar, true); + ED_annotation_draw_view3d(DEG_get_input_scene(depsgraph), depsgraph, v3d, region, true); GPU_depth_test(true); } drw_debug_draw(); GPU_depth_test(false); - ED_region_draw_cb_draw(DST.draw_ctx.evil_C, DST.draw_ctx.ar, REGION_DRAW_POST_VIEW); + ED_region_draw_cb_draw(DST.draw_ctx.evil_C, DST.draw_ctx.region, REGION_DRAW_POST_VIEW); /* Callback can be nasty and do whatever they want with the state. * Don't trust them! */ @@ -1359,7 +1359,7 @@ void DRW_draw_callbacks_post_scene(void) if (((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0) && (do_annotations)) { GPU_depth_test(false); /* XXX: as scene->gpd is not copied for COW yet */ - ED_annotation_draw_view3d(DEG_get_input_scene(depsgraph), depsgraph, v3d, ar, false); + ED_annotation_draw_view3d(DEG_get_input_scene(depsgraph), depsgraph, v3d, region, false); } if ((v3d->gizmo_flag & V3D_GIZMO_HIDE) == 0) { @@ -1372,7 +1372,7 @@ void DRW_draw_callbacks_post_scene(void) if (G.debug_value > 20 && G.debug_value < 30) { GPU_depth_test(false); /* local coordinate visible rect inside region, to accommodate overlapping ui */ - const rcti *rect = ED_region_visible_rect(DST.draw_ctx.ar); + const rcti *rect = ED_region_visible_rect(DST.draw_ctx.region); DRW_stats_draw(rect); } @@ -1401,11 +1401,11 @@ struct DRWTextStore *DRW_text_cache_ensure(void) void DRW_draw_view(const bContext *C) { Depsgraph *depsgraph = CTX_data_expect_evaluated_depsgraph(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); View3D *v3d = CTX_wm_view3d(C); Scene *scene = DEG_get_evaluated_scene(depsgraph); RenderEngineType *engine_type = ED_view3d_engine_type(scene, v3d->shading.type); - GPUViewport *viewport = WM_draw_region_get_bound_viewport(ar); + GPUViewport *viewport = WM_draw_region_get_bound_viewport(region); /* Reset before using it. */ drw_state_prepare_clean_for_draw(&DST); @@ -1414,7 +1414,7 @@ void DRW_draw_view(const bContext *C) DST.options.draw_background = (scene->r.alphamode == R_ADDSKY) || (v3d->shading.type != OB_RENDER); DST.options.do_color_management = true; - DRW_draw_render_loop_ex(depsgraph, engine_type, ar, v3d, viewport, C); + DRW_draw_render_loop_ex(depsgraph, engine_type, region, v3d, viewport, C); } /** @@ -1423,7 +1423,7 @@ void DRW_draw_view(const bContext *C) */ void DRW_draw_render_loop_ex(struct Depsgraph *depsgraph, RenderEngineType *engine_type, - ARegion *ar, + ARegion *region, View3D *v3d, GPUViewport *viewport, const bContext *evil_C) @@ -1431,14 +1431,14 @@ void DRW_draw_render_loop_ex(struct Depsgraph *depsgraph, Scene *scene = DEG_get_evaluated_scene(depsgraph); ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph); - RegionView3D *rv3d = ar->regiondata; + RegionView3D *rv3d = region->regiondata; DST.draw_ctx.evil_C = evil_C; DST.viewport = viewport; /* Setup viewport */ DST.draw_ctx = (DRWContextState){ - .ar = ar, + .region = region, .rv3d = rv3d, .v3d = v3d, .scene = scene, @@ -1535,7 +1535,7 @@ void DRW_draw_render_loop_ex(struct Depsgraph *depsgraph, DRW_draw_callbacks_post_scene(); - if (WM_draw_region_get_bound_viewport(ar)) { + if (WM_draw_region_get_bound_viewport(region)) { /* Don't unbind the framebuffer yet in this case and let * GPU_viewport_unbind do it, so that we can still do further * drawing of action zones on top. */ @@ -1556,7 +1556,7 @@ void DRW_draw_render_loop_ex(struct Depsgraph *depsgraph, } void DRW_draw_render_loop(struct Depsgraph *depsgraph, - ARegion *ar, + ARegion *region, View3D *v3d, GPUViewport *viewport) { @@ -1566,7 +1566,7 @@ void DRW_draw_render_loop(struct Depsgraph *depsgraph, Scene *scene = DEG_get_evaluated_scene(depsgraph); RenderEngineType *engine_type = ED_view3d_engine_type(scene, v3d->shading.type); - DRW_draw_render_loop_ex(depsgraph, engine_type, ar, v3d, viewport, NULL); + DRW_draw_render_loop_ex(depsgraph, engine_type, region, v3d, viewport, NULL); } /** @@ -1574,7 +1574,7 @@ void DRW_draw_render_loop(struct Depsgraph *depsgraph, */ void DRW_draw_render_loop_offscreen(struct Depsgraph *depsgraph, RenderEngineType *engine_type, - ARegion *ar, + ARegion *region, View3D *v3d, const bool draw_background, const bool do_color_management, @@ -1594,7 +1594,7 @@ void DRW_draw_render_loop_offscreen(struct Depsgraph *depsgraph, DST.options.is_image_render = true; DST.options.do_color_management = do_color_management; DST.options.draw_background = draw_background; - DRW_draw_render_loop_ex(depsgraph, engine_type, ar, v3d, render_viewport, NULL); + DRW_draw_render_loop_ex(depsgraph, engine_type, region, v3d, render_viewport, NULL); if (draw_background) { /* HACK(fclem): In this case we need to make sure the final alpha is 1. @@ -2005,7 +2005,7 @@ void DRW_render_instance_buffer_finish(void) * object mode select-loop, see: ED_view3d_draw_select_loop (legacy drawing). */ void DRW_draw_select_loop(struct Depsgraph *depsgraph, - ARegion *ar, + ARegion *region, View3D *v3d, bool UNUSED(use_obedit_skip), bool draw_surface, @@ -2022,9 +2022,9 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph, Object *obact = OBACT(view_layer); Object *obedit = OBEDIT_FROM_OBACT(obact); #ifndef USE_GPU_SELECT - UNUSED_VARS(scene, view_layer, v3d, ar, rect); + UNUSED_VARS(scene, view_layer, v3d, region, rect); #else - RegionView3D *rv3d = ar->regiondata; + RegionView3D *rv3d = region->regiondata; /* Reset before using it. */ drw_state_prepare_clean_for_draw(&DST); @@ -2102,7 +2102,7 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph, /* Instead of 'DRW_context_state_init(C, &DST.draw_ctx)', assign from args */ DST.draw_ctx = (DRWContextState){ - .ar = ar, + .region = region, .rv3d = rv3d, .v3d = v3d, .scene = scene, @@ -2242,7 +2242,7 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph, * object mode select-loop, see: ED_view3d_draw_depth_loop (legacy drawing). */ static void drw_draw_depth_loop_imp(struct Depsgraph *depsgraph, - ARegion *ar, + ARegion *region, View3D *v3d, GPUViewport *viewport, const bool use_opengl_context) @@ -2250,7 +2250,7 @@ static void drw_draw_depth_loop_imp(struct Depsgraph *depsgraph, Scene *scene = DEG_get_evaluated_scene(depsgraph); RenderEngineType *engine_type = ED_view3d_engine_type(scene, v3d->shading.type); ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph); - RegionView3D *rv3d = ar->regiondata; + RegionView3D *rv3d = region->regiondata; if (use_opengl_context) { DRW_opengl_context_enable(); @@ -2261,7 +2261,7 @@ static void drw_draw_depth_loop_imp(struct Depsgraph *depsgraph, /* Instead of 'DRW_context_state_init(C, &DST.draw_ctx)', assign from args */ DST.draw_ctx = (DRWContextState){ - .ar = ar, + .region = region, .rv3d = rv3d, .v3d = v3d, .scene = scene, @@ -2347,7 +2347,7 @@ static void drw_draw_depth_loop_imp(struct Depsgraph *depsgraph, * object mode select-loop, see: ED_view3d_draw_depth_loop (legacy drawing). */ void DRW_draw_depth_loop(struct Depsgraph *depsgraph, - ARegion *ar, + ARegion *region, View3D *v3d, GPUViewport *viewport, bool use_opengl_context) @@ -2366,14 +2366,14 @@ void DRW_draw_depth_loop(struct Depsgraph *depsgraph, } } - drw_draw_depth_loop_imp(depsgraph, ar, v3d, viewport, use_opengl_context); + drw_draw_depth_loop_imp(depsgraph, region, v3d, viewport, use_opengl_context); } /** * Converted from ED_view3d_draw_depth_gpencil (legacy drawing). */ void DRW_draw_depth_loop_gpencil(struct Depsgraph *depsgraph, - ARegion *ar, + ARegion *region, View3D *v3d, GPUViewport *viewport) { @@ -2382,10 +2382,10 @@ void DRW_draw_depth_loop_gpencil(struct Depsgraph *depsgraph, use_drw_engine(&draw_engine_gpencil_type); - drw_draw_depth_loop_imp(depsgraph, ar, v3d, viewport, true); + drw_draw_depth_loop_imp(depsgraph, region, v3d, viewport, true); } -void DRW_draw_select_id(Depsgraph *depsgraph, ARegion *ar, View3D *v3d, const rcti *rect) +void DRW_draw_select_id(Depsgraph *depsgraph, ARegion *region, View3D *v3d, const rcti *rect) { Scene *scene = DEG_get_evaluated_scene(depsgraph); ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph); @@ -2395,8 +2395,8 @@ void DRW_draw_select_id(Depsgraph *depsgraph, ARegion *ar, View3D *v3d, const rc /* Instead of 'DRW_context_state_init(C, &DST.draw_ctx)', assign from args */ DST.draw_ctx = (DRWContextState){ - .ar = ar, - .rv3d = ar->regiondata, + .region = region, + .rv3d = region->regiondata, .v3d = v3d, .scene = scene, .view_layer = view_layer, @@ -2407,7 +2407,7 @@ void DRW_draw_select_id(Depsgraph *depsgraph, ARegion *ar, View3D *v3d, const rc drw_context_state_init(); /* Setup viewport */ - DST.viewport = WM_draw_region_get_viewport(ar, 0); + DST.viewport = WM_draw_region_get_viewport(region, 0); drw_viewport_var_init(); /* Update ubos */ @@ -2463,9 +2463,9 @@ static void draw_world_clip_planes_from_rv3d(GPUBatch *batch, const float world_ /** * Clears the Depth Buffer and draws only the specified object. */ -void DRW_draw_depth_object(ARegion *ar, View3D *v3d, GPUViewport *viewport, Object *object) +void DRW_draw_depth_object(ARegion *region, View3D *v3d, GPUViewport *viewport, Object *object) { - RegionView3D *rv3d = ar->regiondata; + RegionView3D *rv3d = region->regiondata; DRW_opengl_context_enable(); GPU_matrix_projection_set(rv3d->winmat); diff --git a/source/blender/draw/intern/draw_manager_text.c b/source/blender/draw/intern/draw_manager_text.c index 92095791ef7..b74aacb3283 100644 --- a/source/blender/draw/intern/draw_manager_text.c +++ b/source/blender/draw/intern/draw_manager_text.c @@ -119,9 +119,9 @@ void DRW_text_cache_add(DRWTextStore *dt, } } -void DRW_text_cache_draw(DRWTextStore *dt, ARegion *ar, struct View3D *v3d) +void DRW_text_cache_draw(DRWTextStore *dt, ARegion *region, struct View3D *v3d) { - RegionView3D *rv3d = ar->regiondata; + RegionView3D *rv3d = region->regiondata; ViewCachedString *vos; int tot = 0; @@ -130,7 +130,7 @@ void DRW_text_cache_draw(DRWTextStore *dt, ARegion *ar, struct View3D *v3d) BLI_memiter_iter_init(dt->cache_strings, &it); while ((vos = BLI_memiter_iter_step(&it))) { if (ED_view3d_project_short_ex( - ar, + region, (vos->flag & DRW_TEXT_CACHE_GLOBALSPACE) ? rv3d->persmat : rv3d->persmatob, (vos->flag & DRW_TEXT_CACHE_LOCALCLIP) != 0, vos->vec, @@ -153,7 +153,7 @@ void DRW_text_cache_draw(DRWTextStore *dt, ARegion *ar, struct View3D *v3d) float original_proj[4][4]; GPU_matrix_projection_get(original_proj); - wmOrtho2_region_pixelspace(ar); + wmOrtho2_region_pixelspace(region); GPU_matrix_push(); GPU_matrix_identity_set(); @@ -192,7 +192,7 @@ void DRW_text_cache_draw(DRWTextStore *dt, ARegion *ar, struct View3D *v3d) } /* Copied from drawobject.c */ -void DRW_text_edit_mesh_measure_stats(ARegion *ar, +void DRW_text_edit_mesh_measure_stats(ARegion *region, View3D *v3d, Object *ob, const UnitSettings *unit) @@ -251,9 +251,9 @@ void DRW_text_edit_mesh_measure_stats(ARegion *ar, if (v3d->overlay.edit_flag & (V3D_OVERLAY_EDIT_EDGE_LEN | V3D_OVERLAY_EDIT_EDGE_ANG | V3D_OVERLAY_EDIT_INDICES)) { BoundBox bb; - const rcti rect = {0, ar->winx, 0, ar->winy}; + const rcti rect = {0, region->winx, 0, region->winy}; - ED_view3d_clipping_calc(&bb, clip_planes, ar, ob, &rect); + ED_view3d_clipping_calc(&bb, clip_planes, region, ob, &rect); } if (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_EDGE_LEN) { diff --git a/source/blender/draw/intern/draw_manager_text.h b/source/blender/draw/intern/draw_manager_text.h index 393645e614a..66ef2379e38 100644 --- a/source/blender/draw/intern/draw_manager_text.h +++ b/source/blender/draw/intern/draw_manager_text.h @@ -41,9 +41,9 @@ void DRW_text_cache_add(struct DRWTextStore *dt, short flag, const uchar col[4]); -void DRW_text_cache_draw(struct DRWTextStore *dt, struct ARegion *ar, struct View3D *v3d); +void DRW_text_cache_draw(struct DRWTextStore *dt, struct ARegion *region, struct View3D *v3d); -void DRW_text_edit_mesh_measure_stats(struct ARegion *ar, +void DRW_text_edit_mesh_measure_stats(struct ARegion *region, struct View3D *v3d, struct Object *ob, const struct UnitSettings *unit); diff --git a/source/blender/draw/intern/draw_select_buffer.c b/source/blender/draw/intern/draw_select_buffer.c index 6454fc71e56..81c9f400f6e 100644 --- a/source/blender/draw/intern/draw_select_buffer.c +++ b/source/blender/draw/intern/draw_select_buffer.c @@ -48,7 +48,7 @@ /* Main function to read a block of pixels from the select frame buffer. */ uint *DRW_select_buffer_read(struct Depsgraph *depsgraph, - struct ARegion *ar, + struct ARegion *region, struct View3D *v3d, const rcti *rect, uint *r_buf_len) @@ -59,9 +59,9 @@ uint *DRW_select_buffer_read(struct Depsgraph *depsgraph, /* Clamp rect. */ rcti r = { .xmin = 0, - .xmax = ar->winx, + .xmax = region->winx, .ymin = 0, - .ymax = ar->winy, + .ymax = region->winy, }; /* Make sure that the rect is within the bounds of the viewport. @@ -72,11 +72,11 @@ uint *DRW_select_buffer_read(struct Depsgraph *depsgraph, DRW_opengl_context_enable(); /* Update the drawing. */ - DRW_draw_select_id(depsgraph, ar, v3d, rect); + DRW_draw_select_id(depsgraph, region, v3d, rect); if (select_ctx->index_drawn_len > 1) { - BLI_assert(ar->winx == GPU_texture_width(DRW_engine_select_texture_get()) && - ar->winy == GPU_texture_height(DRW_engine_select_texture_get())); + BLI_assert(region->winx == GPU_texture_width(DRW_engine_select_texture_get()) && + region->winy == GPU_texture_height(DRW_engine_select_texture_get())); /* Read the UI32 pixels. */ buf_len = BLI_rcti_size_x(rect) * BLI_rcti_size_y(rect); @@ -126,7 +126,7 @@ uint *DRW_select_buffer_read(struct Depsgraph *depsgraph, * \returns a #BLI_bitmap the length of \a bitmap_len or NULL on failure. */ uint *DRW_select_buffer_bitmap_from_rect(struct Depsgraph *depsgraph, - struct ARegion *ar, + struct ARegion *region, struct View3D *v3d, const rcti *rect, uint *r_bitmap_len) @@ -138,7 +138,7 @@ uint *DRW_select_buffer_bitmap_from_rect(struct Depsgraph *depsgraph, rect_px.ymax += 1; uint buf_len; - uint *buf = DRW_select_buffer_read(depsgraph, ar, v3d, &rect_px, &buf_len); + uint *buf = DRW_select_buffer_read(depsgraph, region, v3d, &rect_px, &buf_len); if (buf == NULL) { return NULL; } @@ -171,7 +171,7 @@ uint *DRW_select_buffer_bitmap_from_rect(struct Depsgraph *depsgraph, * \returns a #BLI_bitmap the length of \a bitmap_len or NULL on failure. */ uint *DRW_select_buffer_bitmap_from_circle(struct Depsgraph *depsgraph, - struct ARegion *ar, + struct ARegion *region, struct View3D *v3d, const int center[2], const int radius, @@ -186,7 +186,7 @@ uint *DRW_select_buffer_bitmap_from_circle(struct Depsgraph *depsgraph, .ymax = center[1] + radius + 1, }; - const uint *buf = DRW_select_buffer_read(depsgraph, ar, v3d, &rect, NULL); + const uint *buf = DRW_select_buffer_read(depsgraph, region, v3d, &rect, NULL); if (buf == NULL) { return NULL; @@ -241,7 +241,7 @@ static void drw_select_mask_px_cb(int x, int x_end, int y, void *user_data) * \returns a #BLI_bitmap. */ uint *DRW_select_buffer_bitmap_from_poly(struct Depsgraph *depsgraph, - struct ARegion *ar, + struct ARegion *region, struct View3D *v3d, const int poly[][2], const int poly_len, @@ -255,7 +255,7 @@ uint *DRW_select_buffer_bitmap_from_poly(struct Depsgraph *depsgraph, rect_px.ymax += 1; uint buf_len; - uint *buf = DRW_select_buffer_read(depsgraph, ar, v3d, &rect_px, &buf_len); + uint *buf = DRW_select_buffer_read(depsgraph, region, v3d, &rect_px, &buf_len); if (buf == NULL) { return NULL; } @@ -312,7 +312,7 @@ uint *DRW_select_buffer_bitmap_from_poly(struct Depsgraph *depsgraph, * Samples a single pixel. */ uint DRW_select_buffer_sample_point(struct Depsgraph *depsgraph, - struct ARegion *ar, + struct ARegion *region, struct View3D *v3d, const int center[2]) { @@ -326,7 +326,7 @@ uint DRW_select_buffer_sample_point(struct Depsgraph *depsgraph, }; uint buf_len; - uint *buf = DRW_select_buffer_read(depsgraph, ar, v3d, &rect, &buf_len); + uint *buf = DRW_select_buffer_read(depsgraph, region, v3d, &rect, &buf_len); if (buf) { BLI_assert(0 != buf_len); ret = buf[0]; @@ -342,7 +342,7 @@ uint DRW_select_buffer_sample_point(struct Depsgraph *depsgraph, * when found, this value is set to the distance of the selection that's returned. */ uint DRW_select_buffer_find_nearest_to_point(struct Depsgraph *depsgraph, - struct ARegion *ar, + struct ARegion *region, struct View3D *v3d, const int center[2], const uint id_min, @@ -369,7 +369,7 @@ uint DRW_select_buffer_find_nearest_to_point(struct Depsgraph *depsgraph, /* Read from selection framebuffer. */ uint buf_len; - const uint *buf = DRW_select_buffer_read(depsgraph, ar, v3d, &rect, &buf_len); + const uint *buf = DRW_select_buffer_read(depsgraph, region, v3d, &rect, &buf_len); if (buf == NULL) { return index; diff --git a/source/blender/draw/intern/draw_view.c b/source/blender/draw/intern/draw_view.c index 80a7760a571..08f5d3ac463 100644 --- a/source/blender/draw/intern/draw_view.c +++ b/source/blender/draw/intern/draw_view.c @@ -50,11 +50,11 @@ void DRW_draw_region_info(void) { const DRWContextState *draw_ctx = DRW_context_state_get(); - ARegion *ar = draw_ctx->ar; + ARegion *region = draw_ctx->region; DRW_draw_cursor(); - view3d_draw_region_info(draw_ctx->evil_C, ar); + view3d_draw_region_info(draw_ctx->evil_C, region); } /* **************************** 3D Cursor ******************************** */ @@ -99,7 +99,7 @@ static bool is_cursor_visible(const DRWContextState *draw_ctx, Scene *scene, Vie void DRW_draw_cursor(void) { const DRWContextState *draw_ctx = DRW_context_state_get(); - ARegion *ar = draw_ctx->ar; + ARegion *region = draw_ctx->region; Scene *scene = draw_ctx->scene; ViewLayer *view_layer = draw_ctx->view_layer; @@ -114,9 +114,9 @@ void DRW_draw_cursor(void) const View3DCursor *cursor = &scene->cursor; if (ED_view3d_project_int_global( - ar, cursor->location, co, V3D_PROJ_TEST_NOP | V3D_PROJ_TEST_CLIP_NEAR) == + region, cursor->location, co, V3D_PROJ_TEST_NOP | V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK) { - RegionView3D *rv3d = ar->regiondata; + RegionView3D *rv3d = region->regiondata; float cursor_quat[4]; BKE_scene_cursor_rot_to_quat(cursor, cursor_quat); @@ -178,7 +178,7 @@ void DRW_draw_cursor(void) float original_proj[4][4]; GPU_matrix_projection_get(original_proj); GPU_matrix_push(); - ED_region_pixelspace(ar); + ED_region_pixelspace(region); GPU_matrix_translate_2f(co[0] + 0.5f, co[1] + 0.5f); GPU_matrix_scale_2f(U.widget_unit, U.widget_unit); @@ -202,20 +202,20 @@ void DRW_draw_cursor(void) void DRW_draw_gizmo_3d(void) { const DRWContextState *draw_ctx = DRW_context_state_get(); - ARegion *ar = draw_ctx->ar; + ARegion *region = draw_ctx->region; /* draw depth culled gizmos - gizmos need to be updated *after* view matrix was set up */ /* TODO depth culling gizmos is not yet supported, just drawing _3D here, should * later become _IN_SCENE (and draw _3D separate) */ - WM_gizmomap_draw(ar->gizmo_map, draw_ctx->evil_C, WM_GIZMOMAP_DRAWSTEP_3D); + WM_gizmomap_draw(region->gizmo_map, draw_ctx->evil_C, WM_GIZMOMAP_DRAWSTEP_3D); } void DRW_draw_gizmo_2d(void) { const DRWContextState *draw_ctx = DRW_context_state_get(); - ARegion *ar = draw_ctx->ar; + ARegion *region = draw_ctx->region; - WM_gizmomap_draw(ar->gizmo_map, draw_ctx->evil_C, WM_GIZMOMAP_DRAWSTEP_2D); + WM_gizmomap_draw(region->gizmo_map, draw_ctx->evil_C, WM_GIZMOMAP_DRAWSTEP_2D); glDepthMask(GL_TRUE); } -- cgit v1.2.3