UI: Make uiTemplateNodeLink work for all socket types
Currently the node link ui template only works with a few socket types. This commit addes support for the rest of the socket type declarations. As pointed out in D13776 currently after recent refactors Shader nodes no longer display in the menu. In the future more socket types will be used in the shader nodes and makes the UI template work better for other node trees. Differential Revision: https://developer.blender.org/D13778
This commit is contained in:
parent
5519a6a520
commit
ca0c69eaeb
|
@ -381,17 +381,42 @@ static Vector<NodeLinkItem> ui_node_link_items(NodeLinkArg *arg,
|
|||
const SocketDeclaration &socket_decl = *socket_decl_ptr;
|
||||
NodeLinkItem item;
|
||||
item.socket_index = index++;
|
||||
/* A socket declaration does not necessarily map to exactly one built-in socket type. So only
|
||||
* check for the types that matter here. */
|
||||
if (dynamic_cast<const decl::Color *>(&socket_decl)) {
|
||||
item.socket_type = SOCK_RGBA;
|
||||
}
|
||||
else if (dynamic_cast<const decl::Float *>(&socket_decl)) {
|
||||
if (dynamic_cast<const decl::Float *>(&socket_decl)) {
|
||||
item.socket_type = SOCK_FLOAT;
|
||||
}
|
||||
else if (dynamic_cast<const decl::Int *>(&socket_decl)) {
|
||||
item.socket_type = SOCK_INT;
|
||||
}
|
||||
else if (dynamic_cast<const decl::Bool *>(&socket_decl)) {
|
||||
item.socket_type = SOCK_BOOLEAN;
|
||||
}
|
||||
else if (dynamic_cast<const decl::Vector *>(&socket_decl)) {
|
||||
item.socket_type = SOCK_VECTOR;
|
||||
}
|
||||
else if (dynamic_cast<const decl::Color *>(&socket_decl)) {
|
||||
item.socket_type = SOCK_RGBA;
|
||||
}
|
||||
else if (dynamic_cast<const decl::String *>(&socket_decl)) {
|
||||
item.socket_type = SOCK_STRING;
|
||||
}
|
||||
else if (dynamic_cast<const decl::Image *>(&socket_decl)) {
|
||||
item.socket_type = SOCK_IMAGE;
|
||||
}
|
||||
else if (dynamic_cast<const decl::Texture *>(&socket_decl)) {
|
||||
item.socket_type = SOCK_TEXTURE;
|
||||
}
|
||||
else if (dynamic_cast<const decl::Material *>(&socket_decl)) {
|
||||
item.socket_type = SOCK_MATERIAL;
|
||||
}
|
||||
else if (dynamic_cast<const decl::Shader *>(&socket_decl)) {
|
||||
item.socket_type = SOCK_SHADER;
|
||||
}
|
||||
else if (dynamic_cast<const decl::Collection *>(&socket_decl)) {
|
||||
item.socket_type = SOCK_COLLECTION;
|
||||
}
|
||||
else if (dynamic_cast<const decl::Object *>(&socket_decl)) {
|
||||
item.socket_type = SOCK_OBJECT;
|
||||
}
|
||||
else {
|
||||
item.socket_type = SOCK_CUSTOM;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue