Fix T96292: unable to set active material output using Python
Differential Revision: https://developer.blender.org/D14301
This commit is contained in:
@@ -4520,6 +4520,25 @@ static void rna_CompositorNodeScale_update(Main *bmain, Scene *scene, PointerRNA
|
||||
rna_Node_update(bmain, scene, ptr);
|
||||
}
|
||||
|
||||
static void rna_ShaderNode_is_active_output_set(PointerRNA *ptr, bool value)
|
||||
{
|
||||
bNodeTree *ntree = (bNodeTree *)ptr->owner_id;
|
||||
bNode *node = ptr->data;
|
||||
if (value) {
|
||||
/* 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;
|
||||
}
|
||||
else {
|
||||
node->flag &= ~NODE_DO_OUTPUT;
|
||||
}
|
||||
}
|
||||
|
||||
static PointerRNA rna_ShaderNodePointDensity_psys_get(PointerRNA *ptr)
|
||||
{
|
||||
bNode *node = ptr->data;
|
||||
@@ -5288,6 +5307,7 @@ static void def_sh_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 output");
|
||||
RNA_def_property_boolean_funcs(prop, NULL, "rna_ShaderNode_is_active_output_set");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
|
||||
prop = RNA_def_property(srna, "target", PROP_ENUM, PROP_NONE);
|
||||
|
Reference in New Issue
Block a user