Blender V4.3
NOD_geo_index_switch.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 const char *node_idname = "GeometryNodeIndexSwitch";
22 static constexpr bool has_type = false;
23 static constexpr bool has_name = false;
24 static constexpr bool has_single_identifier_str = true;
25
27 {
28 auto &storage = *static_cast<NodeIndexSwitch *>(node.storage);
29 return {&storage.items, &storage.items_num, nullptr};
30 }
31 static void copy_item(const IndexSwitchItem &src, IndexSwitchItem &dst)
32 {
33 dst = src;
34 }
35 static void destruct_item(IndexSwitchItem * /*item*/) {}
36 static void blend_write(BlendWriter *writer, const bNode &node);
37 static void blend_read_data(BlendDataReader *reader, bNode &node);
38 static void init(bNode &node, IndexSwitchItem &item)
39 {
40 auto &storage = *static_cast<NodeIndexSwitch *>(node.storage);
41 item.identifier = storage.next_identifier++;
42 }
43 static std::string socket_identifier_for_item(const IndexSwitchItem &item)
44 {
45 return "Item_" + std::to_string(item.identifier);
46 }
47};
48
49} // namespace blender::nodes
struct IndexSwitchItem IndexSwitchItem
IndexSwitchItem * items
static void blend_write(BlendWriter *writer, const bNode &node)
static void init(bNode &node, IndexSwitchItem &item)
static std::string socket_identifier_for_item(const IndexSwitchItem &item)
static void destruct_item(IndexSwitchItem *)
static void blend_read_data(BlendDataReader *reader, bNode &node)
static socket_items::SocketItemsRef< IndexSwitchItem > get_items_from_node(bNode &node)
static void copy_item(const IndexSwitchItem &src, IndexSwitchItem &dst)