--------------------------------- FileResourceManager::Init Load the asset database from the engine and project files and link them together
| 30 | // Load the asset database from the engine and project files and link them together |
| 31 | // |
| 32 | void FileResourceManager::Init() |
| 33 | { |
| 34 | // init databases and file directories unlinked |
| 35 | InitDb(m_ProjectDb, m_ProjectDir, EditorConfig::GetInstance()->GetProjectPath()); |
| 36 | InitDb(m_EngineDb, m_EngineDir, EditorConfig::GetInstance()->GetEnginePath()); |
| 37 | |
| 38 | // link databases |
| 39 | auto assetGetter = [this](core::HashString const assetId) |
| 40 | { |
| 41 | core::I_Asset* ret = m_ProjectDb.GetAsset(assetId, false); |
| 42 | |
| 43 | if (ret == nullptr) |
| 44 | { |
| 45 | return m_EngineDb.GetAsset(assetId); // we only need to log if the first search fails |
| 46 | } |
| 47 | |
| 48 | return ret; |
| 49 | }; |
| 50 | |
| 51 | SetAssetReferences(m_ProjectDb, assetGetter); |
| 52 | SetAssetReferences(m_EngineDb, assetGetter); |
| 53 | } |
| 54 | |
| 55 | //--------------------------------- |
| 56 | // FileResourceManager::Deinit |