diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index db9ba211b..e5a06abcc 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -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)); diff --git a/apps/openmw_test_suite/detournavigator/navigator.cpp b/apps/openmw_test_suite/detournavigator/navigator.cpp index 4ac1b15ac..2bfab13a4 100644 --- a/apps/openmw_test_suite/detournavigator/navigator.cpp +++ b/apps/openmw_test_suite/detournavigator/navigator.cpp @@ -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; diff --git a/components/detournavigator/asyncnavmeshupdater.cpp b/components/detournavigator/asyncnavmeshupdater.cpp index 4897d2594..48860c33d 100644 --- a/components/detournavigator/asyncnavmeshupdater.cpp +++ b/components/detournavigator/asyncnavmeshupdater.cpp @@ -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); } } diff --git a/components/detournavigator/debug.cpp b/components/detournavigator/debug.cpp index d1c6edefd..0ddf002d9 100644 --- a/components/detournavigator/debug.cpp +++ b/components/detournavigator/debug.cpp @@ -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); diff --git a/components/detournavigator/settings.hpp b/components/detournavigator/settings.hpp index e06b8159f..6983eb431 100644 --- a/components/detournavigator/settings.hpp +++ b/components/detournavigator/settings.hpp @@ -9,6 +9,8 @@ namespace DetourNavigator { bool mEnableWriteRecastMeshToFile; bool mEnableWriteNavMeshToFile; + bool mEnableRecastMeshFileNameRevision; + bool mEnableNavMeshFileNameRevision; float mCellHeight; float mCellSize; float mDetailSampleDist; diff --git a/files/settings-default.cfg b/files/settings-default.cfg index 58213f089..8a78e745c 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -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 =