Blender V5.3
NOD_geo_closure_to_list.hh
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#pragma once
6
7#include "DNA_node_types.h"
8
9#include "NOD_socket_items.hh"
10
11namespace blender::nodes {
12
20 static int node_type;
21 static constexpr StringRefNull node_idname = "GeometryNodeClosureToList";
22 static constexpr bool has_type = true;
23 static constexpr bool has_name = true;
24 static constexpr bool has_single_identifier_str = false;
26 static constexpr StringRefNull add_item = "NODE_OT_closure_to_list_item_add";
27 static constexpr StringRefNull remove_item = "NODE_OT_closure_to_list_item_remove";
28 static constexpr StringRefNull move_item = "NODE_OT_closure_to_list_item_move";
29 };
30 struct ui_idnames {
31 static constexpr StringRefNull list = "NODE_UL_closure_to_list_items";
32 };
33 struct rna_names {
34 static constexpr StringRefNull items = "list_items";
35 static constexpr StringRefNull active_index = "active_index";
36 };
37
39 bNode &node)
40 {
41 auto &storage = *static_cast<GeometryNodeClosureToList *>(node.storage);
42 return {&storage.items, &storage.items_num, &storage.active_index};
43 }
44
47 {
48 dst = src;
49 dst.name = BLI_strdup_null(dst.name);
50 }
51
53 {
54 MEM_SAFE_DELETE(item->name);
55 }
56
57 static void blend_write_item(BlendWriter *writer, const ItemT &item);
58 static void blend_read_data_item(BlendDataReader *reader, ItemT &item);
59
61 {
63 }
64
65 static bool supports_socket_type(const eNodeSocketDatatype socket_type, const int ntree_type)
66 {
67 return bke::node_tree_type_supports_socket_type_static(ntree_type, socket_type);
68 }
69
71 {
72 return &item.name;
73 }
74
77 const eNodeSocketDatatype socket_type,
78 const char *name)
79 {
80 auto *storage = static_cast<GeometryNodeClosureToList *>(node.storage);
81 item.socket_type = socket_type;
82 item.identifier = storage->next_identifier++;
85 }
86
88 const GeometryNodeClosureToListItem & /*item*/)
89 {
90 return {};
91 }
93 {
94 return "List_" + std::to_string(item.identifier);
95 }
96};
97
98} // namespace blender::nodes
#define storage(slot, qualifiers)
bool node_tree_type_supports_socket_type_static(const int ntree_type, const eNodeSocketDatatype socket_type)
Definition node.cc:6295
void set_item_name_and_make_unique(bNode &node, typename Accessor::ItemT &item, const char *value)
char * BLI_strdup_null(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_MALLOC
NodeSocketInterfaceStructureType structure_type
static bool supports_socket_type(const eNodeSocketDatatype socket_type, const int ntree_type)
static void copy_item(const GeometryNodeClosureToListItem &src, GeometryNodeClosureToListItem &dst)
static socket_items::SocketItemsRef< GeometryNodeClosureToListItem > get_items_from_node(bNode &node)
static void destruct_item(GeometryNodeClosureToListItem *item)
static eNodeSocketDatatype get_socket_type(const ItemT &item)
static void blend_write_item(BlendWriter *writer, const ItemT &item)
static void init_with_socket_type_and_name(bNode &node, GeometryNodeClosureToListItem &item, const eNodeSocketDatatype socket_type, const char *name)
static std::string output_socket_identifier_for_item(const GeometryNodeClosureToListItem &item)
static std::string input_socket_identifier_for_item(const GeometryNodeClosureToListItem &)
static char ** get_name(GeometryNodeClosureToListItem &item)
static void blend_read_data_item(BlendDataReader *reader, ItemT &item)