Blender V4.3
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
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;
29
30namespace blender::asset_system {
31
32class AssetLibrary;
33
36 const AssetLibrary &owner_asset_library_;
41 std::string relative_identifier_;
42
43 struct ExternalAsset {
44 std::string name;
45 int id_type = 0;
46 std::unique_ptr<AssetMetaData> metadata_ = nullptr;
47 };
48 std::variant<ExternalAsset, ID *> asset_;
49
50 friend class AssetLibrary;
51
52 public:
54 AssetRepresentation(StringRef relative_asset_path,
55 StringRef name,
56 int id_type,
57 std::unique_ptr<AssetMetaData> metadata,
63 AssetRepresentation(StringRef relative_asset_path,
64 ID &id,
67
74
75 StringRefNull get_name() const;
76 ID_Type get_id_type() const;
78
80 std::string full_path() const;
81 std::string full_library_path() const;
82
88 std::optional<eAssetImportMethod> get_import_method() const;
94 bool may_override_import_method() const;
95 bool get_use_relative_path() const;
100 ID *local_id() const;
102 bool is_local_id() const;
103 const AssetLibrary &owner_asset_library() const;
104};
105
106} // namespace blender::asset_system
Enumerations for DNA_ID.h.
ID_Type
AssetRepresentation(StringRef relative_asset_path, StringRef name, int id_type, std::unique_ptr< AssetMetaData > metadata, const 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:413