Fix T86762: Inconsistent show of result of modifier Screw in edit mode

To check if an "is_mesh_verts_only" mesh, the overlay engine checks if the
mesh has no "totedge" and has "totvert".

However, sometimes this engine can check the wrong mesh since editmesh
works on `embm->mesh_eval_final`.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D10917
This commit is contained in:
Germano Cavalcante 2021-04-08 13:04:18 -03:00 committed by Germano Cavalcante
parent 08ae545de4
commit 3d6798962c
Notes: blender-bot 2023-02-14 11:00:17 +01:00
Referenced by issue #86762, Inconsistent show of result of modifier Screw in edit mode
1 changed files with 16 additions and 13 deletions

View File

@ -177,8 +177,22 @@ void OVERLAY_wireframe_cache_populate(OVERLAY_Data *vedata,
const bool all_wires = (ob->dtx & OB_DRAW_ALL_EDGES) != 0;
const bool is_xray = (ob->dtx & OB_DRAW_IN_FRONT) != 0;
const bool is_mesh = ob->type == OB_MESH;
const bool is_mesh_verts_only = is_mesh && (((Mesh *)ob->data)->totedge == 0 &&
((Mesh *)ob->data)->totvert > 0);
const bool is_edit_mode = DRW_object_is_in_edit_mode(ob);
bool has_edit_mesh_cage = false;
bool is_mesh_verts_only = false;
if (is_mesh && is_edit_mode) {
/* TODO: Should be its own function. */
Mesh *me = ob->data;
BMEditMesh *embm = me->edit_mesh;
if (embm) {
has_edit_mesh_cage = embm->mesh_eval_cage && (embm->mesh_eval_cage != embm->mesh_eval_final);
if (embm->mesh_eval_final) {
me = embm->mesh_eval_final;
}
}
is_mesh_verts_only = me->totedge == 0 && me->totvert > 0;
}
const bool use_wire = !is_mesh_verts_only && ((pd->overlay.flag & V3D_OVERLAY_WIREFRAMES) ||
(ob->dtx & OB_DRAWWIRE) || (ob->dt == OB_WIRE));
@ -261,17 +275,6 @@ void OVERLAY_wireframe_cache_populate(OVERLAY_Data *vedata,
}
}
const bool is_edit_mode = DRW_object_is_in_edit_mode(ob);
bool has_edit_mesh_cage = false;
if (is_mesh && is_edit_mode) {
/* TODO: Should be its own function. */
Mesh *me = (Mesh *)ob->data;
BMEditMesh *embm = me->edit_mesh;
if (embm) {
has_edit_mesh_cage = embm->mesh_eval_cage && (embm->mesh_eval_cage != embm->mesh_eval_final);
}
}
/* Don't do that in edit Mesh mode, unless there is a modifier preview. */
if (use_wire && (!is_mesh || (!is_edit_mode || has_edit_mesh_cage))) {
const bool is_sculpt_mode = ((ob->mode & OB_MODE_SCULPT) != 0) && (ob->sculpt != NULL);