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
This commit is contained in:
Omar Emara 2021-11-29 12:34:11 +02:00 committed by Philipp Oeser
parent 99efb95441
commit 61fe0d6264
Notes: blender-bot 2023-02-14 03:00:45 +01:00
Referenced by issue #93479, 3.0 Potential candidates for corrective releases
Referenced by issue #93438, Custom nodes no longer get inserted in between two linked nodes
Referenced by issue #93430, Custom node sockets don't get relinked when dropping a node on an existing link
1 changed files with 8 additions and 7 deletions

View File

@ -2158,18 +2158,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:
@ -2178,7 +2179,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;
}