Blender  V3.3
node_composite_curves.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 "BKE_colortools.h"
9 
10 #include "UI_interface.h"
11 #include "UI_resources.h"
12 
13 #include "node_composite_util.hh"
14 
15 /* **************** CURVE Time ******************** */
16 
18 
20 {
21  b.add_output<decl::Float>(N_("Fac"));
22 }
23 
24 /* custom1 = start_frame, custom2 = end_frame */
26 {
27  node->custom1 = 1;
28  node->custom2 = 250;
29  node->storage = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
30 }
31 
32 } // namespace blender::nodes::node_composite_curves_cc
33 
35 {
36  namespace file_ns = blender::nodes::node_composite_curves_cc;
37 
38  static bNodeType ntype;
39 
40  cmp_node_type_base(&ntype, CMP_NODE_TIME, "Time Curve", NODE_CLASS_INPUT);
42  node_type_size(&ntype, 200, 140, 320);
44  node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
45 
46  nodeRegisterType(&ntype);
47 }
48 
49 /* **************** CURVE VEC ******************** */
50 
52 
54 {
55  b.add_input<decl::Vector>(N_("Vector")).default_value({0.0f, 0.0f, 0.0f}).min(-1.0f).max(1.0f);
56  b.add_output<decl::Vector>(N_("Vector"));
57 }
58 
60 {
61  node->storage = BKE_curvemapping_add(3, -1.0f, -1.0f, 1.0f, 1.0f);
62 }
63 
65 {
66  uiTemplateCurveMapping(layout, ptr, "mapping", 'v', false, false, false, false);
67 }
68 
69 } // namespace blender::nodes::node_composite_curves_cc
70 
72 {
73  namespace file_ns = blender::nodes::node_composite_curves_cc;
74 
75  static bNodeType ntype;
76 
80  node_type_size(&ntype, 200, 140, 320);
82  node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
83 
84  nodeRegisterType(&ntype);
85 }
86 
87 /* **************** CURVE RGB ******************** */
88 
90 
92 {
93  b.add_input<decl::Float>(N_("Fac")).default_value(1.0f).min(-1.0f).max(1.0f).subtype(
94  PROP_FACTOR);
95  b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f});
96  b.add_input<decl::Color>(N_("Black Level")).default_value({0.0f, 0.0f, 0.0f, 1.0f});
97  b.add_input<decl::Color>(N_("White Level")).default_value({1.0f, 1.0f, 1.0f, 1.0f});
98  b.add_output<decl::Color>(N_("Image"));
99 }
100 
102 {
103  node->storage = BKE_curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f);
104 }
105 
106 } // namespace blender::nodes::node_composite_curves_cc
107 
109 {
110  namespace file_ns = blender::nodes::node_composite_curves_cc;
111 
112  static bNodeType ntype;
113 
116  node_type_size(&ntype, 200, 140, 320);
118  node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
119 
120  nodeRegisterType(&ntype);
121 }
struct CurveMapping * BKE_curvemapping_add(int tot, float minx, float miny, float maxx, float maxy)
Definition: colortools.c:72
#define CMP_NODE_TIME
Definition: BKE_node.h:1209
void node_type_size(struct bNodeType *ntype, int width, int minwidth, int maxwidth)
Definition: node.cc:4396
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 CMP_NODE_CURVE_RGB
Definition: BKE_node.h:1204
#define NODE_CLASS_OP_VECTOR
Definition: BKE_node.h:348
#define NODE_CLASS_OP_COLOR
Definition: BKE_node.h:347
#define NODE_CLASS_INPUT
Definition: BKE_node.h:345
#define CMP_NODE_CURVE_VEC
Definition: BKE_node.h:1203
void nodeRegisterType(struct bNodeType *ntype)
Definition: node.cc:1357
#define UNUSED(x)
@ PROP_FACTOR
Definition: RNA_types.h:144
void uiTemplateCurveMapping(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int type, bool levels, bool brush, bool neg_slope, bool tone)
OperationNode * node
bNodeTree * ntree
static void node_composit_init_curve_vec(bNodeTree *UNUSED(ntree), bNode *node)
static void cmp_node_rgbcurves_declare(NodeDeclarationBuilder &b)
static void node_composit_init_curves_time(bNodeTree *UNUSED(ntree), bNode *node)
static void cmp_node_curve_vec_declare(NodeDeclarationBuilder &b)
static void node_composit_init_curve_rgb(bNodeTree *UNUSED(ntree), bNode *node)
static void node_buts_curvevec(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
static void cmp_node_time_declare(NodeDeclarationBuilder &b)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
void register_node_type_cmp_curve_rgb()
void register_node_type_cmp_curve_time()
void register_node_type_cmp_curve_vec()
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
#define min(a, b)
Definition: sort.c:35
Defines a node type.
Definition: BKE_node.h:226
void(* draw_buttons)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr)
Definition: BKE_node.h:244
NodeDeclareFunction declare
Definition: BKE_node.h:324
#define N_(msgid)
PointerRNA * ptr
Definition: wm_files.c:3480