Blender V4.3
NOD_geo_repeat.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
10#include "NOD_socket_items.hh"
11
12namespace blender::nodes {
13
21 static int node_type;
22 static constexpr const char *node_idname = "GeometryNodeRepeatOutput";
23 static constexpr bool has_type = true;
24 static constexpr bool has_name = true;
25 static constexpr bool has_single_identifier_str = true;
26
28 {
29 auto *storage = static_cast<NodeGeometryRepeatOutput *>(node.storage);
30 return {&storage->items, &storage->items_num, &storage->active_index};
31 }
32 static void copy_item(const NodeRepeatItem &src, NodeRepeatItem &dst)
33 {
34 dst = src;
35 dst.name = BLI_strdup_null(dst.name);
36 }
37 static void destruct_item(NodeRepeatItem *item)
38 {
39 MEM_SAFE_FREE(item->name);
40 }
41 static void blend_write(BlendWriter *writer, const bNode &node);
42 static void blend_read_data(BlendDataReader *reader, bNode &node);
47 static char **get_name(NodeRepeatItem &item)
48 {
49 return &item.name;
50 }
51 static bool supports_socket_type(const eNodeSocketDatatype socket_type)
52 {
53 return ELEM(socket_type,
67 }
69 NodeRepeatItem &item,
70 const eNodeSocketDatatype socket_type,
71 const char *name)
72 {
73 auto *storage = static_cast<NodeGeometryRepeatOutput *>(node.storage);
74 item.socket_type = socket_type;
75 item.identifier = storage->next_identifier++;
77 }
78 static std::string socket_identifier_for_item(const NodeRepeatItem &item)
79 {
80 return "Item_" + std::to_string(item.identifier);
81 }
82};
83
84} // namespace blender::nodes
char * BLI_strdup_null(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_MALLOC
Definition string.c:45
#define ELEM(...)
struct NodeRepeatItem NodeRepeatItem
eNodeSocketDatatype
@ SOCK_INT
@ SOCK_VECTOR
@ SOCK_BOOLEAN
@ SOCK_MATERIAL
@ SOCK_MATRIX
@ SOCK_FLOAT
@ SOCK_IMAGE
@ SOCK_COLLECTION
@ SOCK_GEOMETRY
@ SOCK_ROTATION
@ SOCK_OBJECT
@ SOCK_STRING
@ SOCK_RGBA
#define MEM_SAFE_FREE(v)
void set_item_name_and_make_unique(bNode &node, typename Accessor::ItemT &item, const char *value)
static void init_with_socket_type_and_name(bNode &node, NodeRepeatItem &item, const eNodeSocketDatatype socket_type, const char *name)
static socket_items::SocketItemsRef< NodeRepeatItem > get_items_from_node(bNode &node)
static char ** get_name(NodeRepeatItem &item)
static constexpr const char * node_idname
static void copy_item(const NodeRepeatItem &src, NodeRepeatItem &dst)
static constexpr bool has_single_identifier_str
static eNodeSocketDatatype get_socket_type(const NodeRepeatItem &item)
static bool supports_socket_type(const eNodeSocketDatatype socket_type)
static void blend_write(BlendWriter *writer, const bNode &node)
static void blend_read_data(BlendDataReader *reader, bNode &node)
static void destruct_item(NodeRepeatItem *item)
static std::string socket_identifier_for_item(const NodeRepeatItem &item)