Fix #119313: Render layers in startup file are missing

The outputs of the Render Layers node in the compositor in the startup
file are missing. That's because add-ons are disabled when loading the
startup file, so Cycles will not be registered by the time the node tree
of the compositor is loaded, and its passes will not exist.

To fix this, we mark the compositor node tree as needing an update after
loading the startup file.

Pull Request: https://projects.blender.org/blender/blender/pulls/125053
This commit is contained in:
Omar Emara
2024-07-23 10:42:17 +02:00
committed by Omar Emara
parent 57ff2969b8
commit cf032d6893

View File

@@ -76,6 +76,7 @@
#include "BKE_lib_remap.hh"
#include "BKE_main.hh"
#include "BKE_main_namemap.hh"
#include "BKE_node.hh"
#include "BKE_packedFile.h"
#include "BKE_report.hh"
#include "BKE_scene.hh"
@@ -106,6 +107,8 @@
#include "ED_view3d.hh"
#include "ED_view3d_offscreen.hh"
#include "NOD_composite.hh"
#include "GHOST_C-api.h"
#include "GHOST_Path-api.hh"
@@ -785,6 +788,19 @@ static void wm_file_read_post(bContext *C,
ED_editors_init(C);
/* Add-ons are disabled when loading the startup file, so the Render Layer node in compositor
* node trees might be wrong due to missing render engines that are available as add-ons, like
* Cycles. So we need to update compositor node trees after reading the file when add-ons are
* now loaded. */
if (is_startup_file) {
FOREACH_NODETREE_BEGIN (bmain, node_tree, owner_id) {
if (node_tree->type == NTREE_COMPOSIT) {
ntreeCompositUpdateRLayers(node_tree);
}
}
FOREACH_NODETREE_END;
}
#if 1
WM_event_add_notifier(C, NC_WM | ND_FILEREAD, nullptr);
/* Clear static filtered asset tree caches. */