Fix #140381: Crash after creating a node group and undo
We need to ensure that the compositor preview depsgraph gets updated properly after undo, now that the compositing node tree is not embedded in the scene anymore. A test case will be committed separately in #140595 Pull Request: https://projects.blender.org/blender/blender/pulls/140596
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_preview_image.hh"
|
||||
#include "BKE_scene.hh"
|
||||
#include "BKE_scene_runtime.hh"
|
||||
#include "BKE_undo_system.hh"
|
||||
|
||||
#include "../depsgraph/DEG_depsgraph.hh"
|
||||
@@ -230,6 +231,17 @@ static void memfile_undosys_step_decode(
|
||||
bmain, id, memfile_undosys_step_id_reused_cb, nullptr, IDWALK_READONLY);
|
||||
}
|
||||
|
||||
if (GS(id->name) == ID_SCE) {
|
||||
Scene *scene = reinterpret_cast<Scene *>(id);
|
||||
if (scene->compositing_node_group) {
|
||||
/* Ensure undo calls from the UI update the interactive compositor preview depsgraph, see
|
||||
* #compo_initjob. */
|
||||
blender::bke::CompositorRuntime &compositor_runtime = scene->runtime->compositor;
|
||||
DEG_graph_free(compositor_runtime.preview_depsgraph);
|
||||
compositor_runtime.preview_depsgraph = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/* NOTE: Tagging `ID_RECALC_SYNC_TO_EVAL` here should not be needed in practice, since
|
||||
* modified IDs should already have other depsgraph update tags anyway.
|
||||
* However, for the sake of consistency, it's better to effectively use it,
|
||||
|
||||
Reference in New Issue
Block a user