LibOverride: temporarily fix the material driver workaround with a hack.

Currently overriding properties within material node trees is not
supported. However there is a workaround that allows feeding values
through drivers via an intermediate custom property, as described
in T82404. The workaround relies on the behavior of the ID copying
code that always patches datablock self-references even without any
overrides.

Unfortunately, this broke during development of 2.93. This happened
because a call RNA_struct_override_matches added in rB2281db72b0157
detects that no override exists, and 'restores' the self-reference
to point to the original datablock.

To avoid this, mark the Material.node_tree property with the
PROPOVERRIDE_IGNORE flag to stop RNA_struct_override_matches
from recursing into the currently unsupported node tree sub-block.
This flag should be removed when this is properly supported.

This was confirmed to fix the workaround and discussed with @mont29.
This commit is contained in:
Alexander Gavrilov 2021-05-02 20:54:35 +03:00
parent a53d34a28a
commit 6899dbef77
Notes: blender-bot 2023-02-13 11:53:15 +01:00
Referenced by commit fffe219bdb, LibOverride: Make nodetree of material overrideable again.
1 changed files with 2 additions and 0 deletions

View File

@ -840,6 +840,8 @@ void RNA_def_material(BlenderRNA *brna)
prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
RNA_def_property_clear_flag(prop, PROP_PTR_NO_OWNERSHIP);
/* XXX: remove once overrides in material node trees are supported. */
RNA_def_property_override_flag(prop, PROPOVERRIDE_IGNORE);
RNA_def_property_ui_text(prop, "Node Tree", "Node tree for node based materials");
prop = RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE);