mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-10 21:41:50 +00:00
overwrite assets in preload.json
This commit is contained in:
parent
8d7fab1f2f
commit
6f7aeb504f
2 changed files with 9 additions and 5 deletions
|
|
@ -47,9 +47,10 @@ void AssetsLoader::add(
|
||||||
AssetType tag,
|
AssetType tag,
|
||||||
const std::string& filename,
|
const std::string& filename,
|
||||||
const std::string& alias,
|
const std::string& alias,
|
||||||
std::shared_ptr<AssetCfg> settings
|
std::shared_ptr<AssetCfg> settings,
|
||||||
|
bool overwrite
|
||||||
) {
|
) {
|
||||||
if (enqueued.find({tag, alias}) != enqueued.end()){
|
if (!overwrite && enqueued.find({tag, alias}) != enqueued.end()){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
entries.push(aloader_entry {tag, filename, alias, std::move(settings)});
|
entries.push(aloader_entry {tag, filename, alias, std::move(settings)});
|
||||||
|
|
@ -154,11 +155,12 @@ void AssetsLoader::processPreload(
|
||||||
std::string defFolder = assets_def_folder(tag);
|
std::string defFolder = assets_def_folder(tag);
|
||||||
std::string path = defFolder + "/" + name;
|
std::string path = defFolder + "/" + name;
|
||||||
if (map == nullptr) {
|
if (map == nullptr) {
|
||||||
add(tag, path, name);
|
add(tag, path, name, nullptr, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::shared_ptr<AssetCfg> config = nullptr;
|
std::shared_ptr<AssetCfg> config = nullptr;
|
||||||
map.at("path").get(path);
|
map.at("path").get(path);
|
||||||
|
logger.debug() << "processing preload " << util::quote(name) << " path: " << util::quote(path);
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
case AssetType::SOUND: {
|
case AssetType::SOUND: {
|
||||||
bool keepPCM = false;
|
bool keepPCM = false;
|
||||||
|
|
@ -196,7 +198,7 @@ void AssetsLoader::processPreload(
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
add(tag, path, name, std::move(config));
|
add(tag, path, name, std::move(config), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssetsLoader::processPreloadList(AssetType tag, const dv::value& list) {
|
void AssetsLoader::processPreloadList(AssetType tag, const dv::value& list) {
|
||||||
|
|
@ -218,6 +220,7 @@ void AssetsLoader::processPreloadList(AssetType tag, const dv::value& list) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssetsLoader::processPreloadConfig(const io::path& file) {
|
void AssetsLoader::processPreloadConfig(const io::path& file) {
|
||||||
|
logger.debug() << "===== PRELOAD FILE: " << file.string();
|
||||||
auto root = io::read_json(file);
|
auto root = io::read_json(file);
|
||||||
processPreloadList(AssetType::ATLAS, root["atlases"]);
|
processPreloadList(AssetType::ATLAS, root["atlases"]);
|
||||||
processPreloadList(AssetType::FONT, root["fonts"]);
|
processPreloadList(AssetType::FONT, root["fonts"]);
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,8 @@ public:
|
||||||
AssetType tag,
|
AssetType tag,
|
||||||
const std::string& filename,
|
const std::string& filename,
|
||||||
const std::string& alias,
|
const std::string& alias,
|
||||||
std::shared_ptr<AssetCfg> settings = nullptr
|
std::shared_ptr<AssetCfg> settings = nullptr,
|
||||||
|
bool overwrite = false
|
||||||
);
|
);
|
||||||
|
|
||||||
bool hasNext() const;
|
bool hasNext() const;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue