Fix crash in the node editor in cases where nodetree was empty
This seems to happen only in a few files, and not so trivial to
reproduce from scratch.
The crash is real though, and this fixes it.
It also fix a wrong comment style that was introduced in the same faulty
commit.
Bug introduced on ebe2374528
.
Differential Revision: https://developer.blender.org/D12794
This commit is contained in:
parent
0c684a7046
commit
38c4888f09
Notes:
blender-bot
2024-03-25 12:30:38 +01:00
Referenced by issue #92080, The background of Node editors appear brighter than they used too
|
@ -2178,22 +2178,16 @@ static void draw_nodetree(const bContext *C,
|
|||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
const int depth = BLI_listbase_count_at_most(&snode->treepath, max_depth);
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue