Moved region rebake button to 'Tools' menu

This commit is contained in:
Shyotl
2012-12-25 02:27:15 -06:00
parent 1f5c2095a5
commit f8a6e2e19f
21 changed files with 450 additions and 398 deletions

View File

@@ -183,6 +183,7 @@
#include "llmenugl.h"
#include "llmimetypes.h"
#include "llmorphview.h"
#include "llmenuoptionpathfindingrebakenavmesh.h"
#include "llmoveview.h"
#include "llmutelist.h"
#include "llnotify.h"
@@ -5327,6 +5328,39 @@ class LLToolsEnablePathfindingView : public view_listener_t
}
};
class LLToolsDoPathfindingRebakeRegion : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
bool hasPathfinding = (LLPathfindingManager::getInstance() != NULL);
if (hasPathfinding)
{
LLMenuOptionPathfindingRebakeNavmesh::getInstance()->sendRequestRebakeNavmesh();
}
return hasPathfinding;
}
};
class LLToolsEnablePathfindingRebakeRegion : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
bool returnValue = false;
if (LLPathfindingManager::getInstance() != NULL)
{
LLMenuOptionPathfindingRebakeNavmesh *rebakeInstance = LLMenuOptionPathfindingRebakeNavmesh::getInstance();
returnValue = (rebakeInstance->canRebakeRegion() &&
(rebakeInstance->getMode() == LLMenuOptionPathfindingRebakeNavmesh::kRebakeNavMesh_Available));
}
gMenuHolder->findControl(userdata["control"].asString())->setValue(returnValue);
return returnValue;
}
};
// Round the position of all root objects to the grid
class LLToolsSnapObjectXY : public view_listener_t
{
@@ -9511,7 +9545,8 @@ void initialize_menus()
addMenu(new LLToolsEnablePathfinding(), "Tools.EnablePathfinding");
addMenu(new LLToolsEnablePathfindingView(), "Tools.EnablePathfindingView");
addMenu(new LLToolsDoPathfindingRebakeRegion(), "Tools.DoPathfindingRebakeRegion");
addMenu(new LLToolsEnablePathfindingRebakeRegion(), "Tools.EnablePathfindingRebakeRegion");
/*addMenu(new LLToolsVisibleBuyObject(), "Tools.VisibleBuyObject");
addMenu(new LLToolsVisibleTakeObject(), "Tools.VisibleTakeObject");*/