Blender V4.3
node_composite_switch.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2006 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9#include "UI_interface.hh"
10#include "UI_resources.hh"
11
12#include "COM_node_operation.hh"
13
15
16/* **************** Switch ******************** */
17
19
21{
22 b.add_input<decl::Color>("Off").default_value({0.8f, 0.8f, 0.8f, 1.0f});
23 b.add_input<decl::Color>("On").default_value({0.8f, 0.8f, 0.8f, 1.0f});
24 b.add_output<decl::Color>("Image");
25}
26
28{
29 uiItemR(layout, ptr, "check", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
30}
31
32using namespace blender::realtime_compositor;
33
35 public:
37
38 void execute() override
39 {
40 Result &input = get_input(get_condition() ? "On" : "Off");
41 Result &result = get_result("Image");
42 input.pass_through(result);
43 }
44
46 {
47 return bnode().custom1;
48 }
49};
50
52{
53 return new SwitchOperation(context, node);
54}
55
56} // namespace blender::nodes::node_composite_switch_cc
57
59{
61
62 static blender::bke::bNodeType ntype;
63
64 cmp_node_type_base(&ntype, CMP_NODE_SWITCH, "Switch", NODE_CLASS_LAYOUT);
65 ntype.declare = file_ns::cmp_node_switch_declare;
66 ntype.draw_buttons = file_ns::node_composit_buts_switch;
68 ntype.get_compositor_operation = file_ns::get_compositor_operation;
69
71}
#define NODE_CLASS_LAYOUT
Definition BKE_node.hh:420
void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, eUI_Item_Flag flag, const char *name, int icon)
@ UI_ITEM_R_SPLIT_EMPTY_NAME
NodeOperation(Context &context, DNode node)
Result & get_input(StringRef identifier) const
Definition operation.cc:144
Result & get_result(StringRef identifier)
Definition operation.cc:46
local_group_size(16, 16) .push_constant(Type b
void node_type_size_preset(bNodeType *ntype, eNodeSizePreset size)
Definition node.cc:4614
void node_register_type(bNodeType *ntype)
Definition node.cc:1708
static void node_composit_buts_switch(uiLayout *layout, bContext *, PointerRNA *ptr)
static NodeOperation * get_compositor_operation(Context &context, DNode node)
static void cmp_node_switch_declare(NodeDeclarationBuilder &b)
void register_node_type_cmp_switch()
void cmp_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
int16_t custom1
Defines a node type.
Definition BKE_node.hh:218
NodeGetCompositorOperationFunction get_compositor_operation
Definition BKE_node.hh:324
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
Definition BKE_node.hh:238
NodeDeclareFunction declare
Definition BKE_node.hh:347
PointerRNA * ptr
Definition wm_files.cc:4126