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/editors/space_node/drawnode.cc | 5 +++-- source/blender/editors/space_node/node_draw.cc | 8 ++++---- source/blender/editors/space_node/node_relationships.cc | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) (limited to 'source/blender/editors/space_node') diff --git a/source/blender/editors/space_node/drawnode.cc b/source/blender/editors/space_node/drawnode.cc index d5507619e0d..6806d715004 100644 --- a/source/blender/editors/space_node/drawnode.cc +++ b/source/blender/editors/space_node/drawnode.cc @@ -20,6 +20,7 @@ #include "BKE_image.h" #include "BKE_main.h" #include "BKE_node.h" +#include "BKE_node_runtime.hh" #include "BKE_node_tree_update.h" #include "BKE_scene.h" #include "BKE_tracking.h" @@ -1271,14 +1272,14 @@ static void node_file_output_socket_draw(bContext *C, static bool socket_needs_attribute_search(bNode &node, bNodeSocket &socket) { - if (node.declaration == nullptr) { + if (node.runtime->declaration == nullptr) { return false; } if (socket.in_out == SOCK_OUT) { return false; } const int socket_index = BLI_findindex(&node.inputs, &socket); - return node.declaration->inputs()[socket_index]->is_attribute_name(); + return node.runtime->declaration->inputs()[socket_index]->is_attribute_name(); } static void std_node_socket_draw( diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc index f5048e0cc67..4d194dfbd38 100644 --- a/source/blender/editors/space_node/node_draw.cc +++ b/source/blender/editors/space_node/node_draw.cc @@ -982,8 +982,8 @@ static bool node_socket_has_tooltip(bNodeTree *ntree, bNodeSocket *socket) return true; } - if (socket->declaration != nullptr) { - const blender::nodes::SocketDeclaration &socket_decl = *socket->declaration; + if (socket->runtime->declaration != nullptr) { + const blender::nodes::SocketDeclaration &socket_decl = *socket->runtime->declaration; return !socket_decl.description().is_empty(); } @@ -996,8 +996,8 @@ static char *node_socket_get_tooltip(bContext *C, bNodeSocket *socket) { std::stringstream output; - if (socket->declaration != nullptr) { - const blender::nodes::SocketDeclaration &socket_decl = *socket->declaration; + if (socket->runtime->declaration != nullptr) { + const blender::nodes::SocketDeclaration &socket_decl = *socket->runtime->declaration; blender::StringRef description = socket_decl.description(); if (!description.is_empty()) { output << TIP_(description.data()); diff --git a/source/blender/editors/space_node/node_relationships.cc b/source/blender/editors/space_node/node_relationships.cc index c757fb46407..5796a712205 100644 --- a/source/blender/editors/space_node/node_relationships.cc +++ b/source/blender/editors/space_node/node_relationships.cc @@ -2048,7 +2048,7 @@ static bNodeSocket *get_main_socket(bNodeTree &ntree, bNode &node, eNodeSocketIn /* Try to get the main socket based on the socket declaration. */ nodeDeclarationEnsure(&ntree, &node); - const nodes::NodeDeclaration *node_decl = node.declaration; + const nodes::NodeDeclaration *node_decl = node.runtime->declaration; if (node_decl != nullptr) { Span socket_decls = (in_out == SOCK_IN) ? node_decl->inputs() : node_decl->outputs(); -- cgit v1.2.3