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
path: root/source
diff options
context:
space:
mode:
authorFabian Schempp <fabianschempp@googlemail.com>2021-04-15 11:00:25 +0300
committerFabian Schempp <fabianschempp@googlemail.com>2021-04-15 11:00:25 +0300
commit2c3a9caffee61d52cc50a70ff9b2ec3984ee0fc5 (patch)
tree94be508e2b05679113a977db5f93fd8233e13c31 /source
parent5ec39fc2e484a7e3d5e2e0ecb1bef0b428a7b7a7 (diff)
Fix T87356 & T87358: Small multi-input socket issues
T87356 occured because last_node_hovered_while_dragging_a_link was not set on node_link_init. The assert in T87358 failed because the sorting operation was called even if the drag link contained a link to another socket. A little one frame jump was caused because frame was refreshed after picking a link and before sorting happened. Reviewer: Hans Goudey Differential Revision: https://developer.blender.org/D10940
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/space_node/node_intern.h4
-rw-r--r--source/blender/editors/space_node/node_relationships.c11
2 files changed, 13 insertions, 2 deletions
diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h
index 6f281ee05cc..c350e50b524 100644
--- a/source/blender/editors/space_node/node_intern.h
+++ b/source/blender/editors/space_node/node_intern.h
@@ -58,9 +58,11 @@ typedef struct bNodeLinkDrag {
bool from_multi_input_socket;
int in_out;
- /** Temporarily stores the last picked link from multi input socket operator. */
+ /** Temporarily stores the last picked link from multi-input socket operator. */
struct bNodeLink *last_picked_multi_input_socket_link;
+ /** Temporarily stores the last hovered socket for multi-input socket operator.
+ * Store it to recalculate sorting after it is no longer hovered. */
struct bNode *last_node_hovered_while_dragging_a_link;
} bNodeLinkDrag;
diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c
index 80601747f2e..4fa0c8c3c5a 100644
--- a/source/blender/editors/space_node/node_relationships.c
+++ b/source/blender/editors/space_node/node_relationships.c
@@ -224,6 +224,12 @@ static void pick_link(const bContext *C,
BLI_addtail(&nldrag->links, linkdata);
nodeRemLink(snode->edittree, link_to_pick);
+
+ BLI_assert(nldrag->last_node_hovered_while_dragging_a_link != NULL);
+
+ sort_multi_input_socket_links(
+ snode, nldrag->last_node_hovered_while_dragging_a_link, NULL,NULL);
+
/* Send changed event to original link->tonode. */
if (node) {
snode_update(snode, node);
@@ -895,7 +901,9 @@ static void node_link_find_socket(bContext *C, wmOperator *op, float cursor[2])
existing_link_connected_to_fromsock->multi_input_socket_index;
continue;
}
- sort_multi_input_socket_links(snode, tnode, link, cursor);
+ if(link->tosock && link->tosock->flag & SOCK_MULTI_INPUT){
+ sort_multi_input_socket_links(snode, tnode, link, cursor);
+ }
}
}
else {
@@ -1038,6 +1046,7 @@ static bNodeLinkDrag *node_link_init(Main *bmain, SpaceNode *snode, float cursor
/* or an input? */
else if (node_find_indicated_socket(snode, &node, &sock, cursor, SOCK_IN)) {
nldrag = MEM_callocN(sizeof(bNodeLinkDrag), "drag link op customdata");
+ nldrag->last_node_hovered_while_dragging_a_link = node;
const int num_links = nodeCountSocketLinks(snode->edittree, sock);
if (num_links > 0) {