Fix #133638: Overlay Next: Some overlays not displayed in X-Ray mode

Ensure overlay object modes/x-ray/wireframe combinations match 4.3
behavior.

Pull Request: https://projects.blender.org/blender/blender/pulls/134069
This commit is contained in:
Miguel Pozo
2025-02-07 18:12:25 +01:00
parent 5884c61b4c
commit f64641ad30
4 changed files with 10 additions and 8 deletions

View File

@@ -183,7 +183,7 @@ void Instance::object_sync(ObjectRef &ob_ref, Manager &manager)
const bool in_particle_edit_mode = object_is_particle_edit_mode(ob_ref);
const bool in_edit_paint_mode = object_is_edit_paint_mode(
ob_ref, in_edit_mode, in_paint_mode, in_sculpt_mode);
const bool needs_prepass = object_needs_prepass(ob_ref, in_paint_mode);
const bool needs_prepass = object_needs_prepass(ob_ref, in_paint_mode || in_sculpt_mode);
OverlayLayer &layer = object_is_in_front(ob_ref.object, state) ? infront : regular;
@@ -715,7 +715,7 @@ 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)
bool Instance::object_needs_prepass(const ObjectRef &ob_ref, bool in_paint_or_sculpt_mode)
{
if (resources.is_selection() && state.is_wireframe_mode && !state.is_solid()) {
/* Selection in wireframe mode only use wires unless xray opacity is 1. */
@@ -728,7 +728,7 @@ bool Instance::object_needs_prepass(const ObjectRef &ob_ref, bool in_paint_mode)
return true;
}
if (in_paint_mode) {
if (in_paint_or_sculpt_mode && state.is_solid() && ob_ref.object->dt >= OB_SOLID) {
/* Allow paint overlays to draw with depth equal test. */
return object_is_rendered_transparent(ob_ref.object, state);
}
@@ -747,7 +747,7 @@ bool Instance::object_is_rendered_transparent(const Object *object, const State
return false;
}
if (state.xray_enabled) {
if (!state.is_solid()) {
return true;
}

View File

@@ -94,8 +94,10 @@ class Paints : Overlay {
/* Support masked transparency in Workbench.
* EEVEE can't be supported since depth won't match. */
const eDrawType shading_type = eDrawType(state.v3d->shading.type);
const bool masked_transparency_support = (shading_type <= OB_SOLID) ||
BKE_scene_uses_blender_workbench(state.scene);
const bool masked_transparency_support = ((shading_type == OB_SOLID) ||
(shading_type >= OB_SOLID &&
BKE_scene_uses_blender_workbench(state.scene))) &&
!state.xray_enabled;
const bool shadeless = shading_type == OB_WIRE;
const bool draw_contours = state.overlay.wpaint_flag & V3D_OVERLAY_WPAINT_CONTOURS;

View File

@@ -72,7 +72,7 @@ class Prepass : Overlay {
public:
void begin_sync(Resources &res, const State &state) final
{
enabled_ = state.is_space_v3d() && (!state.xray_enabled || res.is_selection());
enabled_ = state.is_space_v3d();
if (!enabled_) {
/* Not used. But release the data. */

View File

@@ -50,7 +50,7 @@ class Sculpts : Overlay {
show_face_set_ = state.show_sculpt_face_sets();
show_mask_ = state.show_sculpt_mask();
enabled_ = state.is_space_v3d() && !state.xray_enabled && !res.is_selection() &&
enabled_ = state.is_space_v3d() && !state.is_wire() && !res.is_selection() &&
!state.is_depth_only_drawing &&
ELEM(state.object_mode, OB_MODE_SCULPT_CURVES, OB_MODE_SCULPT) &&
(show_curves_cage_ || show_face_set_ || show_mask_);