From c9fea8b43cfb50d1e8406ea87f47c51daea7cef1 Mon Sep 17 00:00:00 2001
From: Todd Stinson <stinson@lindenlab.com>
Date: Mon, 25 Jun 2012 18:17:56 -0700
Subject: [PATCH] PATH-718: Disabling the view/test menu in the case of a
 stubbed llphysicsextensions library.

---
 indra/newview/llpathfindingmanager.cpp             | 5 +++++
 indra/newview/llpathfindingmanager.h               | 1 +
 indra/newview/llviewermenu.cpp                     | 9 +++++++++
 indra/newview/skins/default/xui/en/menu_viewer.xml | 2 +-
 4 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp
index a01874296d6..bafcf579441 100644
--- a/indra/newview/llpathfindingmanager.cpp
+++ b/indra/newview/llpathfindingmanager.cpp
@@ -311,6 +311,11 @@ void LLPathfindingManager::quitSystem()
 	}
 }
 
+bool LLPathfindingManager::isPathfindingViewEnabled() const
+{
+	return (LLPathingLib::getInstance() != NULL);
+}
+
 bool LLPathfindingManager::isPathfindingEnabledForCurrentRegion() const
 {
 	return isPathfindingEnabledForRegion(getCurrentRegion());
diff --git a/indra/newview/llpathfindingmanager.h b/indra/newview/llpathfindingmanager.h
index 5fa2b94def1..9aa3065d89d 100644
--- a/indra/newview/llpathfindingmanager.h
+++ b/indra/newview/llpathfindingmanager.h
@@ -67,6 +67,7 @@ class LLPathfindingManager : public LLSingleton<LLPathfindingManager>
 	void initSystem();
 	void quitSystem();
 
+	bool isPathfindingViewEnabled() const;
 	bool isPathfindingEnabledForCurrentRegion() const;
 	bool isPathfindingEnabledForRegion(LLViewerRegion *pRegion) const;
 
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 47cafeb3f8b..bcec9c6edab 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -4886,6 +4886,14 @@ class LLToolsEnablePathfinding : public view_listener_t
 	}
 };
 
+class LLToolsEnablePathfindingView : public view_listener_t
+{
+	bool handleEvent(const LLSD& userdata)
+	{
+		return (LLPathfindingManager::getInstance() != NULL) && LLPathfindingManager::getInstance()->isPathfindingEnabledForCurrentRegion() && LLPathfindingManager::getInstance()->isPathfindingViewEnabled();
+	}
+};
+
 // Round the position of all root objects to the grid
 class LLToolsSnapObjectXY : public view_listener_t
 {
@@ -8281,6 +8289,7 @@ void initialize_menus()
 	view_listener_t::addMenu(new LLToolsEnableSaveToObjectInventory(), "Tools.EnableSaveToObjectInventory");
 
 	view_listener_t::addMenu(new LLToolsEnablePathfinding(), "Tools.EnablePathfinding");
+	view_listener_t::addMenu(new LLToolsEnablePathfindingView(), "Tools.EnablePathfindingView");
 
 	// Help menu
 	// most items use the ShowFloater method
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index 1682996c748..f9a4acb1e33 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -967,7 +967,7 @@
               function="Floater.ToggleOrBringToFront"
               parameter="pathfinding_console" />
           <menu_item_call.on_enable
-              function="Tools.EnablePathfinding" />
+              function="Tools.EnablePathfindingView" />
         </menu_item_call>
       </menu>
 
-- 
GitLab