mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-07 12:01:50 +00:00
change: skeletons are assets now, not content units
This commit is contained in:
parent
587c140a6b
commit
42c4716be2
17 changed files with 144 additions and 120 deletions
|
|
@ -393,6 +393,32 @@ assetload::postfunc assetload::model(
|
|||
}
|
||||
}
|
||||
|
||||
assetload::postfunc assetload::skeleton(
|
||||
AssetsLoader* loader,
|
||||
const ResPaths& paths,
|
||||
const std::string& file,
|
||||
const std::string& name,
|
||||
const std::shared_ptr<AssetCfg>& settings
|
||||
) {
|
||||
return [=](auto assets) {
|
||||
std::string text = io::read_string(file);
|
||||
auto skeleton = rigging::SkeletonConfig::parse(text, file, name);
|
||||
for (auto& bone : skeleton->getBones()) {
|
||||
std::string model = bone->model.name;
|
||||
size_t pos = model.rfind('.');
|
||||
if (pos != std::string::npos) {
|
||||
model = model.substr(0, pos);
|
||||
}
|
||||
if (!model.empty()) {
|
||||
loader->add(
|
||||
AssetType::MODEL, MODELS_FOLDER + "/" + model, model
|
||||
);
|
||||
}
|
||||
}
|
||||
assets->store(std::move(skeleton), name);
|
||||
};
|
||||
}
|
||||
|
||||
static void read_anim_file(
|
||||
const std::string& animFile,
|
||||
std::vector<std::pair<std::string, int>>& frameList
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue