浏览代码

Merge remote-tracking branch 'refs/remotes/GarageGames/development' into development

Alex Piola 9 年之前
父节点
当前提交
e9b0e966a3
共有 1 个文件被更改,包括 16 次插入0 次删除
  1. 16 0
      Engine/source/ts/collada/colladaShapeLoader.cpp

+ 16 - 0
Engine/source/ts/collada/colladaShapeLoader.cpp

@@ -529,6 +529,16 @@ bool ColladaShapeLoader::canLoadCachedDTS(const Torque::Path& path)
       }
       }
    }
    }
 
 
+   //assume the dts is good since it was zipped on purpose
+   Torque::FS::FileSystemRef ref = Torque::FS::GetFileSystem(cachedPath);
+   if (ref && !dStrcmp("Zip", ref->getTypeStr()))
+   {
+      bool forceLoadDAE = Con::getBoolVariable("$collada::forceLoadDAE", false);
+
+      if (!forceLoadDAE && Torque::FS::IsFile(cachedPath))
+          return true;
+   }
+     
    return false;
    return false;
 }
 }
 
 
@@ -709,11 +719,17 @@ TSShape* loadColladaShape(const Torque::Path &path)
 #ifndef DAE2DTS_TOOL
 #ifndef DAE2DTS_TOOL
          // Cache the Collada model to a DTS file for faster loading next time.
          // Cache the Collada model to a DTS file for faster loading next time.
          FileStream dtsStream;
          FileStream dtsStream;
+         
          if (dtsStream.open(cachedPath.getFullPath(), Torque::FS::File::Write))
          if (dtsStream.open(cachedPath.getFullPath(), Torque::FS::File::Write))
          {
          {
+            Torque::FS::FileSystemRef ref = Torque::FS::GetFileSystem(daePath);
+            if (ref && !dStrcmp("Zip", ref->getTypeStr()))
+               Con::errorf("No cached dts file found in archive for %s. Forcing cache to disk.", daePath.getFullFileName().c_str());
+
             Con::printf("Writing cached COLLADA shape to %s", cachedPath.getFullPath().c_str());
             Con::printf("Writing cached COLLADA shape to %s", cachedPath.getFullPath().c_str());
             tss->write(&dtsStream);
             tss->write(&dtsStream);
          }
          }
+
 #endif // DAE2DTS_TOOL
 #endif // DAE2DTS_TOOL
 
 
          // Add collada materials to materials.cs
          // Add collada materials to materials.cs