From c7a7c3f5e5ddd5d8919da84e75c1a277ba0b6de9 Mon Sep 17 00:00:00 2001 From: Aaron Carlisle Date: Tue, 28 Sep 2021 15:29:16 -0400 Subject: Cleanup: convert compositor nodes to c++ - Many cleanups of to use list base - Some variable changes These change is needed to migrate to the new socket builder API Reviewed By: manzanilla Differential Revision: https://developer.blender.org/D12366 --- .../composite/nodes/node_composite_brightness.cc | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 source/blender/nodes/composite/nodes/node_composite_brightness.cc (limited to 'source/blender/nodes/composite/nodes/node_composite_brightness.cc') diff --git a/source/blender/nodes/composite/nodes/node_composite_brightness.cc b/source/blender/nodes/composite/nodes/node_composite_brightness.cc new file mode 100644 index 00000000000..9c0716169c6 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_brightness.cc @@ -0,0 +1,53 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +/* **************** Brigh and contrsast ******************** */ + +static bNodeSocketTemplate cmp_node_brightcontrast_in[] = { + {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + {SOCK_FLOAT, N_("Bright"), 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE}, + {SOCK_FLOAT, N_("Contrast"), 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE}, + {-1, ""}, +}; +static bNodeSocketTemplate cmp_node_brightcontrast_out[] = { + {SOCK_RGBA, N_("Image")}, + {-1, ""}, +}; + +static void node_composit_init_brightcontrast(bNodeTree *UNUSED(ntree), bNode *node) +{ + node->custom1 = 1; +} + +void register_node_type_cmp_brightcontrast(void) +{ + static bNodeType ntype; + + cmp_node_type_base(&ntype, CMP_NODE_BRIGHTCONTRAST, "Bright/Contrast", NODE_CLASS_OP_COLOR, 0); + node_type_socket_templates(&ntype, cmp_node_brightcontrast_in, cmp_node_brightcontrast_out); + node_type_init(&ntype, node_composit_init_brightcontrast); + + nodeRegisterType(&ntype); +} -- cgit v1.2.3 From 79290f51605e31cff09e4984d4f493d05bfe17e2 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 29 Sep 2021 07:29:15 +1000 Subject: Cleanup: spelling in comments --- source/blender/nodes/composite/nodes/node_composite_brightness.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/nodes/composite/nodes/node_composite_brightness.cc') diff --git a/source/blender/nodes/composite/nodes/node_composite_brightness.cc b/source/blender/nodes/composite/nodes/node_composite_brightness.cc index 9c0716169c6..790ccea4dc5 100644 --- a/source/blender/nodes/composite/nodes/node_composite_brightness.cc +++ b/source/blender/nodes/composite/nodes/node_composite_brightness.cc @@ -23,7 +23,7 @@ #include "node_composite_util.hh" -/* **************** Brigh and contrsast ******************** */ +/* **************** Bright and Contrast ******************** */ static bNodeSocketTemplate cmp_node_brightcontrast_in[] = { {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, -- cgit v1.2.3 From 756c22bb411f50e6fcb400fb8dcb3e58968e5f75 Mon Sep 17 00:00:00 2001 From: Aaron Carlisle Date: Wed, 29 Sep 2021 00:09:41 -0400 Subject: Cleanup: Compositor: Migrate color nodes to new socket builder --- .../composite/nodes/node_composite_brightness.cc | 23 +++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'source/blender/nodes/composite/nodes/node_composite_brightness.cc') diff --git a/source/blender/nodes/composite/nodes/node_composite_brightness.cc b/source/blender/nodes/composite/nodes/node_composite_brightness.cc index 790ccea4dc5..ad4b09c69d0 100644 --- a/source/blender/nodes/composite/nodes/node_composite_brightness.cc +++ b/source/blender/nodes/composite/nodes/node_composite_brightness.cc @@ -25,16 +25,17 @@ /* **************** Bright and Contrast ******************** */ -static bNodeSocketTemplate cmp_node_brightcontrast_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, N_("Bright"), 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE}, - {SOCK_FLOAT, N_("Contrast"), 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_brightcontrast_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; +namespace blender::nodes { + +static void cmp_node_brightcontrast_declare(NodeDeclarationBuilder &b) +{ + b.add_input("Image").default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_input("Bright").min(-100.0f).max(100.0f); + b.add_input("Contrast").min(-100.0f).max(100.0f); + b.add_output("Image"); +} + +} // namespace blender::nodes static void node_composit_init_brightcontrast(bNodeTree *UNUSED(ntree), bNode *node) { @@ -46,7 +47,7 @@ void register_node_type_cmp_brightcontrast(void) static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_BRIGHTCONTRAST, "Bright/Contrast", NODE_CLASS_OP_COLOR, 0); - node_type_socket_templates(&ntype, cmp_node_brightcontrast_in, cmp_node_brightcontrast_out); + ntype.declare = blender::nodes::cmp_node_brightcontrast_declare; node_type_init(&ntype, node_composit_init_brightcontrast); nodeRegisterType(&ntype); -- cgit v1.2.3