Fix wireframe overlay not blending over paint overlay correctly

When using wireframe opacity, the paint overlay needs to be drawn
before the wireframes in order to alpha blend correctly.
Sculpt overlays were also affected by this, so this commit refactors
this part of the code in case other overlays needs to be added in
the future.

Reviewed By: Mets

Differential Revision: https://developer.blender.org/D12235
This commit is contained in:
Pablo Dobarro 2021-08-17 00:37:46 +02:00
parent 809dce5bde
commit 24c16f5457
Notes: blender-bot 2023-02-13 17:58:02 +01:00
Referenced by issue #90535, USDPreviewSurface materials in Animal Logic's ALab are missing textures
1 changed files with 14 additions and 14 deletions

View File

@ -576,9 +576,20 @@ static void OVERLAY_draw_scene(void *vedata)
OVERLAY_extra_blend_draw(vedata);
OVERLAY_volume_draw(vedata);
if (pd->ctx_mode == CTX_MODE_SCULPT) {
/* Sculpt overlays are drawn here to avoid artifacts with wireframe opacity. */
OVERLAY_sculpt_draw(vedata);
/* These overlays are drawn here to avoid artifacts with wireframe opacity. */
switch (pd->ctx_mode) {
case CTX_MODE_SCULPT:
OVERLAY_sculpt_draw(vedata);
break;
case CTX_MODE_EDIT_MESH:
case CTX_MODE_POSE:
case CTX_MODE_PAINT_WEIGHT:
case CTX_MODE_PAINT_VERTEX:
case CTX_MODE_PAINT_TEXTURE:
OVERLAY_paint_draw(vedata);
break;
default:
break;
}
if (DRW_state_is_fbo()) {
@ -601,11 +612,6 @@ static void OVERLAY_draw_scene(void *vedata)
OVERLAY_xray_depth_infront_copy(vedata);
if (pd->ctx_mode == CTX_MODE_PAINT_WEIGHT) {
/* Fix weird case where weightpaint mode needs to draw before xray bones. */
OVERLAY_paint_draw(vedata);
}
if (DRW_state_is_fbo()) {
GPU_framebuffer_bind(fbl->overlay_in_front_fb);
}
@ -640,7 +646,6 @@ static void OVERLAY_draw_scene(void *vedata)
switch (pd->ctx_mode) {
case CTX_MODE_EDIT_MESH:
OVERLAY_paint_draw(vedata);
OVERLAY_edit_mesh_draw(vedata);
break;
case CTX_MODE_EDIT_SURFACE:
@ -654,13 +659,8 @@ static void OVERLAY_draw_scene(void *vedata)
OVERLAY_edit_lattice_draw(vedata);
break;
case CTX_MODE_POSE:
OVERLAY_paint_draw(vedata);
OVERLAY_pose_draw(vedata);
break;
case CTX_MODE_PAINT_VERTEX:
case CTX_MODE_PAINT_TEXTURE:
OVERLAY_paint_draw(vedata);
break;
case CTX_MODE_PARTICLE:
OVERLAY_edit_particle_draw(vedata);
break;