Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_node/node_relationships.cc
| Show First 20 Lines • Show All 658 Lines • ▼ Show 20 Lines | for (link = (bNodeLink *)snode->edittree->links.first; link; link = link->next) { | ||||
| } | } | ||||
| } | } | ||||
| if (link) { | if (link) { | ||||
| /* unlink existing connection */ | /* unlink existing connection */ | ||||
| sock = link->fromsock; | sock = link->fromsock; | ||||
| nodeRemLink(snode->edittree, link); | nodeRemLink(snode->edittree, link); | ||||
| /* find a socket after the previously connected socket */ | /* find a socket after the previously connected socket */ | ||||
| if (ED_node_is_geometry(snode)) { | |||||
| /* Geometry nodes viewer only supports geometry sockets for now. */ | |||||
| for (sock = sock->next; sock; sock = sock->next) { | |||||
| if (sock->type == SOCK_GEOMETRY && !nodeSocketIsHidden(sock)) { | |||||
| break; | |||||
| } | |||||
| } | |||||
| } | |||||
| else { | |||||
| for (sock = sock->next; sock; sock = sock->next) { | for (sock = sock->next; sock; sock = sock->next) { | ||||
| if (!nodeSocketIsHidden(sock)) { | if (!nodeSocketIsHidden(sock)) { | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| if (tonode) { | if (tonode) { | ||||
| /* Find a selected socket that overrides the socket to connect to */ | /* Find a selected socket that overrides the socket to connect to */ | ||||
| if (ED_node_is_geometry(snode)) { | |||||
| /* Geometry nodes viewer only supports geometry sockets for now. */ | |||||
| LISTBASE_FOREACH (bNodeSocket *, sock2, &tonode->outputs) { | |||||
| if (sock2->type == SOCK_GEOMETRY && !nodeSocketIsHidden(sock2) && sock2->flag & SELECT) { | |||||
| sock = sock2; | |||||
| break; | |||||
| } | |||||
| } | |||||
| } | |||||
| else { | |||||
| LISTBASE_FOREACH (bNodeSocket *, sock2, &tonode->outputs) { | LISTBASE_FOREACH (bNodeSocket *, sock2, &tonode->outputs) { | ||||
| if (!nodeSocketIsHidden(sock2) && sock2->flag & SELECT) { | if (!nodeSocketIsHidden(sock2) && sock2->flag & SELECT) { | ||||
| sock = sock2; | sock = sock2; | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| /* find a socket starting from the first socket */ | /* find a socket starting from the first socket */ | ||||
| if (!sock) { | if (!sock) { | ||||
| if (ED_node_is_geometry(snode)) { | |||||
| /* Geometry nodes viewer only supports geometry sockets for now. */ | |||||
| for (sock = (bNodeSocket *)tonode->outputs.first; sock; sock = sock->next) { | |||||
| if (sock->type == SOCK_GEOMETRY && !nodeSocketIsHidden(sock)) { | |||||
| break; | |||||
| } | |||||
| } | |||||
| } | |||||
| else { | |||||
| for (sock = (bNodeSocket *)tonode->outputs.first; sock; sock = sock->next) { | for (sock = (bNodeSocket *)tonode->outputs.first; sock; sock = sock->next) { | ||||
| if (!nodeSocketIsHidden(sock)) { | if (!nodeSocketIsHidden(sock)) { | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| if (sock) { | if (sock) { | ||||
| /* add a new viewer if none exists yet */ | /* add a new viewer if none exists yet */ | ||||
| if (!viewer_node) { | if (!viewer_node) { | ||||
| /* XXX location is a quick hack, just place it next to the linked socket */ | /* XXX location is a quick hack, just place it next to the linked socket */ | ||||
| const int viewer_type = ED_node_is_compositor(snode) ? CMP_NODE_VIEWER : GEO_NODE_VIEWER; | const int viewer_type = ED_node_is_compositor(snode) ? CMP_NODE_VIEWER : GEO_NODE_VIEWER; | ||||
| viewer_node = node_add_node(C, nullptr, viewer_type, sock->locx + 100, sock->locy); | viewer_node = node_add_node(C, nullptr, viewer_type, sock->locx + 100, sock->locy); | ||||
| if (!viewer_node) { | if (!viewer_node) { | ||||
| ▲ Show 20 Lines • Show All 1,730 Lines • Show Last 20 Lines | |||||