Correctly report issue if a required asset is not available; Fix issue loading a colormap for the gaia stars

This commit is contained in:
Alexander Bock
2021-12-28 23:39:33 +01:00
parent fdd995ba01
commit 8b4de949dc
2 changed files with 7 additions and 4 deletions

View File

@@ -2131,7 +2131,7 @@ void RenderableGaiaStars::update(const UpdateData&) {
if (!_colorTexturePath.value().empty()) {
_colorTexture = ghoul::io::TextureReader::ref().loadTexture(
absPath(_colorTexturePath).string(),
2
1
);
if (_colorTexture) {
LDEBUG(fmt::format("Loaded texture from {}", absPath(_colorTexturePath)));

View File

@@ -496,9 +496,9 @@ void AssetManager::setUpAssetLuaTable(Asset* asset) {
}
asset->addSynchronization(syncItem->synchronization.get());
std::filesystem::path dir = syncItem->synchronization->directory();
dir += std::filesystem::path::preferred_separator;
ghoul::lua::push(L, dir);
std::filesystem::path path = syncItem->synchronization->directory();
path += std::filesystem::path::preferred_separator;
ghoul::lua::push(L, path);
return 1;
},
2
@@ -697,6 +697,9 @@ Asset* AssetManager::retrieveAsset(const std::filesystem::path& path) {
return it->get();
}
if (!std::filesystem::is_regular_file(path)) {
throw ghoul::RuntimeError(fmt::format("Could not find asset file {}", path));
}
std::unique_ptr<Asset> asset = std::make_unique<Asset>(*this, path);
Asset* res = asset.get();