diff options
author | Aaron Carlisle <carlisle.b3d@gmail.com> | 2022-01-10 01:44:36 +0300 |
---|---|---|
committer | Aaron Carlisle <carlisle.b3d@gmail.com> | 2022-01-10 01:44:36 +0300 |
commit | 6110f3aa1f4df2f477c88cbe6f57747f3ea2717a (patch) | |
tree | e3b3bf44707d126e06505202324946b2a567ee0a /source/blender/nodes | |
parent | ca0c69eaeb14a8e235866dba7a4b82382ac8698c (diff) |
Cleanup: Use new socket builder API
Diffstat (limited to 'source/blender/nodes')
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_normal.cc | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_normal.cc b/source/blender/nodes/shader/nodes/node_shader_normal.cc index d6caa4219f9..e677f36e425 100644 --- a/source/blender/nodes/shader/nodes/node_shader_normal.cc +++ b/source/blender/nodes/shader/nodes/node_shader_normal.cc @@ -25,17 +25,20 @@ namespace blender::nodes::node_shader_normal_cc { -/* **************** NORMAL ******************** */ -static bNodeSocketTemplate sh_node_normal_in[] = { - {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 1.0f, 0.0f, -1.0f, 1.0f, PROP_DIRECTION}, - {-1, ""}, -}; - -static bNodeSocketTemplate sh_node_normal_out[] = { - {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 1.0f, 0.0f, -1.0f, 1.0f, PROP_DIRECTION}, - {SOCK_FLOAT, N_("Dot")}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Vector>(N_("Normal")) + .default_value({0.0f, 0.0f, 1.0f}) + .min(-1.0f) + .max(1.0f) + .subtype(PROP_DIRECTION); + b.add_output<decl::Vector>(N_("Normal")) + .default_value({0.0f, 0.0f, 1.0f}) + .min(-1.0f) + .max(1.0f) + .subtype(PROP_DIRECTION); + b.add_output<decl::Float>(N_("Dot")); +} static int gpu_shader_normal(GPUMaterial *mat, bNode *node, @@ -56,7 +59,7 @@ void register_node_type_sh_normal() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_NORMAL, "Normal", NODE_CLASS_OP_VECTOR); - node_type_socket_templates(&ntype, file_ns::sh_node_normal_in, file_ns::sh_node_normal_out); + ntype.declare = file_ns::node_declare; node_type_gpu(&ntype, file_ns::gpu_shader_normal); nodeRegisterType(&ntype); |