diff options
author | Aaron Carlisle <Blendify> | 2021-12-06 19:59:26 +0300 |
---|---|---|
committer | Aaron Carlisle <carlisle.b3d@gmail.com> | 2021-12-06 19:59:52 +0300 |
commit | 0bd3cad04edf4bf9b9d3b1353f955534aa5e6740 (patch) | |
tree | 1ab5bd8afd56508e8672b6448dd8462e1941fb40 /source/blender/nodes/shader | |
parent | f72cc47d8edf849af98e196f721022bacf86a5e7 (diff) |
Nodes: Add Shader Socket to new decleration API
This commit adds the shader socket type to the new socket builder api.
As a test, this commit also converts the Add Shader node to the new API
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D13485
Diffstat (limited to 'source/blender/nodes/shader')
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_add_shader.cc | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_add_shader.cc b/source/blender/nodes/shader/nodes/node_shader_add_shader.cc index ea06c11326b..81c7643e18b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_add_shader.cc +++ b/source/blender/nodes/shader/nodes/node_shader_add_shader.cc @@ -23,16 +23,12 @@ namespace blender::nodes::node_shader_add_shader_cc { -static bNodeSocketTemplate sh_node_add_shader_in[] = { - {SOCK_SHADER, N_("Shader")}, - {SOCK_SHADER, N_("Shader")}, - {-1, ""}, -}; - -static bNodeSocketTemplate sh_node_add_shader_out[] = { - {SOCK_SHADER, N_("Shader")}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Shader>(N_("Shader")); + b.add_input<decl::Shader>(N_("Shader"), "Shader_001"); + b.add_output<decl::Shader>(N_("Shader")); +} static int node_shader_gpu_add_shader(GPUMaterial *mat, bNode *node, @@ -53,8 +49,7 @@ void register_node_type_sh_add_shader() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_ADD_SHADER, "Add Shader", NODE_CLASS_SHADER, 0); - node_type_socket_templates( - &ntype, file_ns::sh_node_add_shader_in, file_ns::sh_node_add_shader_out); + ntype.declare = file_ns::node_declare; node_type_init(&ntype, nullptr); node_type_storage(&ntype, "", nullptr, nullptr); node_type_gpu(&ntype, file_ns::node_shader_gpu_add_shader); |