diff options
Diffstat (limited to 'source/blender/nodes/composite')
5 files changed, 50 insertions, 64 deletions
diff --git a/source/blender/nodes/composite/nodes/node_composite_alphaOver.cc b/source/blender/nodes/composite/nodes/node_composite_alphaOver.cc index 6210d946bc7..edb451a3654 100644 --- a/source/blender/nodes/composite/nodes/node_composite_alphaOver.cc +++ b/source/blender/nodes/composite/nodes/node_composite_alphaOver.cc @@ -20,22 +20,21 @@ /** \file * \ingroup cmpnodes */ - + #include "node_composite_util.hh" /* **************** ALPHAOVER ******************** */ -namespace blender::nodes { - -static void cmp_node_alphaover_declare(NodeDeclarationBuilder &b) -{ - b.add_input<decl::Float>("Fac").default_value(1.0f).min(0.0f).max(1.0f).subtype(PROP_FACTOR); - b.add_input<decl::Color>("Image").default_value({1.0f, 1.0f, 1.0f, 1.0f}); - b.add_input<decl::Color>("Image", "Image_001").default_value({1.0f, 1.0f, 1.0f, 1.0f}); - b.add_output<decl::Color>("Image"); -} - -} // namespace blender::nodes +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, ""}, +}; static void node_alphaover_init(bNodeTree *UNUSED(ntree), bNode *node) { @@ -47,7 +46,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); - ntype.declare = blender::nodes::cmp_node_alphaover_declare; + node_type_socket_templates(&ntype, cmp_node_alphaover_in, cmp_node_alphaover_out); 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_math.cc b/source/blender/nodes/composite/nodes/node_composite_math.cc index a9859425e28..ecddcc2ad32 100644 --- a/source/blender/nodes/composite/nodes/node_composite_math.cc +++ b/source/blender/nodes/composite/nodes/node_composite_math.cc @@ -24,25 +24,20 @@ #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, ""}}; -namespace blender::nodes { - -static void cmp_node_math_declare(NodeDeclarationBuilder &b) -{ - b.add_input<decl::Float>("Value").default_value(0.5f).min(-10000.0f).max(10000.0f); - b.add_input<decl::Float>("Value", "Value_001").default_value(0.5f).min(-10000.0f).max(10000.0f); - b.add_input<decl::Float>("Value", "Value_002").default_value(0.5f).min(-10000.0f).max(10000.0f); - b.add_output<decl::Float>("Value"); -} - -} // namespace blender::nodes +static bNodeSocketTemplate cmp_node_math_out[] = {{SOCK_FLOAT, N_("Value")}, {-1, ""}}; void register_node_type_cmp_math(void) { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_MATH, "Math", NODE_CLASS_CONVERTER, 0); - ntype.declare = blender::nodes::cmp_node_math_declare; + node_type_socket_templates(&ntype, cmp_node_math_in, cmp_node_math_out); 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 4f2a9c2717c..557116f5b7a 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mixrgb.cc +++ b/source/blender/nodes/composite/nodes/node_composite_mixrgb.cc @@ -25,17 +25,16 @@ /* **************** MIX RGB ******************** */ -namespace blender::nodes { - -static void cmp_node_mixrgb_declare(NodeDeclarationBuilder &b) -{ - b.add_input<decl::Float>("Fac").default_value(1.0f).min(0.0f).max(1.0f).subtype(PROP_FACTOR); - b.add_input<decl::Color>("Image").default_value({1.0f, 1.0f, 1.0f, 1.0f}); - b.add_input<decl::Color>("Image", "Image_001").default_value({1.0f, 1.0f, 1.0f, 1.0f}); - b.add_output<decl::Color>("Image"); -} - -} // namespace blender::nodes +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, ""}, +}; /* custom1 = mix type */ void register_node_type_cmp_mix_rgb(void) @@ -43,7 +42,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); - ntype.declare = blender::nodes::cmp_node_mixrgb_declare; + node_type_socket_templates(&ntype, cmp_node_mix_rgb_in, cmp_node_mix_rgb_out); node_type_label(&ntype, node_blend_label); 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 f64abe87116..54a1c59fca6 100644 --- a/source/blender/nodes/composite/nodes/node_composite_splitViewer.cc +++ b/source/blender/nodes/composite/nodes/node_composite_splitViewer.cc @@ -27,16 +27,11 @@ #include "BKE_image.h" /* **************** SPLIT VIEWER ******************** */ - -namespace blender::nodes { - -static void cmp_node_splitviewer_declare(NodeDeclarationBuilder &b) -{ - b.add_input<decl::Color>("Image"); - b.add_input<decl::Color>("Image", "Image_001"); -} - -} // namespace blender::nodes +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, ""}, +}; static void node_composit_init_splitviewer(bNodeTree *UNUSED(ntree), bNode *node) { @@ -55,7 +50,7 @@ void register_node_type_cmp_splitviewer(void) cmp_node_type_base( &ntype, CMP_NODE_SPLITVIEWER, "Split Viewer", NODE_CLASS_OUTPUT, NODE_PREVIEW); - ntype.declare = blender::nodes::cmp_node_splitviewer_declare; + node_type_socket_templates(&ntype, cmp_node_splitviewer_in, nullptr); 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_zcombine.cc b/source/blender/nodes/composite/nodes/node_composite_zcombine.cc index 79e4d449159..990f9fcd366 100644 --- a/source/blender/nodes/composite/nodes/node_composite_zcombine.cc +++ b/source/blender/nodes/composite/nodes/node_composite_zcombine.cc @@ -24,28 +24,26 @@ #include "node_composite_util.hh" /* **************** Z COMBINE ******************** */ - -namespace blender::nodes { - -static void cmp_node_zcombine_declare(NodeDeclarationBuilder &b) -{ - b.add_input<decl::Color>("Image").default_value({1.0f, 1.0f, 1.0f, 1.0f}); - b.add_input<decl::Float>("Z").default_value(1.0f).min(0.0f).max(10000.0f); - b.add_input<decl::Color>("Image", "Image_001").default_value({1.0f, 1.0f, 1.0f, 1.0f}); - b.add_input<decl::Float>("Z", "Z_001").default_value(1.0f).min(0.0f).max(10000.0f); - b.add_output<decl::Color>("Image"); - b.add_output<decl::Float>("Z"); -} - -} // namespace blender::nodes - /* 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, ""}, +}; + 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); - ntype.declare = blender::nodes::cmp_node_zcombine_declare; + node_type_socket_templates(&ntype, cmp_node_zcombine_in, cmp_node_zcombine_out); nodeRegisterType(&ntype); } |