mirror of
https://github.com/TES3MP/TES3MP.git
synced 2025-09-28 07:32:00 -04:00
Option to enable/disable file names revisions
This commit is contained in:
parent
f8909218ee
commit
373adc6ec4
@ -189,6 +189,8 @@ namespace MWWorld
|
|||||||
navigatorSettings.mEnableWriteNavMeshToFile = Settings::Manager::getBool("enable write nav mesh to file", "Navigator");
|
navigatorSettings.mEnableWriteNavMeshToFile = Settings::Manager::getBool("enable write nav mesh to file", "Navigator");
|
||||||
navigatorSettings.mRecastMeshPathPrefix = Settings::Manager::getString("recast mesh path prefix", "Navigator");
|
navigatorSettings.mRecastMeshPathPrefix = Settings::Manager::getString("recast mesh path prefix", "Navigator");
|
||||||
navigatorSettings.mNavMeshPathPrefix = Settings::Manager::getString("nav 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"));
|
DetourNavigator::Log::instance().setEnabled(Settings::Manager::getBool("enable log", "Navigator"));
|
||||||
mNavigator.reset(new DetourNavigator::Navigator(navigatorSettings));
|
mNavigator.reset(new DetourNavigator::Navigator(navigatorSettings));
|
||||||
|
|
||||||
|
@ -35,6 +35,8 @@ namespace
|
|||||||
{
|
{
|
||||||
mSettings.mEnableWriteRecastMeshToFile = false;
|
mSettings.mEnableWriteRecastMeshToFile = false;
|
||||||
mSettings.mEnableWriteNavMeshToFile = false;
|
mSettings.mEnableWriteNavMeshToFile = false;
|
||||||
|
mSettings.mEnableRecastMeshFileNameRevision = false;
|
||||||
|
mSettings.mEnableNavMeshFileNameRevision = false;
|
||||||
mSettings.mCellHeight = 0.2f;
|
mSettings.mCellHeight = 0.2f;
|
||||||
mSettings.mCellSize = 0.2f;
|
mSettings.mCellSize = 0.2f;
|
||||||
mSettings.mDetailSampleDist = 6;
|
mSettings.mDetailSampleDist = 6;
|
||||||
|
@ -117,12 +117,21 @@ namespace DetourNavigator
|
|||||||
void AsyncNavMeshUpdater::writeDebugFiles(const Job& job) const
|
void AsyncNavMeshUpdater::writeDebugFiles(const Job& job) const
|
||||||
{
|
{
|
||||||
std::string revision;
|
std::string revision;
|
||||||
if (mSettings.get().mEnableWriteNavMeshToFile || mSettings.get().mEnableWriteRecastMeshToFile)
|
std::string recastMeshRevision;
|
||||||
revision = std::to_string((std::chrono::steady_clock::now()
|
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());
|
- std::chrono::steady_clock::time_point()).count());
|
||||||
|
if (mSettings.get().mEnableRecastMeshFileNameRevision)
|
||||||
|
recastMeshRevision = revision;
|
||||||
|
if (mSettings.get().mEnableNavMeshFileNameRevision)
|
||||||
|
navMeshRevision = revision;
|
||||||
|
}
|
||||||
if (mSettings.get().mEnableWriteRecastMeshToFile)
|
if (mSettings.get().mEnableWriteRecastMeshToFile)
|
||||||
writeToFile(*job.mRecastMesh, mSettings.get().mRecastMeshPathPrefix, revision);
|
writeToFile(*job.mRecastMesh, mSettings.get().mRecastMeshPathPrefix, recastMeshRevision);
|
||||||
if (mSettings.get().mEnableWriteNavMeshToFile)
|
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)
|
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);
|
std::ofstream file(path);
|
||||||
if (!file.is_open())
|
if (!file.is_open())
|
||||||
throw NavigatorException("Open file failed: " + path);
|
throw NavigatorException("Open file failed: " + path);
|
||||||
@ -63,7 +63,7 @@ namespace DetourNavigator
|
|||||||
int dataSize;
|
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);
|
std::ofstream file(path, std::ios::binary);
|
||||||
if (!file.is_open())
|
if (!file.is_open())
|
||||||
throw NavigatorException("Open file failed: " + path);
|
throw NavigatorException("Open file failed: " + path);
|
||||||
|
@ -9,6 +9,8 @@ namespace DetourNavigator
|
|||||||
{
|
{
|
||||||
bool mEnableWriteRecastMeshToFile;
|
bool mEnableWriteRecastMeshToFile;
|
||||||
bool mEnableWriteNavMeshToFile;
|
bool mEnableWriteNavMeshToFile;
|
||||||
|
bool mEnableRecastMeshFileNameRevision;
|
||||||
|
bool mEnableNavMeshFileNameRevision;
|
||||||
float mCellHeight;
|
float mCellHeight;
|
||||||
float mCellSize;
|
float mCellSize;
|
||||||
float mDetailSampleDist;
|
float mDetailSampleDist;
|
||||||
|
@ -595,5 +595,7 @@ triangles per chunk = 256
|
|||||||
enable log = false
|
enable log = false
|
||||||
enable write recast mesh to file = false
|
enable write recast mesh to file = false
|
||||||
enable write nav 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 =
|
recast mesh path prefix =
|
||||||
nav mesh path prefix =
|
nav mesh path prefix =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user