Working on save-load system and UI

This commit is contained in:
Vladislav Khorev committed 2026-06-20 21:41:07 +03:00
1 parent 901142385d
commit d7db0faea3
29 files changed
+708 -180

No files matched your search

+22
View File
@@ -13,6 +13,16 @@ namespace ZL
using std::max;
#endif
static std::unordered_map<std::string, BoneSystemNew> s_boneSystemCache;
static std::string BoneCacheKey(const std::string& fileName, const std::string& ZIPFileName)
{
std::string base = fileName;
if (base.size() > 4 && base.compare(base.size() - 4, 4, ".bin") == 0)
base = base.substr(0, base.size() - 4);
return ZIPFileName.empty() ? base : ZIPFileName + ":" + base;
}
int getIndexByValue(const std::string& name, const std::vector<std::string>& words)
{
for (int i = 0; i < words.size(); i++)
@@ -75,6 +85,10 @@ namespace ZL
void BoneSystemNew::LoadFromFile(const std::string& fileName, const std::string& ZIPFileName)
{
std::string key = BoneCacheKey(fileName, ZIPFileName);
auto cacheIt = s_boneSystemCache.find(key);
if (cacheIt != s_boneSystemCache.end()) { *this = cacheIt->second; return; }
std::ifstream filestream;
std::istringstream zipStream;
@@ -487,6 +501,8 @@ namespace ZL
}
}
s_boneSystemCache[key] = *this;
if (startBones.size() > MAX_GPU_BONES)
{
std::cout << "Warning: model has " << startBones.size()
@@ -496,6 +512,10 @@ namespace ZL
void BoneSystemNew::LoadFromBinaryFile(const std::string& fileName, const std::string& ZIPFileName)
{
std::string key = BoneCacheKey(fileName, ZIPFileName);
auto cacheIt = s_boneSystemCache.find(key);
if (cacheIt != s_boneSystemCache.end()) { *this = cacheIt->second; return; }
std::vector<char> fileData;
if (!ZIPFileName.empty())
@@ -678,6 +698,8 @@ namespace ZL
}
}
s_boneSystemCache[key] = *this;
if (startBones.size() > MAX_GPU_BONES)
{
std::cout << "Warning: model has " << startBones.size()