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:
authorHans Goudey <h.goudey@me.com>2021-09-22 22:39:09 +0300
committerHans Goudey <h.goudey@me.com>2021-09-22 22:39:09 +0300
commitc99cb814520480379276192f044c673ef857447b (patch)
treef8786da60252f0bbb9e0fbed2c8c80bb197e146a /source/blender/nodes/shader/nodes/node_shader_math.cc
parentbd01f4761cf983e411b9c3fd52dd83a3fd9103f8 (diff)
Cleanup: Use new node socket declaration API for some shader nodes
This converts socket declarations for most shader nodes that had already been converted to C++, but skips those that needed a special flag.
Diffstat (limited to 'source/blender/nodes/shader/nodes/node_shader_math.cc')
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_math.cc19
1 files changed, 12 insertions, 7 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_math.cc b/source/blender/nodes/shader/nodes/node_shader_math.cc
index 66c50b6de46..80a27b8e6a1 100644
--- a/source/blender/nodes/shader/nodes/node_shader_math.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_math.cc
@@ -26,13 +26,18 @@
#include "NOD_math_functions.hh"
/* **************** SCALAR MATH ******************** */
-static bNodeSocketTemplate sh_node_math_in[] = {
- {SOCK_FLOAT, N_("Value"), 0.5f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f, PROP_NONE},
- {SOCK_FLOAT, N_("Value"), 0.5f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f, PROP_NONE},
- {SOCK_FLOAT, N_("Value"), 0.0f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f, PROP_NONE},
- {-1, ""}};
-static bNodeSocketTemplate sh_node_math_out[] = {{SOCK_FLOAT, N_("Value")}, {-1, ""}};
+namespace blender::nodes {
+
+static void sh_node_math_declare(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Float>("Value").default_value(0.5f).min(-10000.0f).max(10000.0f);
+ b.add_input<decl::Float>("Value", "Value_001").default_value(0.5f).min(-10000.0f).max(10000.0f);
+ b.add_input<decl::Float>("Value", "Value_002").default_value(0.5f).min(-10000.0f).max(10000.0f);
+ b.add_output<decl::Float>("Value");
+};
+
+} // namespace blender::nodes
static const char *gpu_shader_get_name(int mode)
{
@@ -153,7 +158,7 @@ void register_node_type_sh_math(void)
static bNodeType ntype;
sh_fn_node_type_base(&ntype, SH_NODE_MATH, "Math", NODE_CLASS_CONVERTER, 0);
- node_type_socket_templates(&ntype, sh_node_math_in, sh_node_math_out);
+ ntype.declare = blender::nodes::sh_node_math_declare;
node_type_label(&ntype, node_math_label);
node_type_gpu(&ntype, gpu_shader_math);
node_type_update(&ntype, node_math_update);