Skip to content
Snippets Groups Projects
Commit 0633b886 authored by Habib Gahbiche's avatar Habib Gahbiche
Browse files

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
parent 1a0dc71c
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment