Plasma Engine  2.0
Loading...
Searching...
No Matches
AssetTableWriter.h
1#pragma once
2
3#include <EditorFramework/EditorFrameworkDLL.h>
4
5#include <EditorFramework/Assets/AssetCurator.h>
6#include <Foundation/Application/Config/FileSystemConfig.h>
7#include <Foundation/Configuration/Singleton.h>
8#include <Foundation/Threading/TaskSystem.h>
9
10
12class plTask;
13struct plAssetInfo;
14
21{
23 {
24 plString m_sPath;
25 plString m_sType;
26 };
27
28 plString m_sDataDir;
29 plString m_sTargetFile;
30 const plPlatformProfile* m_pProfile = nullptr;
31 bool m_bDirty = true;
32 bool m_bReset = true;
33 plMap<plString, ManagerResource> m_GuidToManagerResource;
34 plMap<plString, plString> m_GuidToPath;
35
36 plResult WriteAssetTable();
37 void Remove(const plSubAsset& subAsset);
38 void Update(const plSubAsset& subAsset);
39 void AddManagerResource(plStringView sGuid, plStringView sPath, plStringView sType);
40};
41
43class PL_EDITORFRAMEWORK_DLL plAssetTableWriter
44{
45public:
48
50 void MainThreadTick();
51
54 void NeedsReloadResource(const plUuid& assetGuid);
55
57 plResult WriteAssetTables(const plPlatformProfile* pAssetProfile, bool bForce);
58
59private:
60 void AssetCuratorEvents(const plAssetCuratorEvent& e);
61 plAssetTable* GetAssetTable(plUInt32 uiDataDirIndex, const plPlatformProfile* pAssetProfile);
62 plUInt32 FindDataDir(const plSubAsset& asset);
63
64private:
65 struct ReloadResource
66 {
67 plUInt32 m_uiDataDirIndex;
68 plString m_sResource;
69 plString m_sType;
70 };
71
72private:
73 plApplicationFileSystemConfig m_FileSystemConfig;
74 plDynamicArray<plString> m_DataDirRoots;
75
76 mutable plCuratorMutex m_AssetTableMutex;
77 bool m_bTablesDirty = true;
78 bool m_bNeedToReloadResources = false;
79 plTime m_NextTableFlush;
80 plDynamicArray<ReloadResource> m_ReloadResources;
82};
Definition FileSystemConfig.h:8
Keeps track of all asset tables and their state as well as reloading modified resources.
Definition AssetTableWriter.h:44
Custom mutex that allows to profile the time in the curator lock.
Definition AssetCurator.h:50
Definition Deque.h:270
Definition DynamicArray.h:81
Definition Map.h:408
Definition PlatformProfile.h:25
plStringView represent a read-only sub-string of a larger string, as it can store a dedicated string ...
Definition StringView.h:34
Base class for custom tasks.
Definition Task.h:10
This data type is the abstraction for 128-bit Uuid (also known as GUID) instances.
Definition Uuid.h:11
Definition AssetCurator.h:122
Definition AssetCurator.h:62
Definition AssetTableWriter.h:23
Asset table class. Persistent cache for an asset table.
Definition AssetTableWriter.h:21
Default enum for returning failure or success, instead of using a bool.
Definition Types.h:54
Information about an asset or sub-asset.
Definition AssetCurator.h:107
The time class encapsulates a double value storing the time in seconds.
Definition Time.h:12