From 685a672b74550ca0dbf8a816257c84c9c44fd34d Mon Sep 17 00:00:00 2001
From: Todd Stinson <stinson@lindenlab.com>
Date: Thu, 28 Jun 2012 15:37:55 -0700
Subject: [PATCH] Cleaning up new files in preparation for merge into
 viewer-release.

---
 .../llfloaterpathfindingcharacters.cpp        |  4 ++
 .../newview/llfloaterpathfindingcharacters.h  |  6 ++-
 indra/newview/llfloaterpathfindingconsole.cpp | 51 +++++++++++--------
 indra/newview/llfloaterpathfindingconsole.h   | 23 +++++----
 .../newview/llfloaterpathfindinglinksets.cpp  |  4 ++
 indra/newview/llfloaterpathfindinglinksets.h  | 49 +++++++++---------
 indra/newview/llfloaterpathfindingobjects.cpp |  2 -
 indra/newview/llfloaterpathfindingobjects.h   |  1 +
 .../llpanelpathfindingrebakenavmesh.cpp       |  5 +-
 .../newview/llpanelpathfindingrebakenavmesh.h |  3 --
 indra/newview/llpathfindingcharacter.cpp      |  2 +
 indra/newview/llpathfindingcharacter.h        |  4 +-
 indra/newview/llpathfindingmanager.cpp        | 47 ++++++++++-------
 indra/newview/llpathfindingmanager.h          | 10 ++--
 indra/newview/llpathfindingnavmesh.cpp        |  6 ++-
 indra/newview/llpathfindingnavmesh.h          |  5 +-
 indra/newview/llpathfindingnavmeshstatus.cpp  |  2 +-
 indra/newview/llpathfindingnavmeshstatus.h    |  4 +-
 indra/newview/llpathfindingnavmeshzone.cpp    | 25 ++++-----
 indra/newview/llpathfindingnavmeshzone.h      | 13 +++--
 indra/newview/llpathfindingobject.cpp         |  2 +-
 indra/newview/llpathfindingobject.h           |  8 +--
 indra/newview/llpathfindingobjectlist.h       |  1 -
 indra/newview/llpathfindingpathtool.cpp       | 10 ++--
 indra/newview/llpathfindingpathtool.h         |  8 +--
 .../xui/en/floater_pathfinding_characters.xml | 16 +++---
 .../default/xui/en/panel_navmesh_rebake.xml   |  1 -
 27 files changed, 167 insertions(+), 145 deletions(-)

diff --git a/indra/newview/llfloaterpathfindingcharacters.cpp b/indra/newview/llfloaterpathfindingcharacters.cpp
index c20e78ade1c..739e56a7c37 100644
--- a/indra/newview/llfloaterpathfindingcharacters.cpp
+++ b/indra/newview/llfloaterpathfindingcharacters.cpp
@@ -40,11 +40,15 @@
 #include "llpathfindingobject.h"
 #include "llpathfindingobjectlist.h"
 #include "llpathinglib.h"
+#include "llquaternion.h"
 #include "llsd.h"
 #include "lluicolortable.h"
+#include "lluuid.h"
 #include "llviewerobject.h"
 #include "llviewerobjectlist.h"
 #include "pipeline.h"
+#include "v3math.h"
+#include "v4color.h"
 
 LLHandle<LLFloaterPathfindingCharacters> LLFloaterPathfindingCharacters::sInstanceHandle;
 
diff --git a/indra/newview/llfloaterpathfindingcharacters.h b/indra/newview/llfloaterpathfindingcharacters.h
index 94cc39a06a9..ef389ad4289 100644
--- a/indra/newview/llfloaterpathfindingcharacters.h
+++ b/indra/newview/llfloaterpathfindingcharacters.h
@@ -30,10 +30,14 @@
 #include "llfloaterpathfindingobjects.h"
 #include "llhandle.h"
 #include "llpathfindingobjectlist.h"
+#include "lluuid.h"
 #include "v4color.h"
 
+class LLCheckBoxCtrl;
 class LLPathfindingCharacter;
+class LLQuaternion;
 class LLSD;
