mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-14 07:36:11 +00:00
Added functionality to import filenames from .pak.contents.txt files
This commit is contained in:
50
src/Core/GameProject/CAssetNameMap.cpp
Normal file
50
src/Core/GameProject/CAssetNameMap.cpp
Normal file
@@ -0,0 +1,50 @@
|
||||
#include "CAssetNameMap.h"
|
||||
|
||||
std::map<EGame, CAssetNameMap*> CAssetNameMap::smGameMap;
|
||||
|
||||
CAssetNameMap::CAssetNameMap(EGame Game)
|
||||
: mGame(Game)
|
||||
{
|
||||
TString ListPath = GetAssetListPath(mGame);
|
||||
CXMLReader Reader(ListPath);
|
||||
Serialize(Reader);
|
||||
}
|
||||
|
||||
void CAssetNameMap::SaveAssetNames()
|
||||
{
|
||||
TString ListPath = GetAssetListPath(mGame);
|
||||
CXMLWriter Writer(ListPath, "AssetList", 0, mGame);
|
||||
Serialize(Writer);
|
||||
}
|
||||
|
||||
void CAssetNameMap::GetNameInfo(CAssetID ID, TString& rOutDirectory, TString& rOutName)
|
||||
{
|
||||
auto It = mMap.find(ID);
|
||||
|
||||
if (It != mMap.end())
|
||||
{
|
||||
SAssetNameInfo& rInfo = It->second;
|
||||
rOutName = rInfo.Name;
|
||||
rOutDirectory = rInfo.Directory;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
rOutDirectory = "Uncategorized\\";
|
||||
rOutName = ID.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
void CAssetNameMap::CopyFromStore(CResourceStore *pStore /*= gpResourceStore*/)
|
||||
{
|
||||
for (CResourceIterator It(pStore); It; ++It)
|
||||
{
|
||||
if (It->IsCategorized() || It->IsNamed())
|
||||
{
|
||||
CAssetID ID = It->ID();
|
||||
TWideString Name = It->Name();
|
||||
TWideString Directory = It->Directory()->FullPath();
|
||||
mMap[ID] = SAssetNameInfo { Name, Directory };
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user