diff --git a/indra/newview/llfloaterpathfindingcharacters.cpp b/indra/newview/llfloaterpathfindingcharacters.cpp
index c20e78ade1cee5079bb0a50cbf8ee94a8a2d9f03..739e56a7c374e6db24dde6b722941060ab98d707 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 94cc39a06a920a3ceee9650f9caaed86959650ef..ef389ad4289df68d185fc49592a3271ec15104f0 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 0bd5dc026386c355ea81aeb21550f212aabdf4de..2fe60a8d8ff6b00c469842aa371c5dbd31c4dd99 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 97300520d667eec56487acf20473af2133b28093..4b2f7672e411e0bb00f0e789c767ac1bcfb745de 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 ae83bcfaeeb4b2d5c842a624aa7db99140557c3c..15490ff87e71c1e1fdbba83d05620738a845bdeb 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 2db41ce479a704c44e603610301c1cbb5630a363..b3e7acfbfec13ca63fbd4e5c56b9c3d40b05dad6 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 da664038cfd40927282c4f6d7493f1b601e2a6bc..847997836b2b1cc303ca896e127a48225d318b10 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 42db7bba657f8fa8ed37b3dfd4c347df52132563..e8d446b598963374700d607fbc9d49c24d339498 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 f423b5891fc1754d24ab906d01f56f00a565e3c8..2c8c46c7bce9812cfcd5ac11e1e4d90d88927026 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 a77cddbc50074fae5f36018a1ce9396c8fed2008..5fe581ec2f52ec8a7ce035f72fd5ba34b1cee3ed 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 9dd9fa503b346ca192caa7daa26a299ded58b60a..00f2ebc4bbe2bea72e9b2a7ba57a0ce9a61f7545 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 6317f5224aa4d6bae218ca1fc40ed3fb534d1d36..7cf9f401b023bc2d8dbbbbd8d70dc1763a19d2e0 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 90199a9cae0999b9f1bc75ac18138f13bbf71521..2dd01e931e097b9c510adfab4af61b63b772401a 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 65589fe3a05585f0134daa72319030c065555611..c61ff244fc1a4549db5c78535cad9633823d28a1 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 1a49560712ccce937e55b500cdbf8dbceaedb590..e01dd3a152f78baf17db8aa69aea42fe29e7ea2d 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 17618d8724dc4ebc7e92ec70ed31372058a62dcb..7a844f54cebf407f6350b8596a7f38e993d02467 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 4bb0bc5a18a5cb46138c361525322ff98f052260..2eaa6075ca30577a53d4aeea34a92c78760c7d91 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 3834aa2ab8fd9e3ff03c8789b277bda27ae3152b..74533fa484f2564a669d8d6b0f1d5232e13544a3 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 0298eedfefdf75993997fc094fb1aed9f6149a03..e190dbba659e3ae71bd9e4efa6b39d42b7a0b5a5 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 0229de50ec901c9ead9785ceed441d6cda5d0001..baa1cc59799d4e51e1aac97dd513b55e6a2dc34c 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 65fcedf2f541aba1d05308708ce95de43981b3c9..f5c0f7874d6876e53ea99b6901e52d688d3660c1 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 924ea3f298d350fce85927b3eb8d3c4690835b67..4b2d546bb1a9be265c6afdc77a0109500ead32e5 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 94c53f3abae7ded42bec719d9969f0025ead1f2d..3ad8e8b096357c574db5fd1d275fb366fed77bda 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 ac4a2fffb972ec9531028b4ae13110531dab5088..006755e20b1c48952c202a5f83e7f8270ba5efb3 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 e0db87d1ed05f517e3cafe3408effc971972373b..97284265f19b0d4327de284b82b0dee170fbe41c 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 c1f1f60c1b88ba36fea896e0e4a3f1773a0a5725..4331e1f340fc6a755bf7ad6a559049adc0c3cb41 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 c9bbaa1a21323e82e783a88086bc12e840620d16..90308a2ca9534c119cea41dca5258087ca6ac612 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>
-