Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_node/node_relationships.c
| Show First 20 Lines • Show All 884 Lines • ▼ Show 20 Lines | if (node_find_indicated_socket(snode, &tnode, &tsock, cursor, SOCK_IN)) { | ||||
| LISTBASE_FOREACH (LinkData *, linkdata, &nldrag->links) { | LISTBASE_FOREACH (LinkData *, linkdata, &nldrag->links) { | ||||
| bNodeLink *link = linkdata->data; | bNodeLink *link = linkdata->data; | ||||
| /* skip if socket is on the same node as the fromsock */ | /* skip if socket is on the same node as the fromsock */ | ||||
| if (tnode && link->fromnode == tnode) { | if (tnode && link->fromnode == tnode) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| /* Skip if tsock is already linked with this output. */ | |||||
| bNodeLink *existing_link_connected_to_fromsock = NULL; | |||||
| LISTBASE_FOREACH (bNodeLink *, existing_link, &snode->edittree->links) { | |||||
| if (existing_link->fromsock == link->fromsock && existing_link->tosock == tsock) { | |||||
| existing_link_connected_to_fromsock = existing_link; | |||||
JacquesLucke: I guess you can add a `break` here? | |||||
| } | |||||
| } | |||||
| /* attach links to the socket */ | /* attach links to the socket */ | ||||
| link->tonode = tnode; | link->tonode = tnode; | ||||
| link->tosock = tsock; | link->tosock = tsock; | ||||
| snode->runtime->last_node_hovered_while_dragging_a_link = tnode; | snode->runtime->last_node_hovered_while_dragging_a_link = tnode; | ||||
| if (existing_link_connected_to_fromsock) { | |||||
| link->multi_input_socket_index = | |||||
| existing_link_connected_to_fromsock->multi_input_socket_index; | |||||
| continue; | |||||
| } | |||||
| sort_multi_input_socket_links(snode, tnode, link, cursor); | sort_multi_input_socket_links(snode, tnode, link, cursor); | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| LISTBASE_FOREACH (LinkData *, linkdata, &nldrag->links) { | LISTBASE_FOREACH (LinkData *, linkdata, &nldrag->links) { | ||||
| bNodeLink *link = linkdata->data; | bNodeLink *link = linkdata->data; | ||||
| if (snode->runtime->last_node_hovered_while_dragging_a_link) { | if (snode->runtime->last_node_hovered_while_dragging_a_link) { | ||||
| sort_multi_input_socket_links( | sort_multi_input_socket_links( | ||||
| ▲ Show 20 Lines • Show All 1,263 Lines • Show Last 20 Lines | |||||
I guess you can add a break here?