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/makesdna/DNA_node_types.h
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/makesdna/DNA_node_types.h')
-rw-r--r--source/blender/makesdna/DNA_node_types.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index 79287885dec..cfe34d83586 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -577,7 +577,9 @@ typedef struct bNodeTree {
} bNodeTree;
/* ntree->type, index */
-#define NTREE_CUSTOM -1 /* for dynamically registered custom types */
+
+#define NTREE_UNDEFINED -2 /* Represents #NodeTreeTypeUndefined type. */
+#define NTREE_CUSTOM -1 /* for dynamically registered custom types */
#define NTREE_SHADER 0
#define NTREE_COMPOSIT 1
#define NTREE_TEXTURE 2