Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Oeser <lichtwerk>2022-08-23 15:19:23 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2022-08-23 15:22:04 +0300
commit0bc95b7b400963eabb261b006f8c4cbb60a0e1fa (patch)
treec4667b140651210f9fb9fa9f7185ce912e57c809 /source/blender/makesrna/intern/rna_nodetree.c
parent1663530408fd0a9f3870289c225acedf24e014d9 (diff)
Compositor: handle NODE_DO_OUTPUT in RNA when setting a node active
Main motivation is from T54314 where there was no way to read from a Viewer image datablock after setting another viewer node active. Part of the problem was addressed in rB16d329da284c (where handlers for the compositing background job were added so that you can act after the compositor has run), however there was still the remaining issue that setting another viewer node active would not properly tag the node NODE_DO_OUTPUT. This forced users into a complicated workaround (using switch nodes feeding into a single viewer node). Now handle NODE_DO_OUTPUT properly in RNA, too, and do proper updates so that behavior from RNA matches that of the Node Editor when setting a viewer node active. ref T54314. Reviewed By: JacquesLucke Maniphest Tasks: T54314 Differential Revision: https://developer.blender.org/D15203
Diffstat (limited to 'source/blender/makesrna/intern/rna_nodetree.c')
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 9d204d38292..14f439db443 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -1267,6 +1267,20 @@ static void rna_NodeTree_active_node_set(PointerRNA *ptr,
if (node && BLI_findindex(&ntree->nodes, node) != -1) {
nodeSetActive(ntree, node);
+
+ /* Handle NODE_DO_OUTPUT as well. */
+ if (node->typeinfo->nclass == NODE_CLASS_OUTPUT && node->type != CMP_NODE_OUTPUT_FILE) {
+ /* If this node becomes the active output, the others of the same type can't be the active
+ * output anymore. */
+ LISTBASE_FOREACH (bNode *, other_node, &ntree->nodes) {
+ if (other_node->type == node->type) {
+ other_node->flag &= ~NODE_DO_OUTPUT;
+ }
+ }
+ node->flag |= NODE_DO_OUTPUT;
+ ntreeSetOutput(ntree);
+ BKE_ntree_update_tag_active_output_changed(ntree);
+ }
}
else {
nodeClearActive(ntree);
@@ -12400,7 +12414,7 @@ static void rna_def_nodetree_nodes_api(BlenderRNA *brna, PropertyRNA *cprop)
prop, "rna_NodeTree_active_node_get", "rna_NodeTree_active_node_set", NULL, NULL);
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
RNA_def_property_ui_text(prop, "Active Node", "Active node in this tree");
- RNA_def_property_update(prop, NC_SCENE | ND_OB_ACTIVE, NULL);
+ RNA_def_property_update(prop, NC_SCENE | ND_OB_ACTIVE, "rna_NodeTree_update");
}
static void rna_def_nodetree_link_api(BlenderRNA *brna, PropertyRNA *cprop)