Blender  V3.3
node_composite_huecorrect.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2006 Blender Foundation. All rights reserved. */
3 
8 #include "node_composite_util.hh"
9 
10 #include "BKE_colortools.h"
11 
13 
15 {
16  b.add_input<decl::Float>(N_("Fac")).default_value(1.0f).min(0.0f).max(1.0f).subtype(PROP_FACTOR);
17  b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f});
18  b.add_output<decl::Color>(N_("Image"));
19 }
20 
22 {
23  node->storage = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
24 
25  CurveMapping *cumapping = (CurveMapping *)node->storage;
26 
27  cumapping->preset = CURVE_PRESET_MID9;
28 
29  for (int c = 0; c < 3; c++) {
30  CurveMap *cuma = &cumapping->cm[c];
31  BKE_curvemap_reset(cuma, &cumapping->clipr, cumapping->preset, CURVEMAP_SLOPE_POSITIVE);
32  }
33 
34  /* default to showing Saturation */
35  cumapping->cur = 1;
36 }
37 
38 } // namespace blender::nodes::node_composite_huecorrect_cc
39 
41 {
43 
44  static bNodeType ntype;
45 
48  node_type_size(&ntype, 320, 140, 500);
50  node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
51 
52  nodeRegisterType(&ntype);
53 }
void BKE_curvemap_reset(struct CurveMap *cuma, const struct rctf *clipr, int preset, int slope)
@ CURVEMAP_SLOPE_POSITIVE
struct CurveMapping * BKE_curvemapping_add(int tot, float minx, float miny, float maxx, float maxy)
Definition: colortools.c:72
void node_type_size(struct bNodeType *ntype, int width, int minwidth, int maxwidth)
Definition: node.cc:4396
#define CMP_NODE_HUECORRECT
Definition: BKE_node.h:1256
void node_type_init(struct bNodeType *ntype, void(*initfunc)(struct bNodeTree *ntree, struct bNode *node))
Definition: node.cc:4390
void node_type_storage(struct bNodeType *ntype, const char *storagename, void(*freefunc)(struct bNode *node), void(*copyfunc)(struct bNodeTree *dest_ntree, struct bNode *dest_node, const struct bNode *src_node))
Definition: node.cc:4426
#define NODE_CLASS_OP_COLOR
Definition: BKE_node.h:347
void nodeRegisterType(struct bNodeType *ntype)
Definition: node.cc:1357
#define UNUSED(x)
@ CURVE_PRESET_MID9
@ PROP_FACTOR
Definition: RNA_types.h:144
OperationNode * node
bNodeTree * ntree
static unsigned c
Definition: RandGen.cpp:83
static void cmp_node_huecorrect_declare(NodeDeclarationBuilder &b)
static void node_composit_init_huecorrect(bNodeTree *UNUSED(ntree), bNode *node)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
void register_node_type_cmp_huecorrect()
void cmp_node_type_base(bNodeType *ntype, int type, const char *name, short nclass)
void node_copy_curves(bNodeTree *UNUSED(dest_ntree), bNode *dest_node, const bNode *src_node)
Definition: node_util.c:50
void node_free_curves(bNode *node)
Definition: node_util.c:38
CurveMap cm[4]
Defines a node type.
Definition: BKE_node.h:226
NodeDeclareFunction declare
Definition: BKE_node.h:324
#define N_(msgid)