mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-30 09:45:36 +00:00
Option to enable/disable file names revisions
This commit is contained in:
parent
f8909218ee
commit
373adc6ec4
6 changed files with 23 additions and 6 deletions
|
@ -189,6 +189,8 @@ namespace MWWorld
|
|||
navigatorSettings.mEnableWriteNavMeshToFile = Settings::Manager::getBool("enable write nav mesh to file", "Navigator");
|
||||
navigatorSettings.mRecastMeshPathPrefix = Settings::Manager::getString("recast mesh path prefix", "Navigator");
|
||||
navigatorSettings.mNavMeshPathPrefix = Settings::Manager::getString("nav mesh path prefix", "Navigator");
|
||||
navigatorSettings.mEnableRecastMeshFileNameRevision = Settings::Manager::getBool("enable recast mesh file name revision", "Navigator");
|
||||
navigatorSettings.mEnableNavMeshFileNameRevision = Settings::Manager::getBool("enable nav mesh file name revision", "Navigator");
|
||||
DetourNavigator::Log::instance().setEnabled(Settings::Manager::getBool("enable log", "Navigator"));
|
||||
mNavigator.reset(new DetourNavigator::Navigator(navigatorSettings));
|
||||
|
||||
|
|
|
@ -35,6 +35,8 @@ namespace
|
|||
{
|
||||
mSettings.mEnableWriteRecastMeshToFile = false;
|
||||
mSettings.mEnableWriteNavMeshToFile = false;
|
||||
mSettings.mEnableRecastMeshFileNameRevision = false;
|
||||
mSettings.mEnableNavMeshFileNameRevision = false;
|
||||
mSettings.mCellHeight = 0.2f;
|
||||
mSettings.mCellSize = 0.2f;
|
||||
mSettings.mDetailSampleDist = 6;
|
||||
|
|
|
@ -117,12 +117,21 @@ namespace DetourNavigator
|
|||
void AsyncNavMeshUpdater::writeDebugFiles(const Job& job) const
|
||||
{
|
||||
std::string revision;
|
||||
if (mSettings.get().mEnableWriteNavMeshToFile || mSettings.get().mEnableWriteRecastMeshToFile)
|
||||
revision = std::to_string((std::chrono::steady_clock::now()
|
||||
std::string recastMeshRevision;
|
||||
std::string navMeshRevision;
|
||||
if ((mSettings.get().mEnableWriteNavMeshToFile || mSettings.get().mEnableWriteRecastMeshToFile)
|
||||
&& (mSettings.get().mEnableRecastMeshFileNameRevision || mSettings.get().mEnableNavMeshFileNameRevision))
|
||||
{
|
||||
revision = "." + std::to_string((std::chrono::steady_clock::now()
|
||||
- std::chrono::steady_clock::time_point()).count());
|
||||
if (mSettings.get().mEnableRecastMeshFileNameRevision)
|
||||
recastMeshRevision = revision;
|
||||
if (mSettings.get().mEnableNavMeshFileNameRevision)
|
||||
navMeshRevision = revision;
|
||||
}
|
||||
if (mSettings.get().mEnableWriteRecastMeshToFile)
|
||||
writeToFile(*job.mRecastMesh, mSettings.get().mRecastMeshPathPrefix, revision);
|
||||
writeToFile(*job.mRecastMesh, mSettings.get().mRecastMeshPathPrefix, recastMeshRevision);
|
||||
if (mSettings.get().mEnableWriteNavMeshToFile)
|
||||
writeToFile(*job.mNavMeshCacheItem->mValue.lock(), mSettings.get().mNavMeshPathPrefix, revision);
|
||||
writeToFile(*job.mNavMeshCacheItem->mValue.lock(), mSettings.get().mNavMeshPathPrefix, navMeshRevision);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace DetourNavigator
|
|||
{
|
||||
void writeToFile(const RecastMesh& recastMesh, const std::string& pathPrefix, const std::string& revision)
|
||||
{
|
||||
const auto path = pathPrefix + "recastmesh." + revision + ".obj";
|
||||
const auto path = pathPrefix + "recastmesh" + revision + ".obj";
|
||||
std::ofstream file(path);
|
||||
if (!file.is_open())
|
||||
throw NavigatorException("Open file failed: " + path);
|
||||
|
@ -63,7 +63,7 @@ namespace DetourNavigator
|
|||
int dataSize;
|
||||
};
|
||||
|
||||
const auto path = pathPrefix + "navmesh." + revision + ".bin";
|
||||
const auto path = pathPrefix + "all_tiles_navmesh" + revision + ".bin";
|
||||
std::ofstream file(path, std::ios::binary);
|
||||
if (!file.is_open())
|
||||
throw NavigatorException("Open file failed: " + path);
|
||||
|
|
|
@ -9,6 +9,8 @@ namespace DetourNavigator
|
|||
{
|
||||
bool mEnableWriteRecastMeshToFile;
|
||||
bool mEnableWriteNavMeshToFile;
|
||||
bool mEnableRecastMeshFileNameRevision;
|
||||
bool mEnableNavMeshFileNameRevision;
|
||||
float mCellHeight;
|
||||
float mCellSize;
|
||||
float mDetailSampleDist;
|
||||
|
|
|
@ -595,5 +595,7 @@ triangles per chunk = 256
|
|||
enable log = false
|
||||
enable write recast mesh to file = false
|
||||
enable write nav mesh to file = false
|
||||
enable recast mesh file name revision = false
|
||||
enable nav mesh file name revision = false
|
||||
recast mesh path prefix =
|
||||
nav mesh path prefix =
|
||||
|
|
Loading…
Reference in a new issue