Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Soluyanov <crantisz>2020-03-23 18:00:42 +0300
committerJulian Eisel <julian@blender.org>2020-03-23 18:35:29 +0300
commitc95b522856c590e31278548ec02bbac1a64e217d (patch)
tree451ee4f970def4c34ca8cab6b4eb7081865491af /source/blender/gpu
parent88a86c025c0fb29b27b6caf7bd3873114e6e7c45 (diff)
UI: Theme options for checkerboard pattern colors and size
This patch adds ability to set up colors and size of background (transparency) checkerboard pattern in viewport and 2d editors. No new backgrounds, only changing colors in existing ones. This is not the background of the viewport, it is a transparency checkerboard that is turned on only in render mode, when the transparency mode is on. And also in 2D-editors, (image, sequencer, etc). Reviewed By: Pablo Vazquez, Julian Eisel Differential Revision: https://developer.blender.org/D6791
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/intern/gpu_immediate_util.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/source/blender/gpu/intern/gpu_immediate_util.c b/source/blender/gpu/intern/gpu_immediate_util.c
index 28544d50ba1..7266f595447 100644
--- a/source/blender/gpu/intern/gpu_immediate_util.c
+++ b/source/blender/gpu/intern/gpu_immediate_util.c
@@ -29,6 +29,8 @@
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
+#include "UI_resources.h"
+
static const float cube_coords[8][3] = {
{-1, -1, -1},
{-1, -1, +1},
@@ -362,11 +364,17 @@ void imm_draw_box_wire_3d(uint pos, float x1, float y1, float x2, float y2)
void imm_draw_box_checker_2d(float x1, float y1, float x2, float y2)
{
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
+ float checker_primary[4];
+ float checker_secondary[4];
+ int checker_size = UI_GetThemeValue(TH_TRANSPARENT_CHECKER_SIZE);
+
immBindBuiltinProgram(GPU_SHADER_2D_CHECKER);
+ UI_GetThemeColor4fv(TH_TRANSPARENT_CHECKER_PRIMARY, checker_primary);
+ UI_GetThemeColor4fv(TH_TRANSPARENT_CHECKER_SECONDARY, checker_secondary);
- immUniform4f("color1", 0.15f, 0.15f, 0.15f, 1.0f);
- immUniform4f("color2", 0.2f, 0.2f, 0.2f, 1.0f);
- immUniform1i("size", 8);
+ immUniform4fv("color1", checker_primary);
+ immUniform4fv("color2", checker_secondary);
+ immUniform1i("size", checker_size);
immRectf(pos, x1, y1, x2, y2);