From ab2a7aa0da81678b19e3362b93f89e8302da65d8 Mon Sep 17 00:00:00 2001 From: Omar Emara Date: Mon, 29 Nov 2021 12:34:11 +0200 Subject: [PATCH] Fix T93438: Auto linking do not work for custom sockets Currently, custom sockets are no longer supported for automatic linking when dropping a node on a link. This is because SOCK_CUSTOM is given a negative priority and is ignored. To fix this, SOCK_CUSTOM is now given the lowest priority and the rest of the sockets got their priority incremented. Reviewed By: Jacques Lucke Differential Revision: https://developer.blender.org/D13403 --- .../editors/space_node/node_relationships.cc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/source/blender/editors/space_node/node_relationships.cc b/source/blender/editors/space_node/node_relationships.cc index aee749edbc4..fa84ada0af0 100644 --- a/source/blender/editors/space_node/node_relationships.cc +++ b/source/blender/editors/space_node/node_relationships.cc @@ -2116,18 +2116,19 @@ static int get_main_socket_priority(const bNodeSocket *socket) { switch ((eNodeSocketDatatype)socket->type) { case __SOCK_MESH: - case SOCK_CUSTOM: return -1; - case SOCK_BOOLEAN: + case SOCK_CUSTOM: return 0; - case SOCK_INT: + case SOCK_BOOLEAN: return 1; - case SOCK_FLOAT: + case SOCK_INT: return 2; - case SOCK_VECTOR: + case SOCK_FLOAT: return 3; - case SOCK_RGBA: + case SOCK_VECTOR: return 4; + case SOCK_RGBA: + return 5; case SOCK_STRING: case SOCK_SHADER: case SOCK_OBJECT: @@ -2136,7 +2137,7 @@ static int get_main_socket_priority(const bNodeSocket *socket) case SOCK_COLLECTION: case SOCK_TEXTURE: case SOCK_MATERIAL: - return 5; + return 6; } return -1; }