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.
This commit is contained in:
@@ -426,7 +426,7 @@ ModelRegistry::readImage(const string& fileName,
|
|||||||
boost::optional<std::string> cachehash = filename_hash_cache.get(absFileName);
|
boost::optional<std::string> cachehash = filename_hash_cache.get(absFileName);
|
||||||
if (cachehash) {
|
if (cachehash) {
|
||||||
hash = *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 {
|
else {
|
||||||
// SG_LOG(SG_IO, SG_ALERT, "Creating hash for " + absFileName);
|
// 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());
|
SG_LOG(SG_INPUT, SG_ALERT, "Modelregistry::failed to compute filehash '" << absFileName << "' " << e.getFormattedMessage());
|
||||||
hash = std::string();
|
hash = std::string();
|
||||||
}
|
}
|
||||||
if (hash != std::string()) {
|
|
||||||
filename_hash_cache.insert(absFileName, hash);
|
|
||||||
boost::optional<std::string> 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<std::string> 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
|
else
|
||||||
{
|
{
|
||||||
@@ -667,7 +667,7 @@ SG_LOG(SG_IO, SG_WARN, pot_message << " " << absFileName);
|
|||||||
if (srcImage1->getFileName().empty()) {
|
if (srcImage1->getFileName().empty()) {
|
||||||
srcImage1->setFileName(absFileName);
|
srcImage1->setFileName(absFileName);
|
||||||
}
|
}
|
||||||
// srcImage1->setFileName(originalFileName);
|
srcImage1->setFileName(originalFileName);
|
||||||
|
|
||||||
if(cache_active && getFileExtension(absFileName) != "dds")
|
if(cache_active && getFileExtension(absFileName) != "dds")
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user