Fix T62774: Respect Show Overlays

Some draw code did not respect Show Overlays option. These were:

 * All mode based drawing engines (edit mode)
 * Wireframe drawing

This change make them respect the Show Overlays Option.

Reviewed By: fclem, billreynish

Maniphest Tasks: T62774

Differential Revision: https://developer.blender.org/D4572
This commit is contained in:
Jeroen Bakker 2019-03-26 07:58:14 +01:00
parent 2bbfaa1c94
commit 30fbf905ef
Notes: blender-bot 2023-02-14 03:17:59 +01:00
Referenced by issue #62774, Some Overlay sections do not respect Overlay On/Off toggle
2 changed files with 3 additions and 7 deletions

View File

@ -1331,8 +1331,6 @@ static void drw_engines_enable(ViewLayer *view_layer, RenderEngineType *engine_t
if (v3d->shading.type == OB_WIRE) {
drw_engines_enable_from_overlays(v3d->overlay.flag);
}
drw_engines_enable_from_mode(mode);
}
}

View File

@ -177,7 +177,6 @@ static void overlay_cache_init(void *vedata)
if (v3d->shading.type == OB_WIRE) {
g_data->overlay.flag |= V3D_OVERLAY_WIREFRAMES;
g_data->show_overlays = true;
if (ELEM(v3d->shading.wire_color_type,
V3D_SHADING_OBJECT_COLOR,
@ -328,8 +327,7 @@ static void overlay_cache_populate(void *vedata, Object *ob)
const DRWContextState *draw_ctx = DRW_context_state_get();
View3D *v3d = draw_ctx->v3d;
if ((!pd->show_overlays) ||
(ob->dt < OB_WIRE) ||
if ((ob->dt < OB_WIRE) ||
(!DRW_object_is_renderable(ob) && (ob->dt != OB_WIRE)))
{
return;
@ -359,14 +357,14 @@ static void overlay_cache_populate(void *vedata, Object *ob)
}
/* Don't do that in edit Mesh mode, unless there is a modifier preview. */
if ((((ob != draw_ctx->object_edit) && !is_edit_mode) || has_edit_mesh_cage) ||
if ((!pd->show_overlays) || (((ob != draw_ctx->object_edit) && !is_edit_mode) || has_edit_mesh_cage) ||
ob->type != OB_MESH)
{
const bool is_active = (ob == draw_ctx->obact);
const bool is_sculpt_mode = is_active && (draw_ctx->object_mode & OB_MODE_SCULPT) != 0;
const bool all_wires = (ob->dtx & OB_DRAW_ALL_EDGES);
const bool is_wire = (ob->dt < OB_SOLID);
const bool use_coloring = (!is_edit_mode && !is_sculpt_mode && !has_edit_mesh_cage);
const bool use_coloring = (pd->show_overlays && !is_edit_mode && !is_sculpt_mode && !has_edit_mesh_cage);
const int stencil_mask = (ob->dtx & OB_DRAWXRAY) ? 0x00 : 0xFF;
float *rim_col, *wire_col;
DRWShadingGroup *shgrp = NULL;