diff options
author | Jacques Lucke <jacques@blender.org> | 2021-11-17 13:52:44 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-11-17 13:52:54 +0300 |
commit | f5dde382af8078a2e5265e7d6710df7cb1b320a0 (patch) | |
tree | 367bdf822149128d0566f02ec062207aa7c82719 /source/blender/nodes/intern/node_util.c | |
parent | 83a4d51997f24a31631217f819f00a6db68fb0cb (diff) |
Cleanup: use same function for updating internal links for all nodes
Previously, node types had a callback that creates internal links. Pretty
much all nodes used the same callback though. The exceptions are the
reroute node (which probably shouldn't be mutable anyway) and some
input/output nodes that are not mutable.
Removing the callback helps with D13246, because it makes it easier
to reason about which internal links are created and when they change.
In the future, the internal links should be part of the node declaration.
Diffstat (limited to 'source/blender/nodes/intern/node_util.c')
-rw-r--r-- | source/blender/nodes/intern/node_util.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/source/blender/nodes/intern/node_util.c b/source/blender/nodes/intern/node_util.c index 4c08a6cb49c..231030030eb 100644 --- a/source/blender/nodes/intern/node_util.c +++ b/source/blender/nodes/intern/node_util.c @@ -41,6 +41,8 @@ #include "MEM_guardedalloc.h" +#include "NOD_common.h" + #include "node_util.h" /* -------------------------------------------------------------------- */ @@ -493,6 +495,10 @@ static int node_datatype_priority(eNodeSocketDatatype from, eNodeSocketDatatype /* select a suitable input socket for an output */ static bNodeSocket *select_internal_link_input(bNode *node, bNodeSocket *output) { + if (node->type == NODE_REROUTE) { + return node->inputs.first; + } + bNodeSocket *selected = NULL, *input; int i; int sel_priority = -1; @@ -526,7 +532,7 @@ static bNodeSocket *select_internal_link_input(bNode *node, bNodeSocket *output) return selected; } -void node_update_internal_links_default(bNodeTree *ntree, bNode *node) +void node_internal_links_create(bNodeTree *ntree, bNode *node) { bNodeLink *link; bNodeSocket *output, *input; |