From 6a59cf053091dc45e0f94b829bee6c34cf940534 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Mon, 30 May 2022 15:31:13 +0200 Subject: Nodes: add separately allocated runtime data for nodes and sockets This is a follow up to rBbb0fc675822f313c5546a2498a162472c2571ecb. Now the same kind of run-time data is added to nodes and sockets. Differential Revision: https://developer.blender.org/D15060 --- source/blender/nodes/NOD_node_tree_ref.hh | 3 ++- source/blender/nodes/intern/node_geometry_exec.cc | 2 +- source/blender/nodes/intern/node_socket.cc | 5 +++-- source/blender/nodes/intern/node_socket_declarations.cc | 7 ++++--- 4 files changed, 10 insertions(+), 7 deletions(-) (limited to 'source/blender/nodes') diff --git a/source/blender/nodes/NOD_node_tree_ref.hh b/source/blender/nodes/NOD_node_tree_ref.hh index 61d1d11d859..257aa5f4110 100644 --- a/source/blender/nodes/NOD_node_tree_ref.hh +++ b/source/blender/nodes/NOD_node_tree_ref.hh @@ -41,6 +41,7 @@ #include "BLI_vector.hh" #include "BKE_node.h" +#include "BKE_node_runtime.hh" #include "DNA_node_types.h" @@ -597,7 +598,7 @@ inline bNodeType *NodeRef::typeinfo() const inline const NodeDeclaration *NodeRef::declaration() const { nodeDeclarationEnsure(this->tree().btree(), bnode_); - return bnode_->declaration; + return bnode_->runtime->declaration; } inline int NodeRef::id() const diff --git a/source/blender/nodes/intern/node_geometry_exec.cc b/source/blender/nodes/intern/node_geometry_exec.cc index 39d8c453e43..9aee3ddcce7 100644 --- a/source/blender/nodes/intern/node_geometry_exec.cc +++ b/source/blender/nodes/intern/node_geometry_exec.cc @@ -37,7 +37,7 @@ void GeoNodeExecParams::check_input_geometry_set(StringRef identifier, const GeometrySet &geometry_set) const { const SocketDeclaration &decl = - *provider_->dnode->input_by_identifier(identifier).bsocket()->declaration; + *provider_->dnode->input_by_identifier(identifier).bsocket()->runtime->declaration; const decl::Geometry *geo_decl = dynamic_cast(&decl); if (geo_decl == nullptr) { return; diff --git a/source/blender/nodes/intern/node_socket.cc b/source/blender/nodes/intern/node_socket.cc index 0ab446d8b0c..098f766589d 100644 --- a/source/blender/nodes/intern/node_socket.cc +++ b/source/blender/nodes/intern/node_socket.cc @@ -19,6 +19,7 @@ #include "BKE_geometry_set.hh" #include "BKE_lib_id.h" #include "BKE_node.h" +#include "BKE_node_runtime.hh" #include "DNA_collection_types.h" #include "DNA_material_types.h" @@ -261,8 +262,8 @@ void node_verify_sockets(bNodeTree *ntree, bNode *node, bool do_id_user) } if (ntype->declare != nullptr) { nodeDeclarationEnsureOnOutdatedNode(ntree, node); - if (!node->declaration->matches(*node)) { - refresh_node(*ntree, *node, *node->declaration, do_id_user); + if (!node->runtime->declaration->matches(*node)) { + refresh_node(*ntree, *node, *node->runtime->declaration, do_id_user); } nodeSocketDeclarationsUpdate(node); return; diff --git a/source/blender/nodes/intern/node_socket_declarations.cc b/source/blender/nodes/intern/node_socket_declarations.cc index 06925761bc7..b9fb75f30c7 100644 --- a/source/blender/nodes/intern/node_socket_declarations.cc +++ b/source/blender/nodes/intern/node_socket_declarations.cc @@ -4,6 +4,7 @@ #include "NOD_socket_declarations_geometry.hh" #include "BKE_node.h" +#include "BKE_node_runtime.hh" #include "BLI_math_vector.h" @@ -33,14 +34,14 @@ static bool sockets_can_connect(const SocketDeclaration &socket_decl, return false; } - if (other_socket.declaration) { + if (other_socket.runtime->declaration) { if (socket_decl.in_out() == SOCK_IN) { - if (!field_types_are_compatible(socket_decl, *other_socket.declaration)) { + if (!field_types_are_compatible(socket_decl, *other_socket.runtime->declaration)) { return false; } } else { - if (!field_types_are_compatible(*other_socket.declaration, socket_decl)) { + if (!field_types_are_compatible(*other_socket.runtime->declaration, socket_decl)) { return false; } } -- cgit v1.2.3