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:
authorRed Mser <RedMser>2020-09-16 02:42:38 +0300
committerHans Goudey <h.goudey@me.com>2020-09-16 02:42:38 +0300
commit675807e2b6b29558367d49ab7f9f30e90c975fcb (patch)
treeb06dd846a129ff2493d44b888e8786d5da2b47fc /source/blender/editors/interface/view2d.c
parent1858535a105c306282d95d1894f4f8dc088d17e4 (diff)
UI: Add grid-related theme options
This commit makes grid theming more consistent and capable by adding some new theme colors related to grid rendering. - Add grid theme color for node editor. `UI_view2d_multi_grid_draw` is called with TH_GRID instead of a shaded `TH_BACK`. Also color-blend `TH_NODE_GROUP`. - Make the movie clip editor's clip preview grid respect grid theme color (`ED_region_grid_draw` uses color-blended `TH_GRID`). - Add versioning code to allow fixing existing themes (the resulting themes should visually look the same as before) These changes did cause some inconsistencies in the movie clip editor, even after adjusting the themes accordingly: 1. The alpha slider of the grid color affects the background and not the grid lines themselves. 2. The grids used by graph and dopesheet mode could already be themed in the past. Now that the clip preview's grid can also be themed, two different modes share the same theme color. Differential Revision: https://developer.blender.org/D8699
Diffstat (limited to 'source/blender/editors/interface/view2d.c')
-rw-r--r--source/blender/editors/interface/view2d.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index 7651989c2df..9057ccaa762 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -1341,7 +1341,9 @@ void UI_view2d_multi_grid_draw(
immBeginAtMost(GPU_PRIM_LINES, vertex_count);
for (int level = 0; level < totlevels; level++) {
- UI_GetThemeColorShade3ubv(colorid, offset, grid_line_color);
+ /* Blend the background color (colorid) with the grid color, to avoid either too low contrast
+ * or high contrast grid lines. This only has an effect if colorid != TH_GRID. */
+ UI_GetThemeColorBlendShade3ubv(colorid, TH_GRID, 0.25f, offset, grid_line_color);
int i = (int)(v2d->cur.xmin / lstep);
if (v2d->cur.xmin > 0.0f) {
@@ -1382,7 +1384,8 @@ void UI_view2d_multi_grid_draw(
}
/* X and Y axis */
- UI_GetThemeColorShade3ubv(colorid, -18 + ((totlevels - 1) * -6), grid_line_color);
+ UI_GetThemeColorBlendShade3ubv(
+ colorid, TH_GRID, 0.5f, -18 + ((totlevels - 1) * -6), grid_line_color);
immAttrSkip(color);
immVertex2f(pos, 0.0f, v2d->cur.ymin);