diff options
author | Aaron Carlisle <carlisle.b3d@gmail.com> | 2022-01-08 07:52:19 +0300 |
---|---|---|
committer | Aaron Carlisle <carlisle.b3d@gmail.com> | 2022-01-08 07:53:57 +0300 |
commit | 937aa8e1142300e0ba82f6f9b9ddb9908be54b9c (patch) | |
tree | fa387cbf2c4be5910cf59fb4e4e3d63eb71d2c33 | |
parent | 90e5ce6ab513e733dddecddb65ed4f303c5589f7 (diff) |
Cleanup: Use new socket builder API
10 files changed, 100 insertions, 136 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_attribute.cc b/source/blender/nodes/shader/nodes/node_shader_attribute.cc index 3e9c57df7cf..8cf48306641 100644 --- a/source/blender/nodes/shader/nodes/node_shader_attribute.cc +++ b/source/blender/nodes/shader/nodes/node_shader_attribute.cc @@ -21,15 +21,13 @@ namespace blender::nodes::node_shader_attribute_cc { -/* **************** OUTPUT ******************** */ - -static bNodeSocketTemplate sh_node_attribute_out[] = { - {SOCK_RGBA, N_("Color")}, - {SOCK_VECTOR, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Fac"), 0.0f, 0.0f, 0.0f, 0.0f, -FLT_MAX, FLT_MAX, PROP_FACTOR}, - {SOCK_FLOAT, N_("Alpha"), 0.0f, 0.0f, 0.0f, 0.0f, -FLT_MAX, FLT_MAX, PROP_FACTOR}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_output<decl::Color>(N_("Color")); + b.add_output<decl::Vector>(N_("Vector")); + b.add_output<decl::Float>(N_("Fac")); + b.add_output<decl::Float>(N_("Alpha")); +} static void node_shader_init_attribute(bNodeTree *UNUSED(ntree), bNode *node) { @@ -75,7 +73,6 @@ static int node_shader_gpu_attribute(GPUMaterial *mat, GPU_stack_link(mat, node, "node_attribute", in, out, cd_attr); - /* for each output. */ int i; LISTBASE_FOREACH_INDEX (bNodeSocket *, sock, &node->outputs, i) { node_shader_gpu_bump_tex_coord(mat, node, &out[i].link); @@ -94,7 +91,7 @@ void register_node_type_sh_attribute() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_ATTRIBUTE, "Attribute", NODE_CLASS_INPUT); - node_type_socket_templates(&ntype, nullptr, file_ns::sh_node_attribute_out); + ntype.declare = file_ns::node_declare; node_type_init(&ntype, file_ns::node_shader_init_attribute); node_type_storage( &ntype, "NodeShaderAttribute", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/shader/nodes/node_shader_background.cc b/source/blender/nodes/shader/nodes/node_shader_background.cc index 39858e36fd1..3b9e71cf842 100644 --- a/source/blender/nodes/shader/nodes/node_shader_background.cc +++ b/source/blender/nodes/shader/nodes/node_shader_background.cc @@ -21,18 +21,12 @@ namespace blender::nodes::node_shader_background_cc { -/* **************** OUTPUT ******************** */ - -static bNodeSocketTemplate sh_node_background_in[] = { - {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Strength"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000000.0f}, - {-1, ""}, -}; - -static bNodeSocketTemplate sh_node_background_out[] = { - {SOCK_SHADER, N_("Background")}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Color")).default_value({0.8f, 0.8f, 0.8f, 1.0f}); + b.add_input<decl::Float>(N_("Strength")).default_value(1.0f).min(0.0f).max(1000000.0f); + b.add_output<decl::Shader>(N_("Background")); +} static int node_shader_gpu_background(GPUMaterial *mat, bNode *node, @@ -53,8 +47,7 @@ void register_node_type_sh_background() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BACKGROUND, "Background", NODE_CLASS_SHADER); - node_type_socket_templates( - &ntype, file_ns::sh_node_background_in, file_ns::sh_node_background_out); + ntype.declare = file_ns::node_declare; node_type_gpu(&ntype, file_ns::node_shader_gpu_background); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/shader/nodes/node_shader_bevel.cc b/source/blender/nodes/shader/nodes/node_shader_bevel.cc index a3063358556..aa38eea273c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bevel.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bevel.cc @@ -21,18 +21,12 @@ namespace blender::nodes::node_shader_bevel_cc { -/* **************** OUTPUT ******************** */ - -static bNodeSocketTemplate sh_node_bevel_in[] = { - {SOCK_FLOAT, N_("Radius"), 0.05f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, - {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - {-1, ""}, -}; - -static bNodeSocketTemplate sh_node_bevel_out[] = { - {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Float>(N_("Radius")).default_value(0.05f).min(0.0f).max(1000.0f); + b.add_input<decl::Vector>(N_("Normal")).hide_value(); + b.add_output<decl::Vector>(N_("Normal")); +} static void node_shader_init_bevel(bNodeTree *UNUSED(ntree), bNode *node) { @@ -66,7 +60,7 @@ void register_node_type_sh_bevel() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BEVEL, "Bevel", NODE_CLASS_INPUT); - node_type_socket_templates(&ntype, file_ns::sh_node_bevel_in, file_ns::sh_node_bevel_out); + ntype.declare = file_ns::node_declare; node_type_init(&ntype, file_ns::node_shader_init_bevel); node_type_gpu(&ntype, file_ns::gpu_shader_bevel); diff --git a/source/blender/nodes/shader/nodes/node_shader_brightness.cc b/source/blender/nodes/shader/nodes/node_shader_brightness.cc index e6328c4972a..66bfaba2785 100644 --- a/source/blender/nodes/shader/nodes/node_shader_brightness.cc +++ b/source/blender/nodes/shader/nodes/node_shader_brightness.cc @@ -21,19 +21,13 @@ namespace blender::nodes::node_shader_brightness_cc { -/* **************** Bright and contrast ******************** */ - -static bNodeSocketTemplate sh_node_brightcontrast_in[] = { - {SOCK_RGBA, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, N_("Bright"), 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE}, - {SOCK_FLOAT, N_("Contrast"), 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE}, - {-1, ""}, -}; - -static bNodeSocketTemplate sh_node_brightcontrast_out[] = { - {SOCK_RGBA, N_("Color")}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Color")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_input<decl::Float>(N_("Bright")).default_value(0.0f).min(-100.0f).max(100.0f); + b.add_input<decl::Float>(N_("Contrast")).default_value(0.0f).min(-100.0f).max(100.0f); + b.add_output<decl::Color>(N_("Color")); +} static int gpu_shader_brightcontrast(GPUMaterial *mat, bNode *node, @@ -53,8 +47,7 @@ void register_node_type_sh_brightcontrast() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BRIGHTCONTRAST, "Bright/Contrast", NODE_CLASS_OP_COLOR); - node_type_socket_templates( - &ntype, file_ns::sh_node_brightcontrast_in, file_ns::sh_node_brightcontrast_out); + ntype.declare = file_ns::node_declare; node_type_gpu(&ntype, file_ns::gpu_shader_brightcontrast); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/shader/nodes/node_shader_fresnel.cc b/source/blender/nodes/shader/nodes/node_shader_fresnel.cc index 2abfb57a364..5dba42fcc30 100644 --- a/source/blender/nodes/shader/nodes/node_shader_fresnel.cc +++ b/source/blender/nodes/shader/nodes/node_shader_fresnel.cc @@ -21,17 +21,12 @@ namespace blender::nodes::node_shader_fresnel_cc { -/* **************** Fresnel ******************** */ -static bNodeSocketTemplate sh_node_fresnel_in[] = { - {SOCK_FLOAT, N_("IOR"), 1.45f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, - {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - {-1, ""}, -}; - -static bNodeSocketTemplate sh_node_fresnel_out[] = { - {SOCK_FLOAT, N_("Fac"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Float>(N_("IOR")).default_value(1.45f).min(0.0f).max(1000.0f); + b.add_input<decl::Vector>(N_("Normal")).hide_value(); + b.add_output<decl::Float>(N_("Fac")); +} static int node_shader_gpu_fresnel(GPUMaterial *mat, bNode *node, @@ -60,7 +55,7 @@ void register_node_type_sh_fresnel() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_FRESNEL, "Fresnel", NODE_CLASS_INPUT); - node_type_socket_templates(&ntype, file_ns::sh_node_fresnel_in, file_ns::sh_node_fresnel_out); + ntype.declare = file_ns::node_declare; node_type_gpu(&ntype, file_ns::node_shader_gpu_fresnel); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/shader/nodes/node_shader_hair_info.cc b/source/blender/nodes/shader/nodes/node_shader_hair_info.cc index c5af7e16201..e22a825c066 100644 --- a/source/blender/nodes/shader/nodes/node_shader_hair_info.cc +++ b/source/blender/nodes/shader/nodes/node_shader_hair_info.cc @@ -21,16 +21,16 @@ namespace blender::nodes::node_shader_hair_info_cc { -static bNodeSocketTemplate outputs[] = { - {SOCK_FLOAT, N_("Is Strand"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Intercept"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Length"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Thickness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_VECTOR, N_("Tangent Normal"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - // { SOCK_FLOAT, 0, N_("Fade"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Random")}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_output<decl::Float>(N_("Is Strand")); + b.add_output<decl::Float>(N_("Intercept")); + b.add_output<decl::Float>(N_("Length")); + b.add_output<decl::Float>(N_("Thickness")); + b.add_output<decl::Vector>(N_("Tangent Normal")); + // b.add_output<decl::Float>(N_("Fade")); + b.add_output<decl::Float>(N_("Random")); +} static int node_shader_gpu_hair_info(GPUMaterial *mat, bNode *node, @@ -55,7 +55,7 @@ void register_node_type_sh_hair_info() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_HAIR_INFO, "Hair Info", NODE_CLASS_INPUT); - node_type_socket_templates(&ntype, nullptr, file_ns::outputs); + ntype.declare = file_ns::node_declare; node_type_gpu(&ntype, file_ns::node_shader_gpu_hair_info); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/shader/nodes/node_shader_light_path.cc b/source/blender/nodes/shader/nodes/node_shader_light_path.cc index 9f8e6502ce5..6fbd5751886 100644 --- a/source/blender/nodes/shader/nodes/node_shader_light_path.cc +++ b/source/blender/nodes/shader/nodes/node_shader_light_path.cc @@ -21,24 +21,22 @@ namespace blender::nodes::node_shader_light_path_cc { -/* **************** OUTPUT ******************** */ - -static bNodeSocketTemplate sh_node_light_path_out[] = { - {SOCK_FLOAT, N_("Is Camera Ray"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Is Shadow Ray"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Is Diffuse Ray"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Is Glossy Ray"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Is Singular Ray"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Is Reflection Ray"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Is Transmission Ray"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Ray Length"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Ray Depth"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Diffuse Depth"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Glossy Depth"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Transparent Depth"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Transmission Depth"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_output<decl::Float>(N_("Is Camera Ray")); + b.add_output<decl::Float>(N_("Is Shadow Ray")); + b.add_output<decl::Float>(N_("Is Diffuse Ray")); + b.add_output<decl::Float>(N_("Is Glossy Ray")); + b.add_output<decl::Float>(N_("Is Singular Ray")); + b.add_output<decl::Float>(N_("Is Reflection Ray")); + b.add_output<decl::Float>(N_("Is Transmission Ray")); + b.add_output<decl::Float>(N_("Ray Length")); + b.add_output<decl::Float>(N_("Ray Depth")); + b.add_output<decl::Float>(N_("Diffuse Depth")); + b.add_output<decl::Float>(N_("Glossy Depth")); + b.add_output<decl::Float>(N_("Transparent Depth")); + b.add_output<decl::Float>(N_("Transmission Depth")); +} static int node_shader_gpu_light_path(GPUMaterial *mat, bNode *node, @@ -59,7 +57,7 @@ void register_node_type_sh_light_path() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_LIGHT_PATH, "Light Path", NODE_CLASS_INPUT); - node_type_socket_templates(&ntype, nullptr, file_ns::sh_node_light_path_out); + ntype.declare = file_ns::node_declare; node_type_gpu(&ntype, file_ns::node_shader_gpu_light_path); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/shader/nodes/node_shader_sepcomb_hsv.cc b/source/blender/nodes/shader/nodes/node_shader_sepcomb_hsv.cc index 44cdc5cd402..700e4ce3667 100644 --- a/source/blender/nodes/shader/nodes/node_shader_sepcomb_hsv.cc +++ b/source/blender/nodes/shader/nodes/node_shader_sepcomb_hsv.cc @@ -26,16 +26,14 @@ namespace blender::nodes::node_shader_sepcomb_hsv_cc { /* **************** SEPARATE HSV ******************** */ -static bNodeSocketTemplate sh_node_sephsv_in[] = { - {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f}, - {-1, ""}, -}; -static bNodeSocketTemplate sh_node_sephsv_out[] = { - {SOCK_FLOAT, N_("H")}, - {SOCK_FLOAT, N_("S")}, - {SOCK_FLOAT, N_("V")}, - {-1, ""}, -}; + +static void node_declare_sephsv(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Color")).default_value({0.8f, 0.8f, 0.8f, 1.0}); + b.add_output<decl::Float>(N_("H")); + b.add_output<decl::Float>(N_("S")); + b.add_output<decl::Float>(N_("V")); +} static int gpu_shader_sephsv(GPUMaterial *mat, bNode *node, @@ -55,7 +53,7 @@ void register_node_type_sh_sephsv() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_SEPHSV, "Separate HSV", NODE_CLASS_CONVERTER); - node_type_socket_templates(&ntype, file_ns::sh_node_sephsv_in, file_ns::sh_node_sephsv_out); + ntype.declare = file_ns::node_declare_sephsv; node_type_gpu(&ntype, file_ns::gpu_shader_sephsv); nodeRegisterType(&ntype); @@ -64,16 +62,14 @@ void register_node_type_sh_sephsv() namespace blender::nodes::node_shader_sepcomb_hsv_cc { /* **************** COMBINE HSV ******************** */ -static bNodeSocketTemplate sh_node_combhsv_in[] = { - {SOCK_FLOAT, N_("H"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED}, - {SOCK_FLOAT, N_("S"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED}, - {SOCK_FLOAT, N_("V"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED}, - {-1, ""}, -}; -static bNodeSocketTemplate sh_node_combhsv_out[] = { - {SOCK_RGBA, N_("Color")}, - {-1, ""}, -}; + +static void node_declare_combhsv(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Float>(N_("H")).default_value(0.0f).min(0.0f).max(1.0f).subtype(PROP_UNSIGNED); + b.add_input<decl::Float>(N_("S")).default_value(0.0f).min(0.0f).max(1.0f).subtype(PROP_UNSIGNED); + b.add_input<decl::Float>(N_("V")).default_value(0.0f).min(0.0f).max(1.0f).subtype(PROP_UNSIGNED); + b.add_output<decl::Color>(N_("Color")); +} static int gpu_shader_combhsv(GPUMaterial *mat, bNode *node, @@ -93,7 +89,7 @@ void register_node_type_sh_combhsv() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_COMBHSV, "Combine HSV", NODE_CLASS_CONVERTER); - node_type_socket_templates(&ntype, file_ns::sh_node_combhsv_in, file_ns::sh_node_combhsv_out); + ntype.declare = file_ns::node_declare_combhsv; node_type_gpu(&ntype, file_ns::gpu_shader_combhsv); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/shader/nodes/node_shader_squeeze.cc b/source/blender/nodes/shader/nodes/node_shader_squeeze.cc index f71b6a3e4e5..83965160019 100644 --- a/source/blender/nodes/shader/nodes/node_shader_squeeze.cc +++ b/source/blender/nodes/shader/nodes/node_shader_squeeze.cc @@ -25,14 +25,13 @@ namespace blender::nodes::node_shader_squeeze_cc { -/* **************** VALUE SQUEEZE ******************** */ -static bNodeSocketTemplate sh_node_squeeze_in[] = { - {SOCK_FLOAT, N_("Value"), 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE}, - {SOCK_FLOAT, N_("Width"), 1.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE}, - {SOCK_FLOAT, N_("Center"), 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE}, - {-1, ""}}; - -static bNodeSocketTemplate sh_node_squeeze_out[] = {{SOCK_FLOAT, N_("Value")}, {-1, ""}}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Float>(N_("Value")).default_value(0.0f).min(-100.0f).max(100.0f); + b.add_input<decl::Float>(N_("Width")).default_value(1.0f).min(-100.0f).max(100.0f); + b.add_input<decl::Float>(N_("Center")).default_value(0.0f).min(-100.0f).max(100.0f); + b.add_output<decl::Float>(N_("Value")); +} static int gpu_shader_squeeze(GPUMaterial *mat, bNode *node, @@ -52,7 +51,7 @@ void register_node_type_sh_squeeze() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_SQUEEZE, "Squeeze Value", NODE_CLASS_CONVERTER); - node_type_socket_templates(&ntype, file_ns::sh_node_squeeze_in, file_ns::sh_node_squeeze_out); + ntype.declare = file_ns::node_declare; node_type_gpu(&ntype, file_ns::gpu_shader_squeeze); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/shader/nodes/node_shader_vector_transform.cc b/source/blender/nodes/shader/nodes/node_shader_vector_transform.cc index 30bc3f020b1..d5960910042 100644 --- a/source/blender/nodes/shader/nodes/node_shader_vector_transform.cc +++ b/source/blender/nodes/shader/nodes/node_shader_vector_transform.cc @@ -25,14 +25,14 @@ namespace blender::nodes::node_shader_vector_transform_cc { -/* **************** Vector Transform ******************** */ -static bNodeSocketTemplate sh_node_vect_transform_in[] = { - {SOCK_VECTOR, N_("Vector"), 0.5f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f, PROP_NONE}, {-1, ""}}; - -static bNodeSocketTemplate sh_node_vect_transform_out[] = { - {SOCK_VECTOR, N_("Vector")}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Vector>(N_("Vector")) + .default_value({0.5f, 0.5f, 0.5f}) + .min(-10000.0f) + .max(10000.0f); + b.add_output<decl::Vector>(N_("Vector")); +} static void node_shader_init_vect_transform(bNodeTree *UNUSED(ntree), bNode *node) { @@ -139,8 +139,7 @@ void register_node_type_sh_vect_transform() sh_node_type_base(&ntype, SH_NODE_VECT_TRANSFORM, "Vector Transform", NODE_CLASS_OP_VECTOR); node_type_init(&ntype, file_ns::node_shader_init_vect_transform); - node_type_socket_templates( - &ntype, file_ns::sh_node_vect_transform_in, file_ns::sh_node_vect_transform_out); + ntype.declare = file_ns::node_declare; node_type_storage( &ntype, "NodeShaderVectTransform", node_free_standard_storage, node_copy_standard_storage); node_type_gpu(&ntype, file_ns::gpu_shader_vect_transform); |