Fix: Compositor: Incorrect viewer is activated

In some cases, multiple viewers can be active and the active viewer is
not the desired one. This is only a problem for the compositor

The fix has two parts:
1. Tag the node tree as changed after the output changes. This solves
 the issue of two viewers being active at the same time
2. Deactivate all other viewers before activating the desired viewer
node (similar to how `NODE_OT_activate_viewer()` works). This ensures
that the only active viewer is the one that the user just set.

Pull Request: https://projects.blender.org/blender/blender/pulls/138671
This commit is contained in:
Habib Gahbiche
2025-05-09 18:07:05 +02:00
parent bb8719030d
commit 58ebe99d9d

View File

@@ -581,9 +581,18 @@ static void finalize_viewer_link(const bContext &C,
viewer_link.flag &= ~NODE_LINK_MUTED;
viewer_node.flag &= ~NODE_MUTED;
viewer_node.flag |= NODE_DO_OUTPUT;
if (snode.edittree->type == NTREE_GEOMETRY) {
viewer_path::activate_geometry_node(*bmain, snode, viewer_node);
}
else if (snode.edittree->type == NTREE_COMPOSIT) {
for (bNode *node : snode.nodetree->all_nodes()) {
if (node->is_type("CompositorNodeViewer") && node != &viewer_node) {
node->flag &= ~NODE_DO_OUTPUT;
}
}
}
BKE_ntree_update_tag_active_output_changed(snode.edittree);
BKE_main_ensure_invariants(*bmain, snode.edittree->id);
}