From 487cdc85cd084aac399a3a95fbf002c3f8c5b8d5 Mon Sep 17 00:00:00 2001 From: Richard Harrison Date: Thu, 21 Feb 2019 19:07:37 +0100 Subject: [PATCH] DDS-TC; retain original filename and fix previous commit Set the filename back to what it was after loading - seems sensible and as yet no side effects. Also the previous commit that included the handling of sgio_exceptions also broke the DDS-TC pretty much completely. --- simgear/scene/model/ModelRegistry.cxx | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/simgear/scene/model/ModelRegistry.cxx b/simgear/scene/model/ModelRegistry.cxx index 6b18d5a3..651a4ad7 100644 --- a/simgear/scene/model/ModelRegistry.cxx +++ b/simgear/scene/model/ModelRegistry.cxx @@ -426,7 +426,7 @@ ModelRegistry::readImage(const string& fileName, boost::optional cachehash = filename_hash_cache.get(absFileName); if (cachehash) { hash = *cachehash; -// SG_LOG(SG_IO, SG_ALERT, "Hash for " + absFileName + " in cache " + hash); + // SG_LOG(SG_IO, SG_ALERT, "Hash for " + absFileName + " in cache " + hash); } else { // SG_LOG(SG_IO, SG_ALERT, "Creating hash for " + absFileName); @@ -437,18 +437,18 @@ ModelRegistry::readImage(const string& fileName, SG_LOG(SG_INPUT, SG_ALERT, "Modelregistry::failed to compute filehash '" << absFileName << "' " << e.getFormattedMessage()); hash = std::string(); } - if (hash != std::string()) { - filename_hash_cache.insert(absFileName, hash); - boost::optional cacheFilename = filename_hash_cache.findValue(hash); - - // possibly a shared texture - but warn the user to allow investigation. - if (cacheFilename && *cacheFilename != absFileName) { - SG_LOG(SG_IO, SG_ALERT, " Already have " + hash + " : " + *cacheFilename + " not " + absFileName); - } - // SG_LOG(SG_IO, SG_ALERT, " >>>> " + hash + " :: " + newName); - } - newName = cache_root + "/" + hash.substr(0, 2) + "/" + hash + ".cache.dds"; } + if (hash != std::string()) { + filename_hash_cache.insert(absFileName, hash); + boost::optional cacheFilename = filename_hash_cache.findValue(hash); + + // possibly a shared texture - but warn the user to allow investigation. + if (cacheFilename && *cacheFilename != absFileName) { + SG_LOG(SG_IO, SG_ALERT, " Already have " + hash + " : " + *cacheFilename + " not " + absFileName); + } + // SG_LOG(SG_IO, SG_ALERT, " >>>> " + hash + " :: " + newName); + } + newName = cache_root + "/" + hash.substr(0, 2) + "/" + hash + ".cache.dds"; } else { @@ -667,7 +667,7 @@ SG_LOG(SG_IO, SG_WARN, pot_message << " " << absFileName); if (srcImage1->getFileName().empty()) { srcImage1->setFileName(absFileName); } -// srcImage1->setFileName(originalFileName); + srcImage1->setFileName(originalFileName); if(cache_active && getFileExtension(absFileName) != "dds") {