diff options
author | Jacques Lucke <jacques@blender.org> | 2021-07-29 11:21:22 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-07-29 11:21:22 +0300 |
commit | 2472b0f0ef669cb704e8ff2bbed549c8903bff17 (patch) | |
tree | 37bdea870d94733b7d46cebb5a4c02537ce210e8 /source/blender/editors/space_node | |
parent | 626be25646de25c00520db8ee7102c44402e399c (diff) | |
parent | d5fd09ab58874a971d21d49eedb46b735e4180f0 (diff) |
Merge branch 'master' into temp-geometry-nodes-fields-prototype
Diffstat (limited to 'source/blender/editors/space_node')
-rw-r--r-- | source/blender/editors/space_node/node_relationships.cc | 51 |
1 files changed, 41 insertions, 10 deletions
diff --git a/source/blender/editors/space_node/node_relationships.cc b/source/blender/editors/space_node/node_relationships.cc index 61a874b2b2d..c6c3ca27d6e 100644 --- a/source/blender/editors/space_node/node_relationships.cc +++ b/source/blender/editors/space_node/node_relationships.cc @@ -664,9 +664,19 @@ static int node_link_viewer(const bContext *C, bNode *tonode) nodeRemLink(snode->edittree, link); /* find a socket after the previously connected socket */ - for (sock = sock->next; sock; sock = sock->next) { - if (!nodeSocketIsHidden(sock)) { - break; + 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) { + if (!nodeSocketIsHidden(sock)) { + break; + } } } } @@ -674,19 +684,40 @@ static int node_link_viewer(const bContext *C, bNode *tonode) if (tonode) { /* Find a selected socket that overrides the socket to connect to */ - LISTBASE_FOREACH (bNodeSocket *, sock2, &tonode->outputs) { - if (!nodeSocketIsHidden(sock2) && sock2->flag & SELECT) { - sock = sock2; - break; + 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) { + if (!nodeSocketIsHidden(sock2) && sock2->flag & SELECT) { + sock = sock2; + break; + } } } } /* find a socket starting from the first socket */ if (!sock) { - for (sock = (bNodeSocket *)tonode->outputs.first; sock; sock = sock->next) { - if (!nodeSocketIsHidden(sock)) { - break; + 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) { + if (!nodeSocketIsHidden(sock)) { + break; + } } } } |