Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/intern/node_util.cc
| Show First 20 Lines • Show All 318 Lines • ▼ Show 20 Lines | if (socket_iter->is_visible() && node_link_socket_match(socket_iter, to_socket)) { | ||||
| } | } | ||||
| } | } | ||||
| socket_iter = socket_iter->next ? socket_iter->next : first; /* Wrap around the list end. */ | socket_iter = socket_iter->next ? socket_iter->next : first; /* Wrap around the list end. */ | ||||
| } | } | ||||
| return nullptr; | return nullptr; | ||||
| } | } | ||||
| void node_insert_link_default(bNodeTree *ntree, bNode *node, bNodeLink *link) | bool node_insert_link_default(bNodeTree *ntree, bNode *node, bNodeLink *link) | ||||
| { | { | ||||
| bNodeSocket *socket = link->tosock; | bNodeSocket *socket = link->tosock; | ||||
| if (node != link->tonode) { | if (node != link->tonode) { | ||||
| return; | return true; | ||||
| } | } | ||||
| /* If we're not at the link limit of the target socket, we can skip | /* If we're not at the link limit of the target socket, we can skip | ||||
| * trying to move existing links to another socket. */ | * trying to move existing links to another socket. */ | ||||
| const int to_link_limit = nodeSocketLinkLimit(socket); | const int to_link_limit = nodeSocketLinkLimit(socket); | ||||
| if (socket->runtime->total_inputs + 1 < to_link_limit) { | if (socket->runtime->total_inputs + 1 < to_link_limit) { | ||||
| return; | return true; | ||||
| } | } | ||||
| LISTBASE_FOREACH_MUTABLE (bNodeLink *, to_link, &ntree->links) { | LISTBASE_FOREACH_MUTABLE (bNodeLink *, to_link, &ntree->links) { | ||||
| if (socket == to_link->tosock) { | if (socket == to_link->tosock) { | ||||
| bNodeSocket *new_socket = node_find_linkable_socket(ntree, node, socket); | bNodeSocket *new_socket = node_find_linkable_socket(ntree, node, socket); | ||||
| if (new_socket && new_socket != socket) { | if (new_socket && new_socket != socket) { | ||||
| /* Attempt to redirect the existing link to the new socket. */ | /* Attempt to redirect the existing link to the new socket. */ | ||||
| to_link->tosock = new_socket; | to_link->tosock = new_socket; | ||||
| return; | return true; | ||||
| } | } | ||||
| if (new_socket == nullptr) { | if (new_socket == nullptr) { | ||||
| /* No possible replacement, remove the existing link. */ | /* No possible replacement, remove the existing link. */ | ||||
| nodeRemLink(ntree, to_link); | nodeRemLink(ntree, to_link); | ||||
| return; | return true; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| return true; | |||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Default value RNA access | /** \name Default value RNA access | ||||
| * \{ */ | * \{ */ | ||||
| ▲ Show 20 Lines • Show All 49 Lines • Show Last 20 Lines | |||||