Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_node/node_relationships.cc
| Show First 20 Lines • Show All 896 Lines • ▼ Show 20 Lines | static void add_dragged_links_to_tree(bContext &C, bNodeLinkDrag &nldrag) | ||||
| for (const bNodeLink &link : nldrag.links) { | for (const bNodeLink &link : nldrag.links) { | ||||
| if (!link.tosock || !link.fromsock) { | if (!link.tosock || !link.fromsock) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| /* Before actually adding the link let nodes perform special link insertion handling. */ | /* Before actually adding the link let nodes perform special link insertion handling. */ | ||||
| bNodeLink *new_link = MEM_new<bNodeLink>(__func__, link); | bNodeLink *new_link = MEM_new<bNodeLink>(__func__, link); | ||||
| if (link.fromnode->typeinfo->insert_link) { | if (link.fromnode->typeinfo->insert_link) { | ||||
| link.fromnode->typeinfo->insert_link(&ntree, link.fromnode, new_link); | if (!link.fromnode->typeinfo->insert_link(&ntree, link.fromnode, new_link)) { | ||||
| continue; | |||||
| } | |||||
| } | } | ||||
| if (link.tonode->typeinfo->insert_link) { | if (link.tonode->typeinfo->insert_link) { | ||||
| link.tonode->typeinfo->insert_link(&ntree, link.tonode, new_link); | if (!link.tonode->typeinfo->insert_link(&ntree, link.tonode, new_link)) { | ||||
| continue; | |||||
| } | |||||
| } | } | ||||
| /* Add link to the node tree. */ | /* Add link to the node tree. */ | ||||
| BLI_addtail(&ntree.links, new_link); | BLI_addtail(&ntree.links, new_link); | ||||
| BKE_ntree_update_tag_link_added(&ntree, new_link); | BKE_ntree_update_tag_link_added(&ntree, new_link); | ||||
| /* We might need to remove a link. */ | /* We might need to remove a link. */ | ||||
| node_remove_extra_links(snode, *new_link); | node_remove_extra_links(snode, *new_link); | ||||
| ▲ Show 20 Lines • Show All 1,515 Lines • Show Last 20 Lines | |||||