Blender V4.5
AS_asset_representation.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
13
14#pragma once
15
16#include <memory>
17#include <optional>
18#include <string>
19#include <variant>
20
21#include "BLI_string_ref.hh"
22#include "BLI_utility_mixins.hh"
23
24#include "DNA_ID_enums.h"
25#include "DNA_asset_types.h"
26
27struct AssetMetaData;
28struct ID;
29struct PreviewImage;
30
31namespace blender::asset_system {
32
33class AssetLibrary;
34
37 AssetLibrary &owner_asset_library_;
42 std::string relative_identifier_;
43
44 struct ExternalAsset {
45 std::string name;
46 int id_type = 0;
47 std::unique_ptr<AssetMetaData> metadata_ = nullptr;
48 PreviewImage *preview_ = nullptr;
49 };
50 std::variant<ExternalAsset, ID *> asset_;
51
52 friend class AssetLibrary;
53
54 public:
56 AssetRepresentation(StringRef relative_asset_path,
57 StringRef name,
58 int id_type,
59 std::unique_ptr<AssetMetaData> metadata,
67
74
83 void ensure_previewable();
91
92 StringRefNull get_name() const;
93 ID_Type get_id_type() const;
95
97 std::string full_path() const;
98 std::string full_library_path() const;
99
105 std::optional<eAssetImportMethod> get_import_method() const;
111 bool may_override_import_method() const;
112 bool get_use_relative_path() const;
117 ID *local_id() const;
119 bool is_local_id() const;
121};
122
123} // namespace blender::asset_system
Enumerations for DNA_ID.h.
ID_Type
NonCopyable(const NonCopyable &other)=delete
NonMovable(NonMovable &&other)=delete
AssetRepresentation(StringRef relative_asset_path, StringRef name, int id_type, std::unique_ptr< AssetMetaData > metadata, AssetLibrary &owner_asset_library)
std::optional< eAssetImportMethod > get_import_method() const
The meta-data of an asset. By creating and giving this for a data-block (ID.asset_data),...
Definition DNA_ID.h:404