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:
authorDalai Felinto <dalai@blender.org>2021-10-08 12:43:52 +0300
committerDalai Felinto <dalai@blender.org>2021-10-08 16:36:18 +0300
commitebe23745281e8675a6b45c39f79441a4f896963e (patch)
treec2f9c72037f4bbadbd955b1dd403ea5a75f926f7
parent601a6a7dc66616e971169c157e67b70684e6ccfe (diff)
User Interface: Make the background inside a node group brighter
The breadcrumbs alone may not be enough to indicate that a user is inside a nodegroup. The original dark green color was a bit overwhelming but having a different background helps. This is a follow up to 919e513fa8f9f.
-rw-r--r--source/blender/editors/space_node/node_draw.cc24
1 files changed, 23 insertions, 1 deletions
diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc
index b5e2434f3d8..bcebd73e9a7 100644
--- a/source/blender/editors/space_node/node_draw.cc
+++ b/source/blender/editors/space_node/node_draw.cc
@@ -2176,6 +2176,28 @@ static void draw_nodetree(const bContext *C,
node_draw_nodetree(C, region, snode, ntree, parent_key);
}
+/**
+ * Make the background slightly brighter to indicate that users are inside a nodegroup.
+ **/
+static void draw_background_color(const SpaceNode *snode)
+{
+ const int max_depth = 2;
+ const float bright_factor = 0.25f;
+
+ float color[3];
+ UI_GetThemeColor3fv(TH_BACK, color);
+
+ int depth = 0;
+ bNodeTreePath *path = (bNodeTreePath *)snode->treepath.last;
+ while (path->prev && depth < max_depth) {
+ path = path->prev;
+ depth++;
+ }
+
+ mul_v3_fl(color, 1.0f + bright_factor * depth);
+ GPU_clear_color(color[0], color[1], color[2], 1.0);
+}
+
void node_draw_space(const bContext *C, ARegion *region)
{
wmWindow *win = CTX_wm_window(C);
@@ -2189,7 +2211,7 @@ void node_draw_space(const bContext *C, ARegion *region)
GPU_framebuffer_bind_no_srgb(framebuffer_overlay);
UI_view2d_view_ortho(v2d);
- UI_ThemeClearColor(TH_BACK);
+ draw_background_color(snode);
GPU_depth_test(GPU_DEPTH_NONE);
GPU_scissor_test(true);