diff options
Diffstat (limited to 'source/blender/blenkernel/BKE_node.h')
-rw-r--r-- | source/blender/blenkernel/BKE_node.h | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 2038842ee59..a2959556810 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -34,6 +34,10 @@ #include "RNA_types.h" #ifdef __cplusplus +# include "BLI_string_ref.hh" +#endif + +#ifdef __cplusplus extern "C" { #endif @@ -114,6 +118,7 @@ namespace nodes { class NodeMultiFunctionBuilder; class GeoNodeExecParams; class NodeDeclarationBuilder; +class GatherLinkSearchOpParams; } // namespace nodes namespace fn { class CPPType; @@ -129,10 +134,15 @@ using SocketGetCPPValueFunction = void (*)(const struct bNodeSocket &socket, voi using SocketGetGeometryNodesCPPValueFunction = void (*)(const struct bNodeSocket &socket, void *r_value); +/* Adds socket link operations that are specific to this node type. */ +using NodeGatherSocketLinkOperationsFunction = + void (*)(blender::nodes::GatherLinkSearchOpParams ¶ms); + #else typedef void *NodeMultiFunctionBuildFunction; typedef void *NodeGeometryExecFunction; typedef void *NodeDeclareFunction; +typedef void *NodeGatherSocketLinkOperationsFunction; typedef void *SocketGetCPPTypeFunction; typedef void *SocketGetGeometryNodesCPPTypeFunction; typedef void *SocketGetGeometryNodesCPPValueFunction; @@ -284,7 +294,7 @@ typedef struct bNodeType { /** * Can this node type be added to a node tree? - * \param r_disabled_hint: Optional hint to display in the UI when the poll fails. + * \param r_disabled_hint: Hint to display in the UI when the poll fails. * The callback can set this to a static string without having to * null-check it (or without setting it to null if it's not used). * The caller must pass a valid `const char **` and null-initialize it @@ -325,6 +335,13 @@ typedef struct bNodeType { /* Declaration to be used when it is not dynamic. */ NodeDeclarationHandle *fixed_declaration; + /** + * Add to the list of search names and operations gathered by node link drag searching. + * Usually it isn't necessary to override the default behavior here, but a node type can have + * custom behavior here like adding custom search items. + */ + NodeGatherSocketLinkOperationsFunction gather_link_search_ops; + /** True when the node cannot be muted. */ bool no_muting; @@ -402,7 +419,7 @@ typedef struct bNodeTreeType { /* Tree update. Overrides `nodetype->updatetreefunc` ! */ void (*update)(struct bNodeTree *ntree); - bool (*validate_link)(struct bNodeTree *ntree, struct bNodeLink *link); + bool (*validate_link)(eNodeSocketDatatype from, eNodeSocketDatatype to); void (*node_add_init)(struct bNodeTree *ntree, struct bNode *bnode); @@ -1768,6 +1785,18 @@ extern struct bNodeSocketType NodeSocketTypeUndefined; } #endif +#ifdef __cplusplus + +namespace blender::bke { + +bNodeSocket *node_find_enabled_socket(bNode &node, eNodeSocketInOut in_out, StringRef name); +bNodeSocket *node_find_enabled_input_socket(bNode &node, StringRef name); +bNodeSocket *node_find_enabled_output_socket(bNode &node, StringRef name); + +} // namespace blender::bke + +#endif + #define NODE_STORAGE_FUNCS(StorageT) \ [[maybe_unused]] static StorageT &node_storage(bNode &node) \ { \ |