Blender V5.3
node_geo_input_object.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2024 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
6#include "UI_resources.hh"
7
9
10#include "node_geometry_util.hh"
11
13
15{
16 b.add_output<decl::Object>("Object"_ustr).custom_draw([](CustomSocketDrawParams &params) {
18 params.layout.prop(&params.node_ptr, "object", ui::ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
19 });
20}
21
23{
24 Object *object = reinterpret_cast<Object *>(params.node().id);
25 params.set_output("Object"_ustr, object);
26}
27
28using namespace blender::compositor;
29
31 public:
33
34 void execute() override
35 {
36 Object *object = reinterpret_cast<Object *>(this->node().id);
37 Result &result = this->get_result("Object");
38 result.allocate_single_value();
39 result.set_single_value(object);
40 }
41};
42
44{
45 return new InputObjectOperation(context, node);
46}
47
48static void node_register()
49{
50 static bke::bNodeType ntype;
51
52 geo_cmp_node_type_base(&ntype, "GeometryNodeInputObject"_ustr, GEO_NODE_INPUT_OBJECT);
53 ntype.ui_name = "Object";
54 ntype.ui_description = "Output a single object";
55 ntype.enum_name_legacy = "INPUT_OBJECT";
57 ntype.declare = node_declare;
61}
63
64} // namespace blender::nodes::node_geo_input_object_cc
#define NODE_CLASS_INPUT
Definition BKE_node.hh:478
#define GEO_NODE_INPUT_OBJECT
#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 NodeOperation * get_compositor_operation(Context &context, const bNode &node)
static void node_declare(NodeDeclarationBuilder &b)
static void node_geo_exec(GeoNodeExecParams params)
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
const char * enum_name_legacy
Definition BKE_node.hh:274
NodeDeclareFunction declare
Definition BKE_node.hh:393
void alignment_set(LayoutAlign alignment)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< StringRef > name_opt, int icon, std::optional< StringRef > placeholder=std::nullopt)