diff options
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/curve/editcurve_paint.c | 9 | ||||
-rw-r--r-- | source/blender/editors/gpencil/annotate_paint.c | 24 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_fill.c | 3 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_paint.c | 12 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_primitive.c | 12 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_utils.c | 2 | ||||
-rw-r--r-- | source/blender/editors/include/ED_view3d.h | 17 | ||||
-rw-r--r-- | source/blender/editors/object/object_transform.c | 7 | ||||
-rw-r--r-- | source/blender/editors/physics/particle_edit.c | 16 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw.c | 172 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_edit.c | 5 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_intern.h | 10 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_utils.c | 22 |
13 files changed, 146 insertions, 165 deletions
diff --git a/source/blender/editors/curve/editcurve_paint.c b/source/blender/editors/curve/editcurve_paint.c index 48a36ff276d..0d071f2e595 100644 --- a/source/blender/editors/curve/editcurve_paint.c +++ b/source/blender/editors/curve/editcurve_paint.c @@ -1083,13 +1083,8 @@ static int curve_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event) /* needed or else the draw matrix can be incorrect */ view3d_operator_needs_opengl(C); - ED_view3d_autodist_init(cdd->vc.depsgraph, cdd->vc.region, cdd->vc.v3d, 0); - - if (cdd->vc.rv3d->depths) { - cdd->vc.rv3d->depths->damaged = true; - } - - ED_view3d_depth_update(cdd->vc.region); + ED_view3d_depth_override( + cdd->vc.depsgraph, cdd->vc.region, cdd->vc.v3d, NULL, V3D_DEPTH_NO_GPENCIL, true); if (cdd->vc.rv3d->depths != NULL) { cdd->project.use_depth = true; diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c index e9817f82090..5c40bc8e418 100644 --- a/source/blender/editors/gpencil/annotate_paint.c +++ b/source/blender/editors/gpencil/annotate_paint.c @@ -660,10 +660,14 @@ static short annotation_stroke_addpoint(tGPsdata *p, View3D *v3d = p->area->spacedata.first; view3d_region_operator_needs_opengl(p->win, p->region); - ED_view3d_autodist_init(p->depsgraph, - p->region, - v3d, - (ts->annotate_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 1 : 0); + ED_view3d_depth_override(p->depsgraph, + p->region, + v3d, + NULL, + (ts->annotate_v3d_align & GP_PROJECT_DEPTH_STROKE) ? + V3D_DEPTH_GPENCIL_ONLY : + V3D_DEPTH_NO_GPENCIL, + false); } /* convert screen-coordinates to appropriate coordinates (and store them) */ @@ -1222,7 +1226,7 @@ static void annotation_stroke_doeraser(tGPsdata *p) if (p->flags & GP_PAINTFLAG_V3D_ERASER_DEPTH) { View3D *v3d = p->area->spacedata.first; view3d_region_operator_needs_opengl(p->win, p->region); - ED_view3d_autodist_init(p->depsgraph, p->region, v3d, 0); + ED_view3d_depth_override(p->depsgraph, p->region, v3d, NULL, V3D_DEPTH_NO_GPENCIL, false); } } @@ -1695,8 +1699,14 @@ static void annotation_paint_strokeend(tGPsdata *p) /* need to restore the original projection settings before packing up */ view3d_region_operator_needs_opengl(p->win, p->region); - ED_view3d_autodist_init( - p->depsgraph, p->region, v3d, (ts->annotate_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 1 : 0); + ED_view3d_depth_override(p->depsgraph, + p->region, + v3d, + NULL, + (ts->annotate_v3d_align & GP_PROJECT_DEPTH_STROKE) ? + V3D_DEPTH_GPENCIL_ONLY : + V3D_DEPTH_NO_GPENCIL, + false); } /* check if doing eraser or not */ diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c index 4749f40fac5..3f86e5474c5 100644 --- a/source/blender/editors/gpencil/gpencil_fill.c +++ b/source/blender/editors/gpencil/gpencil_fill.c @@ -1363,7 +1363,8 @@ static void gpencil_get_depth_array(tGPDfill *tgpf) if (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_VIEW) { /* need to restore the original projection settings before packing up */ view3d_region_operator_needs_opengl(tgpf->win, tgpf->region); - ED_view3d_autodist_init(tgpf->depsgraph, tgpf->region, tgpf->v3d, 0); + ED_view3d_depth_override( + tgpf->depsgraph, tgpf->region, tgpf->v3d, NULL, V3D_DEPTH_NO_GPENCIL, false); /* Since strokes are so fine, when using their depth we need a margin * otherwise they might get missed. */ diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index beaa5f9b64f..d072d8a35df 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -1722,7 +1722,7 @@ static void gpencil_stroke_doeraser(tGPsdata *p) if ((gp_settings != NULL) && (gp_settings->flag & GP_BRUSH_OCCLUDE_ERASER)) { View3D *v3d = p->area->spacedata.first; view3d_region_operator_needs_opengl(p->win, p->region); - ED_view3d_autodist_init(p->depsgraph, p->region, v3d, 0); + ED_view3d_depth_override(p->depsgraph, p->region, v3d, NULL, V3D_DEPTH_NO_GPENCIL, false); } } @@ -2305,8 +2305,14 @@ static void gpencil_paint_strokeend(tGPsdata *p) /* need to restore the original projection settings before packing up */ view3d_region_operator_needs_opengl(p->win, p->region); - ED_view3d_autodist_init( - p->depsgraph, p->region, v3d, (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 1 : 0); + ED_view3d_depth_override(p->depsgraph, + p->region, + v3d, + NULL, + (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) ? + V3D_DEPTH_GPENCIL_ONLY : + V3D_DEPTH_NO_GPENCIL, + false); } /* check if doing eraser or not */ diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c index dfff0ce639e..3d20e32ed49 100644 --- a/source/blender/editors/gpencil/gpencil_primitive.c +++ b/source/blender/editors/gpencil/gpencil_primitive.c @@ -785,10 +785,14 @@ static void gpencil_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi) /* need to restore the original projection settings before packing up */ view3d_region_operator_needs_opengl(tgpi->win, tgpi->region); - ED_view3d_autodist_init(tgpi->depsgraph, - tgpi->region, - tgpi->v3d, - (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 1 : 0); + ED_view3d_depth_override(tgpi->depsgraph, + tgpi->region, + tgpi->v3d, + NULL, + (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) ? + V3D_DEPTH_GPENCIL_ONLY : + V3D_DEPTH_NO_GPENCIL, + false); depth_arr = MEM_mallocN(sizeof(float) * gps->totpoints, "depth_points"); tGPspoint *ptc = &points2D[0]; diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c index 574670de7ca..8d42024a518 100644 --- a/source/blender/editors/gpencil/gpencil_utils.c +++ b/source/blender/editors/gpencil/gpencil_utils.c @@ -648,7 +648,7 @@ void gpencil_point_conversion_init(bContext *C, GP_SpaceConversion *r_gsc) view3d_operator_needs_opengl(C); view3d_region_operator_needs_opengl(win, region); - ED_view3d_autodist_init(depsgraph, region, v3d, 0); + ED_view3d_depth_override(depsgraph, region, v3d, NULL, V3D_DEPTH_NO_GPENCIL, false); /* for camera view set the subrect */ if (rv3d->persp == RV3D_CAMOB) { diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 3b8e062ffec..d00d03abae7 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -144,7 +144,17 @@ bool ED_view3d_camera_to_view_selected(struct Main *bmain, void ED_view3d_lastview_store(struct RegionView3D *rv3d); /* Depth buffer */ -void ED_view3d_depth_update(struct ARegion *region); +typedef enum { + V3D_DEPTH_NO_GPENCIL = 0, + V3D_DEPTH_GPENCIL_ONLY, + V3D_DEPTH_OBJECT_ONLY, +} eV3DDepthOverrideMode; +void ED_view3d_depth_override(struct Depsgraph *depsgraph, + struct ARegion *region, + struct View3D *v3d, + struct Object *obact, + eV3DDepthOverrideMode mode, + bool update_cache); float ED_view3d_depth_read_cached(const struct ViewContext *vc, const int mval[2]); bool ED_view3d_depth_read_cached_normal(const ViewContext *vc, const int mval[2], @@ -481,11 +491,6 @@ bool ED_view3d_autodist(struct Depsgraph *depsgraph, const bool alphaoverride, const float fallback_depth_pt[3]); -/* Only draw so #ED_view3d_autodist_simple can be called many times after. */ -void ED_view3d_autodist_init(struct Depsgraph *depsgraph, - struct ARegion *region, - struct View3D *v3d, - int mode); bool ED_view3d_autodist_simple(struct ARegion *region, const int mval[2], float mouse_worldloc[3], diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index 13c0740bce6..1d7cf61bc3a 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -1782,12 +1782,7 @@ static int object_transform_axis_target_invoke(bContext *C, wmOperator *op, cons vc.v3d->flag2 |= V3D_HIDE_OVERLAYS; #endif - ED_view3d_autodist_init(vc.depsgraph, vc.region, vc.v3d, 0); - - if (vc.rv3d->depths != NULL) { - vc.rv3d->depths->damaged = true; - } - ED_view3d_depth_update(vc.region); + ED_view3d_depth_override(vc.depsgraph, vc.region, vc.v3d, NULL, V3D_DEPTH_NO_GPENCIL, true); #ifdef USE_RENDER_OVERRIDE vc.v3d->flag2 = flag2_prev; diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 0ec8238f741..de4ad913d6d 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -524,15 +524,13 @@ static void PE_set_view3d_data(bContext *C, PEData *data) ED_view3d_viewcontext_init(C, &data->vc, data->depsgraph); if (!XRAY_ENABLED(data->vc.v3d)) { - if (data->vc.v3d->flag & V3D_INVALID_BACKBUF) { - /* needed or else the draw matrix can be incorrect */ - view3d_operator_needs_opengl(C); - - ED_view3d_backbuf_depth_validate(&data->vc); - /* we may need to force an update here by setting the rv3d as dirty - * for now it seems ok, but take care!: - * rv3d->depths->dirty = 1; */ - ED_view3d_depth_update(data->vc.region); + if (!(data->vc.v3d->runtime.flag & V3D_RUNTIME_DEPTHBUF_OVERRIDDEN)) { + ED_view3d_depth_override(data->depsgraph, + data->vc.region, + data->vc.v3d, + data->vc.obact, + V3D_DEPTH_OBJECT_ONLY, + true); } } } diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 1be20c21aba..0b30ca2771d 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -832,52 +832,6 @@ static void drawrenderborder(ARegion *region, View3D *v3d) immUnbindProgram(); } -void ED_view3d_draw_depth(Depsgraph *depsgraph, ARegion *region, View3D *v3d, bool alphaoverride) -{ - struct bThemeState theme_state; - Scene *scene = DEG_get_evaluated_scene(depsgraph); - RegionView3D *rv3d = region->regiondata; - - short flag = v3d->flag; - float glalphaclip = U.glalphaclip; - /* temp set drawtype to solid */ - /* Setting these temporarily is not nice */ - v3d->flag &= ~V3D_SELECT_OUTLINE; - - /* not that nice but means we wont zoom into billboards */ - U.glalphaclip = alphaoverride ? 0.5f : glalphaclip; - - /* Tools may request depth outside of regular drawing code. */ - UI_Theme_Store(&theme_state); - UI_SetTheme(SPACE_VIEW3D, RGN_TYPE_WINDOW); - - ED_view3d_draw_setup_view( - G_MAIN->wm.first, NULL, depsgraph, scene, region, v3d, NULL, NULL, NULL); - - /* get surface depth without bias */ - rv3d->rflag |= RV3D_ZOFFSET_DISABLED; - - /* Needed in cases the 3D Viewport isn't already setup. */ - WM_draw_region_viewport_ensure(region, SPACE_VIEW3D); - WM_draw_region_viewport_bind(region); - - GPUViewport *viewport = WM_draw_region_get_viewport(region); - /* When Blender is starting, a click event can trigger a depth test while the viewport is not - * yet available. */ - if (viewport != NULL) { - DRW_draw_depth_loop(depsgraph, region, v3d, viewport, false); - } - - WM_draw_region_viewport_unbind(region); - - rv3d->rflag &= ~RV3D_ZOFFSET_DISABLED; - - U.glalphaclip = glalphaclip; - v3d->flag = flag; - - UI_Theme_Restore(&theme_state); -} - /** \} */ /* -------------------------------------------------------------------- */ @@ -1634,7 +1588,8 @@ void view3d_main_region_draw(const bContext *C, ARegion *region) /* No depth test for drawing action zones afterwards. */ GPU_depth_test(GPU_DEPTH_NONE); - v3d->flag |= V3D_INVALID_BACKBUF; + v3d->runtime.flag &= ~V3D_RUNTIME_DEPTHBUF_OVERRIDDEN; + /* TODO: Clear cache? */ } /** \} */ @@ -2175,6 +2130,10 @@ static void validate_object_select_id(struct Depsgraph *depsgraph, View3D *v3d, Object *obact) { + /* TODO: Use a flag in the selection engine itself. */ + if (v3d->runtime.flag & V3D_RUNTIME_DEPTHBUF_OVERRIDDEN) { + return; + } Object *obact_eval = DEG_get_evaluated_object(depsgraph, obact); BLI_assert(region->regiontype == RGN_TYPE_WINDOW); @@ -2193,11 +2152,7 @@ static void validate_object_select_id(struct Depsgraph *depsgraph, /* do nothing */ } else { - v3d->flag &= ~V3D_INVALID_BACKBUF; - return; - } - - if (!(v3d->flag & V3D_INVALID_BACKBUF)) { + v3d->runtime.flag |= V3D_RUNTIME_DEPTHBUF_OVERRIDDEN; return; } @@ -2206,9 +2161,7 @@ static void validate_object_select_id(struct Depsgraph *depsgraph, DRW_select_buffer_context_create(&base, 1, -1); } - /* TODO: Create a flag in `DRW_manager` because the drawing is no longer - * made on the back-buffer in this case. */ - v3d->flag &= ~V3D_INVALID_BACKBUF; + v3d->runtime.flag |= V3D_RUNTIME_DEPTHBUF_OVERRIDDEN; } /* TODO: Creating, attaching texture, and destroying a framebuffer is quite slow. @@ -2235,26 +2188,7 @@ static void view3d_opengl_read_Z_pixels(GPUViewport *viewport, rcti *rect, void void ED_view3d_select_id_validate(ViewContext *vc) { - /* TODO: Create a flag in `DRW_manager` because the drawing is no longer - * made on the back-buffer in this case. */ - if (vc->v3d->flag & V3D_INVALID_BACKBUF) { - validate_object_select_id(vc->depsgraph, vc->view_layer, vc->region, vc->v3d, vc->obact); - } -} - -void ED_view3d_backbuf_depth_validate(ViewContext *vc) -{ - if (vc->v3d->flag & V3D_INVALID_BACKBUF) { - ARegion *region = vc->region; - Object *obact_eval = DEG_get_evaluated_object(vc->depsgraph, vc->obact); - - if (obact_eval && ((obact_eval->base_flag & BASE_VISIBLE_DEPSGRAPH) != 0)) { - GPUViewport *viewport = WM_draw_region_get_viewport(region); - DRW_draw_depth_object(vc->scene, vc->region, vc->v3d, viewport, obact_eval); - } - - vc->v3d->flag &= ~V3D_INVALID_BACKBUF; - } + validate_object_select_id(vc->depsgraph, vc->view_layer, vc->region, vc->v3d, vc->obact); } /** @@ -2326,7 +2260,7 @@ void view3d_update_depths_rect(ARegion *region, ViewDepths *d, rcti *rect) } /* Note, with nouveau drivers the glReadPixels() is very slow. T24339. */ -void ED_view3d_depth_update(ARegion *region) +static void view3d_depth_cache_update(ARegion *region) { RegionView3D *rv3d = region->regiondata; @@ -2348,13 +2282,9 @@ void ED_view3d_depth_update(ARegion *region) if (d->damaged) { GPUViewport *viewport = WM_draw_region_get_viewport(region); - rcti r = { - .xmin = 0, - .xmax = d->w, - .ymin = 0, - .ymax = d->h, - }; - view3d_opengl_read_Z_pixels(viewport, &r, d->depths); + DefaultFramebufferList *fbl = GPU_viewport_framebuffer_list_get(viewport); + GPU_framebuffer_read_depth(fbl->depth_only_fb, 0, 0, d->w, d->h, GPU_DATA_FLOAT, d->depths); + /* Assumed to be this as they are never changed. */ d->depth_range[0] = 0.0; d->depth_range[1] = 1.0; @@ -2387,19 +2317,81 @@ float view3d_depth_near(ViewDepths *d) return far == far_real ? FLT_MAX : far; } -void ED_view3d_draw_depth_gpencil(Depsgraph *depsgraph, Scene *scene, ARegion *region, View3D *v3d) +/** + * Redraw the viewport depth buffer. + * + * \param mode: V3D_DEPTH_NO_GPENCIL - Redraw viewport without Grease Pencil and Annotations. + * V3D_DEPTH_GPENCIL_ONLY - Redraw viewport with Grease Pencil and Annotations only. + * V3D_DEPTH_OBJECT_ONLY - Redraw viewport with active object only. + * \param update_cache: If true, store the entire depth buffer in #rv3d->depths. + */ +void ED_view3d_depth_override(Depsgraph *depsgraph, + ARegion *region, + View3D *v3d, + Object *obact, + eV3DDepthOverrideMode mode, + bool update_cache) { - /* Setup view matrix. */ - ED_view3d_draw_setup_view(NULL, NULL, depsgraph, scene, region, v3d, NULL, NULL, NULL); + if (v3d->runtime.flag & V3D_RUNTIME_DEPTHBUF_OVERRIDDEN) { + return; + } + struct bThemeState theme_state; + Scene *scene = DEG_get_evaluated_scene(depsgraph); + RegionView3D *rv3d = region->regiondata; + + short flag = v3d->flag; + /* temp set drawtype to solid */ + /* Setting these temporarily is not nice */ + v3d->flag &= ~V3D_SELECT_OUTLINE; + + /* Tools may request depth outside of regular drawing code. */ + UI_Theme_Store(&theme_state); + UI_SetTheme(SPACE_VIEW3D, RGN_TYPE_WINDOW); + + ED_view3d_draw_setup_view( + G_MAIN->wm.first, NULL, depsgraph, scene, region, v3d, NULL, NULL, NULL); - GPU_clear_depth(1.0f); + /* get surface depth without bias */ + rv3d->rflag |= RV3D_ZOFFSET_DISABLED; - GPU_depth_test(GPU_DEPTH_LESS_EQUAL); + /* Needed in cases the 3D Viewport isn't already setup. */ + WM_draw_region_viewport_ensure(region, SPACE_VIEW3D); + WM_draw_region_viewport_bind(region); GPUViewport *viewport = WM_draw_region_get_viewport(region); - DRW_draw_depth_loop_gpencil(depsgraph, region, v3d, viewport); + /* When Blender is starting, a click event can trigger a depth test while the viewport is not + * yet available. */ + if (viewport != NULL) { + switch (mode) { + case V3D_DEPTH_NO_GPENCIL: + DRW_draw_depth_loop(depsgraph, region, v3d, viewport); + break; + case V3D_DEPTH_GPENCIL_ONLY: + DRW_draw_depth_loop_gpencil(depsgraph, region, v3d, viewport); + break; + case V3D_DEPTH_OBJECT_ONLY: + DRW_draw_depth_object( + scene, region, v3d, viewport, DEG_get_evaluated_object(depsgraph, obact)); + break; + } - GPU_depth_test(GPU_DEPTH_NONE); + if (rv3d->depths != NULL) { + rv3d->depths->damaged = true; + /* TODO: Clear cache? */ + } + if (update_cache) { + view3d_depth_cache_update(region); + } + } + + WM_draw_region_viewport_unbind(region); + + rv3d->rflag &= ~RV3D_ZOFFSET_DISABLED; + + v3d->flag = flag; + v3d->runtime.flag |= V3D_RUNTIME_DEPTHBUF_OVERRIDDEN; + + UI_Theme_Restore(&theme_state); } /** \} */ diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index dc590833368..5f3d71cc190 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -3628,9 +3628,8 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op) ED_view3d_dist_range_get(v3d, dist_range); - /* Get Z Depths, needed for perspective, nice for ortho */ - ED_view3d_draw_depth(CTX_data_ensure_evaluated_depsgraph(C), region, v3d, true); - + ED_view3d_depth_override( + CTX_data_ensure_evaluated_depsgraph(C), region, v3d, NULL, V3D_DEPTH_NO_GPENCIL, false); { /* avoid allocating the whole depth buffer */ ViewDepths depth_temp = {0}; diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 118ec2425fc..e766ae96c2f 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -122,17 +122,7 @@ void VIEW3D_OT_walk(struct wmOperatorType *ot); void view3d_main_region_draw(const struct bContext *C, struct ARegion *region); void view3d_draw_region_info(const struct bContext *C, struct ARegion *region); -void ED_view3d_draw_depth(struct Depsgraph *depsgraph, - struct ARegion *region, - View3D *v3d, - bool alphaoverride); - /* view3d_draw_legacy.c */ -void ED_view3d_draw_depth_gpencil(struct Depsgraph *depsgraph, - Scene *scene, - struct ARegion *region, - View3D *v3d); - void ED_view3d_draw_select_loop(struct Depsgraph *depsgraph, ViewContext *vc, Scene *scene, diff --git a/source/blender/editors/space_view3d/view3d_utils.c b/source/blender/editors/space_view3d/view3d_utils.c index e3acda9bffb..3b4834045f8 100644 --- a/source/blender/editors/space_view3d/view3d_utils.c +++ b/source/blender/editors/space_view3d/view3d_utils.c @@ -1024,6 +1024,7 @@ static float view_autodist_depth_margin(ARegion *region, const int mval[2], int /** * Get the world-space 3d location from a screen-space 2d point. + * TODO: Implement #alphaoverride. We don't want to zoom into billboards. * * \param mval: Input screen-space pixel location. * \param mouse_worldloc: Output world-space location. @@ -1034,7 +1035,7 @@ bool ED_view3d_autodist(Depsgraph *depsgraph, View3D *v3d, const int mval[2], float mouse_worldloc[3], - const bool alphaoverride, + const bool UNUSED(alphaoverride), const float fallback_depth_pt[3]) { float depth_close; @@ -1042,7 +1043,7 @@ bool ED_view3d_autodist(Depsgraph *depsgraph, bool depth_ok = false; /* Get Z Depths, needed for perspective, nice for ortho */ - ED_view3d_draw_depth(depsgraph, region, v3d, alphaoverride); + ED_view3d_depth_override(depsgraph, region, v3d, NULL, V3D_DEPTH_NO_GPENCIL, false); /* Attempt with low margin's first */ int i = 0; @@ -1067,22 +1068,7 @@ bool ED_view3d_autodist(Depsgraph *depsgraph, return false; } -void ED_view3d_autodist_init(Depsgraph *depsgraph, ARegion *region, View3D *v3d, int mode) -{ - /* Get Z Depths, needed for perspective, nice for ortho */ - switch (mode) { - case 0: - ED_view3d_draw_depth(depsgraph, region, v3d, true); - break; - case 1: { - Scene *scene = DEG_get_evaluated_scene(depsgraph); - ED_view3d_draw_depth_gpencil(depsgraph, scene, region, v3d); - break; - } - } -} - -/* no 4x4 sampling, run #ED_view3d_autodist_init first */ +/* no 4x4 sampling, run #ED_view3d_depth_override first */ bool ED_view3d_autodist_simple(ARegion *region, const int mval[2], float mouse_worldloc[3], |