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/blenkernel | |
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/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_node.h | 7 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/node.cc | 11 |
2 files changed, 5 insertions, 13 deletions
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 8f7f224cf0f..bbeb01de0ff 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -318,8 +318,6 @@ typedef struct bNodeType { /* optional handling of link insertion */ void (*insert_link)(struct bNodeTree *ntree, struct bNode *node, struct bNodeLink *link); - /* Update the internal links list, for muting and disconnect operators. */ - void (*update_internal_links)(struct bNodeTree *, struct bNode *node); void (*free_self)(struct bNodeType *ntype); @@ -344,6 +342,9 @@ typedef struct bNodeType { /* Declaration to be used when it is not dynamic. */ NodeDeclarationHandle *fixed_declaration; + /** True when the node cannot be muted. */ + bool no_muting; + /* RNA integration */ ExtensionRNA rna_ext; } bNodeType; @@ -891,8 +892,6 @@ void node_type_exec(struct bNodeType *ntype, NodeFreeExecFunction free_exec_fn, NodeExecFunction exec_fn); void node_type_gpu(struct bNodeType *ntype, NodeGPUExecFunction gpu_fn); -void node_type_internal_links(struct bNodeType *ntype, - void (*update_internal_links)(struct bNodeTree *, struct bNode *)); /** \} */ diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc index 850e3b8072a..e02ea3f7e37 100644 --- a/source/blender/blenkernel/intern/node.cc +++ b/source/blender/blenkernel/intern/node.cc @@ -5237,9 +5237,8 @@ bool nodeUpdateID(bNodeTree *ntree, ID *id) void nodeUpdateInternalLinks(bNodeTree *ntree, bNode *node) { BLI_freelistN(&node->internal_links); - - if (node->typeinfo && node->typeinfo->update_internal_links) { - node->typeinfo->update_internal_links(ntree, node); + if (!node->typeinfo->no_muting) { + node_internal_links_create(ntree, node); } } @@ -5504,12 +5503,6 @@ void node_type_gpu(struct bNodeType *ntype, NodeGPUExecFunction gpu_fn) ntype->gpu_fn = gpu_fn; } -void node_type_internal_links(bNodeType *ntype, - void (*update_internal_links)(bNodeTree *, bNode *)) -{ - ntype->update_internal_links = update_internal_links; -} - /* callbacks for undefined types */ static bool node_undefined_poll(bNodeType *UNUSED(ntype), |