mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Improve error messages for failed mesh loading
This commit is contained in:
parent
77e78193a0
commit
0391d91e5d
2 changed files with 12 additions and 11 deletions
|
@ -669,7 +669,7 @@ void SelfType::MeshExtractor::loadAnimation(const std::size_t animIdx)
|
||||||
|
|
||||||
const auto &sampler = anim.samplers.at(channel.sampler);
|
const auto &sampler = anim.samplers.at(channel.sampler);
|
||||||
if (sampler.interpolation != tiniergltf::AnimationSampler::Interpolation::LINEAR)
|
if (sampler.interpolation != tiniergltf::AnimationSampler::Interpolation::LINEAR)
|
||||||
throw std::runtime_error("unsupported interpolation");
|
throw std::runtime_error("unsupported interpolation, only linear interpolation is supported");
|
||||||
|
|
||||||
const auto inputAccessor = Accessor<f32>::make(m_gltf_model, sampler.input);
|
const auto inputAccessor = Accessor<f32>::make(m_gltf_model, sampler.input);
|
||||||
const auto n_frames = inputAccessor.getCount();
|
const auto n_frames = inputAccessor.getCount();
|
||||||
|
|
|
@ -140,28 +140,29 @@ IAnimatedMesh *CSceneManager::getMesh(io::IReadFile *file)
|
||||||
// load and create a mesh which we know already isn't in the cache and put it in there
|
// load and create a mesh which we know already isn't in the cache and put it in there
|
||||||
IAnimatedMesh *CSceneManager::getUncachedMesh(io::IReadFile *file, const io::path &filename, const io::path &cachename)
|
IAnimatedMesh *CSceneManager::getUncachedMesh(io::IReadFile *file, const io::path &filename, const io::path &cachename)
|
||||||
{
|
{
|
||||||
IAnimatedMesh *msh = 0;
|
|
||||||
|
|
||||||
// iterate the list in reverse order so user-added loaders can override the built-in ones
|
// iterate the list in reverse order so user-added loaders can override the built-in ones
|
||||||
|
|
||||||
|
bool unsupported = true;
|
||||||
for (auto it = MeshLoaderList.rbegin(); it != MeshLoaderList.rend(); it++) {
|
for (auto it = MeshLoaderList.rbegin(); it != MeshLoaderList.rend(); it++) {
|
||||||
if ((*it)->isALoadableFileExtension(filename)) {
|
if ((*it)->isALoadableFileExtension(filename)) {
|
||||||
|
unsupported = false;
|
||||||
// reset file to avoid side effects of previous calls to createMesh
|
// reset file to avoid side effects of previous calls to createMesh
|
||||||
file->seek(0);
|
file->seek(0);
|
||||||
msh = (*it)->createMesh(file);
|
IAnimatedMesh *msh = (*it)->createMesh(file);
|
||||||
if (msh) {
|
if (msh) {
|
||||||
MeshCache->addMesh(cachename, msh);
|
MeshCache->addMesh(cachename, msh);
|
||||||
msh->drop();
|
msh->drop();
|
||||||
break;
|
os::Printer::log("Loaded mesh", filename, ELL_DEBUG);
|
||||||
|
return msh;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!msh)
|
os::Printer::log(unsupported
|
||||||
os::Printer::log("Could not load mesh, file format seems to be unsupported", filename, ELL_ERROR);
|
? "Could not load mesh, file format seems to be unsupported"
|
||||||
else
|
: "Attempt to load mesh failed",
|
||||||
os::Printer::log("Loaded mesh", filename, ELL_DEBUG);
|
filename, ELL_ERROR);
|
||||||
|
return nullptr;
|
||||||
return msh;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//! returns the video driver
|
//! returns the video driver
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue