From c279d894db7021e777cbb44928d973d02dfcaba2 Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Fri, 3 Oct 2025 10:19:19 +0200 Subject: [PATCH] Fix #141013: VSE: Show pure emissive colors in preview VSE doesn support pure emissive colors when rendering, but weren't showed inside the preview. This was a limitation when the background checkerbord is draw. It renders the alpha of the overlay to 1.0 making the background be drawn on top of the image, hiding the pure emissive colors. This PR fixes this by clearing the alpha. This will render the checkerboard below the image. Another solution would be to set the alpha to zero in the theme, but that adds confusion as theme colors will still be able to alter the support of pure emissive colors. Pull Request: https://projects.blender.org/blender/blender/pulls/146562 --- .../blender/editors/space_sequencer/sequencer_preview_draw.cc | 2 +- source/blender/gpu/GPU_immediate_util.hh | 2 +- source/blender/gpu/intern/gpu_immediate_util.cc | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/source/blender/editors/space_sequencer/sequencer_preview_draw.cc b/source/blender/editors/space_sequencer/sequencer_preview_draw.cc index 0fde6e51e37..d52100d4fbc 100644 --- a/source/blender/editors/space_sequencer/sequencer_preview_draw.cc +++ b/source/blender/editors/space_sequencer/sequencer_preview_draw.cc @@ -1673,7 +1673,7 @@ static void sequencer_preview_draw_overlays(const bContext *C, else if (space_sequencer.flag & SEQ_USE_ALPHA) { /* Draw checked-board. */ const View2D &v2d = region.v2d; - imm_draw_box_checker_2d(v2d.tot.xmin, v2d.tot.ymin, v2d.tot.xmax, v2d.tot.ymax); + imm_draw_box_checker_2d(v2d.tot.xmin, v2d.tot.ymin, v2d.tot.xmax, v2d.tot.ymax, true); /* Draw current and preview textures in a special way to pierce a hole in the overlay to make * the actual image visible. */ diff --git a/source/blender/gpu/GPU_immediate_util.hh b/source/blender/gpu/GPU_immediate_util.hh index bb77912f296..8e4e2404692 100644 --- a/source/blender/gpu/GPU_immediate_util.hh +++ b/source/blender/gpu/GPU_immediate_util.hh @@ -145,7 +145,7 @@ void imm_draw_box_checker_2d_ex(float x1, const float color_primary[4], const float color_secondary[4], int checker_size); -void imm_draw_box_checker_2d(float x1, float y1, float x2, float y2); +void imm_draw_box_checker_2d(float x1, float y1, float x2, float y2, bool clear_alpha = false); void imm_draw_cube_fill_3d(uint pos, const float center[3], const float aspect[3]); void imm_draw_cube_wire_3d(uint pos, const float center[3], const float aspect[3]); diff --git a/source/blender/gpu/intern/gpu_immediate_util.cc b/source/blender/gpu/intern/gpu_immediate_util.cc index 5dde20c8216..0e774753b96 100644 --- a/source/blender/gpu/intern/gpu_immediate_util.cc +++ b/source/blender/gpu/intern/gpu_immediate_util.cc @@ -484,12 +484,14 @@ void imm_draw_box_checker_2d_ex(float x1, immUnbindProgram(); } -void imm_draw_box_checker_2d(float x1, float y1, float x2, float y2) +void imm_draw_box_checker_2d(float x1, float y1, float x2, float y2, bool clear_alpha) { float checker_primary[4]; float checker_secondary[4]; UI_GetThemeColor4fv(TH_TRANSPARENT_CHECKER_PRIMARY, checker_primary); UI_GetThemeColor4fv(TH_TRANSPARENT_CHECKER_SECONDARY, checker_secondary); + checker_primary[3] = clear_alpha ? 0.0 : checker_primary[3]; + checker_secondary[3] = clear_alpha ? 0.0 : checker_secondary[3]; int checker_size = UI_GetThemeValue(TH_TRANSPARENT_CHECKER_SIZE) * U.pixelsize; imm_draw_box_checker_2d_ex(x1, y1, x2, y2, checker_primary, checker_secondary, checker_size); }