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:
authorAaron Carlisle <carlisle.b3d@gmail.com>2022-01-09 19:48:23 +0300
committerAaron Carlisle <carlisle.b3d@gmail.com>2022-01-09 19:49:08 +0300
commitca0c69eaeb14a8e235866dba7a4b82382ac8698c (patch)
tree1419d000bd90f4c65fbb007b9722792b128cabce /source/blender/editors/space_node/node_templates.cc
parent5519a6a52062cb240fa00bb97a261bee38974bf2 (diff)
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
Diffstat (limited to 'source/blender/editors/space_node/node_templates.cc')
-rw-r--r--source/blender/editors/space_node/node_templates.cc37
1 files changed, 31 insertions, 6 deletions
diff --git a/source/blender/editors/space_node/node_templates.cc b/source/blender/editors/space_node/node_templates.cc
index 492237477c1..74c0d2124cd 100644
--- a/source/blender/editors/space_node/node_templates.cc
+++ b/source/blender/editors/space_node/node_templates.cc
@@ -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;
}