+class LLVector3;
 
 class LLFloaterPathfindingCharacters : public LLFloaterPathfindingObjects
 {
@@ -43,7 +47,7 @@ class LLFloaterPathfindingCharacters : public LLFloaterPathfindingObjects
 	BOOL                                            isShowPhysicsCapsule() const;
 	void                                            setShowPhysicsCapsule(BOOL pIsShowPhysicsCapsule);
 
-	BOOL                                            isPhysicsCapsuleEnabled(LLUUID& id, LLVector3& pos, LLQuaternion& rot ) const;
+	BOOL                                            isPhysicsCapsuleEnabled(LLUUID& id, LLVector3& pos, LLQuaternion& rot) const;
 
 	static void                                     openCharactersWithSelectedObjects();
 	static LLHandle<LLFloaterPathfindingCharacters> getInstanceHandle();
diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp
index 0bd5dc02638..2fe60a8d8ff 100644
--- a/indra/newview/llfloaterpathfindingconsole.cpp
+++ b/indra/newview/llfloaterpathfindingconsole.cpp
@@ -30,30 +30,31 @@
 
 #include "llfloaterpathfindingconsole.h"
 
-#include "llfloaterpathfindinglinksets.h"
-#include "llfloaterpathfindingcharacters.h"
+#include <vector>
+
+#include <boost/signals2.hpp>
 
-#include "llsd.h"
-#include "llhandle.h"
-#include "llcontrol.h"
-#include "llpanel.h"
 #include "llbutton.h"
 #include "llcheckboxctrl.h"
-#include "llsliderctrl.h"
-#include "lllineeditor.h"
-#include "lltextbase.h"
-#include "lltabcontainer.h"
 #include "llcombobox.h"
+#include "llcontrol.h"
+#include "llenvmanager.h"
+#include "llfloaterpathfindingcharacters.h"
+#include "llfloaterpathfindinglinksets.h"
 #include "llfloaterreg.h"
+#include "llhandle.h"
+#include "llpanel.h"
 #include "llpathfindingnavmeshzone.h"
-#include "llpathfindingmanager.h"
-#include "llenvmanager.h"
 #include "llpathfindingpathtool.h"
+#include "llpathinglib.h"
+#include "llsliderctrl.h"
+#include "llsd.h"
+#include "lltabcontainer.h"
+#include "lltextbase.h"
 #include "lltoolmgr.h"
 #include "lltoolfocus.h"
-#include "pipeline.h"
-#include "llpathinglib.h"
 #include "llviewerparcelmgr.h"
+#include "pipeline.h"
 
 #define XUI_RENDER_HEATMAP_NONE 0
 #define XUI_RENDER_HEATMAP_A 1
@@ -89,8 +90,6 @@
 
 LLHandle<LLFloaterPathfindingConsole> LLFloaterPathfindingConsole::sInstanceHandle;
 
-extern LLPipeline gPipeline;
-
 //---------------------------------------------------------------------------
 // LLFloaterPathfindingConsole
 //---------------------------------------------------------------------------
@@ -213,7 +212,7 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey)
 	{	
 		if (!mNavMeshZoneSlot.connected())
 		{
-			mNavMeshZoneSlot = mNavMeshZone.registerNavMeshZoneListener(boost::bind(&LLFloaterPathfindingConsole::onNavMeshZoneCB, this, _1));
+			mNavMeshZoneSlot = mNavMeshZone.registerNavMeshZoneListener(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshZoneStatus, this, _1));
 		}
 
 		mIsNavMeshUpdating = false;
@@ -500,9 +499,10 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed)
 	mSavedSettingNavMeshFaceSlot(),
 	mSavedSettingTestPathValidEndSlot(),
 	mSavedSettingTestPathInvalidEndSlot(),
-	mSavedSettingWaterSlot(),
 	mSavedSettingTestPathSlot(),
-	mConsoleState(kConsoleStateUnknown)
+	mSavedSettingWaterSlot(),
+	mConsoleState(kConsoleStateUnknown),
+	mRenderableRestoreList()
 {
 	mSelfHandle.bind(this);
 }
@@ -541,7 +541,10 @@ void LLFloaterPathfindingConsole::onShowNavMeshSet()
 
 void LLFloaterPathfindingConsole::onShowWalkabilitySet()
 {
-	LLPathingLib::getInstance()->setNavMeshMaterialType(getRenderHeatmapType());
+	if (LLPathingLib::getInstance() != NULL)
+	{
+		LLPathingLib::getInstance()->setNavMeshMaterialType(getRenderHeatmapType());
+	}
 }
 
 void LLFloaterPathfindingConsole::onCharacterWidthSet()
@@ -559,7 +562,7 @@ void LLFloaterPathfindingConsole::onClearPathClicked()
 	clearPath();
 }
 
