Blender V4.5
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
18
19namespace blender::bke::bake {
20
27class BakeItem {
28 public:
33 std::string name;
34
35 virtual ~BakeItem() = default;
36
37 virtual void count_memory(MemoryCounter &memory) const;
38};
39
49
57
58class GeometryBakeItem : public BakeItem {
59 public:
61
63
64 void count_memory(MemoryCounter &memory) const override;
65
71
78 static void try_restore_data_blocks(GeometrySet &geometry, BakeDataBlockMap *data_block_map);
79};
80
87 private:
88 std::string name_;
89
90 public:
91 AttributeBakeItem(std::string name) : name_(std::move(name)) {}
92
94 {
95 return name_;
96 }
97};
98
99#ifdef WITH_OPENVDB
100class VolumeGridBakeItem : public BakeItem {
101 public:
103 std::unique_ptr<GVolumeGrid> grid;
104
105 VolumeGridBakeItem(std::unique_ptr<GVolumeGrid> grid);
106 ~VolumeGridBakeItem() override;
107
108 void count_memory(MemoryCounter &memory) const override;
109};
110#endif
111
114 private:
115 const CPPType &type_;
116 void *value_;
117
118 public:
119 PrimitiveBakeItem(const CPPType &type, const void *value);
120 ~PrimitiveBakeItem() override;
121
122 const void *value() const
123 {
124 return value_;
125 }
126
127 const CPPType &type() const
128 {
129 return type_;
130 }
131};
132
133class StringBakeItem : public BakeItem {
134 private:
135 std::string value_;
136
137 public:
138 StringBakeItem(std::string value);
139
141 {
142 return value_;
143 }
144
145 void count_memory(MemoryCounter &memory) const override;
146};
147
153class BundleBakeItem : public BakeItem {
154 public:
155 struct Item {
157 std::string socket_idname;
158 std::unique_ptr<BakeItem> value;
159 };
160
162};
163
164} // 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)
Definition bake_items.cc:56
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