diff options
Diffstat (limited to 'source/blender/nodes/composite/nodes/node_composite_switch.cc')
-rw-r--r-- | source/blender/nodes/composite/nodes/node_composite_switch.cc | 25 |
1 files changed, 13 insertions, 12 deletions
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); } |