diff options
Diffstat (limited to 'indra/newview/llfloaterpathfindingconsole.cpp')
-rw-r--r-- | indra/newview/llfloaterpathfindingconsole.cpp | 125 |
1 files changed, 79 insertions, 46 deletions
diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index fce67c4171..50edc55d76 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -313,6 +313,12 @@ void LLFloaterPathfindingConsole::setHasNavMeshReceived() { std::string str = getString("navmesh_fetch_complete_available"); mPathfindingStatus->setText((LLStringExplicit)str); + //check to see if all regions are done loading and they are then stitch the navmeshes together + --mNavMeshCnt; + if ( mNavMeshCnt == 0 ) + { + //LLPathingLib::getInstance()->stitchNavMeshes(); + } } void LLFloaterPathfindingConsole::setHasNoNavMesh() @@ -335,7 +341,10 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mTerrainMaterialA(NULL), mTerrainMaterialB(NULL), mTerrainMaterialC(NULL), - mTerrainMaterialD(NULL) + mTerrainMaterialD(NULL), + mNavMeshCnt(0), + mHasStartPoint(false), + mHasEndPoint(false) { for (int i=0;i<MAX_OBSERVERS;++i) { @@ -353,12 +362,7 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) if ( !LLPathingLib::getInstance() ) { LLPathingLib::initSystem(); - } - //prep# test remove - //LLSD content; - //LLPathingLib::getInstance()->extractNavMeshSrcFromLLSD( content ); - //return true; - //prep# end test + } if ( LLPathingLib::getInstance() == NULL ) { std::string str = getString("navmesh_library_not_implemented"); @@ -370,6 +374,8 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) else { mCurrentMDO = 0; + mNavMeshCnt = 0; + //make sure the region is essentially enabled for navmesh support std::string capability = "RetrieveNavMeshSrc"; @@ -383,7 +389,15 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) shift.push_back( CURRENT_REGION ); //pCurrentRegion->getNeighboringRegionsStatus( shift ); + //If the navmesh shift ops and the total region counts do not match - use the current region, only. + if ( shift.size() != regions.size() ) + { + shift.clear();regions.clear(); + regions.push_back( pCurrentRegion ); + shift.push_back( CURRENT_REGION ); + } int regionCnt = regions.size(); + mNavMeshCnt = regionCnt; for ( int i=0; i<regionCnt; ++i ) { std::string url = regions[i]->getCapability( capability ); @@ -399,6 +413,7 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) } else { + --mNavMeshCnt; std::string str = getString("navmesh_region_not_enabled"); LLStyle::Params styleParams; styleParams.color = LLUIColorTable::instance().getColor("DrYellow"); @@ -432,7 +447,7 @@ void LLFloaterPathfindingConsole::onShowExcludeVolumesToggle() LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); if (llPathingLibInstance != NULL) { - llPathingLibInstance->setRenderNavMeshandShapes(checkBoxValue); + llPathingLibInstance->setRenderShapes(checkBoxValue); } else { @@ -445,15 +460,33 @@ void LLFloaterPathfindingConsole::onShowPathToggle() { BOOL checkBoxValue = mShowPathCheckBox->get(); - llwarns << "functionality has not yet been implemented to toggle '" - << mShowPathCheckBox->getLabel() << "' to " - << (checkBoxValue ? "ON" : "OFF") << llendl; + LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); + if (llPathingLibInstance != NULL) + { + llPathingLibInstance->setRenderPath(checkBoxValue); + } + else + { + mShowPathCheckBox->set(FALSE); + llwarns << "cannot find LLPathingLib instance" << llendl; + } } void LLFloaterPathfindingConsole::onShowWaterPlaneToggle() { BOOL checkBoxValue = mShowWaterPlaneCheckBox->get(); + LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); + if (llPathingLibInstance != NULL) + { + llPathingLibInstance->setRenderWaterPlane(checkBoxValue); + } + else + { + mShowWaterPlaneCheckBox->set(FALSE); + llwarns << "cannot find LLPathingLib instance" << llendl; + } + llwarns << "functionality has not yet been implemented to toggle '" << mShowWaterPlaneCheckBox->getLabel() << "' to " << (checkBoxValue ? "ON" : "OFF") << llendl; @@ -461,21 +494,27 @@ void LLFloaterPathfindingConsole::onShowWaterPlaneToggle() void LLFloaterPathfindingConsole::onRegionOverlayDisplaySwitch() { - switch (getRegionOverlayDisplay()) + LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); + if (llPathingLibInstance != NULL) { - case kRenderOverlayOnFixedPhysicsGeometry : - llwarns << "functionality has not yet been implemented to toggle '" - << mRegionOverlayDisplayRadioGroup->getName() << "' to RenderOverlayOnFixedPhysicsGeometry" - << llendl; - break; - case kRenderOverlayOnAllRenderableGeometry : - llwarns << "functionality has not yet been implemented to toggle '" - << mRegionOverlayDisplayRadioGroup->getName() << "' to RenderOverlayOnAllRenderableGeometry" - << llendl; - break; - default : - llassert(0); - break; + switch (getRegionOverlayDisplay()) + { + case kRenderOverlayOnFixedPhysicsGeometry : + llPathingLibInstance->setRenderOverlayMode(false); + break; + case kRenderOverlayOnAllRenderableGeometry : + llPathingLibInstance->setRenderOverlayMode(true); + break; + default : + llPathingLibInstance->setRenderOverlayMode(false); + llassert(0); + break; + } + } + else + { + this->setRegionOverlayDisplay(kRenderOverlayOnFixedPhysicsGeometry); + llwarns << "cannot find LLPathingLib instance" << llendl; } } @@ -484,19 +523,10 @@ void LLFloaterPathfindingConsole::onPathSelectionSwitch() switch (getPathSelectionState()) { case kPathSelectNone : - llwarns << "functionality has not yet been implemented to toggle '" - << mPathSelectionRadioGroup->getName() << "' to PathSelectNone" - << llendl; break; case kPathSelectStartPoint : - llwarns << "functionality has not yet been implemented to toggle '" - << mPathSelectionRadioGroup->getName() << "' to PathSelectStartPoint" - << llendl; break; case kPathSelectEndPoint : - llwarns << "functionality has not yet been implemented to toggle '" - << mPathSelectionRadioGroup->getName() << "' to PathSelectEndPoint" - << llendl; break; default : llassert(0); @@ -506,9 +536,7 @@ void LLFloaterPathfindingConsole::onPathSelectionSwitch() void LLFloaterPathfindingConsole::onCharacterWidthSet() { - F32 characterWidth = getCharacterWidth(); - llwarns << "functionality has not yet been implemented to set '" << mCharacterWidthSlider->getName() - << "' to the value (" << characterWidth << ")" << llendl; + generatePath(); } void LLFloaterPathfindingConsole::onCharacterTypeSwitch() @@ -586,11 +614,6 @@ void LLFloaterPathfindingConsole::onTerrainMaterialDSet() } -BOOL LLFloaterPathfindingConsole::allowAllRenderables() const -{ - return getRegionOverlayDisplay() == kRenderOverlayOnAllRenderableGeometry ? true : false; -} - void LLFloaterPathfindingConsole::providePathingData( const LLVector3& point1, const LLVector3& point2 ) { switch (getPathSelectionState()) @@ -604,18 +627,28 @@ void LLFloaterPathfindingConsole::providePathingData( const LLVector3& point1, c case kPathSelectStartPoint : mPathData.mStartPointA = point1; mPathData.mEndPointA = point2; + mHasStartPoint = true; break; case kPathSelectEndPoint : mPathData.mStartPointB = point1; mPathData.mEndPointB = point2; - mPathData.mCharacterWidth = getCharacterWidth(); - //prep#TODO# possibly consider an alternate behavior - perhaps add a "path" button to submit the data. - LLPathingLib::getInstance()->generatePath( mPathData ); + mHasEndPoint = true; break; default : llassert(0); break; - } + } + + generatePath(); +} + +void LLFloaterPathfindingConsole::generatePath() +{ + if (mHasStartPoint && mHasEndPoint) + { + mPathData.mCharacterWidth = getCharacterWidth(); + LLPathingLib::getInstance()->generatePath(mPathData); + } } |