Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWannes Malfait <Wannes>2021-07-28 16:48:31 +0300
committerJacques Lucke <jacques@blender.org>2021-07-28 16:54:17 +0300
commitb304616f2addbba19d1863ea2af73194946df501 (patch)
tree59a1ee6d6267e20219be27ee5a26ae3f759d95ce /source/blender/editors/space_node
parent3db37075f699dd62706f41612d91ae022f286247 (diff)
Fix T90221: geometry viewer node links to other socket types
The viewer node in geometry node trees only supports geometry nodes. This patch ensures that when ctrl shift clicking on a node, it will only link to geometry sockets. Differential Revision: https://developer.blender.org/D12055
Diffstat (limited to 'source/blender/editors/space_node')
-rw-r--r--source/blender/editors/space_node/node_relationships.cc51
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;
+ }
}
}
}