Fix #78484: Overlay: No Wireframes in Edit Mode when Overlays are off

Added a mode check bypass for this particular case.
Added comments to explain reasoning.
This commit is contained in:
Clément Foucault
2025-02-10 11:27:59 +01:00
parent 44d5d1b0f3
commit 5ccc02bbf4

View File

@@ -161,7 +161,11 @@ class Wireframe : Overlay {
break;
}
case OB_MESH: {
bool has_edit_cage = Meshes::mesh_has_edit_cage(ob_ref.object);
/* Force display in edit mode when overlay is off in wireframe mode (see #78484). */
const bool wireframe_no_overlay = state.hide_overlays && state.is_wireframe_mode;
/* Display only if there is an edit cage. Otherwise we get Z fighting with edit wires. */
const bool has_edit_cage = Meshes::mesh_has_edit_cage(ob_ref.object);
const bool bypass_mode_check = wireframe_no_overlay || has_edit_cage;
if (show_surface_wire) {
if (BKE_sculptsession_use_pbvh_draw(ob_ref.object, state.rv3d)) {
@@ -171,7 +175,7 @@ class Wireframe : Overlay {
coloring.mesh_all_edges_ps_->draw(batch.batch, handle);
}
}
else if (!in_edit_mode || has_edit_cage) {
else if (!in_edit_mode || bypass_mode_check) {
/* Only draw the wireframe in edit mode if object has edit cage.
* Otherwise the wireframe will conflict with the edit cage drawing and produce
* unpleasant aliasing. */
@@ -182,7 +186,7 @@ class Wireframe : Overlay {
}
/* Draw loose geometry. */
if (!in_edit_paint_mode || has_edit_cage) {
if (!in_edit_paint_mode || bypass_mode_check) {
const Mesh *mesh = static_cast<const Mesh *>(ob_ref.object->data);
gpu::Batch *geom;
if ((mesh->edges_num == 0) && (mesh->verts_num > 0)) {