diff options
author | Wannes Malfait <Wannes> | 2021-04-30 07:36:46 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-04-30 07:36:46 +0300 |
commit | 47aca2b4c402ec35ea52c18afcc0840bcf283b26 (patch) | |
tree | 0e34d910a48d76ada62bc52db04d65b525f1c542 /source/blender/blenkernel/BKE_node.h | |
parent | ddaeaa4b981d38393fcbb6ca6cc27e81f55da900 (diff) |
Nodes: Add a callback to check for valid socket type
This adds a callback to bNodeTreeType to check which socket types are
valid for the tree type. Function has been implemented for the normal
tree types, and can be implemented for custom node trees with python,
by adding a `classmethod` to the tree. However, only builtin socket
types are supported.
This is relevant for T87049, but it also has the advantage that it is
now clear which node trees support which sockets. Previously this
was assumed to be known by all developers.
Differential Revision: https://developer.blender.org/D10938
Diffstat (limited to 'source/blender/blenkernel/BKE_node.h')
-rw-r--r-- | source/blender/blenkernel/BKE_node.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index b913e76836c..819c148f0ad 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -410,6 +410,9 @@ typedef struct bNodeTreeType { void (*node_add_init)(struct bNodeTree *ntree, struct bNode *bnode); + /* Check if the socket type is valid for this tree type. */ + bool (*valid_socket_type)(enum eNodeSocketDatatype socket_type, struct bNodeTreeType *ntreetype); + /* RNA integration */ ExtensionRNA rna_ext; } bNodeTreeType; |