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:
authorJacques Lucke <jacques@blender.org>2022-03-14 12:21:19 +0300
committerJacques Lucke <jacques@blender.org>2022-03-14 12:21:47 +0300
commit82e7956f12aa4ee06cb27d902cc5c518af1ef177 (patch)
tree7bf8ceef34659717d65d4607615e84117952285e /source/blender/makesrna/intern/rna_nodetree.c
parentb3d0abd89350fd5ba99ebac47986f2ab343947a1 (diff)
Fix T96396: cannot set active node group output with Python
This is essentially the same fix as in rB22a341d9d8d3d337f79df228ab2e4e0726f81430.
Diffstat (limited to 'source/blender/makesrna/intern/rna_nodetree.c')
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 640fe3b919b..d1c37eff36f 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -4539,6 +4539,24 @@ static void rna_ShaderNode_is_active_output_set(PointerRNA *ptr, bool value)
}
}
+static void rna_GroupOutput_is_active_output_set(PointerRNA *ptr, bool value)
+{
+ bNodeTree *ntree = (bNodeTree *)ptr->owner_id;
+ bNode *node = ptr->data;
+ if (value) {
+ /* Make sure that no other group output is active at the same time. */
+ LISTBASE_FOREACH (bNode *, other_node, &ntree->nodes) {
+ if (other_node->type == NODE_GROUP_OUTPUT) {
+ other_node->flag &= ~NODE_DO_OUTPUT;
+ }
+ }
+ node->flag |= NODE_DO_OUTPUT;
+ }
+ else {
+ node->flag &= ~NODE_DO_OUTPUT;
+ }
+}
+
static PointerRNA rna_ShaderNodePointDensity_psys_get(PointerRNA *ptr)
{
bNode *node = ptr->data;
@@ -4917,6 +4935,7 @@ static void def_group_output(StructRNA *srna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", NODE_DO_OUTPUT);
RNA_def_property_ui_text(
prop, "Active Output", "True if this node is used as the active group output");
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_GroupOutput_is_active_output_set");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}