[Bf-blender-cvs] [6110f3aa1f4] master: Cleanup: Use new socket builder API
Aaron Carlisle
noreply at git.blender.org
Mon Jan 10 00:25:02 CET 2022
Commit: 6110f3aa1f4df2f477c88cbe6f57747f3ea2717a
Author: Aaron Carlisle
Date: Sun Jan 9 17:44:36 2022 -0500
Branches: master
https://developer.blender.org/rB6110f3aa1f4df2f477c88cbe6f57747f3ea2717a
Cleanup: Use new socket builder API
===================================================================
M source/blender/nodes/shader/nodes/node_shader_normal.cc
===================================================================
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);
More information about the Bf-blender-cvs
mailing list