Blender V5.0
bake_data_block_map.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2005 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#include <ostream>
6
8
9#include "BLI_hash.hh"
10
11#include "DNA_ID.h"
12#include "DNA_modifier_types.h"
13
14namespace blender::bke::bake {
15
17 : type(type), id_name(std::move(id_name)), lib_name(std::move(lib_name))
18{
19}
20
22{
23 this->type = GS(id.name);
24 this->id_name = id.name + 2;
25 if (ID_IS_LINKED(&id)) {
26 this->lib_name = id.lib->id.name + 2;
27 }
28}
29
31 : BakeDataBlockID(ID_Type(data_block.id_type),
32 StringRef(data_block.id_name),
33 StringRef(data_block.lib_name))
34{
35}
36
37std::ostream &operator<<(std::ostream &stream, const BakeDataBlockID &id)
38{
39 return stream << "(" << id.id_name << ", Lib: " << id.lib_name << ")";
40}
41
43{
44 return get_default_hash(this->type, this->id_name, this->lib_name);
45}
46
47} // namespace blender::bke::bake
ID and Library types, which are fundamental for SDNA.
#define ID_IS_LINKED(_id)
Definition DNA_ID.h:694
ID_Type
unsigned long long int uint64_t
#define GS(x)
std::ostream & operator<<(std::ostream &stream, const BakeDataBlockID &id)
uint64_t get_default_hash(const T &v, const Args &...args)
Definition BLI_hash.hh:233
const char * name
Definition DNA_ID.h:414
BakeDataBlockID(ID_Type type, std::string id_name, std::string lib_name)