Page Menu
Home
Search
Configure Global Search
Log In
Paste
P2701
Normal Node Socket Builder
Active
Public
Actions
Authored by
Aaron Carlisle (Blendify)
on Jan 5 2022, 7:37 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Tags
None
Subscribers
None
diff --git a/source/blender/nodes/shader/nodes/node_shader_normal.cc b/source/blender/nodes/shader/nodes/node_shader_normal.cc
index d6caa4219f9..d797992fd64 100644
--- a/source/blender/nodes/shader/nodes/node_shader_normal.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_normal.cc
@@ -25,17 +25,16 @@
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"));
+ b.add_output<decl::Vector>(N_("Dot"));
+}
static int gpu_shader_normal(GPUMaterial *mat,
bNode *node,
@@ -56,7 +55,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);
Event Timeline
Aaron Carlisle (Blendify)
created this paste.
Jan 5 2022, 7:37 PM
Log In to Comment