diff options
author | Omar Emara <mail@OmarEmara.dev> | 2022-11-10 14:02:15 +0300 |
---|---|---|
committer | Omar Emara <mail@OmarEmara.dev> | 2022-11-10 14:02:15 +0300 |
commit | 8ef092d2d8ae0453399c03310d293e71180955ec (patch) | |
tree | 80a1022381fe0b0f65cedc9948b3aa9fc9986af5 /source/blender/editors/space_node/space_node.cc | |
parent | ec1ab6310a3f824b20a40873ed71308d825fb6e9 (diff) |
Fix T102151: Output nodes don't work inside node groups
Using output nodes inside node groups in compositor node trees doesn't
work for the realtime compositor.
Currently, the realtime compositor only considers top level output
nodes. That means if a user edits a node group and adds an output node
in the group, the output node outside of the node group will still be
used, which breaks the temporary viewers workflow where users debug
results inside a node group.
This patch fixes that by first considering the output nodes in the
active context, then consider the root context as a fallback. This is
mostly consistent with the CPU compositor, but the realtime compositor
allow viewing node group output nodes even if no output nodes exist at
the top level context.
Differential Revision: https://developer.blender.org/D16446
Reviewed By: Clement Foucault
Diffstat (limited to 'source/blender/editors/space_node/space_node.cc')
-rw-r--r-- | source/blender/editors/space_node/space_node.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/editors/space_node/space_node.cc b/source/blender/editors/space_node/space_node.cc index ce0273eec81..c993fa57d76 100644 --- a/source/blender/editors/space_node/space_node.cc +++ b/source/blender/editors/space_node/space_node.cc @@ -5,6 +5,7 @@ * \ingroup spnode */ +#include "DNA_ID.h" #include "DNA_gpencil_types.h" #include "DNA_light_types.h" #include "DNA_material_types.h" @@ -28,6 +29,8 @@ #include "UI_resources.h" #include "UI_view2d.h" +#include "DEG_depsgraph.h" + #include "BLO_read_write.h" #include "RNA_access.h" @@ -191,6 +194,13 @@ void ED_node_set_active_viewer_key(SpaceNode *snode) { bNodeTreePath *path = (bNodeTreePath *)snode->treepath.last; if (snode->nodetree && path) { + /* A change in active viewer may result in the change of the output node used by the + * compositor, so we need to get notified about such changes. */ + if (snode->nodetree->active_viewer_key.value != path->parent_key.value) { + DEG_id_tag_update(&snode->nodetree->id, ID_RECALC_NTREE_OUTPUT); + WM_main_add_notifier(NC_NODE, nullptr); + } + snode->nodetree->active_viewer_key = path->parent_key; } } |