Fix #131363: Curves ignore Surface Object Setting
Depth only drawing was not always enabling the overlay engine (now responsible for depth prepass). And the depth prepass was not populated if overlays were turned off.
This commit is contained in:
@@ -126,7 +126,6 @@ void DRW_draw_depth_loop(Depsgraph *depsgraph,
|
||||
View3D *v3d,
|
||||
GPUViewport *viewport,
|
||||
const bool use_gpencil,
|
||||
const bool use_overlay,
|
||||
const bool use_only_selected);
|
||||
/**
|
||||
* Clears the Depth Buffer and draws only the specified object.
|
||||
|
||||
@@ -689,8 +689,8 @@ bool Instance::object_is_in_front(const Object *object, const State &state)
|
||||
|
||||
bool Instance::object_needs_prepass(const ObjectRef &ob_ref, bool in_paint_mode)
|
||||
{
|
||||
if (selection_type_ != SelectionType::DISABLED) {
|
||||
/* Selection always need a prepass.
|
||||
if (selection_type_ != SelectionType::DISABLED || state.is_depth_only_drawing) {
|
||||
/* Selection and depth picking always need a prepass.
|
||||
* Note that depth writing and depth test might be disable for certain selection mode. */
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2618,7 +2618,6 @@ void DRW_draw_depth_loop(Depsgraph *depsgraph,
|
||||
View3D *v3d,
|
||||
GPUViewport *viewport,
|
||||
const bool use_gpencil,
|
||||
const bool use_overlay,
|
||||
const bool use_only_selected)
|
||||
{
|
||||
using namespace blender::draw;
|
||||
@@ -2650,9 +2649,7 @@ void DRW_draw_depth_loop(Depsgraph *depsgraph,
|
||||
if (use_gpencil) {
|
||||
use_drw_engine(&draw_engine_gpencil_type);
|
||||
}
|
||||
if (use_overlay) {
|
||||
drw_engines_enable_overlays();
|
||||
}
|
||||
drw_engines_enable_overlays();
|
||||
|
||||
drw_task_graph_init();
|
||||
|
||||
|
||||
@@ -2392,7 +2392,7 @@ void ED_view3d_depth_override(Depsgraph *depsgraph,
|
||||
RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
|
||||
|
||||
short flag = v3d->flag;
|
||||
/* temp set drawtype to solid */
|
||||
int flag2 = v3d->flag2;
|
||||
/* Setting these temporarily is not nice */
|
||||
v3d->flag &= ~V3D_SELECT_OUTLINE;
|
||||
|
||||
@@ -2400,6 +2400,10 @@ void ED_view3d_depth_override(Depsgraph *depsgraph,
|
||||
use_overlay = false;
|
||||
}
|
||||
|
||||
if (use_overlay) {
|
||||
v3d->flag2 &= ~V3D_HIDE_OVERLAYS;
|
||||
}
|
||||
|
||||
/* Tools may request depth outside of regular drawing code. */
|
||||
UI_Theme_Store(&theme_state);
|
||||
UI_SetTheme(SPACE_VIEW3D, RGN_TYPE_WINDOW);
|
||||
@@ -2427,20 +2431,20 @@ void ED_view3d_depth_override(Depsgraph *depsgraph,
|
||||
if (viewport != nullptr) {
|
||||
switch (mode) {
|
||||
case V3D_DEPTH_ALL:
|
||||
DRW_draw_depth_loop(depsgraph, region, v3d, viewport, true, use_overlay, false);
|
||||
DRW_draw_depth_loop(depsgraph, region, v3d, viewport, true, false);
|
||||
break;
|
||||
case V3D_DEPTH_NO_GPENCIL:
|
||||
DRW_draw_depth_loop(depsgraph, region, v3d, viewport, true, use_overlay, false);
|
||||
DRW_draw_depth_loop(depsgraph, region, v3d, viewport, true, false);
|
||||
break;
|
||||
case V3D_DEPTH_GPENCIL_ONLY:
|
||||
DRW_draw_depth_loop(depsgraph, region, v3d, viewport, false, use_overlay, false);
|
||||
DRW_draw_depth_loop(depsgraph, region, v3d, viewport, false, false);
|
||||
break;
|
||||
case V3D_DEPTH_OBJECT_ONLY:
|
||||
DRW_draw_depth_object(
|
||||
scene, region, v3d, viewport, DEG_get_evaluated_object(depsgraph, obact));
|
||||
break;
|
||||
case V3D_DEPTH_SELECTED_ONLY:
|
||||
DRW_draw_depth_loop(depsgraph, region, v3d, viewport, true, use_overlay, true);
|
||||
DRW_draw_depth_loop(depsgraph, region, v3d, viewport, true, true);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2456,7 +2460,9 @@ void ED_view3d_depth_override(Depsgraph *depsgraph,
|
||||
|
||||
rv3d->rflag &= ~RV3D_ZOFFSET_DISABLED;
|
||||
|
||||
/* Restore. */
|
||||
v3d->flag = flag;
|
||||
v3d->flag2 = flag2;
|
||||
v3d->runtime.flag |= V3D_RUNTIME_DEPTHBUF_OVERRIDDEN;
|
||||
|
||||
UI_Theme_Restore(&theme_state);
|
||||
|
||||
Reference in New Issue
Block a user