Blender V5.3
NOD_geo_rasterize_points.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2024 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 = "GeometryNodeRasterizePoints";
22 static constexpr bool has_type = false;
23 static constexpr bool has_name = true;
25 static constexpr StringRefNull add_item = "NODE_OT_rasterize_points_item_add";
26 static constexpr StringRefNull remove_item = "NODE_OT_rasterize_points_item_remove";
27 static constexpr StringRefNull move_item = "NODE_OT_rasterize_points_item_move";
28 };
29 struct ui_idnames {
30 static constexpr StringRefNull list = "DATA_UL_rasterize_points_items";
31 };
32 struct rna_names {
33 static constexpr StringRefNull items = "rasterize_items";
34 static constexpr StringRefNull active_index = "active_index";
35 };
36
38 bNode &node)
39 {
40 auto *storage = static_cast<NodeGeometryRasterizePoints *>(node.storage);
41 return {&storage->items, &storage->items_num, &storage->active_index};
42 }
43
46 {
47 dst = src;
48 dst.name = BLI_strdup_null(dst.name);
49 }
50
52 {
53 MEM_SAFE_DELETE(item->name);
54 }
55
56 static void blend_write_item(BlendWriter *writer, const ItemT &item);
57 static void blend_read_data_item(BlendDataReader *reader, ItemT &item);
58
60 {
61 return &item.name;
62 }
63
64 static void init_with_name(bNode &node, NodeGeometryRasterizePointsItem &item, const char *name)
65 {
66 auto *storage = static_cast<NodeGeometryRasterizePoints *>(node.storage);
68 item.identifier = storage->next_identifier++;
70 }
71
73 {
74 return "Item_" + std::to_string(item.identifier);
75 }
76};
77
78} // namespace blender::nodes
#define storage(slot, qualifiers)
void set_item_name_and_make_unique(bNode &node, typename Accessor::ItemT &item, const char *value)
@ GEO_NODE_RASTERIZE_POINTS_ITEM_TYPE_SCALAR
char * BLI_strdup_null(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_MALLOC
static socket_items::SocketItemsRef< NodeGeometryRasterizePointsItem > get_items_from_node(bNode &node)
static void destruct_item(NodeGeometryRasterizePointsItem *item)
static char ** get_name(NodeGeometryRasterizePointsItem &item)
static void copy_item(const NodeGeometryRasterizePointsItem &src, NodeGeometryRasterizePointsItem &dst)
static void blend_read_data_item(BlendDataReader *reader, ItemT &item)
static std::string socket_identifier_for_item(const NodeGeometryRasterizePointsItem &item)
static void init_with_name(bNode &node, NodeGeometryRasterizePointsItem &item, const char *name)
static void blend_write_item(BlendWriter *writer, const ItemT &item)