2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-09-12 19:47:27 +00:00

fix: show asset that failed when not being able to parse jsons

This commit is contained in:
Jan
2025-07-09 16:53:53 +01:00
parent 92774e7335
commit f07202d449
7 changed files with 101 additions and 101 deletions

View File

@@ -81,21 +81,21 @@ namespace
private:
bool LoadFromFile(std::istream& jsonStream, XModel& xmodel, AssetCreationContext& context, AssetRegistration<AssetXModel>& registration)
{
const auto jRoot = nlohmann::json::parse(jsonStream);
std::string type;
unsigned version;
jRoot.at("_type").get_to(type);
jRoot.at("_version").get_to(version);
if (type != "xmodel" || version != 1u)
{
std::cerr << std::format("Tried to load xmodel \"{}\" but did not find expected type material of version 1\n", xmodel.name);
return false;
}
try
{
const auto jRoot = nlohmann::json::parse(jsonStream);
std::string type;
unsigned version;
jRoot.at("_type").get_to(type);
jRoot.at("_version").get_to(version);
if (type != "xmodel" || version != 1u)
{
std::cerr << std::format("Tried to load xmodel \"{}\" but did not find expected type material of version 1\n", xmodel.name);
return false;
}
const auto jXModel = jRoot.get<JsonXModel>();
return CreateXModelFromJson(jXModel, xmodel, context, registration);
}