mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Recast: fix tile tool not rebuilding static pathing data
Static pathing data is only build when the entire navmesh is build, but if an individual tile has been created, then the data isn't rebuild to accommodate the changes. Building code has been moved to the base class as it should be used for all tile editors, and is now also called from other code paths that require it.
This commit is contained in:
parent
4a3beeb658
commit
fadb53cb46
@ -21,6 +21,7 @@
|
||||
#include "Shared/Include/SharedAssert.h"
|
||||
#include "Detour/Include/DetourNavMesh.h"
|
||||
#include "Detour/Include/DetourNavMeshQuery.h"
|
||||
#include "Detour/Include/DetourNavMeshBuilder.h"
|
||||
#include "DetourCrowd/Include/DetourCrowd.h"
|
||||
#include "DebugUtils/Include/RecastDebugDraw.h"
|
||||
#include "DebugUtils/Include/DetourDebugDraw.h"
|
||||
@ -308,6 +309,20 @@ void Editor::handleUpdate(const float dt)
|
||||
updateToolStates(dt);
|
||||
}
|
||||
|
||||
void Editor::buildStaticPathingData()
|
||||
{
|
||||
dtDisjointSet data;
|
||||
|
||||
if (!dtCreateDisjointPolyGroups(m_navMesh, data))
|
||||
{
|
||||
m_ctx->log(RC_LOG_ERROR, "buildStaticPathingData: Failed to build disjoint poly groups.");
|
||||
}
|
||||
|
||||
if (!dtCreateTraversalTableData(m_navMesh, data, NavMesh_GetTraversalTableCountForNavMeshType(m_selectedNavMeshType)))
|
||||
{
|
||||
m_ctx->log(RC_LOG_ERROR, "buildStaticPathingData: Failed to build traversal table data.");
|
||||
}
|
||||
}
|
||||
|
||||
void Editor::updateToolStates(const float dt)
|
||||
{
|
||||
|
@ -113,6 +113,8 @@ public:
|
||||
m_editor->removeTile(m_hitPos);
|
||||
else
|
||||
m_editor->buildTile(m_hitPos);
|
||||
|
||||
m_editor->buildStaticPathingData();
|
||||
}
|
||||
}
|
||||
|
||||
@ -521,17 +523,7 @@ void Editor_TileMesh::buildAllTiles()
|
||||
}
|
||||
}
|
||||
|
||||
dtDisjointSet data;
|
||||
|
||||
if (!dtCreateDisjointPolyGroups(m_navMesh, data))
|
||||
{
|
||||
m_ctx->log(RC_LOG_ERROR, "buildNavigation: Failed to build disjoint poly groups.");
|
||||
}
|
||||
|
||||
if (!dtCreateTraversalTableData(m_navMesh, data, NavMesh_GetTraversalTableCountForNavMeshType(m_selectedNavMeshType)))
|
||||
{
|
||||
m_ctx->log(RC_LOG_ERROR, "buildNavigation: Failed to build traversal table data.");
|
||||
}
|
||||
buildStaticPathingData();
|
||||
|
||||
// Start the build process.
|
||||
m_ctx->stopTimer(RC_TIMER_TEMP);
|
||||
|
@ -207,6 +207,8 @@ public:
|
||||
void resetCommonSettings();
|
||||
void handleCommonSettings();
|
||||
|
||||
void buildStaticPathingData();
|
||||
|
||||
private:
|
||||
// Explicitly disabled copy constructor and copy assignment operator.
|
||||
Editor(const Editor&);
|
||||
|
Loading…
x
Reference in New Issue
Block a user