From 6711e6584aa0aa5f17f76a557524725857fbf2ba Mon Sep 17 00:00:00 2001
From: prep <prep@lindenlab.com>
Date: Tue, 19 Jun 2012 15:09:22 -0400
Subject: [PATCH] path-722: handling the case where region entry or teleporting
 would cause the rebake button to be drawn ontop of splash screen.

---
 indra/newview/llpathfindingmanager.cpp | 20 +++++++++++---------
 indra/newview/llpathfindingmanager.h   |  4 ++--
 indra/newview/llviewerdisplay.cpp      | 13 +++++++++----
 3 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp
index f49942ee977..d1a249edc51 100644
--- a/indra/newview/llpathfindingmanager.cpp
+++ b/indra/newview/llpathfindingmanager.cpp
@@ -302,7 +302,6 @@ void LLPathfindingManager::onRegionBoundaryCrossed()
 		mNavMeshSlot = registerNavMeshListenerForRegion(currentRegion, boost::bind(&LLPathfindingManager::handleNavMeshStatus, this, _1, _2));
 		requestGetNavMeshForRegion(currentRegion, true);
 	}
-	displayNavMeshRebakePanel();
 }
 
 LLPathfindingManager::~LLPathfindingManager()
@@ -771,14 +770,17 @@ void LLPathfindingManager::handleNavMeshStatus(LLPathfindingNavMesh::ENavMeshReq
 
 void LLPathfindingManager::displayNavMeshRebakePanel()
 {
-	LLView* rootp = LLUI::getRootView();
-	LLPanel* panel_nmr_container = rootp->getChild<LLPanel>("navmesh_rebake_container");
-	LLPanelNavMeshRebake* panel_namesh_rebake = LLPanelNavMeshRebake::getInstance();
-	panel_nmr_container->addChild( panel_namesh_rebake );
-	panel_nmr_container->setVisible( TRUE );
-	panel_namesh_rebake->reparent( rootp );
-	LLPanelNavMeshRebake::getInstance()->setVisible( TRUE );
-	LLPanelNavMeshRebake::getInstance()->resetButtonStates();
+	if ( LLStartUp::getStartupState() == STATE_STARTED && gAgent.getTeleportState() == LLAgent::TELEPORT_NONE )
+	{
+		LLView* rootp = LLUI::getRootView();
+		LLPanel* panel_nmr_container = rootp->getChild<LLPanel>("navmesh_rebake_container");
+		LLPanelNavMeshRebake* panel_namesh_rebake = LLPanelNavMeshRebake::getInstance();
+		panel_nmr_container->addChild( panel_namesh_rebake );
+		panel_nmr_container->setVisible( TRUE );
+		panel_namesh_rebake->reparent( rootp );
+		LLPanelNavMeshRebake::getInstance()->setVisible( TRUE );
+		LLPanelNavMeshRebake::getInstance()->resetButtonStates();
+	}
 }
 
 void LLPathfindingManager::hideNavMeshRebakePanel()
diff --git a/indra/newview/llpathfindingmanager.h b/indra/newview/llpathfindingmanager.h
index a8ece113023..dafe75216f9 100644
--- a/indra/newview/llpathfindingmanager.h
+++ b/indra/newview/llpathfindingmanager.h
@@ -96,7 +96,8 @@ class LLPathfindingManager : public LLSingleton<LLPathfindingManager>
 	void handleNavMeshRebakeError( U32 pStatus, const std::string &pReason, const std::string &pURL );
 	void triggerNavMeshRebuild();
 	void onRegionBoundaryCrossed();
-	void requestGetAgentState();
+	void requestGetAgentState();	
+	void hideNavMeshRebakePanel();	
 
 protected:
 
@@ -128,7 +129,6 @@ class LLPathfindingManager : public LLSingleton<LLPathfindingManager>
 	void handleNavMeshStatus(LLPathfindingNavMesh::ENavMeshRequestStatus pRequestStatus, const LLPathfindingNavMeshStatus &pNavMeshStatus);
 
 	void displayNavMeshRebakePanel();
-	void hideNavMeshRebakePanel();	
 	void handleAgentStateResult(const LLSD &pContent );
 	void handleAgentStateError(U32 pStatus, const std::string &pReason, const std::string &pURL);
 
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index 0adb187dd20..aeb09e68088 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -77,6 +77,7 @@
 #include "llwlparammanager.h"
 #include "llwaterparammanager.h"
 #include "llpostprocess.h"
+#include "llpathfindingmanager.h"
 
 extern LLPointer<LLViewerTexture> gStartTexture;
 
@@ -391,13 +392,15 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
 			gViewerWindow->setProgressPercent(0);
 			gAgent.setTeleportState( LLAgent::TELEPORT_REQUESTED );
 			gAgent.setTeleportMessage(
-				LLAgent::sTeleportProgressMessages["requesting"]);
+				LLAgent::sTeleportProgressMessages["requesting"]);			
+			LLPathfindingManager::getInstance()->hideNavMeshRebakePanel();
 			break;
 
 		case LLAgent::TELEPORT_REQUESTED:
 			// Waiting for source simulator to respond
 			gViewerWindow->setProgressPercent( llmin(teleport_percent, 37.5f) );
-			gViewerWindow->setProgressString(message);
+			gViewerWindow->setProgressString(message);		
+			LLPathfindingManager::getInstance()->hideNavMeshRebakePanel();
 			break;
 
 		case LLAgent::TELEPORT_MOVING:
@@ -415,7 +418,8 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
 			gAgent.setTeleportMessage(
 				LLAgent::sTeleportProgressMessages["arriving"]);
 			gTextureList.mForceResetTextureStats = TRUE;
-			gAgentCamera.resetView(TRUE, TRUE);
+			gAgentCamera.resetView(TRUE, TRUE);	
+			
 			break;
 
 		case LLAgent::TELEPORT_ARRIVING:
@@ -449,7 +453,8 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
 		case LLAgent::TELEPORT_NONE:
 			// No teleport in progress
 			gViewerWindow->setShowProgress(FALSE);
-			gTeleportDisplay = FALSE;
+			gTeleportDisplay = FALSE;			
+			LLPathfindingManager::getInstance()->requestGetAgentState();
 			break;
 		}
 	}
-- 
GitLab