Blender V4.5
node_composite_value.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
8
10
12
13#include "UI_interface.hh"
14#include "UI_resources.hh"
15
16/* **************** VALUE ******************** */
17
19
21{
22 b.add_output<decl::Float>("Value").default_value(0.5f).custom_draw(
24 uiLayout &row = params.layout.row(true);
25 row.prop(&params.socket_ptr, "default_value", UI_ITEM_NONE, "", ICON_NONE);
26 });
27 ;
28}
29
30using namespace blender::compositor;
31
33 public:
35
36 void execute() override
37 {
38 Result &result = get_result("Value");
39 result.allocate_single_value();
40
41 const bNodeSocket *socket = static_cast<bNodeSocket *>(bnode().outputs.first);
42 float value = static_cast<bNodeSocketValueFloat *>(socket->default_value)->value;
43
44 result.set_single_value(value);
45 }
46};
47
49{
50 return new ValueOperation(context, node);
51}
52
53} // namespace blender::nodes::node_composite_value_cc
54
56{
58
59 static blender::bke::bNodeType ntype;
60
61 cmp_node_type_base(&ntype, "CompositorNodeValue", CMP_NODE_VALUE);
62 ntype.ui_name = "Value";
63 ntype.ui_description = "Input numerical values to other nodes in the node graph";
64 ntype.enum_name_legacy = "VALUE";
66 ntype.declare = file_ns::cmp_node_value_declare;
68 ntype.get_compositor_operation = file_ns::get_compositor_operation;
69 ntype.gather_link_search_ops = nullptr;
70
72}
#define NODE_CLASS_INPUT
Definition BKE_node.hh:433
#define CMP_NODE_VALUE
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define UI_ITEM_NONE
NodeOperation(Context &context, DNode node)
Result & get_result(StringRef identifier)
Definition operation.cc:39
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
void node_register_type(bNodeType &ntype)
Definition node.cc:2748
void node_type_size_preset(bNodeType &ntype, eNodeSizePreset size)
Definition node.cc:5585
static NodeOperation * get_compositor_operation(Context &context, DNode node)
static void cmp_node_value_declare(NodeDeclarationBuilder &b)
void cmp_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
static void register_node_type_cmp_value()
void * first
void * default_value
ListBase outputs
Defines a node type.
Definition BKE_node.hh:226
std::string ui_description
Definition BKE_node.hh:232
NodeGetCompositorOperationFunction get_compositor_operation
Definition BKE_node.hh:336
const char * enum_name_legacy
Definition BKE_node.hh:235
NodeGatherSocketLinkOperationsFunction gather_link_search_ops
Definition BKE_node.hh:371
NodeDeclareFunction declare
Definition BKE_node.hh:355
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< blender::StringRef > name_opt, int icon, std::optional< blender::StringRef > placeholder=std::nullopt)