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-11 10:32:29 +0300
committerDalai Felinto <dalai@blender.org>2021-10-11 11:10:13 +0300
commit813ca82f1ec00af6c570be9504f5ffeea56fdfef (patch)
tree82004fe847054391f66afcdf8227dea86418cb52 /source/blender/editors/space_node/node_draw.cc
parenta282efecbc1487fdb3156fb829ea3170c39e14a7 (diff)
Fix T92080: Background of Node editors appear brighter than before
In the original code depth=0 meant that there was no parents. But with BLI_listbase_count we have depth 1 in those cases. Differential Revision: https://developer.blender.org/D12817
Diffstat (limited to 'source/blender/editors/space_node/node_draw.cc')
-rw-r--r--source/blender/editors/space_node/node_draw.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc
index c864f6c34d6..4332302159c 100644
--- a/source/blender/editors/space_node/node_draw.cc
+++ b/source/blender/editors/space_node/node_draw.cc
@@ -2181,10 +2181,15 @@ static void draw_nodetree(const bContext *C,
*/
static void draw_background_color(const SpaceNode *snode)
{
- const int max_depth = 2;
+ const int max_tree_length = 3;
const float bright_factor = 0.25f;
- const int depth = BLI_listbase_count_at_most(&snode->treepath, max_depth);
+ /* We ignore the first element of the path since it is the top-most tree and it doesn't need to
+ * be brighter. We also set a cap to how many levels we want to set apart, to avoid the
+ * background from getting too bright. */
+ const int clamped_tree_path_length = BLI_listbase_count_at_most(&snode->treepath,
+ max_tree_length);
+ const int depth = max_ii(0, clamped_tree_path_length - 1);
float color[3];
UI_GetThemeColor3fv(TH_BACK, color);