From 41d9bd0e6d018af9201f376a17ce52f59463e7b9 Mon Sep 17 00:00:00 2001 From: prep Date: Thu, 16 Feb 2012 15:59:54 -0500 Subject: Path-278 Debug option to download multiple navmeshes to the viewer. --- indra/newview/llfloaterpathfindingconsole.cpp | 43 +++++++++++++++++++-------- 1 file changed, 31 insertions(+), 12 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 1b948c442b..c54f6a1ffe 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -45,6 +45,7 @@ #include "llviewerregion.h" #include "llviewerwindow.h" #include "llviewercamera.h" +#include "llviewercontrol.h" #include "LLPathingLib.h" @@ -432,7 +433,8 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mNavMeshCnt(0), mHasStartPoint(false), mHasEndPoint(false), - mIsRegionFrozen(false) + mIsRegionFrozen(false), + mNeighboringRegion( CURRENT_REGION ) { mSelfHandle.bind(this); @@ -470,26 +472,43 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) //make sure the region is essentially enabled for navmesh support std::string capability = "RetrieveNavMeshSrc"; - - //prep# neighboring navmesh support proto + LLViewerRegion* pCurrentRegion = gAgent.getRegion(); std::vector regions; regions.push_back( pCurrentRegion ); - //pCurrentRegion->getNeighboringRegions( regions ); - - std::vector shift; - shift.push_back( CURRENT_REGION ); - //pCurrentRegion->getNeighboringRegionsStatus( shift ); + std::vector shiftDirections; + shiftDirections.push_back( CURRENT_REGION ); + mNeighboringRegion = gSavedSettings.getU32("RetrieveNeighboringRegion"); + if ( mNeighboringRegion != CURRENT_REGION ) + { + //User wants to pull in a neighboring region + std::vector availableRegions; + pCurrentRegion->getNeighboringRegionsStatus( availableRegions ); + //Is the desired region in the available list + std::vector::iterator foundElem = std::find(availableRegions.begin(),availableRegions.end(),mNeighboringRegion); + if ( foundElem != availableRegions.end() ) + { + LLViewerRegion* pCurrentRegion = gAgent.getRegion(); + std::vector regionPtrs; + pCurrentRegion->getNeighboringRegions( regionPtrs ); + regions.push_back( regionPtrs[mNeighboringRegion] ); + shiftDirections.push_back( mNeighboringRegion ); + } + } + + //If the navmesh shift ops and the total region counts do not match - use the current region, only. - if ( shift.size() != regions.size() ) + if ( shiftDirections.size() != regions.size() ) { - shift.clear();regions.clear(); + shiftDirections.clear();regions.clear(); regions.push_back( pCurrentRegion ); - shift.push_back( CURRENT_REGION ); + shiftDirections.push_back( CURRENT_REGION ); } + int regionCnt = regions.size(); mNavMeshCnt = regionCnt; + for ( int i=0; igetCapability( capability ); @@ -499,7 +518,7 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) std::string str = getString("navmesh_fetch_inprogress"); mPathfindingStatus->setText((LLStringExplicit)str); LLNavMeshStation::getInstance()->setNavMeshDownloadURL( url ); - int dir = shift[i]; + int dir = shiftDirections[i]; LLNavMeshStation::getInstance()->downloadNavMeshSrc( mNavMeshDownloadObserver[mCurrentMDO].getObserverHandle(), dir ); ++mCurrentMDO; } -- cgit v1.2.3