diff options
author | Aaron Carlisle <carlisle.b3d@gmail.com> | 2022-01-09 07:16:55 +0300 |
---|---|---|
committer | Aaron Carlisle <carlisle.b3d@gmail.com> | 2022-01-09 07:16:55 +0300 |
commit | ed1ced24848824a4acbaaf7aa7ccb34441f6a8f4 (patch) | |
tree | 34bc7a082099ceda73c393eaf89849f5df3b72a1 /source/blender | |
parent | 9620fdc9864405f9fe53493895f9e9d8592fe365 (diff) |
Cleanup: Use new socket builder API
Diffstat (limited to 'source/blender')
11 files changed, 102 insertions, 148 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.cc b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.cc index 75e1b372601..94b9a61c602 100644 --- a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.cc +++ b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.cc @@ -25,19 +25,15 @@ namespace blender::nodes::node_shader_hueSatVal_cc { -/* **************** Hue Saturation ******************** */ -static bNodeSocketTemplate sh_node_hue_sat_in[] = { - {SOCK_FLOAT, N_("Hue"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, - {SOCK_FLOAT, N_("Saturation"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_NONE}, - {SOCK_FLOAT, N_("Value"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_NONE}, - {SOCK_FLOAT, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f}, - {-1, ""}, -}; -static bNodeSocketTemplate sh_node_hue_sat_out[] = { - {SOCK_RGBA, N_("Color")}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Float>(N_("Hue")).default_value(0.5f).min(0.0f).max(1.0f); + b.add_input<decl::Float>(N_("Saturation")).default_value(1.0f).min(0.0f).max(2.0f); + b.add_input<decl::Float>(N_("Value")).default_value(1.0f).min(0.0f).max(2.0f); + b.add_input<decl::Float>(N_("Fac")).default_value(1.0f).min(0.0f).max(1.0f).subtype(PROP_FACTOR); + b.add_input<decl::Color>(N_("Color")).default_value({0.8f, 0.8f, 0.8f, 1.0f}); + b.add_output<decl::Color>(N_("Color")); +} static int gpu_shader_hue_sat(GPUMaterial *mat, bNode *node, @@ -57,7 +53,7 @@ void register_node_type_sh_hue_sat() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR); - node_type_socket_templates(&ntype, file_ns::sh_node_hue_sat_in, file_ns::sh_node_hue_sat_out); + ntype.declare = file_ns::node_declare; node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_gpu(&ntype, file_ns::gpu_shader_hue_sat); diff --git a/source/blender/nodes/shader/nodes/node_shader_ies_light.cc b/source/blender/nodes/shader/nodes/node_shader_ies_light.cc index a107fd83b0e..481524dadc0 100644 --- a/source/blender/nodes/shader/nodes/node_shader_ies_light.cc +++ b/source/blender/nodes/shader/nodes/node_shader_ies_light.cc @@ -21,18 +21,12 @@ namespace blender::nodes::node_shader_ies_light_cc { -/* **************** IES Light ******************** */ - -static bNodeSocketTemplate sh_node_tex_ies_in[] = { - {SOCK_VECTOR, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - {SOCK_FLOAT, N_("Strength"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000000.0f, PROP_NONE}, - {-1, ""}, -}; - -static bNodeSocketTemplate sh_node_tex_ies_out[] = { - {SOCK_FLOAT, N_("Fac")}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Vector>(N_("Vector")).hide_value(); + b.add_input<decl::Float>(N_("Strength")).default_value(1.0f).min(0.0f).max(1000000.0f); + b.add_output<decl::Float>(N_("Fac")); +} static void node_shader_init_tex_ies(bNodeTree *UNUSED(ntree), bNode *node) { @@ -50,7 +44,7 @@ void register_node_type_sh_tex_ies() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_TEX_IES, "IES Texture", NODE_CLASS_TEXTURE); - node_type_socket_templates(&ntype, file_ns::sh_node_tex_ies_in, file_ns::sh_node_tex_ies_out); + ntype.declare = file_ns::node_declare; node_type_init(&ntype, file_ns::node_shader_init_tex_ies); node_type_storage( &ntype, "NodeShaderTexIES", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/shader/nodes/node_shader_invert.cc b/source/blender/nodes/shader/nodes/node_shader_invert.cc index bcdb7ca7b00..3b5f4cb1d38 100644 --- a/source/blender/nodes/shader/nodes/node_shader_invert.cc +++ b/source/blender/nodes/shader/nodes/node_shader_invert.cc @@ -25,13 +25,12 @@ namespace blender::nodes::node_shader_invert_cc { -/* **************** INVERT ******************** */ -static bNodeSocketTemplate sh_node_invert_in[] = { - {SOCK_FLOAT, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_RGBA, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f}, - {-1, ""}}; - -static bNodeSocketTemplate sh_node_invert_out[] = {{SOCK_RGBA, N_("Color")}, {-1, ""}}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Float>(N_("Fac")).default_value(1.0f).min(0.0f).max(1.0f).subtype(PROP_FACTOR); + b.add_input<decl::Color>(N_("Color")).default_value({0.0f, 0.0f, 0.0f, 1.0f}); + b.add_output<decl::Color>(N_("Color")); +} static int gpu_shader_invert(GPUMaterial *mat, bNode *node, @@ -51,7 +50,7 @@ void register_node_type_sh_invert() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR); - node_type_socket_templates(&ntype, file_ns::sh_node_invert_in, file_ns::sh_node_invert_out); + ntype.declare = file_ns::node_declare; node_type_gpu(&ntype, file_ns::gpu_shader_invert); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/shader/nodes/node_shader_layer_weight.cc b/source/blender/nodes/shader/nodes/node_shader_layer_weight.cc index f78bbcaacaa..b4210ce154c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_layer_weight.cc +++ b/source/blender/nodes/shader/nodes/node_shader_layer_weight.cc @@ -21,19 +21,13 @@ namespace blender::nodes::node_shader_layer_weight_cc { -/* **************** Layer Weight ******************** */ - -static bNodeSocketTemplate sh_node_layer_weight_in[] = { - {SOCK_FLOAT, N_("Blend"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.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_layer_weight_out[] = { - {SOCK_FLOAT, N_("Fresnel"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Facing"), 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_("Blend")).default_value(0.5f).min(0.0f).max(1.0f); + b.add_input<decl::Vector>(N_("Normal")).hide_value(); + b.add_output<decl::Float>(N_("Fresnel")); + b.add_output<decl::Float>(N_("Facing")); +} static int node_shader_gpu_layer_weight(GPUMaterial *mat, bNode *node, @@ -62,8 +56,7 @@ void register_node_type_sh_layer_weight() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_LAYER_WEIGHT, "Layer Weight", NODE_CLASS_INPUT); - node_type_socket_templates( - &ntype, file_ns::sh_node_layer_weight_in, file_ns::sh_node_layer_weight_out); + ntype.declare = file_ns::node_declare; node_type_gpu(&ntype, file_ns::node_shader_gpu_layer_weight); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/shader/nodes/node_shader_light_falloff.cc b/source/blender/nodes/shader/nodes/node_shader_light_falloff.cc index 6c2baa01e54..50eea2b3643 100644 --- a/source/blender/nodes/shader/nodes/node_shader_light_falloff.cc +++ b/source/blender/nodes/shader/nodes/node_shader_light_falloff.cc @@ -21,22 +21,14 @@ namespace blender::nodes::node_shader_light_falloff_cc { -/* **************** INPUT ********************* */ - -static bNodeSocketTemplate sh_node_light_falloff_in[] = { - {SOCK_FLOAT, N_("Strength"), 100.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000000.0f}, - {SOCK_FLOAT, N_("Smooth"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, - {-1, ""}, -}; - -/* **************** OUTPUT ******************** */ - -static bNodeSocketTemplate sh_node_light_falloff_out[] = { - {SOCK_FLOAT, N_("Quadratic"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Linear"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Constant"), 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_("Strength")).default_value(100.0f).min(0.0f).max(1000000.0f); + b.add_input<decl::Float>(N_("Smooth")).default_value(0.0f).min(0.0f).max(1000.0f); + b.add_output<decl::Float>(N_("Quadratic")); + b.add_output<decl::Float>(N_("Linear")); + b.add_output<decl::Float>(N_("Constant")); +} static int node_shader_gpu_light_falloff(GPUMaterial *mat, bNode *node, @@ -57,8 +49,7 @@ void register_node_type_sh_light_falloff() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_LIGHT_FALLOFF, "Light Falloff", NODE_CLASS_OP_COLOR); - node_type_socket_templates( - &ntype, file_ns::sh_node_light_falloff_in, file_ns::sh_node_light_falloff_out); + ntype.declare = file_ns::node_declare; node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_gpu(&ntype, file_ns::node_shader_gpu_light_falloff); diff --git a/source/blender/nodes/shader/nodes/node_shader_mapping.cc b/source/blender/nodes/shader/nodes/node_shader_mapping.cc index 758b675f9d6..4d25ae815d6 100644 --- a/source/blender/nodes/shader/nodes/node_shader_mapping.cc +++ b/source/blender/nodes/shader/nodes/node_shader_mapping.cc @@ -25,19 +25,29 @@ namespace blender::nodes::node_shader_mapping_cc { -/* **************** MAPPING ******************** */ -static bNodeSocketTemplate sh_node_mapping_in[] = { - {SOCK_VECTOR, N_("Vector"), 0.0f, 0.0f, 0.0f, 1.0f, -FLT_MAX, FLT_MAX, PROP_NONE}, - {SOCK_VECTOR, N_("Location"), 0.0f, 0.0f, 0.0f, 1.0f, -FLT_MAX, FLT_MAX, PROP_TRANSLATION}, - {SOCK_VECTOR, N_("Rotation"), 0.0f, 0.0f, 0.0f, 1.0f, -FLT_MAX, FLT_MAX, PROP_EULER}, - {SOCK_VECTOR, N_("Scale"), 1.0f, 1.0f, 1.0f, 1.0f, -FLT_MAX, FLT_MAX, PROP_XYZ}, - {-1, ""}, -}; - -static bNodeSocketTemplate sh_node_mapping_out[] = { - {SOCK_VECTOR, N_("Vector")}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Vector>(N_("Vector")) + .default_value({0.0f, 0.0f, 0.0f}) + .min(-FLT_MAX) + .max(FLT_MAX); + b.add_input<decl::Vector>(N_("Location")) + .default_value({0.0f, 0.0f, 0.0f}) + .min(-FLT_MAX) + .max(FLT_MAX) + .subtype(PROP_TRANSLATION); + b.add_input<decl::Vector>(N_("Rotation")) + .default_value({0.0f, 0.0f, 0.0f}) + .min(-FLT_MAX) + .max(FLT_MAX) + .subtype(PROP_EULER); + b.add_input<decl::Vector>(N_("Scale")) + .default_value({1.0f, 1.0f, 1.0f}) + .min(-FLT_MAX) + .max(FLT_MAX) + .subtype(PROP_XYZ); + b.add_output<decl::Vector>(N_("Vector")); +} static const char *gpu_shader_get_name(int mode) { @@ -83,7 +93,7 @@ void register_node_type_sh_mapping() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_MAPPING, "Mapping", NODE_CLASS_OP_VECTOR); - node_type_socket_templates(&ntype, file_ns::sh_node_mapping_in, file_ns::sh_node_mapping_out); + ntype.declare = file_ns::node_declare; node_type_gpu(&ntype, file_ns::gpu_shader_mapping); node_type_update(&ntype, file_ns::node_shader_update_mapping); diff --git a/source/blender/nodes/shader/nodes/node_shader_normal_map.cc b/source/blender/nodes/shader/nodes/node_shader_normal_map.cc index ca75a29e6fe..cd99d0a64c9 100644 --- a/source/blender/nodes/shader/nodes/node_shader_normal_map.cc +++ b/source/blender/nodes/shader/nodes/node_shader_normal_map.cc @@ -21,18 +21,12 @@ namespace blender::nodes::node_shader_normal_map_cc { -/* **************** OUTPUT ******************** */ - -static bNodeSocketTemplate sh_node_normal_map_in[] = { - {SOCK_FLOAT, N_("Strength"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 10.0f}, - {SOCK_RGBA, N_("Color"), 0.5f, 0.5f, 1.0f, 1.0f, 0.0f, 1.0f}, - {-1, ""}, -}; - -static bNodeSocketTemplate sh_node_normal_map_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_("Strength")).default_value(1.0f).min(0.0f).max(10.0f); + b.add_input<decl::Color>(N_("Color")).default_value({0.5f, 0.5f, 1.0f, 1.0f}); + b.add_output<decl::Vector>(N_("Normal")); +} static void node_shader_init_normal_map(bNodeTree *UNUSED(ntree), bNode *node) { @@ -118,8 +112,7 @@ void register_node_type_sh_normal_map() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_NORMAL_MAP, "Normal Map", NODE_CLASS_OP_VECTOR); - node_type_socket_templates( - &ntype, file_ns::sh_node_normal_map_in, file_ns::sh_node_normal_map_out); + ntype.declare = file_ns::node_declare; node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, file_ns::node_shader_init_normal_map); node_type_storage( diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc b/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc index 723458b7321..31f85441a80 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc @@ -23,18 +23,16 @@ namespace blender::nodes::node_shader_tex_coord_cc { -/* **************** OUTPUT ******************** */ - -static bNodeSocketTemplate sh_node_tex_coord_out[] = { - {SOCK_VECTOR, N_("Generated"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_VECTOR, N_("UV"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_VECTOR, N_("Object"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_VECTOR, N_("Camera"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_VECTOR, N_("Window"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_VECTOR, N_("Reflection"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_output<decl::Vector>(N_("Generated")); + b.add_output<decl::Vector>(N_("Normal")); + b.add_output<decl::Vector>(N_("UV")); + b.add_output<decl::Vector>(N_("Object")); + b.add_output<decl::Vector>(N_("Camera")); + b.add_output<decl::Vector>(N_("Window")); + b.add_output<decl::Vector>(N_("Reflection")); +} static int node_shader_gpu_tex_coord(GPUMaterial *mat, bNode *node, @@ -95,7 +93,7 @@ void register_node_type_sh_tex_coord() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_TEX_COORD, "Texture Coordinate", NODE_CLASS_INPUT); - node_type_socket_templates(&ntype, nullptr, file_ns::sh_node_tex_coord_out); + ntype.declare = file_ns::node_declare; node_type_gpu(&ntype, file_ns::node_shader_gpu_tex_coord); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_environment.cc b/source/blender/nodes/shader/nodes/node_shader_tex_environment.cc index aa96d075f7f..7b947392084 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_environment.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_environment.cc @@ -21,17 +21,11 @@ namespace blender::nodes::node_shader_tex_environment_cc { -/* **************** OUTPUT ******************** */ - -static bNodeSocketTemplate sh_node_tex_environment_in[] = { - {SOCK_VECTOR, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - {-1, ""}, -}; - -static bNodeSocketTemplate sh_node_tex_environment_out[] = { - {SOCK_RGBA, N_("Color"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_NO_INTERNAL_LINK}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Vector>(N_("Vector")).hide_value(); + b.add_output<decl::Color>(N_("Color")).no_muted_links(); +} static void node_shader_init_tex_environment(bNodeTree *UNUSED(ntree), bNode *node) { @@ -144,8 +138,7 @@ void register_node_type_sh_tex_environment() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_TEX_ENVIRONMENT, "Environment Texture", NODE_CLASS_TEXTURE); - node_type_socket_templates( - &ntype, file_ns::sh_node_tex_environment_in, file_ns::sh_node_tex_environment_out); + ntype.declare = file_ns::node_declare; node_type_init(&ntype, file_ns::node_shader_init_tex_environment); node_type_storage( &ntype, "NodeTexEnvironment", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.cc b/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.cc index 31d14d09963..8a42577d35c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.cc @@ -23,18 +23,12 @@ namespace blender::nodes::node_shader_tex_pointdensity_cc { -/* **************** OUTPUT ******************** */ - -static bNodeSocketTemplate sh_node_tex_pointdensity_in[] = { - {SOCK_VECTOR, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - {-1, ""}, -}; - -static bNodeSocketTemplate sh_node_tex_pointdensity_out[] = { - {SOCK_RGBA, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Density"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Vector>(N_("Vector")).hide_value(); + b.add_output<decl::Color>(N_("Color")); + b.add_output<decl::Float>(N_("Density")); +} static void node_shader_init_tex_pointdensity(bNodeTree *UNUSED(ntree), bNode *node) { @@ -76,8 +70,7 @@ void register_node_type_sh_tex_pointdensity() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_TEX_POINTDENSITY, "Point Density", NODE_CLASS_TEXTURE); - node_type_socket_templates( - &ntype, file_ns::sh_node_tex_pointdensity_in, file_ns::sh_node_tex_pointdensity_out); + ntype.declare = file_ns::node_declare; node_type_init(&ntype, file_ns::node_shader_init_tex_pointdensity); node_type_storage(&ntype, "NodeShaderTexPointDensity", diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_sky.cc b/source/blender/nodes/shader/nodes/node_shader_tex_sky.cc index 30ec746c2d0..209d71db1ff 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_sky.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_sky.cc @@ -22,17 +22,11 @@ namespace blender::nodes::node_shader_tex_sky_cc { -/* **************** OUTPUT ******************** */ - -static bNodeSocketTemplate sh_node_tex_sky_in[] = { - {SOCK_VECTOR, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - {-1, ""}, -}; - -static bNodeSocketTemplate sh_node_tex_sky_out[] = { - {SOCK_RGBA, N_("Color"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_NO_INTERNAL_LINK}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Vector>(N_("Vector")).hide_value(); + b.add_output<decl::Color>(N_("Color")).no_muted_links(); +} static void node_shader_init_tex_sky(bNodeTree *UNUSED(ntree), bNode *node) { @@ -215,7 +209,7 @@ void register_node_type_sh_tex_sky() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_TEX_SKY, "Sky Texture", NODE_CLASS_TEXTURE); - node_type_socket_templates(&ntype, file_ns::sh_node_tex_sky_in, file_ns::sh_node_tex_sky_out); + ntype.declare = file_ns::node_declare; node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, file_ns::node_shader_init_tex_sky); node_type_storage(&ntype, "NodeTexSky", node_free_standard_storage, node_copy_standard_storage); |