-void LLFloaterPathfindingConsole::onNavMeshZoneCB(LLPathfindingNavMeshZone::ENavMeshZoneRequestStatus pNavMeshZoneRequestStatus)
+void LLFloaterPathfindingConsole::handleNavMeshZoneStatus(LLPathfindingNavMeshZone::ENavMeshZoneRequestStatus pNavMeshZoneRequestStatus)
 {
 	switch (pNavMeshZoneRequestStatus)
 	{
@@ -641,6 +644,7 @@ void LLFloaterPathfindingConsole::setDefaultInputs()
 {
 	mViewTestTabContainer->selectTab(XUI_VIEW_TAB_INDEX);
 	setRenderWorld(TRUE);
+	setRenderWorldMovablesOnly(FALSE);
 	setRenderNavMesh(FALSE);
 	setRenderWalkables(FALSE);
 	setRenderMaterialVolumes(FALSE);
@@ -648,7 +652,6 @@ void LLFloaterPathfindingConsole::setDefaultInputs()
 	setRenderExclusionVolumes(FALSE);
 	setRenderWaterPlane(FALSE);
 	setRenderXRay(FALSE);
-	setRenderWorldMovablesOnly(FALSE);
 }
 
 void LLFloaterPathfindingConsole::setConsoleState(EConsoleState pConsoleState)
@@ -1205,6 +1208,10 @@ void LLFloaterPathfindingConsole::deregisterSavedSettingsListeners()
 	{
 		mSavedSettingTestPathSlot.disconnect();
 	}
+	if (mSavedSettingWaterSlot.connected())
+	{
+		mSavedSettingWaterSlot.disconnect();
+	}
 }
 
 void LLFloaterPathfindingConsole::handleRetrieveNeighborChange(LLControlVariable *pControl, const LLSD &pNewValue)
diff --git a/indra/newview/llfloaterpathfindingconsole.h b/indra/newview/llfloaterpathfindingconsole.h
index 97300520d66..4b2f7672e41 100644
--- a/indra/newview/llfloaterpathfindingconsole.h
+++ b/indra/newview/llfloaterpathfindingconsole.h
@@ -27,26 +27,27 @@
 #ifndef LL_LLFLOATERPATHFINDINGCONSOLE_H
 #define LL_LLFLOATERPATHFINDINGCONSOLE_H
 
+#include <vector>
+
+#include <boost/signals2.hpp>
+
 #include "llfloater.h"
 #include "llhandle.h"
-#include "llpathinglib.h"
 #include "llpathfindingnavmeshzone.h"
 #include "llpathfindingpathtool.h"
+#include "llpathinglib.h"
 #include "v4color.h"
 
-#include <boost/signals2.hpp>
-
-class LLSD;
+class LLButton;
+class LLCheckBoxCtrl;
+class LLComboBox;
+class LLControlVariable;
 class LLPanel;
+class LLSD;
 class LLSliderCtrl;
-class LLLineEditor;
-class LLTextBase;
-class LLCheckBoxCtrl;
 class LLTabContainer;
-class LLComboBox;
-class LLButton;
+class LLTextBase;
 class LLToolset;
-class LLControlVariable;
 
 class LLFloaterPathfindingConsole
 :	public LLFloater
@@ -122,7 +123,7 @@ class LLFloaterPathfindingConsole
 	void onCharacterTypeSwitch();
 	void onClearPathClicked();
 
-	void onNavMeshZoneCB(LLPathfindingNavMeshZone::ENavMeshZoneRequestStatus pNavMeshZoneRequestStatus);
+	void handleNavMeshZoneStatus(LLPathfindingNavMeshZone::ENavMeshZoneRequestStatus pNavMeshZoneRequestStatus);
 	void onRegionBoundaryCross();
 	void onPathEvent();
 
diff --git a/indra/newview/llfloaterpathfindinglinksets.cpp b/indra/newview/llfloaterpathfindinglinksets.cpp
index ae83bcfaeeb..15490ff87e7 100644
--- a/indra/newview/llfloaterpathfindinglinksets.cpp
+++ b/indra/newview/llfloaterpathfindinglinksets.cpp
@@ -30,11 +30,14 @@
 
 #include "llfloaterpathfindinglinksets.h"
 
+#include <string>
+
 #include <boost/bind.hpp>
 
 #include "llagent.h"
 #include "llbutton.h"
 #include "llcombobox.h"
+#include "llfloaterpathfindingobjects.h"
 #include "llfloaterreg.h"
 #include "lllineeditor.h"
 #include "llnotificationsutil.h"
@@ -46,6 +49,7 @@
 #include "lltextbase.h"
 #include "lltextvalidate.h"
 #include "lluicolortable.h"
+#include "lluictrl.h"
 #include "v3math.h"
 #include "v4color.h"
 
diff --git a/indra/newview/llfloaterpathfindinglinksets.h b/indra/newview/llfloaterpathfindinglinksets.h
index 2db41ce479a..b3e7acfbfec 100644
--- a/indra/newview/llfloaterpathfindinglinksets.h
+++ b/indra/newview/llfloaterpathfindinglinksets.h
@@ -27,9 +27,10 @@
 #ifndef LL_LLFLOATERPATHFINDINGLINKSETS_H
 #define LL_LLFLOATERPATHFINDINGLINKSETS_H
 
+#include <string>
+
 #include "llfloaterpathfindingobjects.h"
 #include "llpathfindinglinkset.h"
-#include "llpathfindingmanager.h"
 #include "llpathfindingobjectlist.h"
 #include "v4color.h"
 
@@ -102,29 +103,29 @@ class LLFloaterPathfindingLinksets : public LLFloaterPathfindingObjects
 	LLPathfindingLinkset::ELinksetUse convertToLinksetUse(LLSD pXuiValue) const;
 	LLSD                              convertToXuiValue(LLPathfindingLinkset::ELinksetUse pLinksetUse) const;
 
-	LLLineEditor                             *mFilterByName;
-	LLLineEditor                             *mFilterByDescription;
-	LLComboBox                               *mFilterByLinksetUse;
-	LLComboBox                               *mEditLinksetUse;
-	LLScrollListItem                         *mEditLinksetUseUnset;
-	LLScrollListItem                         *mEditLinksetUseWalkable;
-	LLScrollListItem                         *mEditLinksetUseStaticObstacle;
-	LLScrollListItem                         *mEditLinksetUseDynamicObstacle;
-	LLScrollListItem                         *mEditLinksetUseMaterialVolume;
-	LLScrollListItem                         *mEditLinksetUseExclusionVolume;
-	LLScrollListItem                         *mEditLinksetUseDynamicPhantom;
-	LLTextBase                               *mLabelWalkabilityCoefficients;
-	LLTextBase                               *mLabelEditA;
-	LLLineEditor                             *mEditA;
-	LLTextBase                               *mLabelEditB;
-	LLLineEditor                             *mEditB;
-	LLTextBase                               *mLabelEditC;
-	LLLineEditor                             *mEditC;
-	LLTextBase                               *mLabelEditD;
-	LLLineEditor                             *mEditD;
-	LLButton                                 *mApplyEditsButton;
-
-	LLColor4                                 mBeaconColor;
+	LLLineEditor     *mFilterByName;
+	LLLineEditor     *mFilterByDescription;
+	LLComboBox       *mFilterByLinksetUse;
+	LLComboBox       *mEditLinksetUse;
+	LLScrollListItem *mEditLinksetUseUnset;
+	LLScrollListItem *mEditLinksetUseWalkable;
+	LLScrollListItem *mEditLinksetUseStaticObstacle;
+	LLScrollListItem *mEditLinksetUseDynamicObstacle;
+	LLScrollListItem *mEditLinksetUseMaterialVolume;
+	LLScrollListItem *mEditLinksetUseExclusionVolume;
+	LLScrollListItem *mEditLinksetUseDynamicPhantom;
+	LLTextBase       *mLabelWalkabilityCoefficients;
+	LLTextBase       *mLabelEditA;
+	LLLineEditor     *mEditA;
+	LLTextBase       *mLabelEditB;
+	LLLineEditor     *mEditB;
+	LLTextBase       *mLabelEditC;
+	LLLineEditor     *mEditC;
+	LLTextBase       *mLabelEditD;
+	LLLineEditor     *mEditD;
+	LLButton         *mApplyEditsButton;
+
+	LLColor4         mBeaconColor;
 };
 
 #endif // LL_LLFLOATERPATHFINDINGLINKSETS_H
