Blender V5.0
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 /* Mutable to allow lazy updating on name changes in #library_relative_identifier(). */
43 mutable std::string relative_identifier_;
44
45 struct ExternalAsset {
46 std::string name;
47 int id_type = 0;
48 std::unique_ptr<AssetMetaData> metadata_ = nullptr;
49 PreviewImage *preview_ = nullptr;
50 };
51 std::variant<ExternalAsset, ID *> asset_;
52
53 friend class AssetLibrary;
54
55 public:
57 AssetRepresentation(StringRef relative_asset_path,
59 int id_type,
60 std::unique_ptr<AssetMetaData> metadata,
68
75
84 void ensure_previewable();
92
93 StringRefNull get_name() const;
94 ID_Type get_id_type() const;
96
98 std::string full_path() const;
99 std::string full_library_path() const;
100
106 std::optional<eAssetImportMethod> get_import_method() const;
112 bool may_override_import_method() const;
113 bool get_use_relative_path() const;
118 ID *local_id() const;
120 bool is_local_id() const;
122};
123
124} // 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
const char * name
The meta-data of an asset. By creating and giving this for a data-block (ID.asset_data),...
Definition DNA_ID.h:414