feat: automatically loading models used in skeleton

This commit is contained in:
MihailRis
2024-07-17 12:12:40 +03:00
parent 051dc6e05f
commit 739ef49d8f
11 changed files with 43 additions and 32 deletions
+11
View File
@@ -12,6 +12,7 @@
#include "../content/Content.hpp"
#include "../content/ContentPack.hpp"
#include "../voxels/Block.hpp"
#include "../objects/rigging.hpp"
#include "../graphics/core/Texture.hpp"
#include "../logic/scripting/scripting.hpp"
@@ -205,6 +206,16 @@ void AssetsLoader::addDefaults(AssetsLoader& loader, const Content* content) {
fs::path folder = info.folder / fs::path("layouts");
addLayouts(pack->getEnvironment(), info.id, folder, loader);
}
for (auto& entry : content->getSkeletons()) {
auto& skeleton = *entry.second;
for (auto& bone : skeleton.getBones()) {
auto& model = bone->model.name;
if (!model.empty()) {
loader.add(AssetType::MODEL, MODELS_FOLDER+"/"+model, model);
}
}
}
}
loader.add(AssetType::ATLAS, TEXTURES_FOLDER+"/blocks", "blocks");
loader.add(AssetType::ATLAS, TEXTURES_FOLDER+"/items", "items");