Grindstone Game Engine v0.2.0
An open source game engine and toolkit.
Loading...
Searching...
No Matches
AssetRegistry.hpp
1#pragma once
2
3#include <filesystem>
4#include <map>
5#include <string>
6#include <vector>
7#include <unordered_set>
8
9#include <Common/ResourcePipeline/AssetType.hpp>
10#include <Common/ResourcePipeline/Uuid.hpp>
11
12namespace Grindstone::Editor {
13 class MetaFile;
14
16 public:
17 struct Entry {
18 Uuid uuid;
19 std::string displayName;
20 std::string subassetIdentifier;
21 std::string address;
22 std::filesystem::path path;
23 AssetType assetType;
24 };
25
26 public:
27 virtual ~AssetRegistry();
28
29 void Initialize(const std::filesystem::path& projectPath);
30 virtual void Cleanup();
31 virtual void UpdateEntry(
32 const std::filesystem::path& path,
33 const std::string_view subassetIdentifier,
34 const std::string_view displayName,
35 const std::string_view address,
36 Uuid& uuid,
37 AssetType assetType
38 );
39 virtual void WriteFile();
40 virtual void ReadFile();
41 virtual Uuid Import(const std::filesystem::path& path);
42 [[nodiscard]] virtual Grindstone::Editor::MetaFile GetMetaFileByPath(const std::filesystem::path& path);
43 [[nodiscard]] virtual const std::filesystem::path& GetCompiledAssetsPath() const;
44
45 virtual bool RemoveEntry(Uuid uuid);
46 virtual bool HasAsset(Uuid uuid) const;
47 virtual bool TryGetPathWithMountPoint(const std::filesystem::path& path, std::filesystem::path& outMountedPath) const;
48 virtual bool TryGetAbsolutePathFromMountedPath(const std::filesystem::path& mountedPath, std::filesystem::path& outAbsolutePath) const;
49 virtual bool TryGetAssetDataFromAbsolutePath(const std::filesystem::path& path, AssetRegistry::Entry& outEntry) const;
50 virtual bool TryGetAssetData(const std::filesystem::path & path, AssetRegistry::Entry & outEntry) const;
51 virtual bool TryGetAssetData(const std::string& address, AssetRegistry::Entry& outEntry) const;
52 virtual bool TryGetAssetData(Uuid uuid, AssetRegistry::Entry& outEntry) const;
53
54 virtual void FindAllFilesOfType(AssetType assetType, std::vector<Entry>& outEntries) const;
55
56 virtual std::unordered_set<Grindstone::Uuid> GetUsedUuids() const;
57 private:
58 std::map<Uuid, Entry> assets;
59 std::filesystem::path assetsPath;
60 std::filesystem::path compiledAssetsPath;
61 std::filesystem::path assetRegistryPath;
62 };
63}
Definition AssetRegistry.hpp:15
Definition MetaFile.hpp:13
Definition Uuid.hpp:7
Definition AssetRegistry.hpp:17