Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_node/node_relationships.c
| Show First 20 Lines • Show All 988 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| bNodeLinkDrag *nldrag = NULL; | bNodeLinkDrag *nldrag = NULL; | ||||
| /* output indicated? */ | /* output indicated? */ | ||||
| bNode *node; | bNode *node; | ||||
| bNodeSocket *sock; | bNodeSocket *sock; | ||||
| if (node_find_indicated_socket(snode, &node, &sock, cursor, SOCK_OUT)) { | if (node_find_indicated_socket(snode, &node, &sock, cursor, SOCK_OUT)) { | ||||
| nldrag = MEM_callocN(sizeof(bNodeLinkDrag), "drag link op customdata"); | 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); | const int num_links = nodeCountSocketLinks(snode->edittree, sock); | ||||
| int link_limit = nodeSocketLinkLimit(sock); | int link_limit = nodeSocketLinkLimit(sock); | ||||
| if (num_links > 0 && (num_links >= link_limit || detach)) { | if (num_links > 0 && (num_links >= link_limit || detach)) { | ||||
| /* dragged links are fixed on input side */ | /* dragged links are fixed on input side */ | ||||
| nldrag->in_out = SOCK_IN; | nldrag->in_out = SOCK_IN; | ||||
| /* detach current links and store them in the operator data */ | /* detach current links and store them in the operator data */ | ||||
| LISTBASE_FOREACH_MUTABLE (bNodeLink *, link, &snode->edittree->links) { | LISTBASE_FOREACH_MUTABLE (bNodeLink *, link, &snode->edittree->links) { | ||||
| Show All 28 Lines | else { | ||||
| LinkData *linkdata = create_drag_link(bmain, snode, node, sock); | LinkData *linkdata = create_drag_link(bmain, snode, node, sock); | ||||
| BLI_addtail(&nldrag->links, linkdata); | BLI_addtail(&nldrag->links, linkdata); | ||||
| } | } | ||||
| } | } | ||||
| /* or an input? */ | /* or an input? */ | ||||
| else if (node_find_indicated_socket(snode, &node, &sock, cursor, SOCK_IN)) { | else if (node_find_indicated_socket(snode, &node, &sock, cursor, SOCK_IN)) { | ||||
| nldrag = MEM_callocN(sizeof(bNodeLinkDrag), "drag link op customdata"); | 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); | const int num_links = nodeCountSocketLinks(snode->edittree, sock); | ||||
| if (num_links > 0) { | if (num_links > 0) { | ||||
| /* dragged links are fixed on output side */ | /* dragged links are fixed on output side */ | ||||
| nldrag->in_out = SOCK_OUT; | nldrag->in_out = SOCK_OUT; | ||||
| /* detach current links and store them in the operator data */ | /* detach current links and store them in the operator data */ | ||||
| bNodeLink *link_to_pick; | bNodeLink *link_to_pick; | ||||
| LISTBASE_FOREACH_MUTABLE (bNodeLink *, link, &snode->edittree->links) { | LISTBASE_FOREACH_MUTABLE (bNodeLink *, link, &snode->edittree->links) { | ||||
| ▲ Show 20 Lines • Show All 1,227 Lines • Show Last 20 Lines | |||||