From 0633b886836a9445318fa6859e8b5a23d491af27 Mon Sep 17 00:00:00 2001 From: Habib Gahbiche <habib@blender.org> Date: Mon, 17 Mar 2025 17:33:41 +0100 Subject: [PATCH] Fix: link_viewer() not updating viewer node properly How to reproduce: - Open blend file in original PR - `ctrl + left click` on render layers node - Expected behavior: Viewer connected to "image" socket gets activated. - Actual behavior: Viewer 2 is still active and there are two active viewers in the node tree. The reason why `NODE_OT_link_viewer()` worked before without ensuring only one active viewer exists in the node tree is because if it found a linked viewer, it would link it without explicitly activating it (i.e. without setting `viewer_node->flag |= NODE_DO_OUTPUT`), assuming no other active viewers can exist in that case. But in principle, viewer nodes can also be activated using `node_tree.nodes.active = viewer_node` as well, which is now more likely to happen after b51c560f. One could argue that it makes more sense to activate the viewer node without shortcut by default when `link_viewer()` is called, instead of activating the first viewer (in this case with shortcut `1`). However, this patch aims to keep the change minimal. Also, the socket that gets previewed woul be the same which is probably what users want anyways. Pull Request: https://projects.blender.org/blender/blender/pulls/135966 --- source/blender/editors/space_node/node_relationships.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/source/blender/editors/space_node/node_relationships.cc b/source/blender/editors/space_node/node_relationships.cc index a57a9c0317d..0ff2339c82d 100644 --- a/source/blender/editors/space_node/node_relationships.cc +++ b/source/blender/editors/space_node/node_relationships.cc @@ -848,6 +848,7 @@ static int node_active_link_viewer_exec(bContext *C, wmOperator * /*op*/) return OPERATOR_CANCELLED; } + BKE_ntree_update_tag_active_output_changed(snode.edittree); BKE_main_ensure_invariants(*CTX_data_main(C), snode.edittree->id); return OPERATOR_FINISHED; -- GitLab