update RigConfig
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
#include "../graphics/core/Font.hpp"
|
||||
#include "../graphics/core/Model.hpp"
|
||||
#include "../graphics/core/TextureAnimation.hpp"
|
||||
#include "../objects/rigging.hpp"
|
||||
#include "../frontend/UiDocument.hpp"
|
||||
#include "../constants.hpp"
|
||||
|
||||
@@ -216,7 +217,7 @@ assetload::postfunc assetload::model(
|
||||
for (auto& mesh : model->meshes) {
|
||||
if (mesh.texture.find('$') == std::string::npos) {
|
||||
auto filename = TEXTURES_FOLDER+"/"+mesh.texture;
|
||||
loader->add(AssetType::texture, filename, mesh.texture, nullptr);
|
||||
loader->add(AssetType::TEXTURE, filename, mesh.texture, nullptr);
|
||||
}
|
||||
}
|
||||
assets->store(std::unique_ptr<model::Model>(model), name);
|
||||
@@ -227,6 +228,27 @@ assetload::postfunc assetload::model(
|
||||
}
|
||||
}
|
||||
|
||||
assetload::postfunc assetload::rig(
|
||||
AssetsLoader* loader,
|
||||
const ResPaths* paths,
|
||||
const std::string& file,
|
||||
const std::string& name,
|
||||
const std::shared_ptr<AssetCfg>&
|
||||
) {
|
||||
auto path = paths->find(file+".json");
|
||||
auto text = files::read_string(path);
|
||||
try {
|
||||
auto rig = rigging::RigConfig::parse(text, path.u8string()).release();
|
||||
return [=](Assets* assets) {
|
||||
// TODO: add models loading
|
||||
assets->store(std::unique_ptr<rigging::RigConfig>(rig), name);
|
||||
};
|
||||
} catch (const parsing_error& err) {
|
||||
std::cerr << err.errorLog() << std::endl;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
static void read_anim_file(
|
||||
const std::string& animFile,
|
||||
std::vector<std::pair<std::string, int>>& frameList
|
||||
|
||||
Reference in New Issue
Block a user