[Bf-blender-cvs] [ebe23745281] master: User Interface: Make the background inside a node group brighter

Dalai Felinto noreply at git.blender.org
Fri Oct 8 15:38:22 CEST 2021


Commit: ebe23745281e8675a6b45c39f79441a4f896963e
Author: Dalai Felinto
Date:   Fri Oct 8 11:43:52 2021 +0200
Branches: master
https://developer.blender.org/rBebe23745281e8675a6b45c39f79441a4f896963e

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.

===================================================================

M	source/blender/editors/space_node/node_draw.cc

===================================================================

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);



More information about the Bf-blender-cvs mailing list