diff --git a/indra/newview/llfloaterpathfindingobjects.cpp b/indra/newview/llfloaterpathfindingobjects.cpp
index da664038cfd..847997836b2 100644
--- a/indra/newview/llfloaterpathfindingobjects.cpp
+++ b/indra/newview/llfloaterpathfindingobjects.cpp
@@ -57,7 +57,6 @@
 #include "llviewerobject.h"
 #include "llviewerobjectlist.h"
 #include "llviewerregion.h"
-#include "pipeline.h"
 #include "v3dmath.h"
 #include "v3math.h"
 #include "v4color.h"
@@ -835,4 +834,3 @@ LLPathfindingObjectPtr LLFloaterPathfindingObjects::findObject(const LLScrollLis
 
 	return objectPtr;
 }
-
diff --git a/indra/newview/llfloaterpathfindingobjects.h b/indra/newview/llfloaterpathfindingobjects.h
index 42db7bba657..e8d446b5989 100644
--- a/indra/newview/llfloaterpathfindingobjects.h
+++ b/indra/newview/llfloaterpathfindingobjects.h
@@ -28,6 +28,7 @@
 #define LL_LLFLOATERPATHFINDINGOBJECTS_H
 
 #include <set>
+
 #include <boost/signals2.hpp>
 
 #include "llagent.h"
diff --git a/indra/newview/llpanelpathfindingrebakenavmesh.cpp b/indra/newview/llpanelpathfindingrebakenavmesh.cpp
index f423b5891fc..2c8c46c7bce 100644
--- a/indra/newview/llpanelpathfindingrebakenavmesh.cpp
+++ b/indra/newview/llpanelpathfindingrebakenavmesh.cpp
@@ -36,7 +36,6 @@
 #include "llagent.h"
 #include "llbutton.h"
 #include "llenvmanager.h"
-#include "llhandle.h"
 #include "llhints.h"
 #include "llnotificationsutil.h"
 #include "llpanel.h"
@@ -45,9 +44,7 @@
 #include "llpathfindingnavmeshstatus.h"
 #include "lltoolbar.h"
 #include "lltoolbarview.h"
-#include "lltoolmgr.h"
 #include "lltooltip.h"
-#include "llview.h"
 #include "llviewercontrol.h"
 #include "llviewerregion.h"
 
