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
This commit is contained in:
Dalai Felinto 2021-10-11 09:32:29 +02:00
parent a282efecbc
commit 813ca82f1e
Notes: blender-bot 2023-02-14 06:54:28 +01:00
Referenced by issue #92080, The background of Node editors appear brighter than they used too
1 changed files with 7 additions and 2 deletions

View File

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