diff options
author | Hans Goudey <h.goudey@me.com> | 2021-12-22 20:25:55 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-12-22 20:25:55 +0300 |
commit | e2a9e7e80395c7706e20d4574851d698d7d01bac (patch) | |
tree | de2c3eecfcd250fd0b5a9167a87a86c6cd28f7e5 /source | |
parent | 6a71b2af66cf10556b21361cc609d54e45be5e3b (diff) |
Nodes: Remove unnecessary node tree socket tagging
`SOCK_IN_USE` is now set in `update_socket_used_tags` in
`node_tree_update.cc` when a node tree is changed.
It doesn't need to run every single redraw. Removing this
results in a small speedup of 0.4 ms when drawing a tree
with about 4000 nodes (from about 70 ms total).
Differential Revision: https://developer.blender.org/D13645
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_node.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/node.cc | 20 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_draw.cc | 1 |
3 files changed, 0 insertions, 22 deletions
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 7fbf9de53ce..5c35ff69233 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -827,7 +827,6 @@ void nodeClearActiveID(struct bNodeTree *ntree, short idtype); struct bNode *nodeGetActiveTexture(struct bNodeTree *ntree); int nodeSocketIsHidden(const struct bNodeSocket *sock); -void ntreeTagUsedSockets(struct bNodeTree *ntree); void nodeSetSocketAvailability(struct bNodeTree *ntree, struct bNodeSocket *sock, bool is_available); diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc index e5aa28f8e0a..e05d452ca50 100644 --- a/source/blender/blenkernel/intern/node.cc +++ b/source/blender/blenkernel/intern/node.cc @@ -4304,26 +4304,6 @@ void ntreeUpdateNodeLevels(bNodeTree *ntree) } } -void ntreeTagUsedSockets(bNodeTree *ntree) -{ - /* first clear data */ - LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { - LISTBASE_FOREACH (bNodeSocket *, sock, &node->inputs) { - sock->flag &= ~SOCK_IN_USE; - } - LISTBASE_FOREACH (bNodeSocket *, sock, &node->outputs) { - sock->flag &= ~SOCK_IN_USE; - } - } - - LISTBASE_FOREACH (bNodeLink *, link, &ntree->links) { - link->fromsock->flag |= SOCK_IN_USE; - if (!(link->flag & NODE_LINK_MUTED)) { - link->tosock->flag |= SOCK_IN_USE; - } - } -} - void ntreeUpdateAllNew(Main *main) { Vector<bNodeTree *> new_ntrees; diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc index 635ef41d859..2d3c42b16d1 100644 --- a/source/blender/editors/space_node/node_draw.cc +++ b/source/blender/editors/space_node/node_draw.cc @@ -2380,7 +2380,6 @@ static void node_update_nodetree(const bContext &C, { /* Make sure socket "used" tags are correct, for displaying value buttons. */ SpaceNode *snode = CTX_wm_space_node(&C); - ntreeTagUsedSockets(&ntree); count_multi_input_socket_links(ntree, *snode); |