View3D: Allow 3D cursor to snap to grease pencil geometry

The `Surface Project` option for setting the 3d cursor location ignored
grease pencil geometry. Since grease pencil is now it's own object, separate
from annotations, it makes more sense to now consider grease pencil objects.

This changes the `V3D_DEPTH_NO_OVERLAYS` to also render grease pencil.
If grease pencil shouldn't be considered, the `V3D_DEPTH_NO_GPENCIL`
flag should be used instead.

Note that annotations are independent of the `eV3DDepthOverrideMode`.
It seems like they are always rendered according to
`drw_draw_show_annotation()`.
The description for the options in `eV3DDepthOverrideMode` is
updated to reflect that.

Resolves #122700.

Pull Request: https://projects.blender.org/blender/blender/pulls/122705
This commit is contained in:
Falk David
2024-08-23 10:52:19 +02:00
committed by Falk David
parent a21a1a7b86
commit f1972deba1
3 changed files with 4 additions and 4 deletions

View File

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

View File

@@ -2414,7 +2414,7 @@ void ED_view3d_depth_override(Depsgraph *depsgraph,
if (viewport != nullptr) {
switch (mode) {
case V3D_DEPTH_NO_OVERLAYS:
DRW_draw_depth_loop(depsgraph, region, v3d, viewport, false, true, false, false);
DRW_draw_depth_loop(depsgraph, region, v3d, viewport, true, true, false, false);
break;
case V3D_DEPTH_NO_GPENCIL:
DRW_draw_depth_loop(depsgraph,

View File

@@ -854,7 +854,7 @@ void ED_view3d_cursor3d_position(bContext *C,
view3d_operator_needs_opengl(C);
/* Ensure the depth buffer is updated for #ED_view3d_autodist. */
ED_view3d_depth_override(depsgraph, region, v3d, nullptr, V3D_DEPTH_NO_GPENCIL, nullptr);
ED_view3d_depth_override(depsgraph, region, v3d, nullptr, V3D_DEPTH_NO_OVERLAYS, nullptr);
if (ED_view3d_autodist(region, v3d, mval, r_cursor_co, nullptr)) {
depth_used = true;