diff options
Diffstat (limited to 'indra/newview/llfloaterpathfindingconsole.cpp')
-rw-r--r-- | indra/newview/llfloaterpathfindingconsole.cpp | 74 |
1 files changed, 62 insertions, 12 deletions
diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 269bef22fe..d51f427c4e 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -35,6 +35,7 @@ #include "llradiogroup.h"
#include "llsliderctrl.h"
#include "lllineeditor.h"
+#include "lltextbase.h"
#include "lltextvalidate.h"
#include "llnavmeshstation.h"
#include "llviewerregion.h"
@@ -53,6 +54,8 @@ #define XUI_CHARACTER_TYPE_C 3
#define XUI_CHARACTER_TYPE_D 4
+const int CURRENT_REGION = 99;
+const int MAX_OBSERVERS = 10;
//---------------------------------------------------------------------------
// LLFloaterPathfindingConsole
//---------------------------------------------------------------------------
@@ -95,6 +98,9 @@ BOOL LLFloaterPathfindingConsole::postBuild() llassert(mCharacterTypeRadioGroup != NULL);
mCharacterTypeRadioGroup->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterTypeSwitch, this));
+ mPathfindingStatus = findChild<LLTextBase>("pathfinding_status");
+ llassert(mPathfindingStatus != NULL);
+
mTerrainMaterialA = findChild<LLLineEditor>("terrain_material_a");
llassert(mTerrainMaterialA != NULL);
mTerrainMaterialA->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onTerrainMaterialASet, this));
@@ -303,6 +309,18 @@ void LLFloaterPathfindingConsole::setTerrainMaterialD(F32 pTerrainMaterial) mTerrainMaterialD->setValue(LLSD(pTerrainMaterial));
}
+void LLFloaterPathfindingConsole::setHasNavMeshReceived()
+{
+ std::string str = getString("navmesh_fetch_complete_available");
+ mPathfindingStatus->setText((LLStringExplicit)str);
+}
+
+void LLFloaterPathfindingConsole::setHasNoNavMesh()
+{
+ std::string str = getString("navmesh_fetch_complete_none");
+ mPathfindingStatus->setText((LLStringExplicit)str);
+}
+
LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed)
: LLFloater(pSeed),
mShowNavMeshCheckBox(NULL),
@@ -313,12 +331,16 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mPathSelectionRadioGroup(NULL),
mCharacterWidthSlider(NULL),
mCharacterTypeRadioGroup(NULL),
+ mPathfindingStatus(NULL),
mTerrainMaterialA(NULL),
mTerrainMaterialB(NULL),
mTerrainMaterialC(NULL),
- mTerrainMaterialD(NULL),
- mNavMeshDownloadObserver()
+ mTerrainMaterialD(NULL)
{
+ for (int i=0;i<MAX_OBSERVERS;++i)
+ {
+ mNavMeshDownloadObserver[i].setPathfindingConsole(this);
+ }
}
LLFloaterPathfindingConsole::~LLFloaterPathfindingConsole()
@@ -339,22 +361,50 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) //prep# end test
if ( LLPathingLib::getInstance() == NULL )
{
- llinfos<<"No implementation of pathing library."<<llendl;
+ std::string str = getString("navmesh_library_not_implemented");
+ LLStyle::Params styleParams;
+ styleParams.color = LLUIColorTable::instance().getColor("DrYellow");
+ mPathfindingStatus->setText((LLStringExplicit)str, styleParams);
+ llwarns <<"Errror: cannout find pathing library implementation."<<llendl;
}
else
{
+ mCurrentMDO = 0;
//make sure the region is essentially enabled for navmesh support
std::string capability = "RetrieveNavMeshSrc";
- std::string url = gAgent.getRegion()->getCapability( capability );
- if ( !url.empty() )
- {
- llinfos<<"Region has required caps of type ["<<capability<<"]"<<llendl;
- LLNavMeshStation::getInstance()->setNavMeshDownloadURL( url );
- LLNavMeshStation::getInstance()->downloadNavMeshSrc( mNavMeshDownloadObserver.getObserverHandle() );
- }
- else
+
+ //prep# neighboring navmesh support proto
+ LLViewerRegion* pCurrentRegion = gAgent.getRegion();
+ std::vector<LLViewerRegion*> regions;
+ regions.push_back( pCurrentRegion );
+ //pCurrentRegion->getNeighboringRegions( regions );
+
+ std::vector<int> shift;
+ shift.push_back( CURRENT_REGION );
+ //pCurrentRegion->getNeighboringRegionsStatus( shift );
+
+ int regionCnt = regions.size();
+ for ( int i=0; i<regionCnt; ++i )
{
- llinfos<<"Region has does not required caps of type ["<<capability<<"]"<<llendl;
+ std::string url = regions[i]->getCapability( capability );
+
+ if ( !url.empty() )
+ {
+ std::string str = getString("navmesh_fetch_inprogress");
+ mPathfindingStatus->setText((LLStringExplicit)str);
+ LLNavMeshStation::getInstance()->setNavMeshDownloadURL( url );
+ int dir = shift[i];
+ LLNavMeshStation::getInstance()->downloadNavMeshSrc( mNavMeshDownloadObserver[mCurrentMDO].getObserverHandle(), dir );
+ ++mCurrentMDO;
+ }
+ else
+ {
+ std::string str = getString("navmesh_region_not_enabled");
+ LLStyle::Params styleParams;
+ styleParams.color = LLUIColorTable::instance().getColor("DrYellow");
+ mPathfindingStatus->setText((LLStringExplicit)str, styleParams);
+ llinfos<<"Region has does not required caps of type ["<<capability<<"]"<<llendl;
+ }
}
}
}
|