Python: Nodes: deactivate_viewer() affects active viewer only

It is assumed that within a node tree at most one viewer is active at a
time, see also `node_tree_set_output()`. So we ignore selection when
deactivating a viewer and rely on the active node from context instead
to decide which viewer node should be deactivated.

Motivation: #145506  and #145509
Pull Request: https://projects.blender.org/blender/blender/pulls/145505
This commit is contained in:
Habib Gahbiche
2025-09-04 17:55:53 +02:00
parent 8571dfa881
commit f518f2ea67

View File

@@ -1863,12 +1863,11 @@ static wmOperatorStatus node_deactivate_viewer_exec(bContext *C, wmOperator * /*
if (node->type_legacy != GEO_NODE_VIEWER) {
continue;
}
if (!(node->flag & SELECT)) {
continue;
}
if (node == active_viewer) {
node->flag &= ~NODE_DO_OUTPUT;
BKE_ntree_update_tag_node_property(snode.edittree, node);
/* At most, only one viewer is active so break early. */
break;
}
}