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:
authorBastien Montagne <mont29>2021-11-08 13:51:54 +0300
committerBastien Montagne <bastien@blender.org>2021-11-08 14:24:47 +0300
commitd6e22109353cf9920284f3f84dee9b8cfd125669 (patch)
treeaf55acd7aef301416285e02244de5d2b6a668b5e /source/blender/makesrna/intern/rna_nodetree.c
parentfc373af8f5a43553a8f9cdb86f8e18c78040a537 (diff)
Fix inconsistent creation of `NodeTreeTypeUndefined` type of node tree
Currently, when creating a new node tree ID, its `typeinfo` is set to `NodeTreeTypeUndefined`, but its `type` enum value is left to `0`, aka `NTREE_SHADER`. This patch adds a new `NTREE_UNDIFINED` value, and use it for `NodeTreeTypeUndefined` types of node trees. NOTE: While it is not clear whether that actually fixes issues currently, quite a bit of code still relies on the value of `type`, so think it makes sense to sanitize this. NOTE: Would have been ideal to reserve `0` value to undefined type, but at this point this is not possible anymore, so chose to use `-2` instead. Reviewed By: JacquesLucke Differential Revision: https://developer.blender.org/D13123
Diffstat (limited to 'source/blender/makesrna/intern/rna_nodetree.c')
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 01889a1b0a9..53b3f07dbbc 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -12753,6 +12753,11 @@ static void rna_def_nodetree(BlenderRNA *brna)
PropertyRNA *parm;
static const EnumPropertyItem static_type_items[] = {
+ {NTREE_UNDEFINED,
+ "UNDEFINED",
+ ICON_QUESTION,
+ "Undefined",
+ "Undefined type of nodes (can happen e.g. when a linked node tree goes missing)"},
{NTREE_SHADER, "SHADER", ICON_MATERIAL, "Shader", "Shader nodes"},
{NTREE_TEXTURE, "TEXTURE", ICON_TEXTURE, "Texture", "Texture nodes"},
{NTREE_COMPOSIT, "COMPOSITING", ICON_RENDERLAYERS, "Compositing", "Compositing nodes"},