Fix #120778: Depth navigation no longer works for non-geometry objects

Regression in [0] that changed behavior of depth drawing to exclude
overlays which are needed so users can box-zoom to an armature or camera
for example. Add `V3D_DEPTH_NO_OVERLAY` when no overlays are desired.

[0]: 5fea1eda36179943deb06ab7d1c1896d80a28f4c
This commit is contained in:
Campbell Barton 2024-05-02 22:34:45 +10:00
parent f15646df59
commit 1b788f3a84
3 changed files with 9 additions and 3 deletions

@ -130,7 +130,7 @@ bool DrawingPlacement::use_project_to_nearest_stroke() const
void DrawingPlacement::cache_viewport_depths(Depsgraph *depsgraph, ARegion *region, View3D *view3d)
{
const eV3DDepthOverrideMode mode = (depth_ == DrawingPlacementDepth::Surface) ?
V3D_DEPTH_NO_GPENCIL :
V3D_DEPTH_NO_OVERLAYS :
V3D_DEPTH_GPENCIL_ONLY;
ED_view3d_depth_override(depsgraph, region, view3d, nullptr, mode, &this->depth_cache_);
}

@ -178,8 +178,10 @@ void ED_view3d_lastview_store(RegionView3D *rv3d);
/* Depth buffer */
enum eV3DDepthOverrideMode {
/** Redraw viewport without overlays. */
V3D_DEPTH_NO_OVERLAYS = 0,
/** Redraw viewport without Grease Pencil and Annotations. */
V3D_DEPTH_NO_GPENCIL = 0,
V3D_DEPTH_NO_GPENCIL,
/** Redraw viewport with Grease Pencil and Annotations only. */
V3D_DEPTH_GPENCIL_ONLY,
/** Redraw viewport with active object only. */

@ -2410,9 +2410,13 @@ void ED_view3d_depth_override(Depsgraph *depsgraph,
* yet available. */
if (viewport != nullptr) {
switch (mode) {
case V3D_DEPTH_NO_GPENCIL:
case V3D_DEPTH_NO_OVERLAYS:
DRW_draw_depth_loop(depsgraph, region, v3d, viewport, false, true, false);
break;
case V3D_DEPTH_NO_GPENCIL:
DRW_draw_depth_loop(
depsgraph, region, v3d, viewport, false, true, (v3d->flag2 & V3D_HIDE_OVERLAYS) == 0);
break;
case V3D_DEPTH_GPENCIL_ONLY:
DRW_draw_depth_loop(depsgraph, region, v3d, viewport, true, false, false);
break;