Blender V5.3
node_geo_input_font.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2026 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#include "BKE_vfont.hh"
6
7#include "DNA_vfont_types.h"
8
9#include "UI_interface_c.hh"
11
12#include "COM_node_operation.hh"
13
14#include "node_geometry_util.hh"
15
17
19{
20 b.add_output<decl::Font>("Font"_ustr).custom_draw([](CustomSocketDrawParams &params) {
22 ui::template_id(&params.layout,
23 &params.C,
24 &params.node_ptr,
25 "font",
26 nullptr,
27 "FONT_OT_open",
28 "FONT_OT_unlink");
29 });
30}
31
32static void node_init(bNodeTree * /*ntree*/, bNode *node)
33{
34 node->id = id_cast<ID *>(BKE_vfont_builtin_ensure());
35}
36
38{
39 VFont *font = id_cast<VFont *>(params.node().id);
40 params.set_output("Font"_ustr, font);
41}
42
43using namespace blender::compositor;
44
46 public:
48
49 void execute() override
50 {
51 VFont *font = id_cast<VFont *>(this->node().id);
52 Result &result = this->get_result("Font");
53 result.allocate_single_value();
54 result.set_single_value(font);
55 }
56};
57
59{
60 return new InputFontOperation(context, node);
61}
62
63static void node_register()
64{
65 static bke::bNodeType ntype;
66
67 geo_cmp_node_type_base(&ntype, "GeometryNodeInputFont"_ustr);
68 ntype.ui_name = "Font";
69 ntype.ui_description = "Output a font";
71 ntype.declare = node_declare;
72 ntype.initfunc = node_init;
76}
78
79} // namespace blender::nodes::node_geo_input_font_cc
#define NODE_CLASS_INPUT
Definition BKE_node.hh:478
#define NOD_REGISTER_NODE(REGISTER_FUNC)
NodeOperation(Context &context, const bNode &node)
Result & get_result(StringRef identifier)
Definition operation.cc:40
void set_output(const UString identifier, T &&value)
void node_register_type(bNodeType &ntype)
Definition node.cc:2920
static void node_init(bNodeTree *, bNode *node)
static void node_geo_exec(GeoNodeExecParams params)
static void node_declare(NodeDeclarationBuilder &b)
static NodeOperation * get_compositor_operation(Context &context, const bNode &node)
void template_id(Layout *layout, const bContext *C, PointerRNA *ptr, StringRefNull propname, const char *newop, const char *openop, const char *unlinkop, int filter=TEMPLATE_ID_FILTER_ALL, bool live_icon=false, std::optional< StringRef > text=std::nullopt)
VFont * BKE_vfont_builtin_ensure()
Definition vfont.cc:387
void geo_cmp_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
Defines a node type.
Definition BKE_node.hh:265
std::string ui_description
Definition BKE_node.hh:271
NodeGetCompositorOperationFunction get_compositor_operation
Definition BKE_node.hh:379
NodeGeometryExecFunction geometry_node_execute
Definition BKE_node.hh:385
void(*) initfunc(bNodeTree *ntree, bNode *node)
Definition BKE_node.hh:320
NodeDeclareFunction declare
Definition BKE_node.hh:393
void alignment_set(LayoutAlign alignment)