Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_node/node_relationships.cc
| Show First 20 Lines • Show All 214 Lines • ▼ Show 20 Lines | else { | ||||
| oplink->tonode = node; | oplink->tonode = node; | ||||
| oplink->tosock = sock; | oplink->tosock = sock; | ||||
| } | } | ||||
| oplink->flag |= NODE_LINK_VALID; | oplink->flag |= NODE_LINK_VALID; | ||||
| oplink->flag &= ~NODE_LINK_TEST; | oplink->flag &= ~NODE_LINK_TEST; | ||||
| if (node_connected_to_output(bmain, snode->edittree, node)) { | if (node_connected_to_output(bmain, snode->edittree, node)) { | ||||
| oplink->flag |= NODE_LINK_TEST; | oplink->flag |= NODE_LINK_TEST; | ||||
| } | } | ||||
| oplink->flag |= NODE_LINK_DRAGGED; | |||||
| return linkdata; | return linkdata; | ||||
| } | } | ||||
| static void pick_link(const bContext *C, | static void pick_link(const bContext *C, | ||||
| wmOperator *op, | wmOperator *op, | ||||
| bNodeLinkDrag *nldrag, | bNodeLinkDrag *nldrag, | ||||
| SpaceNode *snode, | SpaceNode *snode, | ||||
| bNode *node, | bNode *node, | ||||
| ▲ Show 20 Lines • Show All 658 Lines • ▼ Show 20 Lines | LISTBASE_FOREACH (LinkData *, linkdata, &nldrag->links) { | ||||
| bNodeLink *link = (bNodeLink *)linkdata->data; | bNodeLink *link = (bNodeLink *)linkdata->data; | ||||
| /* See note below, but basically TEST flag means that the link | /* See note below, but basically TEST flag means that the link | ||||
| * was connected to output (or to a node which affects the | * was connected to output (or to a node which affects the | ||||
| * output). | * output). | ||||
| */ | */ | ||||
| do_tag_update |= (link->flag & NODE_LINK_TEST) != 0; | do_tag_update |= (link->flag & NODE_LINK_TEST) != 0; | ||||
| link->flag &= ~NODE_LINK_DRAGGED; | |||||
| if (apply_links && link->tosock && link->fromsock) { | if (apply_links && link->tosock && link->fromsock) { | ||||
| /* before actually adding the link, | /* before actually adding the link, | ||||
| * let nodes perform special link insertion handling | * let nodes perform special link insertion handling | ||||
| */ | */ | ||||
| if (link->fromnode->typeinfo->insert_link) { | if (link->fromnode->typeinfo->insert_link) { | ||||
| link->fromnode->typeinfo->insert_link(ntree, link->fromnode, link); | link->fromnode->typeinfo->insert_link(ntree, link->fromnode, link); | ||||
| } | } | ||||
| if (link->tonode->typeinfo->insert_link) { | if (link->tonode->typeinfo->insert_link) { | ||||
| ▲ Show 20 Lines • Show All 187 Lines • ▼ Show 20 Lines | if (num_links > 0 && (num_links >= link_limit || detach)) { | ||||
| LISTBASE_FOREACH_MUTABLE (bNodeLink *, link, &snode->edittree->links) { | LISTBASE_FOREACH_MUTABLE (bNodeLink *, link, &snode->edittree->links) { | ||||
| if (link->fromsock == sock) { | if (link->fromsock == sock) { | ||||
| LinkData *linkdata = (LinkData *)MEM_callocN(sizeof(LinkData), "drag link op link data"); | LinkData *linkdata = (LinkData *)MEM_callocN(sizeof(LinkData), "drag link op link data"); | ||||
| bNodeLink *oplink = (bNodeLink *)MEM_callocN(sizeof(bNodeLink), "drag link op link"); | bNodeLink *oplink = (bNodeLink *)MEM_callocN(sizeof(bNodeLink), "drag link op link"); | ||||
| linkdata->data = oplink; | linkdata->data = oplink; | ||||
| *oplink = *link; | *oplink = *link; | ||||
| oplink->next = oplink->prev = nullptr; | oplink->next = oplink->prev = nullptr; | ||||
| oplink->flag |= NODE_LINK_VALID; | oplink->flag |= NODE_LINK_VALID; | ||||
| oplink->flag |= NODE_LINK_DRAGGED; | |||||
| /* The link could be disconnected and in that case we | /* The link could be disconnected and in that case we | ||||
| * wouldn't be able to check whether tag update is | * wouldn't be able to check whether tag update is | ||||
| * needed or not when releasing mouse button. So we | * needed or not when releasing mouse button. So we | ||||
| * cache whether the link affects output or not here | * cache whether the link affects output or not here | ||||
| * using TEST flag. | * using TEST flag. | ||||
| */ | */ | ||||
| oplink->flag &= ~NODE_LINK_TEST; | oplink->flag &= ~NODE_LINK_TEST; | ||||
| Show All 37 Lines | if (num_links > 0) { | ||||
| if (link_to_pick != nullptr && !nldrag->from_multi_input_socket) { | if (link_to_pick != nullptr && !nldrag->from_multi_input_socket) { | ||||
| LinkData *linkdata = (LinkData *)MEM_callocN(sizeof(LinkData), "drag link op link data"); | LinkData *linkdata = (LinkData *)MEM_callocN(sizeof(LinkData), "drag link op link data"); | ||||
| bNodeLink *oplink = (bNodeLink *)MEM_callocN(sizeof(bNodeLink), "drag link op link"); | bNodeLink *oplink = (bNodeLink *)MEM_callocN(sizeof(bNodeLink), "drag link op link"); | ||||
| linkdata->data = oplink; | linkdata->data = oplink; | ||||
| *oplink = *link_to_pick; | *oplink = *link_to_pick; | ||||
| oplink->next = oplink->prev = nullptr; | oplink->next = oplink->prev = nullptr; | ||||
| oplink->flag |= NODE_LINK_VALID; | oplink->flag |= NODE_LINK_VALID; | ||||
| oplink->flag |= NODE_LINK_DRAGGED; | |||||
| oplink->flag &= ~NODE_LINK_TEST; | oplink->flag &= ~NODE_LINK_TEST; | ||||
| if (node_connected_to_output(bmain, snode->edittree, link_to_pick->tonode)) { | if (node_connected_to_output(bmain, snode->edittree, link_to_pick->tonode)) { | ||||
| oplink->flag |= NODE_LINK_TEST; | oplink->flag |= NODE_LINK_TEST; | ||||
| } | } | ||||
| BLI_addtail(&nldrag->links, linkdata); | BLI_addtail(&nldrag->links, linkdata); | ||||
| nodeRemLink(snode->edittree, link_to_pick); | nodeRemLink(snode->edittree, link_to_pick); | ||||
| ▲ Show 20 Lines • Show All 1,312 Lines • Show Last 20 Lines | |||||