Fix #136335: Overlay: Always respect backface culling mode in selection

This reintroduce the same behavior as 4.3 with regard to
selection and depth drawing.

This patch also disables facing overlay during depth
drawing to avoid it conflicting with tge auto-depth
feature.

Also fix #136418

Pull Request: https://projects.blender.org/blender/blender/pulls/136427
This commit is contained in:
Clément Foucault
2025-03-24 16:38:09 +01:00
committed by Clément Foucault
parent cba18b006a
commit 4fb3edd488
2 changed files with 8 additions and 1 deletions

View File

@@ -29,7 +29,7 @@ class Facing : Overlay {
void begin_sync(Resources &res, const State &state) final
{
enabled_ = state.v3d && state.show_face_orientation() && !state.xray_enabled &&
!res.is_selection();
!res.is_selection() && !state.is_depth_only_drawing;
if (!enabled_) {
/* Not used. But release the data. */
ps_.init();

View File

@@ -392,6 +392,13 @@ void Resources::update_theme_settings(const DRWContext *ctx, const State &state)
const View3DShading &shading = state.v3d->shading;
gb->backface_culling = (shading.type == OB_SOLID) &&
(shading.flag & V3D_SHADING_BACKFACE_CULLING);
if (is_selection() || state.is_depth_only_drawing) {
/* This is bad as this makes a solid mode setting affect material preview / render mode
* selection and auto-depth. But users are relying on this to work in scene using backface
* culling in shading (see #136335 and #136418). */
gb->backface_culling = (shading.flag & V3D_SHADING_BACKFACE_CULLING);
}
}
else {
gb->backface_culling = false;