@@ -218,6 +215,7 @@ void LLPanelPathfindingRebakeNavmesh::handleNavMeshStatus(const LLPathfindingNav
 void LLPanelPathfindingRebakeNavmesh::handleRegionBoundaryCrossed()
 {
 	createNavMeshStatusListenerForCurrentRegion();
+	mCanRebakeRegion = FALSE;
 	LLPathfindingManager::getInstance()->requestGetAgentState();
 }
 
@@ -227,7 +225,6 @@ void LLPanelPathfindingRebakeNavmesh::createNavMeshStatusListenerForCurrentRegio
 	{
 		mNavMeshSlot.disconnect();
 	}
-	mCanRebakeRegion = FALSE;
 
 	LLViewerRegion *currentRegion = gAgent.getRegion();
 	if (currentRegion != NULL)
diff --git a/indra/newview/llpanelpathfindingrebakenavmesh.h b/indra/newview/llpanelpathfindingrebakenavmesh.h
index a77cddbc500..5fe581ec2f5 100644
--- a/indra/newview/llpanelpathfindingrebakenavmesh.h
+++ b/indra/newview/llpanelpathfindingrebakenavmesh.h
@@ -27,17 +27,14 @@
 #ifndef LL_LLPANELPATHFINDINGREBAKENAVMESH_H
 #define LL_LLPANELPATHFINDINGREBAKENAVMESH_H
 
-#include <boost/bind.hpp>
 #include <boost/signals2.hpp>
 
-#include "llhandle.h"
 #include "llpanel.h"
 #include "llpathfindingmanager.h"
 #include "llpathfindingnavmesh.h"
 
 class LLButton;
 class LLPathfindingNavMeshStatus;
-class LLView;
 
 class LLPanelPathfindingRebakeNavmesh : public LLPanel
 {
diff --git a/indra/newview/llpathfindingcharacter.cpp b/indra/newview/llpathfindingcharacter.cpp
index 9dd9fa503b3..00f2ebc4bbe 100644
--- a/indra/newview/llpathfindingcharacter.cpp
+++ b/indra/newview/llpathfindingcharacter.cpp
@@ -30,6 +30,8 @@
 
 #include "llpathfindingcharacter.h"
 
+#include <string>
+
 #include "llpathfindingobject.h"
 #include "llsd.h"
 
diff --git a/indra/newview/llpathfindingcharacter.h b/indra/newview/llpathfindingcharacter.h
index 6317f5224aa..7cf9f401b02 100644
--- a/indra/newview/llpathfindingcharacter.h
+++ b/indra/newview/llpathfindingcharacter.h
@@ -27,6 +27,8 @@
 #ifndef LL_LLPATHFINDINGCHARACTER_H
 #define LL_LLPATHFINDINGCHARACTER_H
 
+#include <string>
+
 #include "llpathfindingobject.h"
 
 class LLSD;
@@ -48,8 +50,6 @@ class LLPathfindingCharacter : public LLPathfindingObject
 
 protected:
 
-public:
-
 private:
 	void parseCharacterData(const LLSD &pCharacterData);
 
diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp
index 90199a9cae0..2dd01e931e0 100644
--- a/indra/newview/llpathfindingmanager.cpp
+++ b/indra/newview/llpathfindingmanager.cpp
@@ -33,7 +33,9 @@
 #include <string>
 #include <map>
 
+#include <boost/bind.hpp>
 #include <boost/function.hpp>
+#include <boost/shared_ptr.hpp>
 #include <boost/signals2.hpp>
 
 #include "llagent.h"
@@ -53,7 +55,6 @@
 #include "lluuid.h"
 #include "llviewerregion.h"
 #include "llweb.h"
-#include "llenvmanager.h"
 
 #define CAP_SERVICE_RETRIEVE_NAVMESH        "RetrieveNavMeshSrc"
 
@@ -366,12 +367,6 @@ void LLPathfindingManager::requestGetNavMeshForRegion(LLViewerRegion *pRegion, b
 	}
 }
 
-LLPathfindingManager::agent_state_slot_t LLPathfindingManager::registerAgentStateListener(agent_state_callback_t pAgentStateCallback)
-{
-	return mAgentStateSignal.connect(pAgentStateCallback);
-}
-
-
 void LLPathfindingManager::requestGetLinksets(request_id_t pRequestId, object_request_callback_t pLinksetsCallback) const
 {
 	LLPathfindingObjectListPtr emptyLinksetListPtr;
@@ -495,6 +490,11 @@ void LLPathfindingManager::requestGetCharacters(request_id_t pRequestId, object_
 	}
 }
 
+LLPathfindingManager::agent_state_slot_t LLPathfindingManager::registerAgentStateListener(agent_state_callback_t pAgentStateCallback)
+{
+	return mAgentStateSignal.connect(pAgentStateCallback);
+}
+
 void LLPathfindingManager::requestGetAgentState()
 {
 	LLViewerRegion *currentRegion = getCurrentRegion();
@@ -525,14 +525,24 @@ void LLPathfindingManager::requestGetAgentState()
 
 void LLPathfindingManager::requestRebakeNavMesh(rebake_navmesh_callback_t pRebakeNavMeshCallback)
 {
-	std::string navMeshStatusURL = getNavMeshStatusURLForCurrentRegion();
-	llassert(!navMeshStatusURL.empty())
-	if (!navMeshStatusURL.empty())
+	LLViewerRegion *currentRegion = getCurrentRegion();
+
+	if (currentRegion == NULL)
+	{
+		pRebakeNavMeshCallback(false);
+	}
+	else if (!isPathfindingEnabledForRegion(currentRegion))
 	{
-		LLSD mPostData;			
-		mPostData["command"] = "rebuild";
+		pRebakeNavMeshCallback(false);
+	}
+	else
+	{
+		std::string navMeshStatusURL = getNavMeshStatusURLForCurrentRegion();
+		llassert(!navMeshStatusURL.empty());
+		LLSD postData;			
+		postData["command"] = "rebuild";
 		LLHTTPClient::ResponderPtr responder = new NavMeshRebakeResponder(navMeshStatusURL, pRebakeNavMeshCallback);
-		LLHTTPClient::post(navMeshStatusURL, mPostData, responder);
+		LLHTTPClient::post(navMeshStatusURL, postData, responder);
 	}
 }
 
@@ -673,11 +683,6 @@ LLPathfindingNavMeshPtr LLPathfindingManager::getNavMeshForRegion(LLViewerRegion
 	return getNavMeshForRegion(regionUUID);
 }
 
-std::string LLPathfindingManager::getAgentStateURLForRegion(LLViewerRegion *pRegion) const
-{
-	return getCapabilityURLForRegion(pRegion, CAP_SERVICE_AGENT_STATE);
-}
-
 std::string LLPathfindingManager::getNavMeshStatusURLForCurrentRegion() const
 {
 	return getNavMeshStatusURLForRegion(getCurrentRegion());
@@ -708,6 +713,11 @@ std::string LLPathfindingManager::getCharactersURLForCurrentRegion() const
 	return getCapabilityURLForCurrentRegion(CAP_SERVICE_CHARACTERS);
 }
 
+std::string LLPathfindingManager::getAgentStateURLForRegion(LLViewerRegion *pRegion) const
+{
+	return getCapabilityURLForRegion(pRegion, CAP_SERVICE_AGENT_STATE);
+}
+
 std::string LLPathfindingManager::getCapabilityURLForCurrentRegion(const std::string &pCapabilityName) const
 {
 	return getCapabilityURLForRegion(getCurrentRegion(), pCapabilityName);
@@ -1037,4 +1047,3 @@ void CharactersResponder::error(U32 pStatus, const std::string &pReason)
 	LLPathfindingObjectListPtr characterListPtr =  LLPathfindingObjectListPtr(new LLPathfindingCharacterList());
 	mCharactersCallback(mRequestId, LLPathfindingManager::kRequestError, characterListPtr);
 }
-
diff --git a/indra/newview/llpathfindingmanager.h b/indra/newview/llpathfindingmanager.h
index 65589fe3a05..c61ff244fc1 100644
--- a/indra/newview/llpathfindingmanager.h
+++ b/indra/newview/llpathfindingmanager.h
@@ -37,12 +37,10 @@
 #include "llpathfindingobjectlist.h"
 #include "llpathfindingnavmesh.h"
 #include "llsingleton.h"
-#include "lluuid.h"
-#include "llpanel.h"
-#include "llmoveview.h"
 
-class LLViewerRegion;
 class LLPathfindingNavMeshStatus;
+class LLUUID;
+class LLViewerRegion;
 
 class LLPathfindingManager : public LLSingleton<LLPathfindingManager>
 {
@@ -51,8 +49,6 @@ class LLPathfindingManager : public LLSingleton<LLPathfindingManager>
 	friend class LLAgentStateChangeNode;
 	friend class AgentStateResponder;
 public:
-	typedef std::map<LLUUID, LLPathfindingNavMeshPtr> NavMeshMap;
-
 	typedef enum {
 		kRequestStarted,
 		kRequestCompleted,
@@ -96,6 +92,8 @@ class LLPathfindingManager : public LLSingleton<LLPathfindingManager>
 protected:
 
 private:
+	typedef std::map<LLUUID, LLPathfindingNavMeshPtr> NavMeshMap;
+
 	void sendRequestGetNavMeshForRegion(LLPathfindingNavMeshPtr navMeshPtr, LLViewerRegion *pRegion, const LLPathfindingNavMeshStatus &pNavMeshStatus);
 
 	void handleDeferredGetAgentStateForRegion(const LLUUID &pRegionUUID);
diff --git a/indra/newview/llpathfindingnavmesh.cpp b/indra/newview/llpathfindingnavmesh.cpp
index 1a49560712c..e01dd3a152f 100644
--- a/indra/newview/llpathfindingnavmesh.cpp
+++ b/indra/newview/llpathfindingnavmesh.cpp
@@ -30,12 +30,13 @@
 
 #include "llpathfindingnavmesh.h"
 
+#include <string>
+
 #include "llpathfindingnavmeshstatus.h"
+#include "llsd.h"
 #include "llsdserialize.h"
 #include "lluuid.h"
 
-#include <string>
-
 #define NAVMESH_VERSION_FIELD "navmesh_version"
 #define NAVMESH_DATA_FIELD    "navmesh_data"
 
@@ -119,6 +120,7 @@ void LLPathfindingNavMesh::handleNavMeshStart(const LLPathfindingNavMeshStatus &
 
 void LLPathfindingNavMesh::handleNavMeshResult(const LLSD &pContent, U32 pNavMeshVersion)
 {
+	llassert(pContent.has(NAVMESH_VERSION_FIELD));
 	if (pContent.has(NAVMESH_VERSION_FIELD))
 	{
 		llassert(pContent.get(NAVMESH_VERSION_FIELD).isInteger());
diff --git a/indra/newview/llpathfindingnavmesh.h b/indra/newview/llpathfindingnavmesh.h
index 17618d8724d..7a844f54ceb 100644
--- a/indra/newview/llpathfindingnavmesh.h
+++ b/indra/newview/llpathfindingnavmesh.h
@@ -27,8 +27,6 @@
 #ifndef LL_LLPATHFINDINGNAVMESH_H
 #define LL_LLPATHFINDINGNAVMESH_H
 
-#include "llsd.h"
-
 #include <string>
 
 #include <boost/shared_ptr.hpp>
@@ -36,9 +34,10 @@
 #include <boost/signals2.hpp>
 
 #include "llpathfindingnavmeshstatus.h"
+#include "llsd.h"
 
-class LLUUID;
 class LLPathfindingNavMesh;
+class LLUUID;
 
 typedef boost::shared_ptr<LLPathfindingNavMesh> LLPathfindingNavMeshPtr;
 
diff --git a/indra/newview/llpathfindingnavmeshstatus.cpp b/indra/newview/llpathfindingnavmeshstatus.cpp
index 4bb0bc5a18a..2eaa6075ca3 100644
--- a/indra/newview/llpathfindingnavmeshstatus.cpp
+++ b/indra/newview/llpathfindingnavmeshstatus.cpp
@@ -33,8 +33,8 @@
 #include <string>
 
 #include "llsd.h"
-#include "lluuid.h"
 #include "llstring.h"
+#include "lluuid.h"
 
 #define REGION_FIELD  "region_id"
 #define STATUS_FIELD  "status"
diff --git a/indra/newview/llpathfindingnavmeshstatus.h b/indra/newview/llpathfindingnavmeshstatus.h
index 3834aa2ab8f..74533fa484f 100644
--- a/indra/newview/llpathfindingnavmeshstatus.h
+++ b/indra/newview/llpathfindingnavmeshstatus.h
@@ -27,10 +27,10 @@
 #ifndef LL_LLPATHFINDINGNAVMESHSTATUS_H
 #define LL_LLPATHFINDINGNAVMESHSTATUS_H
 
-#include "lluuid.h"
-
 #include <string>
 
+#include "lluuid.h"
+
 class LLSD;
 
 class LLPathfindingNavMeshStatus
diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp
index 0298eedfefd..e190dbba659 100644
--- a/indra/newview/llpathfindingnavmeshzone.cpp
+++ b/indra/newview/llpathfindingnavmeshzone.cpp
@@ -30,20 +30,22 @@
 
 #include "llpathfindingnavmeshzone.h"
 
-#include "llsd.h"
-#include "lluuid.h"
-#include "llagent.h"
-#include "llviewerregion.h"
-#include "llpathfindingnavmesh.h"
-#include "llpathfindingmanager.h"
-#include "llviewercontrol.h"
-
-#include "llpathinglib.h"
-
-#include <string>
 #include <vector>
 
 #include <boost/bind.hpp>
+#include <boost/function.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/signals2.hpp>
+
+#include "llagent.h"
+#include "llpathfindingmanager.h"
+#include "llpathfindingnavmesh.h"
+#include "llpathfindingnavmeshstatus.h"
+#include "llpathinglib.h"
+#include "llsd.h"
+#include "lluuid.h"
+#include "llviewercontrol.h"
+#include "llviewerregion.h"
 
 #define CENTER_REGION 99
 
@@ -104,7 +106,6 @@ void LLPathfindingNavMeshZone::disable()
 
 void LLPathfindingNavMeshZone::refresh()
 {
-	llassert(LLPathingLib::getInstance() != NULL);
 	if (LLPathingLib::getInstance() != NULL)
 	{
 		LLPathingLib::getInstance()->cleanupResidual();
diff --git a/indra/newview/llpathfindingnavmeshzone.h b/indra/newview/llpathfindingnavmeshzone.h
index 0229de50ec9..baa1cc59799 100644
--- a/indra/newview/llpathfindingnavmeshzone.h
+++ b/indra/newview/llpathfindingnavmeshzone.h
@@ -27,19 +27,18 @@
 #ifndef LL_LLPATHFINDINGNAVMESHZONE_H
 #define LL_LLPATHFINDINGNAVMESHZONE_H
 
-#include "llsd.h"
-#include "lluuid.h"
-#include "llpathfindingnavmesh.h"
-#include "llpathfindingnavmeshstatus.h"
-#include "llviewerregion.h"
-
 #include <vector>
 
 #include <boost/shared_ptr.hpp>
 #include <boost/function.hpp>
 #include <boost/signals2.hpp>
 
-class LLPathfindingNavMeshStatus;
+#include "llpathfindingnavmesh.h"
+#include "llpathfindingnavmeshstatus.h"
+#include "llsd.h"
+#include "lluuid.h"
+
+class LLViewerRegion;
 
 class LLPathfindingNavMeshZone
 {
diff --git a/indra/newview/llpathfindingobject.cpp b/indra/newview/llpathfindingobject.cpp
index 65fcedf2f54..f5c0f7874d6 100644
--- a/indra/newview/llpathfindingobject.cpp
+++ b/indra/newview/llpathfindingobject.cpp
@@ -32,11 +32,11 @@
 
 #include <string>
 
-#include "v3math.h"
 #include "llavatarname.h"
 #include "llavatarnamecache.h"
 #include "llsd.h"
 #include "lluuid.h"
+#include "v3math.h"
 
 #define PATHFINDING_OBJECT_NAME_FIELD        "name"
 #define PATHFINDING_OBJECT_DESCRIPTION_FIELD "description"
diff --git a/indra/newview/llpathfindingobject.h b/indra/newview/llpathfindingobject.h
index 924ea3f298d..4b2d546bb1a 100644
--- a/indra/newview/llpathfindingobject.h
+++ b/indra/newview/llpathfindingobject.h
@@ -27,14 +27,14 @@
 #ifndef LL_LLPATHFINDINGOBJECT_H
 #define LL_LLPATHFINDINGOBJECT_H
 
-#include "llavatarname.h"
-#include "lluuid.h"
-#include "v3math.h"
-
 #include <string>
 
 #include <boost/shared_ptr.hpp>
 
+#include "llavatarname.h"
+#include "lluuid.h"
+#include "v3math.h"
+
 class LLPathfindingObject;
 class LLSD;
 
diff --git a/indra/newview/llpathfindingobjectlist.h b/indra/newview/llpathfindingobjectlist.h
index 94c53f3abae..3ad8e8b0963 100644
--- a/indra/newview/llpathfindingobjectlist.h
+++ b/indra/newview/llpathfindingobjectlist.h
@@ -34,7 +34,6 @@
 
 #include "llpathfindingobject.h"
 
-class LLSD;
 class LLPathfindingObjectList;
 
 typedef boost::shared_ptr<LLPathfindingObjectList> LLPathfindingObjectListPtr;
diff --git a/indra/newview/llpathfindingpathtool.cpp b/indra/newview/llpathfindingpathtool.cpp
index ac4a2fffb97..006755e20b1 100644
--- a/indra/newview/llpathfindingpathtool.cpp
+++ b/indra/newview/llpathfindingpathtool.cpp
@@ -30,17 +30,17 @@
 
 #include "llpathfindingpathtool.h"
 
+#include <boost/function.hpp>
+#include <boost/signals2.hpp>
+
 #include "llagent.h"
+#include "llpathfindingmanager.h"
+#include "llpathinglib.h"
 #include "llsingleton.h"
 #include "lltool.h"
 #include "llviewercamera.h"
 #include "llviewerregion.h"
 #include "llviewerwindow.h"
-#include "llpathfindingmanager.h"
-#include "llpathinglib.h"
-
-#include <boost/function.hpp>
-#include <boost/signals2.hpp>
 
 #define PATH_TOOL_NAME "PathfindingPathTool"
 
diff --git a/indra/newview/llpathfindingpathtool.h b/indra/newview/llpathfindingpathtool.h
index e0db87d1ed0..97284265f19 100644
--- a/indra/newview/llpathfindingpathtool.h
+++ b/indra/newview/llpathfindingpathtool.h
@@ -27,13 +27,13 @@
 #ifndef LL_LLPATHFINDINGPATHTOOL_H
 #define LL_LLPATHFINDINGPATHTOOL_H
 
-#include "llsingleton.h"
-#include "lltool.h"
-#include "llpathinglib.h"
-
 #include <boost/function.hpp>
 #include <boost/signals2.hpp>
 
+#include "llpathinglib.h"
+#include "llsingleton.h"
+#include "lltool.h"
+
 class LLPathfindingPathTool : public LLTool, public LLSingleton<LLPathfindingPathTool>
 {
 public:
diff --git a/indra/newview/skins/default/xui/en/floater_pathfinding_characters.xml b/indra/newview/skins/default/xui/en/floater_pathfinding_characters.xml
index c1f1f60c1b8..4331e1f340f 100644
--- a/indra/newview/skins/default/xui/en/floater_pathfinding_characters.xml
+++ b/indra/newview/skins/default/xui/en/floater_pathfinding_characters.xml
@@ -150,14 +150,14 @@
         left_pad="0"
         width="150" />
     <check_box
-     height="19"
-     follows="left|bottom"
-     label="Show physics capsule"
-     layout="topleft"
-     name="show_physics_capsule"
-     top_pad="-19"
-     left_pad="0"
-     width="150" />
+        height="19"
+        follows="left|bottom"
+        label="Show physics capsule"
+        layout="topleft"
+        name="show_physics_capsule"
+        top_pad="-19"
+        left_pad="0"
+        width="150" />
     <button
         follows="left|bottom"
         height="22"
diff --git a/indra/newview/skins/default/xui/en/panel_navmesh_rebake.xml b/indra/newview/skins/default/xui/en/panel_navmesh_rebake.xml
index c9bbaa1a213..90308a2ca95 100644
--- a/indra/newview/skins/default/xui/en/panel_navmesh_rebake.xml
+++ b/indra/newview/skins/default/xui/en/panel_navmesh_rebake.xml
@@ -43,4 +43,3 @@
       enabled="false"
       width="120" />
 </panel>
-
-- 
GitLab