Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-11-19 23:36:32 +0300
committerHans Goudey <h.goudey@me.com>2021-11-19 23:36:32 +0300
commit51a7961e0984468e8ee6e5f9313e3884ba46d69d (patch)
tree103ea126fa0d98ba9fb389595b3180183da1f44c /source/blender/editors/space_node/node_draw.cc
parentc3fed4d463f07b8bfcecf98ed91256cf4e561e81 (diff)
Cleanup: Simplify node editor link dragging storage
Now that `node_intern.hh` is a C++ header, we can use C++ types there. This patch replaces the linked list of dragged links with a vector. Also, the list of drag operator custom data, `nldrag`, doesn't seem to need to be a list at all, so I just made it a unique pointer. Differential Revision: https://developer.blender.org/D13252
Diffstat (limited to 'source/blender/editors/space_node/node_draw.cc')
-rw-r--r--source/blender/editors/space_node/node_draw.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc
index bf3a9ba0c52..867544d0805 100644
--- a/source/blender/editors/space_node/node_draw.cc
+++ b/source/blender/editors/space_node/node_draw.cc
@@ -2116,15 +2116,15 @@ static void count_multi_input_socket_links(bNodeTree *ntree, SpaceNode *snode)
}
}
/* Count temporary links going into this socket. */
- LISTBASE_FOREACH (bNodeLinkDrag *, nldrag, &snode->runtime->linkdrag) {
- LISTBASE_FOREACH (LinkData *, linkdata, &nldrag->links) {
- bNodeLink *link = (bNodeLink *)linkdata->data;
+ if (snode->runtime->linkdrag) {
+ for (const bNodeLink *link : snode->runtime->linkdrag->links) {
if (link->tosock && (link->tosock->flag & SOCK_MULTI_INPUT)) {
int &count = counts.lookup_or_add(link->tosock, 0);
count++;
}
}
}
+
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
LISTBASE_FOREACH (bNodeSocket *, socket, &node->inputs) {
if (socket->flag & SOCK_MULTI_INPUT) {
@@ -2383,9 +2383,9 @@ void node_draw_space(const bContext *C, ARegion *region)
/* Temporary links. */
GPU_blend(GPU_BLEND_ALPHA);
GPU_line_smooth(true);
- LISTBASE_FOREACH (bNodeLinkDrag *, nldrag, &snode->runtime->linkdrag) {
- LISTBASE_FOREACH (LinkData *, linkdata, &nldrag->links) {
- node_draw_link(C, v2d, snode, (bNodeLink *)linkdata->data);
+ if (snode->runtime->linkdrag) {
+ for (const bNodeLink *link : snode->runtime->linkdrag->links) {
+ node_draw_link(C, v2d, snode, link);
}
}
GPU_line_smooth(false);