Blender V5.0
BKE_bake_items.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
12
14#include "BKE_geometry_set.hh"
16
17namespace blender::bke::bake {
18
25class BakeItem {
26 public:
31 std::string name;
32
33 virtual ~BakeItem() = default;
34
35 virtual void count_memory(MemoryCounter &memory) const;
36};
37
47
55
56class GeometryBakeItem : public BakeItem {
57 public:
59
61
62 void count_memory(MemoryCounter &memory) const override;
63
69
76 static void try_restore_data_blocks(GeometrySet &geometry, BakeDataBlockMap *data_block_map);
77};
78
85 private:
86 std::string name_;
87
88 public:
89 AttributeBakeItem(std::string name) : name_(std::move(name)) {}
90
92 {
93 return name_;
94 }
95};
96
97#ifdef WITH_OPENVDB
98class VolumeGridBakeItem : public BakeItem {
99 public:
101 std::unique_ptr<GVolumeGrid> grid;
102
103 VolumeGridBakeItem(std::unique_ptr<GVolumeGrid> grid);
104 ~VolumeGridBakeItem() override;
105
106 void count_memory(MemoryCounter &memory) const override;
107};
108#endif
109
112 private:
113 const CPPType &type_;
114 void *value_;
115
116 public:
117 PrimitiveBakeItem(const CPPType &type, const void *value);
118 ~PrimitiveBakeItem() override;
119
120 const void *value() const
121 {
122 return value_;
123 }
124
125 const CPPType &type() const
126 {
127 return type_;
128 }
129};
130
131class StringBakeItem : public BakeItem {
132 private:
133 std::string value_;
134
135 public:
136 StringBakeItem(std::string value);
137
139 {
140 return value_;
141 }
142
143 void count_memory(MemoryCounter &memory) const override;
144};
145
151class BundleBakeItem : public BakeItem {
152 public:
153 struct SocketValue {
154 std::string socket_idname;
155 std::unique_ptr<BakeItem> value;
156 };
157
161
162 struct Item {
163 std::string key;
164 std::variant<SocketValue, InternalValue> value;
165 };
166
168};
169
170} // namespace blender::bke::bake
virtual void count_memory(MemoryCounter &memory) const
virtual ~BakeItem()=default
static void prepare_geometry_for_bake(GeometrySet &geometry, BakeDataBlockMap *data_block_map)
GeometryBakeItem(GeometrySet geometry)
Definition bake_items.cc:25
void count_memory(MemoryCounter &memory) const override
Definition bake_items.cc:27
static void try_restore_data_blocks(GeometrySet &geometry, BakeDataBlockMap *data_block_map)
PrimitiveBakeItem(const CPPType &type, const void *value)
void count_memory(MemoryCounter &memory) const override
Map< int, const BakeItem * > items_by_id
Map< int, std::unique_ptr< BakeItem > > items_by_id
void count_memory(MemoryCounter &memory) const
std::variant< SocketValue, InternalValue > value