diff options
author | Aaron Carlisle <Blendify> | 2021-12-04 04:26:10 +0300 |
---|---|---|
committer | Aaron Carlisle <carlisle.b3d@gmail.com> | 2021-12-04 04:26:38 +0300 |
commit | 5ef5a9fc24668aa264fe0558db9c0fb1246aa37f (patch) | |
tree | 0730bf610408fac2dd9c7281fdc0627245d7a494 | |
parent | d5920744f4429423e89a56112ede8a8ea87ccbbb (diff) |
Compositor: Migrate most nodes to new socket builder API
This patch leaves a out a few nodes:
- Group Nodes
- Image input node
- File output node
- Switch View
- Cryptomatte
These nodes above are a bit more complicated and should be worked on individually.
Differential Revision: https://developer.blender.org/D13266
52 files changed, 648 insertions, 490 deletions
diff --git a/source/blender/nodes/composite/nodes/node_composite_alphaOver.cc b/source/blender/nodes/composite/nodes/node_composite_alphaOver.cc index b6f64ed00c7..262333055d7 100644 --- a/source/blender/nodes/composite/nodes/node_composite_alphaOver.cc +++ b/source/blender/nodes/composite/nodes/node_composite_alphaOver.cc @@ -25,16 +25,17 @@ /* **************** ALPHAOVER ******************** */ -static bNodeSocketTemplate cmp_node_alphaover_in[] = { - {SOCK_FLOAT, N_("Fac"), 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_alphaover_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; +namespace blender::nodes { + +static void cmp_node_alphaover_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_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_input<decl::Color>(N_("Image"), "Image_001").default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_output<decl::Color>(N_("Image")); +} + +} // namespace blender::nodes static void node_alphaover_init(bNodeTree *UNUSED(ntree), bNode *node) { @@ -46,7 +47,7 @@ void register_node_type_cmp_alphaover(void) static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_ALPHAOVER, "Alpha Over", NODE_CLASS_OP_COLOR, 0); - node_type_socket_templates(&ntype, cmp_node_alphaover_in, cmp_node_alphaover_out); + ntype.declare = blender::nodes::cmp_node_alphaover_declare; node_type_init(&ntype, node_alphaover_init); node_type_storage( &ntype, "NodeTwoFloats", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_antialiasing.cc b/source/blender/nodes/composite/nodes/node_composite_antialiasing.cc index 23e63b9a53b..6adba7ee3bf 100644 --- a/source/blender/nodes/composite/nodes/node_composite_antialiasing.cc +++ b/source/blender/nodes/composite/nodes/node_composite_antialiasing.cc @@ -27,10 +27,15 @@ /* **************** Anti-Aliasing (SMAA 1x) ******************** */ -static bNodeSocketTemplate cmp_node_antialiasing_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, {-1, ""}}; +namespace blender::nodes { -static bNodeSocketTemplate cmp_node_antialiasing_out[] = {{SOCK_RGBA, N_("Image")}, {-1, ""}}; +static void cmp_node_antialiasing_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_output<decl::Color>(N_("Image")); +} + +} // namespace blender::nodes static void node_composit_init_antialiasing(bNodeTree *UNUSED(ntree), bNode *node) { @@ -50,7 +55,7 @@ void register_node_type_cmp_antialiasing(void) cmp_node_type_base( &ntype, CMP_NODE_ANTIALIASING, "Anti-Aliasing", NODE_CLASS_OP_FILTER, NODE_PREVIEW); - node_type_socket_templates(&ntype, cmp_node_antialiasing_in, cmp_node_antialiasing_out); + ntype.declare = blender::nodes::cmp_node_antialiasing_declare; node_type_size(&ntype, 170, 140, 200); node_type_init(&ntype, node_composit_init_antialiasing); node_type_storage( diff --git a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.cc b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.cc index 3e724d17a10..3b1171ea11d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.cc +++ b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.cc @@ -24,15 +24,17 @@ #include "node_composite_util.hh" /* **************** BILATERALBLUR ******************** */ -static bNodeSocketTemplate cmp_node_bilateralblur_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_RGBA, N_("Determinator"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}}; -static bNodeSocketTemplate cmp_node_bilateralblur_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; +namespace blender::nodes { + +static void cmp_node_bilateralblur_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_input<decl::Color>(N_("Determinator")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_output<decl::Color>(N_("Image")); +} + +} // namespace blender::nodes static void node_composit_init_bilateralblur(bNodeTree *UNUSED(ntree), bNode *node) { @@ -49,7 +51,7 @@ void register_node_type_cmp_bilateralblur(void) static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_BILATERALBLUR, "Bilateral Blur", NODE_CLASS_OP_FILTER, 0); - node_type_socket_templates(&ntype, cmp_node_bilateralblur_in, cmp_node_bilateralblur_out); + ntype.declare = blender::nodes::cmp_node_bilateralblur_declare; node_type_init(&ntype, node_composit_init_bilateralblur); node_type_storage( &ntype, "NodeBilateralBlurData", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_blur.cc b/source/blender/nodes/composite/nodes/node_composite_blur.cc index c5c0c21929e..5cc19416471 100644 --- a/source/blender/nodes/composite/nodes/node_composite_blur.cc +++ b/source/blender/nodes/composite/nodes/node_composite_blur.cc @@ -25,11 +25,17 @@ #include "node_composite_util.hh" /* **************** BLUR ******************** */ -static bNodeSocketTemplate cmp_node_blur_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, N_("Size"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, - {-1, ""}}; -static bNodeSocketTemplate cmp_node_blur_out[] = {{SOCK_RGBA, N_("Image")}, {-1, ""}}; + +namespace blender::nodes { + +static void cmp_node_blur_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_input<decl::Float>(N_("Size")).default_value(1.0f).min(0.0f).max(1.0f); + b.add_output<decl::Color>(N_("Image")); +} + +} // namespace blender::nodes static void node_composit_init_blur(bNodeTree *UNUSED(ntree), bNode *node) { @@ -43,7 +49,7 @@ void register_node_type_cmp_blur(void) static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_BLUR, "Blur", NODE_CLASS_OP_FILTER, NODE_PREVIEW); - node_type_socket_templates(&ntype, cmp_node_blur_in, cmp_node_blur_out); + ntype.declare = blender::nodes::cmp_node_blur_declare; node_type_init(&ntype, node_composit_init_blur); node_type_storage( &ntype, "NodeBlurData", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_bokehblur.cc b/source/blender/nodes/composite/nodes/node_composite_bokehblur.cc index f130a642e20..9099cae37f1 100644 --- a/source/blender/nodes/composite/nodes/node_composite_bokehblur.cc +++ b/source/blender/nodes/composite/nodes/node_composite_bokehblur.cc @@ -25,15 +25,19 @@ #include "../node_composite_util.hh" /* **************** BLUR ******************** */ -static bNodeSocketTemplate cmp_node_bokehblur_in[] = { - {SOCK_RGBA, N_("Image"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, - {SOCK_RGBA, N_("Bokeh"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Size"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 10.0f}, - {SOCK_FLOAT, N_("Bounding box"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f}, - {-1, ""}}; -static bNodeSocketTemplate cmp_node_bokehblur_out[] = { - {SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, {-1, ""}}; +namespace blender::nodes { + +static void cmp_node_bokehblur_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image")).default_value({0.8f, 0.8f, 0.8f, 1.0f}); + b.add_input<decl::Color>(N_("Bokeh")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_input<decl::Float>(N_("Size")).default_value(1.0f).min(0.0f).max(10.0f); + b.add_input<decl::Float>(N_("Bounding box")).default_value(1.0f).min(0.0f).max(1.0f); + b.add_output<decl::Color>(N_("Image")); +} + +} // namespace blender::nodes static void node_composit_init_bokehblur(bNodeTree *UNUSED(ntree), bNode *node) { @@ -46,7 +50,7 @@ void register_node_type_cmp_bokehblur(void) static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_BOKEHBLUR, "Bokeh Blur", NODE_CLASS_OP_FILTER, 0); - node_type_socket_templates(&ntype, cmp_node_bokehblur_in, cmp_node_bokehblur_out); + ntype.declare = blender::nodes::cmp_node_bokehblur_declare; node_type_init(&ntype, node_composit_init_bokehblur); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_boxmask.cc b/source/blender/nodes/composite/nodes/node_composite_boxmask.cc index cdf96065f97..b4d2a4dba2a 100644 --- a/source/blender/nodes/composite/nodes/node_composite_boxmask.cc +++ b/source/blender/nodes/composite/nodes/node_composite_boxmask.cc @@ -24,13 +24,17 @@ #include "../node_composite_util.hh" /* **************** SCALAR MATH ******************** */ -static bNodeSocketTemplate cmp_node_boxmask_in[] = { - {SOCK_FLOAT, N_("Mask"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Value"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, - {-1, ""}}; -static bNodeSocketTemplate cmp_node_boxmask_out[] = { - {SOCK_FLOAT, N_("Mask"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, {-1, ""}}; +namespace blender::nodes { + +static void cmp_node_boxmask_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Float>(N_("Mask")).default_value(0.0f).min(0.0f).max(1.0f); + b.add_input<decl::Float>(N_("Value")).default_value(1.0f).min(0.0f).max(1.0f); + b.add_output<decl::Float>(N_("Mask")); +} + +} // namespace blender::nodes static void node_composit_init_boxmask(bNodeTree *UNUSED(ntree), bNode *node) { @@ -48,7 +52,7 @@ void register_node_type_cmp_boxmask(void) static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_MASK_BOX, "Box Mask", NODE_CLASS_MATTE, 0); - node_type_socket_templates(&ntype, cmp_node_boxmask_in, cmp_node_boxmask_out); + ntype.declare = blender::nodes::cmp_node_boxmask_declare; node_type_init(&ntype, node_composit_init_boxmask); node_type_storage(&ntype, "NodeBoxMask", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_channelMatte.cc b/source/blender/nodes/composite/nodes/node_composite_channelMatte.cc index e211bc45b17..3d3ed90b198 100644 --- a/source/blender/nodes/composite/nodes/node_composite_channelMatte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_channelMatte.cc @@ -24,16 +24,17 @@ #include "node_composite_util.hh" /* ******************* Channel Matte Node ********************************* */ -static bNodeSocketTemplate cmp_node_channel_matte_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_channel_matte_out[] = { - {SOCK_RGBA, N_("Image")}, - {SOCK_FLOAT, N_("Matte")}, - {-1, ""}, -}; +namespace blender::nodes { + +static void cmp_node_channel_matte_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_output<decl::Color>(N_("Image")); + b.add_output<decl::Float>(N_("Matte")); +} + +} // namespace blender::nodes static void node_composit_init_channel_matte(bNodeTree *UNUSED(ntree), bNode *node) { @@ -56,7 +57,7 @@ void register_node_type_cmp_channel_matte(void) cmp_node_type_base( &ntype, CMP_NODE_CHANNEL_MATTE, "Channel Key", NODE_CLASS_MATTE, NODE_PREVIEW); - node_type_socket_templates(&ntype, cmp_node_channel_matte_in, cmp_node_channel_matte_out); + ntype.declare = blender::nodes::cmp_node_channel_matte_declare; node_type_init(&ntype, node_composit_init_channel_matte); node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.cc b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.cc index 990778160df..e3a79763cf3 100644 --- a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.cc @@ -24,17 +24,18 @@ #include "node_composite_util.hh" /* ******************* Chroma Key ********************************************************** */ -static bNodeSocketTemplate cmp_node_chroma_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_RGBA, N_("Key Color"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; - -static bNodeSocketTemplate cmp_node_chroma_out[] = { - {SOCK_RGBA, N_("Image")}, - {SOCK_FLOAT, N_("Matte")}, - {-1, ""}, -}; + +namespace blender::nodes { + +static void cmp_node_chroma_matte_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_input<decl::Color>(N_("Key Color")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_output<decl::Color>(N_("Image")); + b.add_output<decl::Float>(N_("Matte")); +} + +} // namespace blender::nodes static void node_composit_init_chroma_matte(bNodeTree *UNUSED(ntree), bNode *node) { @@ -52,7 +53,7 @@ void register_node_type_cmp_chroma_matte(void) static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_CHROMA_MATTE, "Chroma Key", NODE_CLASS_MATTE, NODE_PREVIEW); - node_type_socket_templates(&ntype, cmp_node_chroma_in, cmp_node_chroma_out); + ntype.declare = blender::nodes::cmp_node_chroma_matte_declare; node_type_init(&ntype, node_composit_init_chroma_matte); node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_colorMatte.cc b/source/blender/nodes/composite/nodes/node_composite_colorMatte.cc index fc9a0075b14..33a50e35514 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorMatte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_colorMatte.cc @@ -23,18 +23,19 @@ #include "node_composite_util.hh" -/* ******************* Color Key ********************************************************** */ -static bNodeSocketTemplate cmp_node_color_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_RGBA, N_("Key Color"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; - -static bNodeSocketTemplate cmp_node_color_out[] = { - {SOCK_RGBA, N_("Image")}, - {SOCK_FLOAT, N_("Matte")}, - {-1, ""}, -}; +/* ******************* Color Matte ********************************************************** */ + +namespace blender::nodes { + +static void cmp_node_color_matte_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_input<decl::Color>(N_("Key Color")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_output<decl::Color>(N_("Image")); + b.add_output<decl::Float>(N_("Matte")); +} + +} // namespace blender::nodes static void node_composit_init_color_matte(bNodeTree *UNUSED(ntree), bNode *node) { @@ -52,7 +53,7 @@ void register_node_type_cmp_color_matte(void) static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_COLOR_MATTE, "Color Key", NODE_CLASS_MATTE, NODE_PREVIEW); - node_type_socket_templates(&ntype, cmp_node_color_in, cmp_node_color_out); + ntype.declare = blender::nodes::cmp_node_color_matte_declare; node_type_init(&ntype, node_composit_init_color_matte); node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_colorSpill.cc b/source/blender/nodes/composite/nodes/node_composite_colorSpill.cc index 7bdc2e8289e..ad1679bb671 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorSpill.cc +++ b/source/blender/nodes/composite/nodes/node_composite_colorSpill.cc @@ -24,16 +24,17 @@ #include "node_composite_util.hh" /* ******************* Color Spill Suppression ********************************* */ -static bNodeSocketTemplate cmp_node_color_spill_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_color_spill_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; +namespace blender::nodes { + +static void cmp_node_color_spill_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_input<decl::Float>(N_("Fac")).default_value(1.0f).min(0.0f).max(1.0f).subtype(PROP_FACTOR); + b.add_output<decl::Color>(N_("Image")); +} + +} // namespace blender::nodes static void node_composit_init_color_spill(bNodeTree *UNUSED(ntree), bNode *node) { @@ -51,7 +52,7 @@ void register_node_type_cmp_color_spill(void) static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_COLOR_SPILL, "Color Spill", NODE_CLASS_MATTE, 0); - node_type_socket_templates(&ntype, cmp_node_color_spill_in, cmp_node_color_spill_out); + ntype.declare = blender::nodes::cmp_node_color_spill_declare; node_type_init(&ntype, node_composit_init_color_spill); node_type_storage( &ntype, "NodeColorspill", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_cornerpin.cc b/source/blender/nodes/composite/nodes/node_composite_cornerpin.cc index b5ca1fb015e..806fa631fb8 100644 --- a/source/blender/nodes/composite/nodes/node_composite_cornerpin.cc +++ b/source/blender/nodes/composite/nodes/node_composite_cornerpin.cc @@ -23,27 +23,39 @@ #include "node_composite_util.hh" -static bNodeSocketTemplate inputs[] = { - {SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - {SOCK_VECTOR, N_("Upper Left"), 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - {SOCK_VECTOR, N_("Upper Right"), 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - {SOCK_VECTOR, N_("Lower Left"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - {SOCK_VECTOR, N_("Lower Right"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - {-1, ""}, -}; - -static bNodeSocketTemplate outputs[] = { - {SOCK_RGBA, N_("Image")}, - {SOCK_FLOAT, N_("Plane")}, - {-1, ""}, -}; +namespace blender::nodes { + +static void cmp_node_cornerpin_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_input<decl::Vector>(N_("Upper Left")) + .default_value({0.0f, 1.0f, 0.0f}) + .min(0.0f) + .max(1.0f); + b.add_input<decl::Vector>(N_("Upper Right")) + .default_value({1.0f, 1.0f, 0.0f}) + .min(0.0f) + .max(1.0f); + b.add_input<decl::Vector>(N_("Lower Left")) + .default_value({0.0f, 0.0f, 0.0f}) + .min(0.0f) + .max(1.0f); + b.add_input<decl::Vector>(N_("Lower Right")) + .default_value({1.0f, 0.0f, 0.0f}) + .min(0.0f) + .max(1.0f); + b.add_output<decl::Color>(N_("Image")); + b.add_output<decl::Float>(N_("Plane")); +} + +} // namespace blender::nodes void register_node_type_cmp_cornerpin(void) { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_CORNERPIN, "Corner Pin", NODE_CLASS_DISTORT, 0); - node_type_socket_templates(&ntype, inputs, outputs); + ntype.declare = blender::nodes::cmp_node_cornerpin_declare; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_crop.cc b/source/blender/nodes/composite/nodes/node_composite_crop.cc index f07dba8a74b..622d5c52612 100644 --- a/source/blender/nodes/composite/nodes/node_composite_crop.cc +++ b/source/blender/nodes/composite/nodes/node_composite_crop.cc @@ -25,14 +25,15 @@ /* **************** Crop ******************** */ -static bNodeSocketTemplate cmp_node_crop_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_crop_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; +namespace blender::nodes { + +static void cmp_node_crop_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_output<decl::Color>(N_("Image")); +} + +} // namespace blender::nodes static void node_composit_init_crop(bNodeTree *UNUSED(ntree), bNode *node) { @@ -49,7 +50,7 @@ void register_node_type_cmp_crop(void) static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_CROP, "Crop", NODE_CLASS_DISTORT, 0); - node_type_socket_templates(&ntype, cmp_node_crop_in, cmp_node_crop_out); + ntype.declare = blender::nodes::cmp_node_crop_declare; node_type_init(&ntype, node_composit_init_crop); node_type_storage(&ntype, "NodeTwoXYs", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_curves.cc b/source/blender/nodes/composite/nodes/node_composite_curves.cc index 5f99bb57768..0e3ed53e129 100644 --- a/source/blender/nodes/composite/nodes/node_composite_curves.cc +++ b/source/blender/nodes/composite/nodes/node_composite_curves.cc @@ -56,15 +56,16 @@ void register_node_type_cmp_curve_time(void) } /* **************** CURVE VEC ******************** */ -static bNodeSocketTemplate cmp_node_curve_vec_in[] = { - {SOCK_VECTOR, N_("Vector"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_curve_vec_out[] = { - {SOCK_VECTOR, N_("Vector")}, - {-1, ""}, -}; +namespace blender::nodes { + +static void cmp_node_curve_vec_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Vector>(N_("Vector")).default_value({0.0f, 0.0f, 0.0f}).min(-1.0f).max(1.0f); + b.add_output<decl::Vector>(N_("Vector")); +} + +} // namespace blender::nodes static void node_composit_init_curve_vec(bNodeTree *UNUSED(ntree), bNode *node) { @@ -76,7 +77,7 @@ void register_node_type_cmp_curve_vec(void) static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_CURVE_VEC, "Vector Curves", NODE_CLASS_OP_VECTOR, 0); - node_type_socket_templates(&ntype, cmp_node_curve_vec_in, cmp_node_curve_vec_out); + ntype.declare = blender::nodes::cmp_node_curve_vec_declare; node_type_size(&ntype, 200, 140, 320); node_type_init(&ntype, node_composit_init_curve_vec); node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); diff --git a/source/blender/nodes/composite/nodes/node_composite_defocus.cc b/source/blender/nodes/composite/nodes/node_composite_defocus.cc index 1103aff4366..ac4c209a74b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_defocus.cc +++ b/source/blender/nodes/composite/nodes/node_composite_defocus.cc @@ -26,15 +26,17 @@ #include <climits> /* ************ Defocus Node ****************** */ -static bNodeSocketTemplate cmp_node_defocus_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, N_("Z"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_defocus_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; + +namespace blender::nodes { + +static void cmp_node_defocus_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_input<decl::Float>(N_("Z")).default_value(1.0f).min(0.0f).max(1.0f); + b.add_output<decl::Color>(N_("Image")); +} + +} // namespace blender::nodes static void node_composit_init_defocus(bNodeTree *UNUSED(ntree), bNode *node) { @@ -58,7 +60,7 @@ void register_node_type_cmp_defocus(void) static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_DEFOCUS, "Defocus", NODE_CLASS_OP_FILTER, 0); - node_type_socket_templates(&ntype, cmp_node_defocus_in, cmp_node_defocus_out); + ntype.declare = blender::nodes::cmp_node_defocus_declare; node_type_init(&ntype, node_composit_init_defocus); node_type_storage(&ntype, "NodeDefocus", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_denoise.cc b/source/blender/nodes/composite/nodes/node_composite_denoise.cc index ec085794462..cce33debf22 100644 --- a/source/blender/nodes/composite/nodes/node_composite_denoise.cc +++ b/source/blender/nodes/composite/nodes/node_composite_denoise.cc @@ -25,12 +25,21 @@ #include "node_composite_util.hh" -static bNodeSocketTemplate cmp_node_denoise_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f}, - {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - {SOCK_RGBA, N_("Albedo"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - {-1, ""}}; -static bNodeSocketTemplate cmp_node_denoise_out[] = {{SOCK_RGBA, N_("Image")}, {-1, ""}}; +namespace blender::nodes { + +static void cmp_node_denoise_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_input<decl::Vector>(N_("Normal")) + .default_value({0.0f, 0.0f, 0.0f}) + .min(-1.0f) + .max(1.0f) + .hide_value(); + b.add_input<decl::Color>(N_("Albedo")).default_value({1.0f, 1.0f, 1.0f, 1.0f}).hide_value(); + b.add_output<decl::Color>(N_("Image")); +} + +} // namespace blender::nodes static void node_composit_init_denonise(bNodeTree *UNUSED(ntree), bNode *node) { @@ -45,7 +54,7 @@ void register_node_type_cmp_denoise(void) static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_DENOISE, "Denoise", NODE_CLASS_OP_FILTER, 0); - node_type_socket_templates(&ntype, cmp_node_denoise_in, cmp_node_denoise_out); + ntype.declare = blender::nodes::cmp_node_denoise_declare; node_type_init(&ntype, node_composit_init_denonise); node_type_storage(&ntype, "NodeDenoise", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_despeckle.cc b/source/blender/nodes/composite/nodes/node_composite_despeckle.cc index 52d91dabeb1..51a4b0653b3 100644 --- a/source/blender/nodes/composite/nodes/node_composite_despeckle.cc +++ b/source/blender/nodes/composite/nodes/node_composite_despeckle.cc @@ -24,15 +24,17 @@ #include "node_composite_util.hh" /* **************** FILTER ******************** */ -static bNodeSocketTemplate cmp_node_despeckle_in[] = { - {SOCK_FLOAT, N_("Fac"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_despeckle_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; + +namespace blender::nodes { + +static void cmp_node_despeckle_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_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_output<decl::Color>(N_("Image")); +} + +} // namespace blender::nodes static void node_composit_init_despeckle(bNodeTree *UNUSED(ntree), bNode *node) { @@ -45,7 +47,7 @@ void register_node_type_cmp_despeckle(void) static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_DESPECKLE, "Despeckle", NODE_CLASS_OP_FILTER, NODE_PREVIEW); - node_type_socket_templates(&ntype, cmp_node_despeckle_in, cmp_node_despeckle_out); + ntype.declare = blender::nodes::cmp_node_despeckle_declare; node_type_init(&ntype, node_composit_init_despeckle); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_diffMatte.cc b/source/blender/nodes/composite/nodes/node_composite_diffMatte.cc index 1e1a48381b7..9e3ecf9ebb5 100644 --- a/source/blender/nodes/composite/nodes/node_composite_diffMatte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_diffMatte.cc @@ -24,17 +24,18 @@ #include "node_composite_util.hh" /* ******************* channel Difference Matte ********************************* */ -static bNodeSocketTemplate cmp_node_diff_matte_in[] = { - {SOCK_RGBA, N_("Image 1"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_RGBA, N_("Image 2"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; - -static bNodeSocketTemplate cmp_node_diff_matte_out[] = { - {SOCK_RGBA, N_("Image")}, - {SOCK_FLOAT, N_("Matte")}, - {-1, ""}, -}; + +namespace blender::nodes { + +static void cmp_node_diff_matte_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image 1")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_input<decl::Color>(N_("Image 2")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_output<decl::Color>(N_("Image")); + b.add_output<decl::Color>(N_("Matte")); +} + +} // namespace blender::nodes static void node_composit_init_diff_matte(bNodeTree *UNUSED(ntree), bNode *node) { @@ -50,7 +51,7 @@ void register_node_type_cmp_diff_matte(void) cmp_node_type_base( &ntype, CMP_NODE_DIFF_MATTE, "Difference Key", NODE_CLASS_MATTE, NODE_PREVIEW); - node_type_socket_templates(&ntype, cmp_node_diff_matte_in, cmp_node_diff_matte_out); + ntype.declare = blender::nodes::cmp_node_diff_matte_declare; node_type_init(&ntype, node_composit_init_diff_matte); node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_dilate.cc b/source/blender/nodes/composite/nodes/node_composite_dilate.cc index 57884a299da..4953e26c21f 100644 --- a/source/blender/nodes/composite/nodes/node_composite_dilate.cc +++ b/source/blender/nodes/composite/nodes/node_composite_dilate.cc @@ -25,9 +25,15 @@ /* **************** Dilate/Erode ******************** */ -static bNodeSocketTemplate cmp_node_dilateerode_in[] = { - {SOCK_FLOAT, N_("Mask"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, {-1, ""}}; -static bNodeSocketTemplate cmp_node_dilateerode_out[] = {{SOCK_FLOAT, N_("Mask")}, {-1, ""}}; +namespace blender::nodes { + +static void cmp_node_dilate_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Float>(N_("Mask")).default_value(0.0f).min(0.0f).max(1.0f); + b.add_output<decl::Float>(N_("Mask")); +} + +} // namespace blender::nodes static void node_composit_init_dilateerode(bNodeTree *UNUSED(ntree), bNode *node) { @@ -42,7 +48,7 @@ void register_node_type_cmp_dilateerode(void) static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_DILATEERODE, "Dilate/Erode", NODE_CLASS_OP_FILTER, 0); - node_type_socket_templates(&ntype, cmp_node_dilateerode_in, cmp_node_dilateerode_out); + ntype.declare = blender::nodes::cmp_node_dilate_declare; node_type_init(&ntype, node_composit_init_dilateerode); node_type_storage( &ntype, "NodeDilateErode", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_directionalblur.cc b/source/blender/nodes/composite/nodes/node_composite_directionalblur.cc index d9f82ba5009..4250938aa44 100644 --- a/source/blender/nodes/composite/nodes/node_composite_directionalblur.cc +++ b/source/blender/nodes/composite/nodes/node_composite_directionalblur.cc @@ -23,10 +23,15 @@ #include "node_composite_util.hh" -static bNodeSocketTemplate cmp_node_dblur_in[] = {{SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}}; +namespace blender::nodes { -static bNodeSocketTemplate cmp_node_dblur_out[] = {{SOCK_RGBA, N_("Image")}, {-1, ""}}; +static void cmp_node_directional_blur_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_output<decl::Color>(N_("Image")); +} + +} // namespace blender::nodes static void node_composit_init_dblur(bNodeTree *UNUSED(ntree), bNode *node) { @@ -42,7 +47,7 @@ void register_node_type_cmp_dblur(void) static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_DBLUR, "Directional Blur", NODE_CLASS_OP_FILTER, 0); - node_type_socket_templates(&ntype, cmp_node_dblur_in, cmp_node_dblur_out); + ntype.declare = blender::nodes::cmp_node_directional_blur_declare; node_type_init(&ntype, node_composit_init_dblur); node_type_storage( &ntype, "NodeDBlurData", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_displace.cc b/source/blender/nodes/composite/nodes/node_composite_displace.cc index b1ed7f05794..90db3fbcb8e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_displace.cc +++ b/source/blender/nodes/composite/nodes/node_composite_displace.cc @@ -25,24 +25,29 @@ /* **************** Displace ******************** */ -static bNodeSocketTemplate cmp_node_displace_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_VECTOR, N_("Vector"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_TRANSLATION}, - {SOCK_FLOAT, N_("X Scale"), 0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f, PROP_NONE}, - {SOCK_FLOAT, N_("Y Scale"), 0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f, PROP_NONE}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_displace_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; +namespace blender::nodes { + +static void cmp_node_displace_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_input<decl::Vector>(N_("Vector")) + .default_value({1.0f, 1.0f, 1.0f}) + .min(0.0f) + .max(1.0f) + .subtype(PROP_TRANSLATION); + b.add_input<decl::Float>(N_("X Scale")).default_value(0.0f).min(-1000.0f).max(1000.0f); + b.add_input<decl::Float>(N_("Y Scale")).default_value(0.0f).min(-1000.0f).max(1000.0f); + b.add_output<decl::Color>(N_("Image")); +} + +} // namespace blender::nodes void register_node_type_cmp_displace(void) { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_DISPLACE, "Displace", NODE_CLASS_DISTORT, 0); - node_type_socket_templates(&ntype, cmp_node_displace_in, cmp_node_displace_out); + ntype.declare = blender::nodes::cmp_node_displace_declare; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.cc b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.cc index 3f8767ecd08..8c85b488c2c 100644 --- a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.cc @@ -24,17 +24,18 @@ #include "node_composite_util.hh" /* ******************* channel Distance Matte ********************************* */ -static bNodeSocketTemplate cmp_node_distance_matte_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_RGBA, N_("Key Color"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; - -static bNodeSocketTemplate cmp_node_distance_matte_out[] = { - {SOCK_RGBA, N_("Image")}, - {SOCK_FLOAT, N_("Matte")}, - {-1, ""}, -}; + +namespace blender::nodes { + +static void cmp_node_distance_matte_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_input<decl::Color>(N_("Key Color")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_output<decl::Color>(N_("Image")); + b.add_output<decl::Float>(N_("Matte")); +} + +} // namespace blender::nodes static void node_composit_init_distance_matte(bNodeTree *UNUSED(ntree), bNode *node) { @@ -50,7 +51,7 @@ void register_node_type_cmp_distance_matte(void) static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_DIST_MATTE, "Distance Key", NODE_CLASS_MATTE, NODE_PREVIEW); - node_type_socket_templates(&ntype, cmp_node_distance_matte_in, cmp_node_distance_matte_out); + ntype.declare = blender::nodes::cmp_node_distance_matte_declare; node_type_init(&ntype, node_composit_init_distance_matte); node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.cc b/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.cc index 7c9a48efc2d..2b572c35372 100644 --- a/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.cc +++ b/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.cc @@ -21,30 +21,26 @@ * \ingroup cmpnodes */ #include "node_composite_util.hh" + /* **************** Double Edge Mask ******************** */ -static bNodeSocketTemplate cmp_node_doubleedgemask_in[] = { - /* Inner mask socket definition. */ - {SOCK_FLOAT, "Inner Mask", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - /* Outer mask socket definition. */ - {SOCK_FLOAT, "Outer Mask", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - /* Input socket array terminator. */ - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_doubleedgemask_out[] = { - /* Output socket definition. */ - {SOCK_FLOAT, "Mask"}, - /* Output socket array terminator. */ - {-1, ""}, -}; +namespace blender::nodes { + +static void cmp_node_double_edge_mask_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Float>(N_("Inner Mask")).default_value(0.8f).min(0.0f).max(1.0f); + b.add_input<decl::Float>(N_("Outer Mask")).default_value(0.8f).min(0.0f).max(1.0f); + b.add_output<decl::Float>(N_("Mask")); +} + +} // namespace blender::nodes void register_node_type_cmp_doubleedgemask(void) { static bNodeType ntype; /* Allocate a node type data structure. */ cmp_node_type_base(&ntype, CMP_NODE_DOUBLEEDGEMASK, "Double Edge Mask", NODE_CLASS_MATTE, 0); - node_type_socket_templates(&ntype, cmp_node_doubleedgemask_in, cmp_node_doubleedgemask_out); - node_type_socket_templates(&ntype, cmp_node_doubleedgemask_in, cmp_node_doubleedgemask_out); + ntype.declare = blender::nodes::cmp_node_double_edge_mask_declare; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_ellipsemask.cc b/source/blender/nodes/composite/nodes/node_composite_ellipsemask.cc index 67196fb0d35..6ab5450c7e8 100644 --- a/source/blender/nodes/composite/nodes/node_composite_ellipsemask.cc +++ b/source/blender/nodes/composite/nodes/node_composite_ellipsemask.cc @@ -24,13 +24,17 @@ #include "../node_composite_util.hh" /* **************** SCALAR MATH ******************** */ -static bNodeSocketTemplate cmp_node_ellipsemask_in[] = { - {SOCK_FLOAT, N_("Mask"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Value"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, - {-1, ""}}; -static bNodeSocketTemplate cmp_node_ellipsemask_out[] = { - {SOCK_FLOAT, N_("Mask"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, {-1, ""}}; +namespace blender::nodes { + +static void cmp_node_ellipsemask_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Float>(N_("Mask")).default_value(0.0f).min(0.0f).max(1.0f); + b.add_input<decl::Float>(N_("Value")).default_value(1.0f).min(0.0f).max(1.0f); + b.add_output<decl::Float>(N_("Mask")); +} + +} // namespace blender::nodes static void node_composit_init_ellipsemask(bNodeTree *UNUSED(ntree), bNode *node) { @@ -49,7 +53,7 @@ void register_node_type_cmp_ellipsemask(void) static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_MASK_ELLIPSE, "Ellipse Mask", NODE_CLASS_MATTE, 0); - node_type_socket_templates(&ntype, cmp_node_ellipsemask_in, cmp_node_ellipsemask_out); + ntype.declare = blender::nodes::cmp_node_ellipsemask_declare; node_type_size(&ntype, 260, 110, 320); node_type_init(&ntype, node_composit_init_ellipsemask); node_type_storage( diff --git a/source/blender/nodes/composite/nodes/node_composite_filter.cc b/source/blender/nodes/composite/nodes/node_composite_filter.cc index f07619877f4..d5d2be295b8 100644 --- a/source/blender/nodes/composite/nodes/node_composite_filter.cc +++ b/source/blender/nodes/composite/nodes/node_composite_filter.cc @@ -24,22 +24,24 @@ #include "node_composite_util.hh" /* **************** FILTER ******************** */ -static bNodeSocketTemplate cmp_node_filter_in[] = { - {SOCK_FLOAT, N_("Fac"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_filter_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; + +namespace blender::nodes { + +static void cmp_node_filter_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_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_output<decl::Color>(N_("Image")); +} + +} // namespace blender::nodes void register_node_type_cmp_filter(void) { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_FILTER, "Filter", NODE_CLASS_OP_FILTER, NODE_PREVIEW); - node_type_socket_templates(&ntype, cmp_node_filter_in, cmp_node_filter_out); + ntype.declare = blender::nodes::cmp_node_filter_declare; node_type_label(&ntype, node_filter_label); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_flip.cc b/source/blender/nodes/composite/nodes/node_composite_flip.cc index 42aa3141f5c..d663aff24d1 100644 --- a/source/blender/nodes/composite/nodes/node_composite_flip.cc +++ b/source/blender/nodes/composite/nodes/node_composite_flip.cc @@ -24,22 +24,23 @@ #include "node_composite_util.hh" /* **************** Flip ******************** */ -static bNodeSocketTemplate cmp_node_flip_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_flip_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; +namespace blender::nodes { + +static void cmp_node_flip_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_output<decl::Color>(N_("Image")); +} + +} // namespace blender::nodes void register_node_type_cmp_flip(void) { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_FLIP, "Flip", NODE_CLASS_DISTORT, 0); - node_type_socket_templates(&ntype, cmp_node_flip_in, cmp_node_flip_out); + ntype.declare = blender::nodes::cmp_node_flip_declare; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_glare.cc b/source/blender/nodes/composite/nodes/node_composite_glare.cc index 8a2fd1e1584..2500a129e6f 100644 --- a/source/blender/nodes/composite/nodes/node_composite_glare.cc +++ b/source/blender/nodes/composite/nodes/node_composite_glare.cc @@ -23,14 +23,15 @@ #include "node_composite_util.hh" -static bNodeSocketTemplate cmp_node_glare_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_glare_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; +namespace blender::nodes { + +static void cmp_node_glare_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_output<decl::Color>(N_("Image")); +} + +} // namespace blender::nodes static void node_composit_init_glare(bNodeTree *UNUSED(ntree), bNode *node) { @@ -54,7 +55,7 @@ void register_node_type_cmp_glare(void) static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_GLARE, "Glare", NODE_CLASS_OP_FILTER, 0); - node_type_socket_templates(&ntype, cmp_node_glare_in, cmp_node_glare_out); + ntype.declare = blender::nodes::cmp_node_glare_declare; node_type_init(&ntype, node_composit_init_glare); node_type_storage(&ntype, "NodeGlare", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_inpaint.cc b/source/blender/nodes/composite/nodes/node_composite_inpaint.cc index d0ff97a2ca0..5c043fbe878 100644 --- a/source/blender/nodes/composite/nodes/node_composite_inpaint.cc +++ b/source/blender/nodes/composite/nodes/node_composite_inpaint.cc @@ -25,16 +25,22 @@ /* **************** Inpaint/ ******************** */ -static bNodeSocketTemplate cmp_node_inpaint_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, {-1, ""}}; -static bNodeSocketTemplate cmp_node_inpaint_out[] = {{SOCK_RGBA, N_("Image")}, {-1, ""}}; +namespace blender::nodes { + +static void cmp_node_inpaint_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_output<decl::Color>(N_("Image")); +} + +} // namespace blender::nodes void register_node_type_cmp_inpaint(void) { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_INPAINT, "Inpaint", NODE_CLASS_OP_FILTER, 0); - node_type_socket_templates(&ntype, cmp_node_inpaint_in, cmp_node_inpaint_out); + ntype.declare = blender::nodes::cmp_node_inpaint_declare; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_keying.cc b/source/blender/nodes/composite/nodes/node_composite_keying.cc index d5547161069..07826cfa492 100644 --- a/source/blender/nodes/composite/nodes/node_composite_keying.cc +++ b/source/blender/nodes/composite/nodes/node_composite_keying.cc @@ -29,22 +29,22 @@ #include "node_composite_util.hh" -/* **************** Translate ******************** */ +/* **************** Keying ******************** */ -static bNodeSocketTemplate cmp_node_keying_in[] = { - {SOCK_RGBA, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, - {SOCK_RGBA, "Key Color", 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, "Garbage Matte", 0.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, "Core Matte", 0.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; +namespace blender::nodes { -static bNodeSocketTemplate cmp_node_keying_out[] = { - {SOCK_RGBA, "Image"}, - {SOCK_FLOAT, "Matte"}, - {SOCK_FLOAT, "Edges"}, - {-1, ""}, -}; +static void cmp_node_keying_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image")).default_value({0.8f, 0.8f, 0.8f, 1.0f}); + b.add_input<decl::Color>(N_("Key Color")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_input<decl::Float>(N_("Garbage Matte")).hide_value(); + b.add_input<decl::Float>(N_("Core Matte")).hide_value(); + b.add_output<decl::Color>(N_("Image")); + b.add_output<decl::Float>(N_("Matte")); + b.add_output<decl::Float>(N_("Edges")); +} + +} // namespace blender::nodes static void node_composit_init_keying(bNodeTree *UNUSED(ntree), bNode *node) { @@ -65,7 +65,7 @@ void register_node_type_cmp_keying(void) static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_KEYING, "Keying", NODE_CLASS_MATTE, 0); - node_type_socket_templates(&ntype, cmp_node_keying_in, cmp_node_keying_out); + ntype.declare = blender::nodes::cmp_node_keying_declare; node_type_init(&ntype, node_composit_init_keying); node_type_storage( &ntype, "NodeKeyingData", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_keyingscreen.cc b/source/blender/nodes/composite/nodes/node_composite_keyingscreen.cc index c976a92b92d..c8001ec9c60 100644 --- a/source/blender/nodes/composite/nodes/node_composite_keyingscreen.cc +++ b/source/blender/nodes/composite/nodes/node_composite_keyingscreen.cc @@ -28,12 +28,16 @@ #include "node_composite_util.hh" -/* **************** Translate ******************** */ +/* **************** Keying Screen ******************** */ -static bNodeSocketTemplate cmp_node_keyingscreen_out[] = { - {SOCK_RGBA, "Screen"}, - {-1, ""}, -}; +namespace blender::nodes { + +static void cmp_node_keyingscreen_declare(NodeDeclarationBuilder &b) +{ + b.add_output<decl::Color>(N_("Screen")); +} + +} // namespace blender::nodes static void node_composit_init_keyingscreen(bNodeTree *UNUSED(ntree), bNode *node) { @@ -47,7 +51,7 @@ void register_node_type_cmp_keyingscreen(void) static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_KEYINGSCREEN, "Keying Screen", NODE_CLASS_MATTE, 0); - node_type_socket_templates(&ntype, nullptr, cmp_node_keyingscreen_out); + ntype.declare = blender::nodes::cmp_node_keyingscreen_declare; node_type_init(&ntype, node_composit_init_keyingscreen); node_type_storage( &ntype, "NodeKeyingScreenData", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_lensdist.cc b/source/blender/nodes/composite/nodes/node_composite_lensdist.cc index 2a8dc035792..1ea6d45df5b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_lensdist.cc +++ b/source/blender/nodes/composite/nodes/node_composite_lensdist.cc @@ -23,16 +23,17 @@ #include "node_composite_util.hh" -static bNodeSocketTemplate cmp_node_lensdist_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, N_("Distort"), 0.0f, 0.0f, 0.0f, 0.0f, -0.999f, 1.0f, PROP_NONE}, - {SOCK_FLOAT, N_("Dispersion"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_lensdist_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; +namespace blender::nodes { + +static void cmp_node_lensdist_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_input<decl::Float>(N_("Distort")).default_value(0.0f).min(-0.999f).max(1.0f); + b.add_input<decl::Float>(N_("Dispersion")).default_value(0.0f).min(0.0f).max(1.0f); + b.add_output<decl::Color>(N_("Image")); +} + +} // namespace blender::nodes static void node_composit_init_lensdist(bNodeTree *UNUSED(ntree), bNode *node) { @@ -46,7 +47,7 @@ void register_node_type_cmp_lensdist(void) static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_LENSDIST, "Lens Distortion", NODE_CLASS_DISTORT, 0); - node_type_socket_templates(&ntype, cmp_node_lensdist_in, cmp_node_lensdist_out); + ntype.declare = blender::nodes::cmp_node_lensdist_declare; node_type_init(&ntype, node_composit_init_lensdist); node_type_storage( &ntype, "NodeLensDist", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.cc b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.cc index 600406d22b9..c73b7883e4b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.cc @@ -24,16 +24,17 @@ #include "node_composite_util.hh" /* ******************* Luma Matte Node ********************************* */ -static bNodeSocketTemplate cmp_node_luma_matte_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_luma_matte_out[] = { - {SOCK_RGBA, N_("Image")}, - {SOCK_FLOAT, N_("Matte")}, - {-1, ""}, -}; +namespace blender::nodes { + +static void cmp_node_luma_matte_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_output<decl::Color>(N_("Image")); + b.add_output<decl::Float>(N_("Matte")); +} + +} // namespace blender::nodes static void node_composit_init_luma_matte(bNodeTree *UNUSED(ntree), bNode *node) { @@ -48,7 +49,7 @@ void register_node_type_cmp_luma_matte(void) static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_LUMA_MATTE, "Luminance Key", NODE_CLASS_MATTE, NODE_PREVIEW); - node_type_socket_templates(&ntype, cmp_node_luma_matte_in, cmp_node_luma_matte_out); + ntype.declare = blender::nodes::cmp_node_luma_matte_declare; node_type_init(&ntype, node_composit_init_luma_matte); node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_mapRange.cc b/source/blender/nodes/composite/nodes/node_composite_mapRange.cc index 808ad538e55..b21a9203bd1 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mapRange.cc +++ b/source/blender/nodes/composite/nodes/node_composite_mapRange.cc @@ -23,26 +23,28 @@ #include "node_composite_util.hh" -/* **************** MAP VALUE ******************** */ -static bNodeSocketTemplate cmp_node_map_range_in[] = { - {SOCK_FLOAT, N_("Value"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - {SOCK_FLOAT, N_("From Min"), 0.0f, 1.0f, 1.0f, 1.0f, -10000.0f, 10000.0f, PROP_NONE}, - {SOCK_FLOAT, N_("From Max"), 1.0f, 1.0f, 1.0f, 1.0f, -10000.0f, 10000.0f, PROP_NONE}, - {SOCK_FLOAT, N_("To Min"), 0.0f, 1.0f, 1.0f, 1.0f, -10000.0f, 10000.0f, PROP_NONE}, - {SOCK_FLOAT, N_("To Max"), 1.0f, 1.0f, 1.0f, 1.0f, -10000.0f, 10000.0f, PROP_NONE}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_map_range_out[] = { - {SOCK_FLOAT, N_("Value")}, - {-1, ""}, -}; +/* **************** Map Range ******************** */ + +namespace blender::nodes { + +static void cmp_node_map_range_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Float>(N_("Value")).default_value(1.0f).min(0.0f).max(1.0f); + b.add_input<decl::Float>(N_("From Min")).default_value(0.0f).min(-10000.0f).max(10000.0f); + b.add_input<decl::Float>(N_("From Max")).default_value(0.0f).min(-10000.0f).max(10000.0f); + b.add_input<decl::Float>(N_("To Min")).default_value(0.0f).min(-10000.0f).max(10000.0f); + b.add_input<decl::Float>(N_("To Max")).default_value(0.0f).min(-10000.0f).max(10000.0f); + b.add_output<decl::Float>(N_("Value")); +} + +} // namespace blender::nodes void register_node_type_cmp_map_range(void) { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_MAP_RANGE, "Map Range", NODE_CLASS_OP_VECTOR, 0); - node_type_socket_templates(&ntype, cmp_node_map_range_in, cmp_node_map_range_out); + ntype.declare = blender::nodes::cmp_node_map_range_declare; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_mapUV.cc b/source/blender/nodes/composite/nodes/node_composite_mapUV.cc index 99032bd042e..893710c183d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mapUV.cc +++ b/source/blender/nodes/composite/nodes/node_composite_mapUV.cc @@ -25,22 +25,23 @@ /* **************** Map UV ******************** */ -static bNodeSocketTemplate cmp_node_mapuv_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_VECTOR, N_("UV"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_mapuv_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; +namespace blender::nodes { + +static void cmp_node_map_uv_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_input<decl::Vector>(N_("UV")).default_value({1.0f, 0.0f, 0.0f}).min(0.0f).max(1.0f); + b.add_output<decl::Color>(N_("Image")); +} + +} // namespace blender::nodes void register_node_type_cmp_mapuv(void) { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_MAP_UV, "Map UV", NODE_CLASS_DISTORT, 0); - node_type_socket_templates(&ntype, cmp_node_mapuv_in, cmp_node_mapuv_out); + ntype.declare = blender::nodes::cmp_node_map_uv_declare; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_mapValue.cc b/source/blender/nodes/composite/nodes/node_composite_mapValue.cc index 25c00c2ba13..8e2c9add414 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mapValue.cc +++ b/source/blender/nodes/composite/nodes/node_composite_mapValue.cc @@ -24,14 +24,16 @@ #include "node_composite_util.hh" /* **************** MAP VALUE ******************** */ -static bNodeSocketTemplate cmp_node_map_value_in[] = { - {SOCK_FLOAT, N_("Value"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_map_value_out[] = { - {SOCK_FLOAT, N_("Value")}, - {-1, ""}, -}; + +namespace blender::nodes { + +static void cmp_node_map_value_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Float>(N_("Value")).default_value(1.0f).min(0.0f).max(1.0f); + b.add_output<decl::Float>(N_("Value")); +} + +} // namespace blender::nodes static void node_composit_init_map_value(bNodeTree *UNUSED(ntree), bNode *node) { @@ -43,7 +45,7 @@ void register_node_type_cmp_map_value(void) static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_MAP_VALUE, "Map Value", NODE_CLASS_OP_VECTOR, 0); - node_type_socket_templates(&ntype, cmp_node_map_value_in, cmp_node_map_value_out); + ntype.declare = blender::nodes::cmp_node_map_value_declare; node_type_init(&ntype, node_composit_init_map_value); node_type_storage(&ntype, "TexMapping", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_math.cc b/source/blender/nodes/composite/nodes/node_composite_math.cc index ecddcc2ad32..6657d13ce02 100644 --- a/source/blender/nodes/composite/nodes/node_composite_math.cc +++ b/source/blender/nodes/composite/nodes/node_composite_math.cc @@ -24,20 +24,31 @@ #include "node_composite_util.hh" /* **************** SCALAR MATH ******************** */ -static bNodeSocketTemplate cmp_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 cmp_node_math_out[] = {{SOCK_FLOAT, N_("Value")}, {-1, ""}}; +namespace blender::nodes { + +static void cmp_node_math_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Float>(N_("Value")).default_value(0.5f).min(-10000.0f).max(10000.0f); + b.add_input<decl::Float>(N_("Value"), "Value_001") + .default_value(0.5f) + .min(-10000.0f) + .max(10000.0f); + b.add_input<decl::Float>(N_("Value"), "Value_002") + .default_value(0.5f) + .min(-10000.0f) + .max(10000.0f); + b.add_output<decl::Float>(N_("Value")); +} + +} // namespace blender::nodes void register_node_type_cmp_math(void) { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_MATH, "Math", NODE_CLASS_CONVERTER, 0); - node_type_socket_templates(&ntype, cmp_node_math_in, cmp_node_math_out); + ntype.declare = blender::nodes::cmp_node_math_declare; node_type_label(&ntype, node_math_label); node_type_update(&ntype, node_math_update); diff --git a/source/blender/nodes/composite/nodes/node_composite_mixrgb.cc b/source/blender/nodes/composite/nodes/node_composite_mixrgb.cc index 557116f5b7a..4f1da66c7e0 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mixrgb.cc +++ b/source/blender/nodes/composite/nodes/node_composite_mixrgb.cc @@ -25,16 +25,17 @@ /* **************** MIX RGB ******************** */ -static bNodeSocketTemplate cmp_node_mix_rgb_in[] = { - {SOCK_FLOAT, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_mix_rgb_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; +namespace blender::nodes { + +static void cmp_node_mixrgb_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_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_input<decl::Color>(N_("Image"), "Image_001").default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_output<decl::Color>(N_("Image")); +} + +} // namespace blender::nodes /* custom1 = mix type */ void register_node_type_cmp_mix_rgb(void) @@ -42,7 +43,7 @@ void register_node_type_cmp_mix_rgb(void) static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, NODE_PREVIEW); - node_type_socket_templates(&ntype, cmp_node_mix_rgb_in, cmp_node_mix_rgb_out); + ntype.declare = blender::nodes::cmp_node_mixrgb_declare; node_type_label(&ntype, node_blend_label); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.cc b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.cc index 2bac30cc152..4c1bd12b23f 100644 --- a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.cc +++ b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.cc @@ -28,15 +28,15 @@ /* **************** Translate ******************** */ -static bNodeSocketTemplate cmp_node_moviedistortion_in[] = { - {SOCK_RGBA, N_("Image"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, - {-1, ""}, -}; +namespace blender::nodes { -static bNodeSocketTemplate cmp_node_moviedistortion_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; +static void cmp_node_moviedistortion_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image")).default_value({0.8f, 0.8f, 0.8f, 1.0f}); + b.add_output<decl::Color>(N_("Image")); +} + +} // namespace blender::nodes static void label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int maxlen) { @@ -78,7 +78,7 @@ void register_node_type_cmp_moviedistortion(void) static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_MOVIEDISTORTION, "Movie Distortion", NODE_CLASS_DISTORT, 0); - node_type_socket_templates(&ntype, cmp_node_moviedistortion_in, cmp_node_moviedistortion_out); + ntype.declare = blender::nodes::cmp_node_moviedistortion_declare; node_type_label(&ntype, label); ntype.initfunc_api = init; diff --git a/source/blender/nodes/composite/nodes/node_composite_normal.cc b/source/blender/nodes/composite/nodes/node_composite_normal.cc index 7531025daa5..975dbe310ec 100644 --- a/source/blender/nodes/composite/nodes/node_composite_normal.cc +++ b/source/blender/nodes/composite/nodes/node_composite_normal.cc @@ -24,23 +24,28 @@ #include "node_composite_util.hh" /* **************** NORMAL ******************** */ -static bNodeSocketTemplate cmp_node_normal_in[] = { - {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 1.0f, 0.0f, -1.0f, 1.0f, PROP_DIRECTION}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_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, ""}, -}; +namespace blender::nodes { + +static void cmp_node_normal_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Vector>(N_("Normal")) + .default_value({1.0f, 1.0f, 1.0f}) + .min(-1.0f) + .max(1.0f) + .subtype(PROP_DIRECTION); + b.add_output<decl::Vector>(N_("Normal")); + b.add_output<decl::Float>(N_("Dot")); +} + +} // namespace blender::nodes void register_node_type_cmp_normal(void) { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_NORMAL, "Normal", NODE_CLASS_OP_VECTOR, 0); - node_type_socket_templates(&ntype, cmp_node_normal_in, cmp_node_normal_out); + ntype.declare = blender::nodes::cmp_node_normal_declare; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_normalize.cc b/source/blender/nodes/composite/nodes/node_composite_normalize.cc index 7cc54e4eed6..44c1a28f399 100644 --- a/source/blender/nodes/composite/nodes/node_composite_normalize.cc +++ b/source/blender/nodes/composite/nodes/node_composite_normalize.cc @@ -24,16 +24,23 @@ #include "node_composite_util.hh" /* **************** NORMALIZE single channel, useful for Z buffer ******************** */ -static bNodeSocketTemplate cmp_node_normalize_in[] = { - {SOCK_FLOAT, N_("Value"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, {-1, ""}}; -static bNodeSocketTemplate cmp_node_normalize_out[] = {{SOCK_FLOAT, N_("Value")}, {-1, ""}}; + +namespace blender::nodes { + +static void cmp_node_normalize_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Float>(N_("Value")).default_value(1.0f).min(0.0f).max(1.0f); + b.add_output<decl::Float>(N_("Value")); +} + +} // namespace blender::nodes void register_node_type_cmp_normalize(void) { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_NORMALIZE, "Normalize", NODE_CLASS_OP_VECTOR, 0); - node_type_socket_templates(&ntype, cmp_node_normalize_in, cmp_node_normalize_out); + ntype.declare = blender::nodes::cmp_node_normalize_declare; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_pixelate.cc b/source/blender/nodes/composite/nodes/node_composite_pixelate.cc index 19975c21a0b..7e164196de8 100644 --- a/source/blender/nodes/composite/nodes/node_composite_pixelate.cc +++ b/source/blender/nodes/composite/nodes/node_composite_pixelate.cc @@ -25,16 +25,22 @@ /* **************** Pixelate ******************** */ -static bNodeSocketTemplate cmp_node_pixelate_in[] = { - {SOCK_RGBA, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, {-1, ""}}; -static bNodeSocketTemplate cmp_node_pixelate_out[] = {{SOCK_RGBA, N_("Color")}, {-1, ""}}; +namespace blender::nodes { + +static void cmp_node_pixelate_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Color")); + b.add_output<decl::Color>(N_("Color")); +} + +} // namespace blender::nodes void register_node_type_cmp_pixelate(void) { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_PIXELATE, "Pixelate", NODE_CLASS_OP_FILTER, 0); - node_type_socket_templates(&ntype, cmp_node_pixelate_in, cmp_node_pixelate_out); + ntype.declare = blender::nodes::cmp_node_pixelate_declare; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_planetrackdeform.cc b/source/blender/nodes/composite/nodes/node_composite_planetrackdeform.cc index e122b710b7b..db820d291f9 100644 --- a/source/blender/nodes/composite/nodes/node_composite_planetrackdeform.cc +++ b/source/blender/nodes/composite/nodes/node_composite_planetrackdeform.cc @@ -23,14 +23,16 @@ #include "node_composite_util.hh" -static bNodeSocketTemplate cmp_node_planetrackdeform_in[] = { - {SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, {-1, ""}}; +namespace blender::nodes { -static bNodeSocketTemplate cmp_node_planetrackdeform_out[] = { - {SOCK_RGBA, N_("Image")}, - {SOCK_FLOAT, N_("Plane")}, - {-1, ""}, -}; +static void cmp_node_planetrackdeform_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image")); + b.add_output<decl::Color>(N_("Image")); + b.add_output<decl::Float>(N_("Plane")); +} + +} // namespace blender::nodes static void init(bNodeTree *UNUSED(ntree), bNode *node) { @@ -47,7 +49,7 @@ void register_node_type_cmp_planetrackdeform(void) cmp_node_type_base( &ntype, CMP_NODE_PLANETRACKDEFORM, "Plane Track Deform", NODE_CLASS_DISTORT, 0); - node_type_socket_templates(&ntype, cmp_node_planetrackdeform_in, cmp_node_planetrackdeform_out); + ntype.declare = blender::nodes::cmp_node_planetrackdeform_declare; node_type_init(&ntype, init); node_type_storage( &ntype, "NodePlaneTrackDeformData", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_posterize.cc b/source/blender/nodes/composite/nodes/node_composite_posterize.cc index 45a98e68b4b..bd3968683ea 100644 --- a/source/blender/nodes/composite/nodes/node_composite_posterize.cc +++ b/source/blender/nodes/composite/nodes/node_composite_posterize.cc @@ -25,22 +25,23 @@ /* **************** Posterize ******************** */ -static bNodeSocketTemplate cmp_node_posterize_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, N_("Steps"), 8.0f, 8.0f, 8.0f, 8.0f, 2.0f, 1024.0f, PROP_NONE}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_posterize_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; +namespace blender::nodes { + +static void cmp_node_posterize_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_input<decl::Float>(N_("Steps")).default_value(8.0f).min(2.0f).max(1024.0f); + b.add_output<decl::Color>(N_("Image")); +} + +} // namespace blender::nodes void register_node_type_cmp_posterize(void) { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_POSTERIZE, "Posterize", NODE_CLASS_OP_COLOR, 0); - node_type_socket_templates(&ntype, cmp_node_posterize_in, cmp_node_posterize_out); + ntype.declare = blender::nodes::cmp_node_posterize_declare; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_rotate.cc b/source/blender/nodes/composite/nodes/node_composite_rotate.cc index d28b35ec9fb..1ac04c554fb 100644 --- a/source/blender/nodes/composite/nodes/node_composite_rotate.cc +++ b/source/blender/nodes/composite/nodes/node_composite_rotate.cc @@ -25,15 +25,20 @@ /* **************** Rotate ******************** */ -static bNodeSocketTemplate cmp_node_rotate_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, N_("Degr"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f, PROP_ANGLE}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_rotate_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; +namespace blender::nodes { + +static void cmp_node_rotate_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_input<decl::Float>(N_("Degr")) + .default_value(0.0f) + .min(-10000.0f) + .max(10000.0f) + .subtype(PROP_ANGLE); + b.add_output<decl::Color>(N_("Image")); +} + +} // namespace blender::nodes static void node_composit_init_rotate(bNodeTree *UNUSED(ntree), bNode *node) { @@ -45,7 +50,7 @@ void register_node_type_cmp_rotate(void) static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_ROTATE, "Rotate", NODE_CLASS_DISTORT, 0); - node_type_socket_templates(&ntype, cmp_node_rotate_in, cmp_node_rotate_out); + ntype.declare = blender::nodes::cmp_node_rotate_declare; node_type_init(&ntype, node_composit_init_rotate); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_scale.cc b/source/blender/nodes/composite/nodes/node_composite_scale.cc index 284d16b9b0d..81acd646920 100644 --- a/source/blender/nodes/composite/nodes/node_composite_scale.cc +++ b/source/blender/nodes/composite/nodes/node_composite_scale.cc @@ -25,12 +25,17 @@ /* **************** Scale ******************** */ -static bNodeSocketTemplate cmp_node_scale_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, N_("X"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, CMP_SCALE_MAX, PROP_NONE}, - {SOCK_FLOAT, N_("Y"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, CMP_SCALE_MAX, PROP_NONE}, - {-1, ""}}; -static bNodeSocketTemplate cmp_node_scale_out[] = {{SOCK_RGBA, N_("Image")}, {-1, ""}}; +namespace blender::nodes { + +static void cmp_node_scale_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_input<decl::Float>(N_("X")).default_value(1.0f).min(0.0001f).max(CMP_SCALE_MAX); + b.add_input<decl::Float>(N_("Y")).default_value(1.0f).min(0.0001f).max(CMP_SCALE_MAX); + b.add_output<decl::Color>(N_("Image")); +} + +} // namespace blender::nodes static void node_composite_update_scale(bNodeTree *ntree, bNode *node) { @@ -50,7 +55,7 @@ void register_node_type_cmp_scale(void) static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_SCALE, "Scale", NODE_CLASS_DISTORT, 0); - node_type_socket_templates(&ntype, cmp_node_scale_in, cmp_node_scale_out); + ntype.declare = blender::nodes::cmp_node_scale_declare; node_type_update(&ntype, node_composite_update_scale); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_splitViewer.cc b/source/blender/nodes/composite/nodes/node_composite_splitViewer.cc index c0403a041db..62b8f9a34ca 100644 --- a/source/blender/nodes/composite/nodes/node_composite_splitViewer.cc +++ b/source/blender/nodes/composite/nodes/node_composite_splitViewer.cc @@ -27,11 +27,16 @@ #include "BKE_image.h" /* **************** SPLIT VIEWER ******************** */ -static bNodeSocketTemplate cmp_node_splitviewer_in[] = { - {SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f}, - {-1, ""}, -}; + +namespace blender::nodes { + +static void cmp_node_split_viewer_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image")); + b.add_input<decl::Color>(N_("Image"), "Image_001"); +} + +} // namespace blender::nodes static void node_composit_init_splitviewer(bNodeTree *UNUSED(ntree), bNode *node) { @@ -49,7 +54,7 @@ void register_node_type_cmp_splitviewer(void) cmp_node_type_base( &ntype, CMP_NODE_SPLITVIEWER, "Split Viewer", NODE_CLASS_OUTPUT, NODE_PREVIEW); - node_type_socket_templates(&ntype, cmp_node_splitviewer_in, nullptr); + ntype.declare = blender::nodes::cmp_node_split_viewer_declare; node_type_init(&ntype, node_composit_init_splitviewer); node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_stabilize2d.cc b/source/blender/nodes/composite/nodes/node_composite_stabilize2d.cc index e5ce2e8ceb9..a6a18705f2f 100644 --- a/source/blender/nodes/composite/nodes/node_composite_stabilize2d.cc +++ b/source/blender/nodes/composite/nodes/node_composite_stabilize2d.cc @@ -26,17 +26,17 @@ #include "BKE_context.h" #include "BKE_lib_id.h" -/* **************** Translate ******************** */ +/* **************** Stabilize 2D ******************** */ -static bNodeSocketTemplate cmp_node_stabilize2d_in[] = { - {SOCK_RGBA, N_("Image"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, - {-1, ""}, -}; +namespace blender::nodes { -static bNodeSocketTemplate cmp_node_stabilize2d_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; +static void cmp_node_stabilize2d_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image")).default_value({0.8f, 0.8f, 0.8f, 1.0f}); + b.add_output<decl::Color>(N_("Image")); +} + +} // namespace blender::nodes static void init(const bContext *C, PointerRNA *ptr) { @@ -55,7 +55,7 @@ void register_node_type_cmp_stabilize2d(void) static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_STABILIZE2D, "Stabilize 2D", NODE_CLASS_DISTORT, 0); - node_type_socket_templates(&ntype, cmp_node_stabilize2d_in, cmp_node_stabilize2d_out); + ntype.declare = blender::nodes::cmp_node_stabilize2d_declare; ntype.initfunc_api = init; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_sunbeams.cc b/source/blender/nodes/composite/nodes/node_composite_sunbeams.cc index 73907d2e27f..43468e20d03 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sunbeams.cc +++ b/source/blender/nodes/composite/nodes/node_composite_sunbeams.cc @@ -23,14 +23,15 @@ #include "node_composite_util.hh" -static bNodeSocketTemplate inputs[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {-1, ""}, -}; -static bNodeSocketTemplate outputs[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; +namespace blender::nodes { + +static void cmp_node_sunbeams_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_output<decl::Color>(N_("Image")); +} + +} // namespace blender::nodes static void init(bNodeTree *UNUSED(ntree), bNode *node) { @@ -46,7 +47,7 @@ void register_node_type_cmp_sunbeams(void) static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_SUNBEAMS, "Sun Beams", NODE_CLASS_OP_FILTER, 0); - node_type_socket_templates(&ntype, inputs, outputs); + ntype.declare = blender::nodes::cmp_node_sunbeams_declare; node_type_init(&ntype, init); node_type_storage( &ntype, "NodeSunBeams", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_switch.cc b/source/blender/nodes/composite/nodes/node_composite_switch.cc index 71226a6da0b..0430a8c9f7a 100644 --- a/source/blender/nodes/composite/nodes/node_composite_switch.cc +++ b/source/blender/nodes/composite/nodes/node_composite_switch.cc @@ -23,17 +23,18 @@ #include "../node_composite_util.hh" -/* **************** MIX RGB ******************** */ -static bNodeSocketTemplate cmp_node_switch_in[] = { - {SOCK_RGBA, N_("Off"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, - {SOCK_RGBA, N_("On"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, - {-1, ""}, -}; - -static bNodeSocketTemplate cmp_node_switch_out[] = { - {SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, - {-1, ""}, -}; +/* **************** Switch ******************** */ + +namespace blender::nodes { + +static void cmp_node_switch_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Off")).default_value({0.8f, 0.8f, 0.8f, 1.0f}); + b.add_input<decl::Color>(N_("On")).default_value({0.8f, 0.8f, 0.8f, 1.0f}); + b.add_output<decl::Color>(N_("Image")); +} + +} // namespace blender::nodes /* custom1 = mix type */ void register_node_type_cmp_switch(void) @@ -41,7 +42,7 @@ void register_node_type_cmp_switch(void) static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_SWITCH, "Switch", NODE_CLASS_LAYOUT, 0); - node_type_socket_templates(&ntype, cmp_node_switch_in, cmp_node_switch_out); + ntype.declare = blender::nodes::cmp_node_switch_declare; node_type_size_preset(&ntype, NODE_SIZE_SMALL); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_transform.cc b/source/blender/nodes/composite/nodes/node_composite_transform.cc index 1695101cdbf..ade737d9a63 100644 --- a/source/blender/nodes/composite/nodes/node_composite_transform.cc +++ b/source/blender/nodes/composite/nodes/node_composite_transform.cc @@ -25,26 +25,30 @@ /* **************** Transform ******************** */ -static bNodeSocketTemplate cmp_node_transform_in[] = { - {SOCK_RGBA, N_("Image"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("X"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f}, - {SOCK_FLOAT, N_("Y"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f}, - {SOCK_FLOAT, N_("Angle"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f, PROP_ANGLE}, - {SOCK_FLOAT, N_("Scale"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, CMP_SCALE_MAX}, - {-1, ""}, -}; - -static bNodeSocketTemplate cmp_node_transform_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; +namespace blender::nodes { + +static void cmp_node_transform_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image")).default_value({0.8f, 0.8f, 0.8f, 1.0f}); + b.add_input<decl::Float>(N_("X")).default_value(0.0f).min(-10000.0f).max(10000.0f); + b.add_input<decl::Float>(N_("Y")).default_value(0.0f).min(-10000.0f).max(10000.0f); + b.add_input<decl::Float>(N_("Angle")) + .default_value(0.0f) + .min(-10000.0f) + .max(10000.0f) + .subtype(PROP_ANGLE); + b.add_input<decl::Float>(N_("Scale")).default_value(1.0f).min(0.0001f).max(CMP_SCALE_MAX); + b.add_output<decl::Color>(N_("Image")); +} + +} // namespace blender::nodes void register_node_type_cmp_transform(void) { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_TRANSFORM, "Transform", NODE_CLASS_DISTORT, 0); - node_type_socket_templates(&ntype, cmp_node_transform_in, cmp_node_transform_out); + ntype.declare = blender::nodes::cmp_node_transform_declare; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_translate.cc b/source/blender/nodes/composite/nodes/node_composite_translate.cc index 0ee8a41a5ea..15652664a7a 100644 --- a/source/blender/nodes/composite/nodes/node_composite_translate.cc +++ b/source/blender/nodes/composite/nodes/node_composite_translate.cc @@ -23,18 +23,19 @@ #include "node_composite_util.hh" -/* **************** Translate ******************** */ - -static bNodeSocketTemplate cmp_node_translate_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, N_("X"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f, PROP_NONE}, - {SOCK_FLOAT, N_("Y"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f, PROP_NONE}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_translate_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; +/* **************** Translate ******************** */ + +namespace blender::nodes { + +static void cmp_node_translate_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_input<decl::Float>(N_("X")).default_value(0.0f).min(-10000.0f).max(10000.0f); + b.add_input<decl::Float>(N_("Y")).default_value(0.0f).min(-10000.0f).max(10000.0f); + b.add_output<decl::Color>(N_("Image")); +} + +} // namespace blender::nodes static void node_composit_init_translate(bNodeTree *UNUSED(ntree), bNode *node) { @@ -48,7 +49,7 @@ void register_node_type_cmp_translate(void) static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_TRANSLATE, "Translate", NODE_CLASS_DISTORT, 0); - node_type_socket_templates(&ntype, cmp_node_translate_in, cmp_node_translate_out); + ntype.declare = blender::nodes::cmp_node_translate_declare; node_type_init(&ntype, node_composit_init_translate); node_type_storage( &ntype, "NodeTranslateData", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_vecBlur.cc b/source/blender/nodes/composite/nodes/node_composite_vecBlur.cc index ce6ba659609..600e4dd9d12 100644 --- a/source/blender/nodes/composite/nodes/node_composite_vecBlur.cc +++ b/source/blender/nodes/composite/nodes/node_composite_vecBlur.cc @@ -24,12 +24,22 @@ #include "node_composite_util.hh" /* **************** VECTOR BLUR ******************** */ -static bNodeSocketTemplate cmp_node_vecblur_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, N_("Z"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, - {SOCK_VECTOR, N_("Speed"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_VELOCITY}, - {-1, ""}}; -static bNodeSocketTemplate cmp_node_vecblur_out[] = {{SOCK_RGBA, N_("Image")}, {-1, ""}}; + +namespace blender::nodes { + +static void cmp_node_vec_blur_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_input<decl::Float>(N_("Z")).default_value(0.0f).min(0.0f).max(1.0f); + b.add_input<decl::Vector>(N_("Speed")) + .default_value({0.0f, 0.0f, 0.0f}) + .min(0.0f) + .max(1.0f) + .subtype(PROP_VELOCITY); + b.add_output<decl::Color>(N_("Image")); +} + +} // namespace blender::nodes static void node_composit_init_vecblur(bNodeTree *UNUSED(ntree), bNode *node) { @@ -45,7 +55,7 @@ void register_node_type_cmp_vecblur(void) static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_VECBLUR, "Vector Blur", NODE_CLASS_OP_FILTER, 0); - node_type_socket_templates(&ntype, cmp_node_vecblur_in, cmp_node_vecblur_out); + ntype.declare = blender::nodes::cmp_node_vec_blur_declare; node_type_init(&ntype, node_composit_init_vecblur); node_type_storage( &ntype, "NodeBlurData", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_zcombine.cc b/source/blender/nodes/composite/nodes/node_composite_zcombine.cc index 990f9fcd366..9c39148ed5d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_zcombine.cc +++ b/source/blender/nodes/composite/nodes/node_composite_zcombine.cc @@ -24,26 +24,27 @@ #include "node_composite_util.hh" /* **************** Z COMBINE ******************** */ -/* lazy coder NOTE: node->custom2 is abused to send signal. */ -static bNodeSocketTemplate cmp_node_zcombine_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, N_("Z"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 10000.0f, PROP_NONE}, - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, N_("Z"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 10000.0f, PROP_NONE}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_zcombine_out[] = { - {SOCK_RGBA, N_("Image")}, - {SOCK_FLOAT, N_("Z")}, - {-1, ""}, -}; + +namespace blender::nodes { + +static void cmp_node_zcombine_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_input<decl::Float>(N_("Z")).default_value(1.0f).min(0.f).max(10000.0f); + b.add_input<decl::Color>(N_("Image"), "Image_001").default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_input<decl::Float>(N_("Z"), "Z_001").default_value(1.0f).min(0.f).max(10000.0f); + b.add_output<decl::Color>(N_("Image")); + b.add_output<decl::Float>(N_("Z")); +} + +} // namespace blender::nodes void register_node_type_cmp_zcombine(void) { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_ZCOMBINE, "Z Combine", NODE_CLASS_OP_COLOR, 0); - node_type_socket_templates(&ntype, cmp_node_zcombine_in, cmp_node_zcombine_out); + ntype.declare = blender::nodes::cmp_node_zcombine_declare; nodeRegisterType(&ntype); } |