From 581de7c7b8025c48e585c1af80e060af94aca328 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 5 Mar 2012 17:20:35 -0800 Subject: PATH-205,PATH-304: More work to handle downloading of out-of-date navmeshes. --- indra/newview/llpathfindingnavmeshzone.cpp | 230 +++++++++++++++++++++++++++++ 1 file changed, 230 insertions(+) create mode 100644 indra/newview/llpathfindingnavmeshzone.cpp (limited to 'indra/newview/llpathfindingnavmeshzone.cpp') diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp new file mode 100644 index 0000000000..986acfa3e8 --- /dev/null +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -0,0 +1,230 @@ +/** + * @file llpathfindingnavmeshzone.cpp + * @author William Todd Stinson + * @brief A class for representing the zone of navmeshes containing and possible surrounding the current region. + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llsd.h" +#include "lluuid.h" +#include "llagent.h" +#include "llviewerregion.h" +#include "llpathfindingnavmesh.h" +#include "llpathfindingnavmeshzone.h" +#include "llpathfindingmanager.h" +#include "llviewercontrol.h" + +#include "LLPathingLib.h" + +#include +#include + +#define CENTER_REGION 99 + +//--------------------------------------------------------------------------- +// LLPathfindingNavMeshZone +//--------------------------------------------------------------------------- + +LLPathfindingNavMeshZone::LLPathfindingNavMeshZone() + : mNavMeshLocations(), + mNavMeshZoneSignal(), + mNavMeshSlot() +{ +} + +LLPathfindingNavMeshZone::~LLPathfindingNavMeshZone() +{ +} + +LLPathfindingNavMeshZone::navmesh_zone_slot_t LLPathfindingNavMeshZone::registerNavMeshZoneListener(navmesh_zone_callback_t pNavMeshZoneCallback) +{ + return mNavMeshZoneSignal.connect(pNavMeshZoneCallback); +} + +void LLPathfindingNavMeshZone::setCurrentRegionAsCenter() +{ + llassert(LLPathingLib::getInstance() != NULL); + LLPathingLib::getInstance()->cleanupResidual(); + mNavMeshLocations.clear(); + LLViewerRegion *currentRegion = gAgent.getRegion(); + const LLUUID ¤tRegionUUID = currentRegion->getRegionID(); + NavMeshLocation centerNavMesh(currentRegionUUID, CENTER_REGION); + mNavMeshLocations.insert(std::pair(currentRegionUUID, centerNavMesh)); +} + +void LLPathfindingNavMeshZone::refresh() +{ + LLPathfindingManager *pathfindingManagerInstance = LLPathfindingManager::getInstance(); + if (!mNavMeshSlot.connected()) + { + pathfindingManagerInstance->registerNavMeshListenerForCurrentRegion(boost::bind(&LLPathfindingNavMeshZone::handleNavMesh, this, _1, _2, _3, _4)); + } + + pathfindingManagerInstance->requestGetNavMeshForCurrentRegion(); +} + +void LLPathfindingNavMeshZone::disable() +{ + if (mNavMeshSlot.connected()) + { + mNavMeshSlot.disconnect(); + } + + llassert(LLPathingLib::getInstance() != NULL); + LLPathingLib::getInstance()->cleanupResidual(); + + mNavMeshLocations.clear(); +} + +void LLPathfindingNavMeshZone::handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLUUID &pRegionUUID, U32 pNavMeshVersion, const LLSD::Binary &pNavMeshData) +{ + NavMeshLocations::iterator navMeshIter = mNavMeshLocations.find(pRegionUUID); + if (navMeshIter != mNavMeshLocations.end()) + { + navMeshIter->second.handleNavMesh(pNavMeshRequestStatus, pRegionUUID, pNavMeshVersion, pNavMeshData); + updateStatus(); + } +} + +void LLPathfindingNavMeshZone::updateStatus() +{ + bool hasRequestUnknown = false; + bool hasRequestStarted = false; + bool hasRequestCompleted = false; + bool hasRequestNotEnabled = false; + bool hasRequestError = false; + + for (NavMeshLocations::iterator navMeshIter = mNavMeshLocations.begin(); + navMeshIter != mNavMeshLocations.end(); ++navMeshIter) + { + switch (navMeshIter->second.getRequestStatus()) + { + case LLPathfindingNavMesh::kNavMeshRequestUnknown : + hasRequestUnknown = true; + break; + case LLPathfindingNavMesh::kNavMeshRequestStarted : + hasRequestStarted = true; + break; + case LLPathfindingNavMesh::kNavMeshRequestCompleted : + hasRequestCompleted = true; + break; + case LLPathfindingNavMesh::kNavMeshRequestNotEnabled : + hasRequestNotEnabled = true; + break; + case LLPathfindingNavMesh::kNavMeshRequestError : + hasRequestError = true; + break; + default : + hasRequestError = true; + llassert(0); + break; + } + } + + ENavMeshZoneRequestStatus zoneRequestStatus = kNavMeshZoneRequestUnknown; + if (hasRequestNotEnabled) + { + zoneRequestStatus = kNavMeshZoneRequestNotEnabled; + } + else if (hasRequestError) + { + zoneRequestStatus = kNavMeshZoneRequestError; + } + else if (hasRequestStarted) + { + zoneRequestStatus = kNavMeshZoneRequestStarted; + } + else if (hasRequestUnknown) + { + zoneRequestStatus = kNavMeshZoneRequestUnknown; + llassert(0); + } + else if (hasRequestCompleted) + { + zoneRequestStatus = kNavMeshZoneRequestCompleted; + LLPathingLib::getInstance()->stitchNavMeshes( gSavedSettings.getBOOL("EnableVBOForNavMeshVisualization") ); + } + else + { + zoneRequestStatus = kNavMeshZoneRequestError; + llassert(0); + } + + mNavMeshZoneSignal(zoneRequestStatus); +} + +//--------------------------------------------------------------------------- +// LLPathfindingNavMeshZone::NavMeshLocation +//--------------------------------------------------------------------------- + +LLPathfindingNavMeshZone::NavMeshLocation::NavMeshLocation(const LLUUID &pRegionUUID, S32 pDirection) + : mRegionUUID(pRegionUUID), + mDirection(pDirection), + mHasNavMesh(false), + mNavMeshVersion(0U), + mRequestStatus(LLPathfindingNavMesh::kNavMeshRequestUnknown) +{ +} + +LLPathfindingNavMeshZone::NavMeshLocation::NavMeshLocation(const NavMeshLocation &other) + : mRegionUUID(other.mRegionUUID), + mDirection(other.mDirection), + mHasNavMesh(other.mHasNavMesh), + mNavMeshVersion(other.mNavMeshVersion), + mRequestStatus(other.mRequestStatus) +{ +} + +LLPathfindingNavMeshZone::NavMeshLocation::~NavMeshLocation() +{ +} + +void LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLUUID &pRegionUUID, U32 pNavMeshVersion, const LLSD::Binary &pNavMeshData) +{ + llassert(mRegionUUID == pRegionUUID); + mRequestStatus = pNavMeshRequestStatus; + if ((pNavMeshRequestStatus == LLPathfindingNavMesh::kNavMeshRequestCompleted) && (!mHasNavMesh || (mNavMeshVersion != pNavMeshVersion))) + { + llassert(!pNavMeshData.empty()); + mHasNavMesh = true; + mNavMeshVersion = pNavMeshVersion; + LLPathingLib::getInstance()->extractNavMeshSrcFromLLSD(pNavMeshData, mDirection); + } +} + +LLPathfindingNavMesh::ENavMeshRequestStatus LLPathfindingNavMeshZone::NavMeshLocation::getRequestStatus() const +{ + return mRequestStatus; +} + +LLPathfindingNavMeshZone::NavMeshLocation &LLPathfindingNavMeshZone::NavMeshLocation::operator =(const NavMeshLocation &other) +{ + mRegionUUID = other.mRegionUUID; + mDirection = other.mDirection; + mHasNavMesh = other.mHasNavMesh; + mNavMeshVersion = other.mNavMeshVersion; + mRequestStatus = other.mRequestStatus; + + return (*this); +} -- cgit v1.3 From 8ad01dd79a2c215895017475bcfd62808f8893be Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 5 Mar 2012 17:55:33 -0800 Subject: Wrapping all cases of LLPathingLib::getInstance in null pointer checks. --- indra/newview/llfloaterpathfindingconsole.cpp | 5 ++++- indra/newview/llpathfindingnavmeshzone.cpp | 23 ++++++++++++++++++----- 2 files changed, 22 insertions(+), 6 deletions(-) (limited to 'indra/newview/llpathfindingnavmeshzone.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index eee5d6860d..37bf937cd1 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -265,7 +265,10 @@ void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting) mNavMeshZoneSlot.disconnect(); } - //mNavMeshZone.disable(); + if (LLPathingLib::getInstance() != NULL) + { + mNavMeshZone.disable(); + } LLFloater::onClose(pIsAppQuitting); setHeartBeat( false ); diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp index 986acfa3e8..8fa6fc3c8b 100644 --- a/indra/newview/llpathfindingnavmeshzone.cpp +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -65,7 +65,10 @@ LLPathfindingNavMeshZone::navmesh_zone_slot_t LLPathfindingNavMeshZone::register void LLPathfindingNavMeshZone::setCurrentRegionAsCenter() { llassert(LLPathingLib::getInstance() != NULL); - LLPathingLib::getInstance()->cleanupResidual(); + if (LLPathingLib::getInstance() != NULL) + { + LLPathingLib::getInstance()->cleanupResidual(); + } mNavMeshLocations.clear(); LLViewerRegion *currentRegion = gAgent.getRegion(); const LLUUID ¤tRegionUUID = currentRegion->getRegionID(); @@ -91,8 +94,10 @@ void LLPathfindingNavMeshZone::disable() mNavMeshSlot.disconnect(); } - llassert(LLPathingLib::getInstance() != NULL); - LLPathingLib::getInstance()->cleanupResidual(); + if (LLPathingLib::getInstance() != NULL) + { + LLPathingLib::getInstance()->cleanupResidual(); + } mNavMeshLocations.clear(); } @@ -163,7 +168,11 @@ void LLPathfindingNavMeshZone::updateStatus() else if (hasRequestCompleted) { zoneRequestStatus = kNavMeshZoneRequestCompleted; - LLPathingLib::getInstance()->stitchNavMeshes( gSavedSettings.getBOOL("EnableVBOForNavMeshVisualization") ); + llassert(LLPathingLib::getInstance() != NULL); + if (LLPathingLib::getInstance() != NULL) + { + LLPathingLib::getInstance()->stitchNavMeshes( gSavedSettings.getBOOL("EnableVBOForNavMeshVisualization") ); + } } else { @@ -209,7 +218,11 @@ void LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh(LLPathfindingNavMe llassert(!pNavMeshData.empty()); mHasNavMesh = true; mNavMeshVersion = pNavMeshVersion; - LLPathingLib::getInstance()->extractNavMeshSrcFromLLSD(pNavMeshData, mDirection); + llassert(LLPathingLib::getInstance() != NULL); + if (LLPathingLib::getInstance() != NULL) + { + LLPathingLib::getInstance()->extractNavMeshSrcFromLLSD(pNavMeshData, mDirection); + } } } -- cgit v1.3 From 6c9561c882cf0d5bb0cb547852e95daec19f559c Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 6 Mar 2012 15:57:28 -0800 Subject: Storing the slots for the registered signal listeners. Before, this was creating the artifact of crashing the Viewer on the second close of the pathfinding console. --- indra/newview/llfloaterpathfindingconsole.cpp | 4 ++-- indra/newview/llfloaterpathfindinglinksets.cpp | 2 +- indra/newview/llpathfindingnavmeshzone.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/llpathfindingnavmeshzone.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 37bf937cd1..f2404dcb6b 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -168,7 +168,7 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) { if (!mNavMeshZoneSlot.connected()) { - mNavMeshZone.registerNavMeshZoneListener(boost::bind(&LLFloaterPathfindingConsole::onNavMeshZoneCB, this, _1)); + mNavMeshZoneSlot = mNavMeshZone.registerNavMeshZoneListener(boost::bind(&LLFloaterPathfindingConsole::onNavMeshZoneCB, this, _1)); } mNavMeshZone.setCurrentRegionAsCenter(); @@ -246,7 +246,7 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) if (!mAgentStateSlot.connected()) { - LLPathfindingManager::getInstance()->registerAgentStateListener(boost::bind(&LLFloaterPathfindingConsole::onAgentStateCB, this, _1)); + mAgentStateSlot = LLPathfindingManager::getInstance()->registerAgentStateListener(boost::bind(&LLFloaterPathfindingConsole::onAgentStateCB, this, _1)); } setAgentState(LLPathfindingManager::getInstance()->getAgentState()); diff --git a/indra/newview/llfloaterpathfindinglinksets.cpp b/indra/newview/llfloaterpathfindinglinksets.cpp index 5ef41f1d3f..af2024021b 100644 --- a/indra/newview/llfloaterpathfindinglinksets.cpp +++ b/indra/newview/llfloaterpathfindinglinksets.cpp @@ -211,7 +211,7 @@ void LLFloaterPathfindingLinksets::onOpen(const LLSD& pKey) if (!mAgentStateSlot.connected()) { - LLPathfindingManager::getInstance()->registerAgentStateListener(boost::bind(&LLFloaterPathfindingLinksets::onAgentStateCB, this, _1)); + mAgentStateSlot = LLPathfindingManager::getInstance()->registerAgentStateListener(boost::bind(&LLFloaterPathfindingLinksets::onAgentStateCB, this, _1)); } if (!mSelectionUpdateSlot.connected()) diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp index 8fa6fc3c8b..c6b9c6c338 100644 --- a/indra/newview/llpathfindingnavmeshzone.cpp +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -81,7 +81,7 @@ void LLPathfindingNavMeshZone::refresh() LLPathfindingManager *pathfindingManagerInstance = LLPathfindingManager::getInstance(); if (!mNavMeshSlot.connected()) { - pathfindingManagerInstance->registerNavMeshListenerForCurrentRegion(boost::bind(&LLPathfindingNavMeshZone::handleNavMesh, this, _1, _2, _3, _4)); + mNavMeshSlot = pathfindingManagerInstance->registerNavMeshListenerForCurrentRegion(boost::bind(&LLPathfindingNavMeshZone::handleNavMesh, this, _1, _2, _3, _4)); } pathfindingManagerInstance->requestGetNavMeshForCurrentRegion(); -- cgit v1.3 From a0c626fe411336871505c2c414143ae4b2f73259 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 6 Mar 2012 18:40:37 -0800 Subject: PATH-205,PATH-304: More work to handle downloading of out-of-date navmeshes. --- indra/newview/llfloaterpathfindingconsole.cpp | 73 +--------- indra/newview/llpathfindingmanager.cpp | 39 +++--- indra/newview/llpathfindingmanager.h | 8 +- indra/newview/llpathfindingnavmeshzone.cpp | 194 ++++++++++++++++++-------- indra/newview/llpathfindingnavmeshzone.h | 40 ++++-- 5 files changed, 190 insertions(+), 164 deletions(-) (limited to 'indra/newview/llpathfindingnavmeshzone.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index f2404dcb6b..fe5c6b8d44 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -171,77 +171,10 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) mNavMeshZoneSlot = mNavMeshZone.registerNavMeshZoneListener(boost::bind(&LLFloaterPathfindingConsole::onNavMeshZoneCB, this, _1)); } - mNavMeshZone.setCurrentRegionAsCenter(); - mNavMeshZone.refresh(); -#if 0 - LLPathingLib::getInstance()->cleanupResidual(); - - mCurrentMDO = 0; - mNavMeshCnt = 0; - - //make sure the region is essentially enabled for navmesh support - std::string capability = "RetrieveNavMeshSrc"; - - LLViewerRegion* pCurrentRegion = gAgent.getRegion(); - std::vector regions; - regions.push_back( pCurrentRegion ); - 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 ( shiftDirections.size() != regions.size() ) - { - shiftDirections.clear();regions.clear(); - regions.push_back( pCurrentRegion ); - shiftDirections.push_back( CURRENT_REGION ); - } + mNavMeshZone.initialize(); - int regionCnt = regions.size(); - mNavMeshCnt = regionCnt; - - for ( int i=0; igetCapability( capability ); - - if ( !url.empty() ) - { - std::string str = getString("navmesh_fetch_inprogress"); - mPathfindingStatus->setText((LLStringExplicit)str); - LLNavMeshStation::getInstance()->setNavMeshDownloadURL( url ); - int dir = shiftDirections[i]; - LLNavMeshStation::getInstance()->downloadNavMeshSrc( mNavMeshDownloadObserver[mCurrentMDO].getObserverHandle(), dir ); - ++mCurrentMDO; - } - else - { - --mNavMeshCnt; - 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 ["<canManageEstate())); } -LLPathfindingNavMesh::navmesh_slot_t LLPathfindingManager::registerNavMeshListenerForCurrentRegion(LLPathfindingNavMesh::navmesh_callback_t pNavMeshCallback) +LLPathfindingNavMesh::navmesh_slot_t LLPathfindingManager::registerNavMeshListenerForRegion(LLViewerRegion *pRegion, LLPathfindingNavMesh::navmesh_callback_t pNavMeshCallback) { - LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForCurrentRegion(); + LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pRegion); return navMeshPtr->registerNavMeshListener(pNavMeshCallback); } -void LLPathfindingManager::requestGetNavMeshForCurrentRegion() +void LLPathfindingManager::requestGetNavMeshForRegion(LLViewerRegion *pRegion) { - LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForCurrentRegion(); + LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pRegion); if (navMeshPtr->hasNavMeshVersion(mNavMeshVersionXXX)) { @@ -220,14 +220,13 @@ void LLPathfindingManager::requestGetNavMeshForCurrentRegion() } else { - LLViewerRegion *region = getCurrentRegion(); - if (region == NULL) + if (pRegion == NULL) { navMeshPtr->handleNavMeshNotEnabled(); } else { - std::string navMeshURL = getRetrieveNavMeshURLForCurrentRegion(); + std::string navMeshURL = getRetrieveNavMeshURLForRegion(pRegion); if (navMeshURL.empty()) { navMeshPtr->handleNavMeshNotEnabled(); @@ -239,7 +238,7 @@ void LLPathfindingManager::requestGetNavMeshForCurrentRegion() LLSD postData; postData["agent_id"] = gAgent.getID(); - postData["region_id"] = region->getRegionID(); + postData["region_id"] = pRegion->getRegionID(); LLHTTPClient::post(navMeshURL, postData, responder); } } @@ -371,14 +370,13 @@ LLPathfindingManager::ELinksetsRequestStatus LLPathfindingManager::requestSetLin return status; } -LLPathfindingNavMeshPtr LLPathfindingManager::getNavMeshForCurrentRegion() +LLPathfindingNavMeshPtr LLPathfindingManager::getNavMeshForRegion(LLViewerRegion *pRegion) { LLUUID regionUUID; - LLViewerRegion *region = getCurrentRegion(); - if (region != NULL) + if (pRegion != NULL) { - regionUUID = region->getRegionID(); + regionUUID = pRegion->getRegionID(); } LLPathfindingNavMeshPtr navMeshPtr; @@ -469,6 +467,11 @@ std::string LLPathfindingManager::getRetrieveNavMeshURLForCurrentRegion() const return getCapabilityURLForCurrentRegion(CAP_SERVICE_RETRIEVE_NAVMESH); } +std::string LLPathfindingManager::getRetrieveNavMeshURLForRegion(LLViewerRegion *pRegion) const +{ + return getCapabilityURLForRegion(pRegion, CAP_SERVICE_RETRIEVE_NAVMESH); +} + std::string LLPathfindingManager::getAgentStateURLForCurrentRegion() const { return getCapabilityURLForCurrentRegion(CAP_SERVICE_AGENT_STATE); @@ -485,19 +488,23 @@ std::string LLPathfindingManager::getTerrainLinksetsURLForCurrentRegion() const } std::string LLPathfindingManager::getCapabilityURLForCurrentRegion(const std::string &pCapabilityName) const +{ + return getCapabilityURLForRegion(getCurrentRegion(), pCapabilityName); +} + +std::string LLPathfindingManager::getCapabilityURLForRegion(LLViewerRegion *pRegion, const std::string &pCapabilityName) const { std::string capabilityURL(""); - LLViewerRegion* region = getCurrentRegion(); - if (region != NULL) + if (pRegion != NULL) { - capabilityURL = region->getCapability(pCapabilityName); + capabilityURL = pRegion->getCapability(pCapabilityName); } if (capabilityURL.empty()) { llwarns << "cannot find capability '" << pCapabilityName << "' for current region '" - << ((region != NULL) ? region->getName() : "") << "'" << llendl; + << ((pRegion != NULL) ? pRegion->getName() : "") << "'" << llendl; } return capabilityURL; diff --git a/indra/newview/llpathfindingmanager.h b/indra/newview/llpathfindingmanager.h index f034ddb9ea..eb8704e308 100644 --- a/indra/newview/llpathfindingmanager.h +++ b/indra/newview/llpathfindingmanager.h @@ -78,8 +78,8 @@ public: bool isAllowAlterPermanent(); bool isAllowViewTerrainProperties() const; - LLPathfindingNavMesh::navmesh_slot_t registerNavMeshListenerForCurrentRegion(LLPathfindingNavMesh::navmesh_callback_t pNavMeshCallback); - void requestGetNavMeshForCurrentRegion(); + LLPathfindingNavMesh::navmesh_slot_t registerNavMeshListenerForRegion(LLViewerRegion *pRegion, LLPathfindingNavMesh::navmesh_callback_t pNavMeshCallback); + void requestGetNavMeshForRegion(LLViewerRegion *pRegion); agent_state_slot_t registerAgentStateListener(agent_state_callback_t pAgentStateCallback); EAgentState getAgentState(); @@ -92,7 +92,7 @@ public: protected: private: - LLPathfindingNavMeshPtr getNavMeshForCurrentRegion(); + LLPathfindingNavMeshPtr getNavMeshForRegion(LLViewerRegion *pRegion); static bool isValidAgentState(EAgentState pAgentState); @@ -102,11 +102,13 @@ private: void handleAgentStateError(U32 pStatus, const std::string &pReason, const std::string &pURL); std::string getRetrieveNavMeshURLForCurrentRegion() const; + std::string getRetrieveNavMeshURLForRegion(LLViewerRegion *pRegion) const; std::string getAgentStateURLForCurrentRegion() const; std::string getObjectLinksetsURLForCurrentRegion() const; std::string getTerrainLinksetsURLForCurrentRegion() const; std::string getCapabilityURLForCurrentRegion(const std::string &pCapabilityName) const; + std::string getCapabilityURLForRegion(LLViewerRegion *pRegion, const std::string &pCapabilityName) const; LLViewerRegion *getCurrentRegion() const; NavMeshMap mNavMeshMap; diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp index c6b9c6c338..7b9ac913c9 100644 --- a/indra/newview/llpathfindingnavmeshzone.cpp +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -38,7 +38,9 @@ #include "LLPathingLib.h" #include -#include +#include + +#include #define CENTER_REGION 99 @@ -47,9 +49,8 @@ //--------------------------------------------------------------------------- LLPathfindingNavMeshZone::LLPathfindingNavMeshZone() - : mNavMeshLocations(), - mNavMeshZoneSignal(), - mNavMeshSlot() + : mNavMeshLocationPtrs(), + mNavMeshZoneSignal() { } @@ -62,56 +63,68 @@ LLPathfindingNavMeshZone::navmesh_zone_slot_t LLPathfindingNavMeshZone::register return mNavMeshZoneSignal.connect(pNavMeshZoneCallback); } -void LLPathfindingNavMeshZone::setCurrentRegionAsCenter() +void LLPathfindingNavMeshZone::initialize() { llassert(LLPathingLib::getInstance() != NULL); if (LLPathingLib::getInstance() != NULL) { LLPathingLib::getInstance()->cleanupResidual(); } - mNavMeshLocations.clear(); - LLViewerRegion *currentRegion = gAgent.getRegion(); - const LLUUID ¤tRegionUUID = currentRegion->getRegionID(); - NavMeshLocation centerNavMesh(currentRegionUUID, CENTER_REGION); - mNavMeshLocations.insert(std::pair(currentRegionUUID, centerNavMesh)); + mNavMeshLocationPtrs.clear(); + + NavMeshLocationPtr centerNavMeshPtr(new NavMeshLocation(CENTER_REGION, boost::bind(&LLPathfindingNavMeshZone::handleNavMeshLocation, this))); + mNavMeshLocationPtrs.push_back(centerNavMeshPtr); + + U32 neighborRegionDir = gSavedSettings.getU32("RetrieveNeighboringRegion"); + if (neighborRegionDir != CENTER_REGION) + { + NavMeshLocationPtr neighborNavMeshPtr(new NavMeshLocation(neighborRegionDir, boost::bind(&LLPathfindingNavMeshZone::handleNavMeshLocation, this))); + mNavMeshLocationPtrs.push_back(neighborNavMeshPtr); + } } -void LLPathfindingNavMeshZone::refresh() +void LLPathfindingNavMeshZone::enable() { - LLPathfindingManager *pathfindingManagerInstance = LLPathfindingManager::getInstance(); - if (!mNavMeshSlot.connected()) + for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); + navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) { - mNavMeshSlot = pathfindingManagerInstance->registerNavMeshListenerForCurrentRegion(boost::bind(&LLPathfindingNavMeshZone::handleNavMesh, this, _1, _2, _3, _4)); + NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; + navMeshLocationPtr->enable(); } - - pathfindingManagerInstance->requestGetNavMeshForCurrentRegion(); } void LLPathfindingNavMeshZone::disable() { - if (mNavMeshSlot.connected()) + for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); + navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) { - mNavMeshSlot.disconnect(); + NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; + navMeshLocationPtr->disable(); } - +#if 0 + llassert(LLPathingLib::getInstance() != NULL); if (LLPathingLib::getInstance() != NULL) { LLPathingLib::getInstance()->cleanupResidual(); } - - mNavMeshLocations.clear(); +#endif } -void LLPathfindingNavMeshZone::handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLUUID &pRegionUUID, U32 pNavMeshVersion, const LLSD::Binary &pNavMeshData) +void LLPathfindingNavMeshZone::refresh() { - NavMeshLocations::iterator navMeshIter = mNavMeshLocations.find(pRegionUUID); - if (navMeshIter != mNavMeshLocations.end()) + for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); + navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) { - navMeshIter->second.handleNavMesh(pNavMeshRequestStatus, pRegionUUID, pNavMeshVersion, pNavMeshData); - updateStatus(); + NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; + navMeshLocationPtr->refresh(); } } +void LLPathfindingNavMeshZone::handleNavMeshLocation() +{ + updateStatus(); +} + void LLPathfindingNavMeshZone::updateStatus() { bool hasRequestUnknown = false; @@ -120,10 +133,11 @@ void LLPathfindingNavMeshZone::updateStatus() bool hasRequestNotEnabled = false; bool hasRequestError = false; - for (NavMeshLocations::iterator navMeshIter = mNavMeshLocations.begin(); - navMeshIter != mNavMeshLocations.end(); ++navMeshIter) + for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); + navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) { - switch (navMeshIter->second.getRequestStatus()) + NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; + switch (navMeshLocationPtr->getRequestStatus()) { case LLPathfindingNavMesh::kNavMeshRequestUnknown : hasRequestUnknown = true; @@ -148,23 +162,14 @@ void LLPathfindingNavMeshZone::updateStatus() } ENavMeshZoneRequestStatus zoneRequestStatus = kNavMeshZoneRequestUnknown; - if (hasRequestNotEnabled) + if (hasRequestStarted) { - zoneRequestStatus = kNavMeshZoneRequestNotEnabled; + zoneRequestStatus = kNavMeshZoneRequestStarted; } else if (hasRequestError) { zoneRequestStatus = kNavMeshZoneRequestError; } - else if (hasRequestStarted) - { - zoneRequestStatus = kNavMeshZoneRequestStarted; - } - else if (hasRequestUnknown) - { - zoneRequestStatus = kNavMeshZoneRequestUnknown; - llassert(0); - } else if (hasRequestCompleted) { zoneRequestStatus = kNavMeshZoneRequestCompleted; @@ -174,6 +179,14 @@ void LLPathfindingNavMeshZone::updateStatus() LLPathingLib::getInstance()->stitchNavMeshes( gSavedSettings.getBOOL("EnableVBOForNavMeshVisualization") ); } } + else if (hasRequestNotEnabled) + { + zoneRequestStatus = kNavMeshZoneRequestNotEnabled; + } + else if (hasRequestUnknown) + { + zoneRequestStatus = kNavMeshZoneRequestUnknown; + } else { zoneRequestStatus = kNavMeshZoneRequestError; @@ -187,26 +200,62 @@ void LLPathfindingNavMeshZone::updateStatus() // LLPathfindingNavMeshZone::NavMeshLocation //--------------------------------------------------------------------------- -LLPathfindingNavMeshZone::NavMeshLocation::NavMeshLocation(const LLUUID &pRegionUUID, S32 pDirection) - : mRegionUUID(pRegionUUID), - mDirection(pDirection), +LLPathfindingNavMeshZone::NavMeshLocation::NavMeshLocation(S32 pDirection, navmesh_location_callback_t pLocationCallback) + : mDirection(pDirection), + mRegionUUID(), mHasNavMesh(false), mNavMeshVersion(0U), - mRequestStatus(LLPathfindingNavMesh::kNavMeshRequestUnknown) + mLocationCallback(pLocationCallback), + mRequestStatus(LLPathfindingNavMesh::kNavMeshRequestUnknown), + mNavMeshSlot() { } -LLPathfindingNavMeshZone::NavMeshLocation::NavMeshLocation(const NavMeshLocation &other) - : mRegionUUID(other.mRegionUUID), - mDirection(other.mDirection), - mHasNavMesh(other.mHasNavMesh), - mNavMeshVersion(other.mNavMeshVersion), - mRequestStatus(other.mRequestStatus) +LLPathfindingNavMeshZone::NavMeshLocation::~NavMeshLocation() { } -LLPathfindingNavMeshZone::NavMeshLocation::~NavMeshLocation() +void LLPathfindingNavMeshZone::NavMeshLocation::enable() { + clear(); + + LLViewerRegion *region = getRegion(); + if (region == NULL) + { + mRegionUUID.setNull(); + } + else + { + mRegionUUID = region->getRegionID(); + mNavMeshSlot = LLPathfindingManager::getInstance()->registerNavMeshListenerForRegion(region, boost::bind(&LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh, this, _1, _2, _3, _4)); + } +} + +void LLPathfindingNavMeshZone::NavMeshLocation::refresh() +{ + LLViewerRegion *region = getRegion(); + + if (region == NULL) + { + llassert(mRegionUUID.isNull()); + LLSD::Binary nullData; + handleNavMesh(LLPathfindingNavMesh::kNavMeshRequestUnknown, mRegionUUID, 0U, nullData); + } + else + { + llassert(mRegionUUID == region->getRegionID()); + LLPathfindingManager::getInstance()->requestGetNavMeshForRegion(region); + } +} + +void LLPathfindingNavMeshZone::NavMeshLocation::disable() +{ + clear(); +} + +LLPathfindingNavMesh::ENavMeshRequestStatus LLPathfindingNavMeshZone::NavMeshLocation::getRequestStatus() const +{ + return mRequestStatus; } void LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLUUID &pRegionUUID, U32 pNavMeshVersion, const LLSD::Binary &pNavMeshData) @@ -224,20 +273,45 @@ void LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh(LLPathfindingNavMe LLPathingLib::getInstance()->extractNavMeshSrcFromLLSD(pNavMeshData, mDirection); } } + mLocationCallback(); } -LLPathfindingNavMesh::ENavMeshRequestStatus LLPathfindingNavMeshZone::NavMeshLocation::getRequestStatus() const +void LLPathfindingNavMeshZone::NavMeshLocation::clear() { - return mRequestStatus; + mHasNavMesh = false; + mRequestStatus = LLPathfindingNavMesh::kNavMeshRequestUnknown; + if (mNavMeshSlot.connected()) + { + mNavMeshSlot.disconnect(); + } } -LLPathfindingNavMeshZone::NavMeshLocation &LLPathfindingNavMeshZone::NavMeshLocation::operator =(const NavMeshLocation &other) +LLViewerRegion *LLPathfindingNavMeshZone::NavMeshLocation::getRegion() const { - mRegionUUID = other.mRegionUUID; - mDirection = other.mDirection; - mHasNavMesh = other.mHasNavMesh; - mNavMeshVersion = other.mNavMeshVersion; - mRequestStatus = other.mRequestStatus; + LLViewerRegion *region = NULL; + + LLViewerRegion *currentRegion = gAgent.getRegion(); + if (currentRegion != NULL) + { + if (mDirection == CENTER_REGION) + { + region = currentRegion; + } + else + { + //User wants to pull in a neighboring region + std::vector availableRegions; + currentRegion->getNeighboringRegionsStatus( availableRegions ); + //Is the desired region in the available list + std::vector::iterator foundElem = std::find(availableRegions.begin(),availableRegions.end(),mDirection); + if ( foundElem != availableRegions.end() ) + { + std::vector neighborRegionsPtrs; + currentRegion->getNeighboringRegions( neighborRegionsPtrs ); + region = neighborRegionsPtrs[foundElem - availableRegions.begin()]; + } + } + } - return (*this); + return region; } diff --git a/indra/newview/llpathfindingnavmeshzone.h b/indra/newview/llpathfindingnavmeshzone.h index 9d1139de32..8489b5899b 100644 --- a/indra/newview/llpathfindingnavmeshzone.h +++ b/indra/newview/llpathfindingnavmeshzone.h @@ -32,8 +32,9 @@ #include "lluuid.h" #include "llpathfindingnavmesh.h" -#include +#include +#include #include #include @@ -56,44 +57,53 @@ public: virtual ~LLPathfindingNavMeshZone(); navmesh_zone_slot_t registerNavMeshZoneListener(navmesh_zone_callback_t pNavMeshZoneCallback); - void setCurrentRegionAsCenter(); - void refresh(); - void disable(); + void initialize(); - void handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLUUID &pRegionUUID, U32 pNavMeshVersion, const LLSD::Binary &pNavMeshData); + void enable(); + void disable(); + void refresh(); protected: private: + typedef boost::function navmesh_location_callback_t; class NavMeshLocation { public: - NavMeshLocation(const LLUUID &pRegionUUID, S32 pDirection); - NavMeshLocation(const NavMeshLocation &other); + NavMeshLocation(S32 pDirection, navmesh_location_callback_t pLocationCallback); virtual ~NavMeshLocation(); - void handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLUUID &pRegionUUID, U32 pNavMeshVersion, const LLSD::Binary &pNavMeshData); - LLPathfindingNavMesh::ENavMeshRequestStatus getRequestStatus() const; + void enable(); + void refresh(); + void disable(); - NavMeshLocation &operator =(const NavMeshLocation &other); + LLPathfindingNavMesh::ENavMeshRequestStatus getRequestStatus() const; protected: private: - LLUUID mRegionUUID; + void handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLUUID &pRegionUUID, U32 pNavMeshVersion, const LLSD::Binary &pNavMeshData); + + void clear(); + LLViewerRegion *getRegion() const; + S32 mDirection; + LLUUID mRegionUUID; bool mHasNavMesh; U32 mNavMeshVersion; + navmesh_location_callback_t mLocationCallback; LLPathfindingNavMesh::ENavMeshRequestStatus mRequestStatus; + LLPathfindingNavMesh::navmesh_slot_t mNavMeshSlot; }; - typedef std::map NavMeshLocations; + typedef boost::shared_ptr NavMeshLocationPtr; + typedef std::vector NavMeshLocationPtrs; + void handleNavMeshLocation(); void updateStatus(); - NavMeshLocations mNavMeshLocations; - navmesh_zone_signal_t mNavMeshZoneSignal; - LLPathfindingNavMesh::navmesh_slot_t mNavMeshSlot; + NavMeshLocationPtrs mNavMeshLocationPtrs; + navmesh_zone_signal_t mNavMeshZoneSignal; }; #endif // LL_LLPATHFINDINGNAVMESHZONE_H -- cgit v1.3 From a7944f17bec66e7c0f066ab3b6196cc2233b1ca7 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Wed, 7 Mar 2012 14:39:27 -0800 Subject: PATH-205,PATh-304: Fixing a crash issue with loading multiple navmeshes during the second refresh. --- indra/newview/llfloaterpathfindingconsole.cpp | 4 +++- indra/newview/llpathfindingnavmeshzone.cpp | 24 +++++++++--------------- 2 files changed, 12 insertions(+), 16 deletions(-) (limited to 'indra/newview/llpathfindingnavmeshzone.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index fe5c6b8d44..6824e629c9 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -613,6 +613,9 @@ void LLFloaterPathfindingConsole::onNavMeshZoneCB(LLPathfindingNavMeshZone::ENav { switch (pNavMeshZoneRequestStatus) { + case LLPathfindingNavMeshZone::kNavMeshZoneRequestUnknown : + setConsoleState(kConsoleStateUnknown); + break; case LLPathfindingNavMeshZone::kNavMeshZoneRequestStarted : setConsoleState(kConsoleStateDownloading); break; @@ -625,7 +628,6 @@ void LLFloaterPathfindingConsole::onNavMeshZoneCB(LLPathfindingNavMeshZone::ENav case LLPathfindingNavMeshZone::kNavMeshZoneRequestError : setConsoleState(kConsoleStateError); break; - case LLPathfindingNavMeshZone::kNavMeshZoneRequestUnknown : default: setConsoleState(kConsoleStateUnknown); llassert(0); diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp index 7b9ac913c9..983b88fe05 100644 --- a/indra/newview/llpathfindingnavmeshzone.cpp +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -65,11 +65,6 @@ LLPathfindingNavMeshZone::navmesh_zone_slot_t LLPathfindingNavMeshZone::register void LLPathfindingNavMeshZone::initialize() { - llassert(LLPathingLib::getInstance() != NULL); - if (LLPathingLib::getInstance() != NULL) - { - LLPathingLib::getInstance()->cleanupResidual(); - } mNavMeshLocationPtrs.clear(); NavMeshLocationPtr centerNavMeshPtr(new NavMeshLocation(CENTER_REGION, boost::bind(&LLPathfindingNavMeshZone::handleNavMeshLocation, this))); @@ -101,17 +96,16 @@ void LLPathfindingNavMeshZone::disable() NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; navMeshLocationPtr->disable(); } -#if 0 +} + +void LLPathfindingNavMeshZone::refresh() +{ llassert(LLPathingLib::getInstance() != NULL); if (LLPathingLib::getInstance() != NULL) { LLPathingLib::getInstance()->cleanupResidual(); } -#endif -} -void LLPathfindingNavMeshZone::refresh() -{ for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) { @@ -170,6 +164,10 @@ void LLPathfindingNavMeshZone::updateStatus() { zoneRequestStatus = kNavMeshZoneRequestError; } + else if (hasRequestUnknown) + { + zoneRequestStatus = kNavMeshZoneRequestUnknown; + } else if (hasRequestCompleted) { zoneRequestStatus = kNavMeshZoneRequestCompleted; @@ -183,10 +181,6 @@ void LLPathfindingNavMeshZone::updateStatus() { zoneRequestStatus = kNavMeshZoneRequestNotEnabled; } - else if (hasRequestUnknown) - { - zoneRequestStatus = kNavMeshZoneRequestUnknown; - } else { zoneRequestStatus = kNavMeshZoneRequestError; @@ -239,7 +233,7 @@ void LLPathfindingNavMeshZone::NavMeshLocation::refresh() { llassert(mRegionUUID.isNull()); LLSD::Binary nullData; - handleNavMesh(LLPathfindingNavMesh::kNavMeshRequestUnknown, mRegionUUID, 0U, nullData); + handleNavMesh(LLPathfindingNavMesh::kNavMeshRequestNotEnabled, mRegionUUID, 0U, nullData); } else { -- cgit v1.3 From f578181af9cbe3277374578c27487e2e72956079 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Thu, 8 Mar 2012 12:34:11 -0800 Subject: PATH-304: Adding functionality to handle the reloading of out-of-date navmeshes. --- etc/message.xml | 12 ++++- indra/newview/llfloaterpathfindingconsole.cpp | 20 ++++++-- indra/newview/llfloaterpathfindingconsole.h | 4 +- indra/newview/llpathfindingmanager.cpp | 60 ++++++++++++++++++---- indra/newview/llpathfindingmanager.h | 2 + indra/newview/llpathfindingnavmesh.cpp | 11 ++-- indra/newview/llpathfindingnavmesh.h | 2 + indra/newview/llpathfindingnavmeshzone.cpp | 58 ++++++++++++++++++++- indra/newview/llpathfindingnavmeshzone.h | 7 +++ .../default/xui/en/floater_pathfinding_console.xml | 2 +- 10 files changed, 153 insertions(+), 25 deletions(-) (limited to 'indra/newview/llpathfindingnavmeshzone.cpp') diff --git a/etc/message.xml b/etc/message.xml index 3445975545..9407888a92 100644 --- a/etc/message.xml +++ b/etc/message.xml @@ -546,8 +546,16 @@ trusted-sender true - - + + NavmeshStatusUpdate + + flavor + llsd + trusted-sender + true + + + ScriptRunningReply flavor diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 6824e629c9..493b4617b5 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -171,6 +171,7 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) mNavMeshZoneSlot = mNavMeshZone.registerNavMeshZoneListener(boost::bind(&LLFloaterPathfindingConsole::onNavMeshZoneCB, this, _1)); } + mIsNavMeshUpdating = false; mNavMeshZone.initialize(); mNavMeshZone.enable(); @@ -478,6 +479,7 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mClearPathButton(NULL), mNavMeshZoneSlot(), mNavMeshZone(), + mIsNavMeshUpdating(false), mAgentStateSlot(), mConsoleState(kConsoleStateUnknown), mPathData(), @@ -616,10 +618,15 @@ void LLFloaterPathfindingConsole::onNavMeshZoneCB(LLPathfindingNavMeshZone::ENav case LLPathfindingNavMeshZone::kNavMeshZoneRequestUnknown : setConsoleState(kConsoleStateUnknown); break; + case LLPathfindingNavMeshZone::kNavMeshZoneRequestNeedsUpdate : + mIsNavMeshUpdating = true; + mNavMeshZone.refresh(); + break; case LLPathfindingNavMeshZone::kNavMeshZoneRequestStarted : setConsoleState(kConsoleStateDownloading); break; case LLPathfindingNavMeshZone::kNavMeshZoneRequestCompleted : + mIsNavMeshUpdating = false; setConsoleState(kConsoleStateHasNavMesh); break; case LLPathfindingNavMeshZone::kNavMeshZoneRequestNotEnabled : @@ -689,7 +696,6 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() mHasEndPoint = false; break; case kConsoleStateHasNavMesh : - case kConsoleStateHasNavMeshDownloading : mShowNavMeshCheckBox->setEnabled(TRUE); mShowNavMeshWalkabilityComboBox->setEnabled(TRUE); mShowWalkablesCheckBox->setEnabled(TRUE); @@ -731,14 +737,18 @@ void LLFloaterPathfindingConsole::updateStatusOnConsoleState() styleParams.color = warningColor; break; case kConsoleStateDownloading : - statusText = getString("navmesh_status_downloading"); + if (mIsNavMeshUpdating) + { + statusText = getString("navmesh_status_updating"); + } + else + { + statusText = getString("navmesh_status_downloading"); + } break; case kConsoleStateHasNavMesh : statusText = getString("navmesh_status_has_navmesh"); break; - case kConsoleStateHasNavMeshDownloading : - statusText = getString("navmesh_status_has_navmesh_downloading"); - break; case kConsoleStateError : statusText = getString("navmesh_status_error"); styleParams.color = warningColor; diff --git a/indra/newview/llfloaterpathfindingconsole.h b/indra/newview/llfloaterpathfindingconsole.h index b1886fb716..8c29bf5909 100644 --- a/indra/newview/llfloaterpathfindingconsole.h +++ b/indra/newview/llfloaterpathfindingconsole.h @@ -122,7 +122,6 @@ private: kConsoleStateRegionNotEnabled, kConsoleStateDownloading, kConsoleStateHasNavMesh, - kConsoleStateHasNavMeshDownloading, kConsoleStateError } EConsoleState; @@ -179,9 +178,10 @@ private: LLTextBase *mPathTestingStatus; LLButton *mClearPathButton; - LLPathfindingNavMeshZone::navmesh_zone_slot_t mNavMeshZoneSlot; LLPathfindingNavMeshZone mNavMeshZone; + bool mIsNavMeshUpdating; + LLPathfindingManager::agent_state_slot_t mAgentStateSlot; EConsoleState mConsoleState; diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index cba0501ad2..ebefebbb64 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -26,8 +26,10 @@ */ #include +#include #include "llviewerprecompiledheaders.h" +#include "llsd.h" #include "llpathfindingmanager.h" #include "llsingleton.h" #include "llhttpclient.h" @@ -36,6 +38,7 @@ #include "llpathfindingnavmesh.h" #include "llpathfindinglinkset.h" #include "llpathfindinglinksetlist.h" +#include "llhttpnode.h" #include #include @@ -49,6 +52,20 @@ #define CAP_SERVICE_OBJECT_LINKSETS "ObjectNavMeshProperties" #define CAP_SERVICE_TERRAIN_LINKSETS "TerrainNavMeshProperties" +#define SIM_MESSAGE_NAVMESH_STATUS_UPDATE "/message/NavmeshStatusUpdate" + +//--------------------------------------------------------------------------- +// LLNavMeshSimStateChangeNode +//--------------------------------------------------------------------------- + +class LLNavMeshSimStateChangeNode : public LLHTTPNode +{ +public: + virtual void post(ResponsePtr pResponse, const LLSD &pContext, const LLSD &pInput) const; +}; + +LLHTTPRegistration gHTTPRegistrationNavMeshSimStateChangeNode(SIM_MESSAGE_NAVMESH_STATUS_UPDATE); + //--------------------------------------------------------------------------- // NavMeshResponder //--------------------------------------------------------------------------- @@ -243,6 +260,12 @@ void LLPathfindingManager::requestGetNavMeshForRegion(LLViewerRegion *pRegion) } } +void LLPathfindingManager::handleNavMeshUpdate(const LLUUID &pRegionUUID, U32 pNavMeshVersion) +{ + LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pRegionUUID); + navMeshPtr->handleNavMeshNewVersion(++mNavMeshVersionXXX); +} + LLPathfindingManager::agent_state_slot_t LLPathfindingManager::registerAgentStateListener(agent_state_callback_t pAgentStateCallback) { return mAgentStateSignal.connect(pAgentStateCallback); @@ -368,21 +391,14 @@ LLPathfindingManager::ELinksetsRequestStatus LLPathfindingManager::requestSetLin return status; } -LLPathfindingNavMeshPtr LLPathfindingManager::getNavMeshForRegion(LLViewerRegion *pRegion) +LLPathfindingNavMeshPtr LLPathfindingManager::getNavMeshForRegion(const LLUUID &pRegionUUID) { - - LLUUID regionUUID; - if (pRegion != NULL) - { - regionUUID = pRegion->getRegionID(); - } - LLPathfindingNavMeshPtr navMeshPtr; - NavMeshMap::iterator navMeshIter = mNavMeshMap.find(regionUUID); + NavMeshMap::iterator navMeshIter = mNavMeshMap.find(pRegionUUID); if (navMeshIter == mNavMeshMap.end()) { - navMeshPtr = LLPathfindingNavMeshPtr(new LLPathfindingNavMesh(regionUUID)); - mNavMeshMap.insert(std::pair(regionUUID, navMeshPtr)); + navMeshPtr = LLPathfindingNavMeshPtr(new LLPathfindingNavMesh(pRegionUUID)); + mNavMeshMap.insert(std::pair(pRegionUUID, navMeshPtr)); } else { @@ -392,6 +408,17 @@ LLPathfindingNavMeshPtr LLPathfindingManager::getNavMeshForRegion(LLViewerRegion return navMeshPtr; } +LLPathfindingNavMeshPtr LLPathfindingManager::getNavMeshForRegion(LLViewerRegion *pRegion) +{ + LLUUID regionUUID; + if (pRegion != NULL) + { + regionUUID = pRegion->getRegionID(); + } + + return getNavMeshForRegion(regionUUID); +} + bool LLPathfindingManager::isValidAgentState(EAgentState pAgentState) { return ((pAgentState == kAgentStateFrozen) || (pAgentState == kAgentStateUnfrozen)); @@ -513,6 +540,17 @@ LLViewerRegion *LLPathfindingManager::getCurrentRegion() const return gAgent.getRegion(); } +//--------------------------------------------------------------------------- +// LLNavMeshSimStateChangeNode +//--------------------------------------------------------------------------- + +void LLNavMeshSimStateChangeNode::post(ResponsePtr pResponse, const LLSD &pContext, const LLSD &pInput) const +{ + LLViewerRegion *region = gAgent.getRegion(); + U32 navMeshVersion = 0U; + LLPathfindingManager::getInstance()->handleNavMeshUpdate(region->getRegionID(), navMeshVersion); +} + //--------------------------------------------------------------------------- // NavMeshResponder //--------------------------------------------------------------------------- diff --git a/indra/newview/llpathfindingmanager.h b/indra/newview/llpathfindingmanager.h index eb8704e308..3e85cb1291 100644 --- a/indra/newview/llpathfindingmanager.h +++ b/indra/newview/llpathfindingmanager.h @@ -80,6 +80,7 @@ public: LLPathfindingNavMesh::navmesh_slot_t registerNavMeshListenerForRegion(LLViewerRegion *pRegion, LLPathfindingNavMesh::navmesh_callback_t pNavMeshCallback); void requestGetNavMeshForRegion(LLViewerRegion *pRegion); + void handleNavMeshUpdate(const LLUUID &pRegionUUID, U32 pNavMeshVersion); agent_state_slot_t registerAgentStateListener(agent_state_callback_t pAgentStateCallback); EAgentState getAgentState(); @@ -92,6 +93,7 @@ public: protected: private: + LLPathfindingNavMeshPtr getNavMeshForRegion(const LLUUID &pRegionUUID); LLPathfindingNavMeshPtr getNavMeshForRegion(LLViewerRegion *pRegion); static bool isValidAgentState(EAgentState pAgentState); diff --git a/indra/newview/llpathfindingnavmesh.cpp b/indra/newview/llpathfindingnavmesh.cpp index 469972efa9..84343cf31e 100644 --- a/indra/newview/llpathfindingnavmesh.cpp +++ b/indra/newview/llpathfindingnavmesh.cpp @@ -64,6 +64,13 @@ void LLPathfindingNavMesh::handleRefresh() mNavMeshSignal(mNavMeshRequestStatus, mRegionUUID, mNavMeshVersion, mNavMeshData); } +void LLPathfindingNavMesh::handleNavMeshNewVersion(U32 pNavMeshVersion) +{ + mNavMeshData.clear(); + mNavMeshVersion = pNavMeshVersion; + setRequestStatus(kNavMeshRequestNeedsUpdate); +} + void LLPathfindingNavMesh::handleNavMeshStart(U32 pNavMeshVersion) { mNavMeshVersion = pNavMeshVersion; @@ -72,7 +79,6 @@ void LLPathfindingNavMesh::handleNavMeshStart(U32 pNavMeshVersion) void LLPathfindingNavMesh::handleNavMeshResult(const LLSD &pContent, U32 pNavMeshVersion) { - llassert(mNavMeshVersion == pNavMeshVersion); if (mNavMeshVersion == pNavMeshVersion) { if ( pContent.has("navmesh_data") ) @@ -118,10 +124,9 @@ void LLPathfindingNavMesh::handleNavMeshNotEnabled() void LLPathfindingNavMesh::handleNavMeshError(U32 pStatus, const std::string &pReason, const std::string &pURL, U32 pNavMeshVersion) { llwarns << "error with request to URL '" << pURL << "' because " << pReason << " (statusCode:" << pStatus << ")" << llendl; - llassert(mNavMeshVersion == pNavMeshVersion); - mNavMeshData.clear(); if (mNavMeshVersion == pNavMeshVersion) { + mNavMeshData.clear(); setRequestStatus(kNavMeshRequestError); } } diff --git a/indra/newview/llpathfindingnavmesh.h b/indra/newview/llpathfindingnavmesh.h index 26ef21f90e..eb9ef9683d 100644 --- a/indra/newview/llpathfindingnavmesh.h +++ b/indra/newview/llpathfindingnavmesh.h @@ -47,6 +47,7 @@ class LLPathfindingNavMesh public: typedef enum { kNavMeshRequestUnknown, + kNavMeshRequestNeedsUpdate, kNavMeshRequestStarted, kNavMeshRequestCompleted, kNavMeshRequestNotEnabled, @@ -65,6 +66,7 @@ public: bool hasNavMeshVersion(U32 pNavMeshVersion) const; void handleRefresh(); + void handleNavMeshNewVersion(U32 pNavMeshVersion); void handleNavMeshStart(U32 pNavMeshVersion); void handleNavMeshResult(const LLSD &pContent, U32 pNavMeshVersion); void handleNavMeshNotEnabled(); diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp index 983b88fe05..3767834655 100644 --- a/indra/newview/llpathfindingnavmeshzone.cpp +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -67,6 +67,24 @@ void LLPathfindingNavMeshZone::initialize() { mNavMeshLocationPtrs.clear(); +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + LLViewerRegion *currentRegion = gAgent.getRegion(); + if (currentRegion != NULL) + { + llinfos << "STINSON DEBUG: currentRegion: '" << currentRegion->getName() << "' (" << currentRegion->getRegionID().asString() << ")" << llendl; + std::vector availableRegions; + currentRegion->getNeighboringRegionsStatus( availableRegions ); + std::vector neighborRegionsPtrs; + currentRegion->getNeighboringRegions( neighborRegionsPtrs ); + for (std::vector::const_iterator statusIter = availableRegions.begin(); + statusIter != availableRegions.end(); ++statusIter) + { + LLViewerRegion *region = neighborRegionsPtrs[statusIter - availableRegions.begin()]; + llinfos << "STINSON DEBUG: region #" << *statusIter << ": '" << region->getName() << "' (" << region->getRegionID().asString() << ")" << llendl; + } + } + +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE NavMeshLocationPtr centerNavMeshPtr(new NavMeshLocation(CENTER_REGION, boost::bind(&LLPathfindingNavMeshZone::handleNavMeshLocation, this))); mNavMeshLocationPtrs.push_back(centerNavMeshPtr); @@ -122,20 +140,30 @@ void LLPathfindingNavMeshZone::handleNavMeshLocation() void LLPathfindingNavMeshZone::updateStatus() { bool hasRequestUnknown = false; + bool hasRequestNeedsUpdate = false; bool hasRequestStarted = false; bool hasRequestCompleted = false; bool hasRequestNotEnabled = false; bool hasRequestError = false; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update BEGIN" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) { NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: region #" << navMeshLocationPtr->getDirection() << ": region(" << navMeshLocationPtr->getRegionUUID().asString() << ") status:" << navMeshLocationPtr->getRequestStatus() << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE switch (navMeshLocationPtr->getRequestStatus()) { case LLPathfindingNavMesh::kNavMeshRequestUnknown : hasRequestUnknown = true; break; + case LLPathfindingNavMesh::kNavMeshRequestNeedsUpdate : + hasRequestNeedsUpdate = true; + break; case LLPathfindingNavMesh::kNavMeshRequestStarted : hasRequestStarted = true; break; @@ -156,34 +184,62 @@ void LLPathfindingNavMeshZone::updateStatus() } ENavMeshZoneRequestStatus zoneRequestStatus = kNavMeshZoneRequestUnknown; - if (hasRequestStarted) + if (hasRequestNeedsUpdate) + { + zoneRequestStatus = kNavMeshZoneRequestNeedsUpdate; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is NEEDS UPDATE" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + } + else if (hasRequestStarted) { zoneRequestStatus = kNavMeshZoneRequestStarted; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is STARTED" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE } else if (hasRequestError) { zoneRequestStatus = kNavMeshZoneRequestError; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is ERROR" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE } else if (hasRequestUnknown) { zoneRequestStatus = kNavMeshZoneRequestUnknown; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is UNKNOWN" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE } else if (hasRequestCompleted) { zoneRequestStatus = kNavMeshZoneRequestCompleted; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is stitching" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE llassert(LLPathingLib::getInstance() != NULL); if (LLPathingLib::getInstance() != NULL) { LLPathingLib::getInstance()->stitchNavMeshes( gSavedSettings.getBOOL("EnableVBOForNavMeshVisualization") ); } +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is COMPLETED" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE } else if (hasRequestNotEnabled) { zoneRequestStatus = kNavMeshZoneRequestNotEnabled; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is NOT ENABLED" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE } else { zoneRequestStatus = kNavMeshZoneRequestError; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is BAD ERROR" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE llassert(0); } diff --git a/indra/newview/llpathfindingnavmeshzone.h b/indra/newview/llpathfindingnavmeshzone.h index 8489b5899b..7084869b33 100644 --- a/indra/newview/llpathfindingnavmeshzone.h +++ b/indra/newview/llpathfindingnavmeshzone.h @@ -38,11 +38,14 @@ #include #include +#define XXX_STINSON_DEBUG_NAVMESH_ZONE + class LLPathfindingNavMeshZone { public: typedef enum { kNavMeshZoneRequestUnknown, + kNavMeshZoneRequestNeedsUpdate, kNavMeshZoneRequestStarted, kNavMeshZoneRequestCompleted, kNavMeshZoneRequestNotEnabled, @@ -78,6 +81,10 @@ private: void disable(); LLPathfindingNavMesh::ENavMeshRequestStatus getRequestStatus() const; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + const LLUUID &getRegionUUID() const {return mRegionUUID;}; + S32 getDirection() const {return mDirection;}; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE protected: diff --git a/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml b/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml index 6c97af2878..75465f1aea 100644 --- a/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml +++ b/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml @@ -15,8 +15,8 @@ Cannot find pathing library implementation. This region is not enabled for pathfinding. Downloading the navmesh ... + The navmesh has changed on the server. Downloading the latest navmesh ... Navmesh received. - Downloading the latest navmesh ... Unable to download navmesh successfully. Please choose start and end points. Please choose start point. -- cgit v1.3 From b3197fc12e41bc60e3510d840c67ef98816c3ae8 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 12 Mar 2012 18:48:40 -0700 Subject: PATH-304: Making the navmesh version information work for both Premium Wilderness regions (old pathfinding simulator build with missing capabilities) as well as the new pathfinding simulator builds with the version services. --- indra/newview/CMakeLists.txt | 2 + indra/newview/llpathfindingmanager.cpp | 170 ++++++++++++++++++++++----- indra/newview/llpathfindingmanager.h | 11 +- indra/newview/llpathfindingnavmesh.cpp | 18 ++- indra/newview/llpathfindingnavmesh.h | 8 ++ indra/newview/llpathfindingnavmeshstatus.cpp | 134 +++++++++++++++++++++ indra/newview/llpathfindingnavmeshstatus.h | 77 ++++++++++++ indra/newview/llpathfindingnavmeshzone.cpp | 11 +- indra/newview/llviewerregion.cpp | 1 + 9 files changed, 391 insertions(+), 41 deletions(-) create mode 100644 indra/newview/llpathfindingnavmeshstatus.cpp create mode 100644 indra/newview/llpathfindingnavmeshstatus.h (limited to 'indra/newview/llpathfindingnavmeshzone.cpp') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 44cb23b648..36b7e136d0 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -421,6 +421,7 @@ set(viewer_SOURCE_FILES llpathfindinglinksetlist.cpp llpathfindingmanager.cpp llpathfindingnavmesh.cpp + llpathfindingnavmeshstatus.cpp llpathfindingnavmeshzone.cpp llphysicsmotion.cpp llphysicsshapebuilderutil.cpp @@ -976,6 +977,7 @@ set(viewer_HEADER_FILES llpathfindinglinksetlist.h llpathfindingmanager.h llpathfindingnavmesh.h + llpathfindingnavmeshstatus.h llpathfindingnavmeshzone.h llphysicsmotion.h llphysicsshapebuilderutil.h diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index ebefebbb64..9cd3d5625c 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -30,12 +30,14 @@ #include "llviewerprecompiledheaders.h" #include "llsd.h" +#include "lluuid.h" #include "llpathfindingmanager.h" #include "llsingleton.h" #include "llhttpclient.h" #include "llagent.h" #include "llviewerregion.h" #include "llpathfindingnavmesh.h" +#include "llpathfindingnavmeshstatus.h" #include "llpathfindinglinkset.h" #include "llpathfindinglinksetlist.h" #include "llhttpnode.h" @@ -45,14 +47,16 @@ #define CAP_SERVICE_RETRIEVE_NAVMESH "RetrieveNavMeshSrc" -#define CAP_SERVICE_AGENT_STATE "AgentPreferences" +#define CAP_SERVICE_NAVMESH_STATUS "NavMeshGenerationStatus" + +#define CAP_SERVICE_AGENT_STATE "AgentPreferences" #define ALTER_NAVMESH_OBJECTS_FIELD "alter_navmesh_objects" #define DEPRECATED_ALTER_NAVMESH_OBJECTS_FIELD "alter_permanent_objects" -#define CAP_SERVICE_OBJECT_LINKSETS "ObjectNavMeshProperties" -#define CAP_SERVICE_TERRAIN_LINKSETS "TerrainNavMeshProperties" +#define CAP_SERVICE_OBJECT_LINKSETS "ObjectNavMeshProperties" +#define CAP_SERVICE_TERRAIN_LINKSETS "TerrainNavMeshProperties" -#define SIM_MESSAGE_NAVMESH_STATUS_UPDATE "/message/NavmeshStatusUpdate" +#define SIM_MESSAGE_NAVMESH_STATUS_UPDATE "/message/NavMeshStatusUpdate" //--------------------------------------------------------------------------- // LLNavMeshSimStateChangeNode @@ -66,6 +70,27 @@ public: LLHTTPRegistration gHTTPRegistrationNavMeshSimStateChangeNode(SIM_MESSAGE_NAVMESH_STATUS_UPDATE); +//--------------------------------------------------------------------------- +// NavMeshStatusResponder +//--------------------------------------------------------------------------- + +class NavMeshStatusResponder : public LLHTTPClient::Responder +{ +public: + NavMeshStatusResponder(const std::string &pCapabilityURL, LLViewerRegion *pRegion); + virtual ~NavMeshStatusResponder(); + + virtual void result(const LLSD &pContent); + virtual void error(U32 pStatus, const std::string& pReason); + +protected: + +private: + std::string mCapabilityURL; + LLViewerRegion *mRegion; + LLUUID mRegionUUID; +}; + //--------------------------------------------------------------------------- // NavMeshResponder //--------------------------------------------------------------------------- @@ -193,7 +218,6 @@ private: LLPathfindingManager::LLPathfindingManager() : LLSingleton(), mNavMeshMap(), - mNavMeshVersionXXX(0), mAgentStateSignal(), mAgentState(kAgentStateUnknown), mLastKnownNonErrorAgentState(kAgentStateUnknown) @@ -206,7 +230,12 @@ LLPathfindingManager::~LLPathfindingManager() bool LLPathfindingManager::isPathfindingEnabledForCurrentRegion() const { - std::string retrieveNavMeshURL = getRetrieveNavMeshURLForCurrentRegion(); + return isPathfindingEnabledForRegion(getCurrentRegion()); +} + +bool LLPathfindingManager::isPathfindingEnabledForRegion(LLViewerRegion *pRegion) const +{ + std::string retrieveNavMeshURL = getRetrieveNavMeshURLForRegion(pRegion); return !retrieveNavMeshURL.empty(); } @@ -231,39 +260,64 @@ void LLPathfindingManager::requestGetNavMeshForRegion(LLViewerRegion *pRegion) { LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pRegion); - if (navMeshPtr->hasNavMeshVersion(mNavMeshVersionXXX)) + if ((pRegion == NULL) || !isPathfindingEnabledForRegion(pRegion)) { - navMeshPtr->handleRefresh(); + navMeshPtr->handleNavMeshNotEnabled(); } else { - if (pRegion == NULL) + std::string navMeshStatusURL = getNavMeshStatusURLForRegion(pRegion); +#ifdef DEPRECATED_UNVERSIONED_NAVMESH + if (navMeshStatusURL.empty()) { - navMeshPtr->handleNavMeshNotEnabled(); + sendRequestGetNavMeshForRegion(navMeshPtr, pRegion, navMeshPtr->getNavMeshVersion() + 1U); } else { - std::string navMeshURL = getRetrieveNavMeshURLForRegion(pRegion); - if (navMeshURL.empty()) - { - navMeshPtr->handleNavMeshNotEnabled(); - } - else - { - navMeshPtr->handleNavMeshStart(mNavMeshVersionXXX); - LLHTTPClient::ResponderPtr responder = new NavMeshResponder(navMeshURL, mNavMeshVersionXXX, navMeshPtr); + LLHTTPClient::ResponderPtr navMeshStatusResponder = new NavMeshStatusResponder(navMeshStatusURL, pRegion); + LLHTTPClient::get(navMeshStatusURL, navMeshStatusResponder); + } +#else // DEPRECATED_UNVERSIONED_NAVMESH + llassert(!navMeshStatusURL.empty()); + LLHTTPClient::ResponderPtr navMeshStatusResponder = new NavMeshStatusResponder(navMeshStatusURL, pRegion); + LLHTTPClient::get(navMeshStatusURL, navMeshStatusResponder); +#endif // DEPRECATED_UNVERSIONED_NAVMESH + } +} - LLSD postData; - LLHTTPClient::post(navMeshURL, postData, responder); - } +void LLPathfindingManager::handleNavMeshStatusRequest(const LLPathfindingNavMeshStatus &pNavMeshStatus, LLViewerRegion *pRegion) +{ + LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pNavMeshStatus.getRegionUUID()); + + if (!pNavMeshStatus.isValid()) + { + navMeshPtr->handleNavMeshError(); + } + else + { + if (navMeshPtr->hasNavMeshVersion(pNavMeshStatus.getVersion())) + { + navMeshPtr->handleRefresh(); + } + else + { + sendRequestGetNavMeshForRegion(navMeshPtr, pRegion, pNavMeshStatus.getVersion()); } } } -void LLPathfindingManager::handleNavMeshUpdate(const LLUUID &pRegionUUID, U32 pNavMeshVersion) +void LLPathfindingManager::handleNavMeshStatusUpdate(const LLPathfindingNavMeshStatus &pNavMeshStatus) { - LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pRegionUUID); - navMeshPtr->handleNavMeshNewVersion(++mNavMeshVersionXXX); + LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pNavMeshStatus.getRegionUUID()); + + if (!pNavMeshStatus.isValid()) + { + navMeshPtr->handleNavMeshError(); + } + else + { + navMeshPtr->handleNavMeshNewVersion(pNavMeshStatus.getVersion()); + } } LLPathfindingManager::agent_state_slot_t LLPathfindingManager::registerAgentStateListener(agent_state_callback_t pAgentStateCallback) @@ -391,6 +445,31 @@ LLPathfindingManager::ELinksetsRequestStatus LLPathfindingManager::requestSetLin return status; } +void LLPathfindingManager::sendRequestGetNavMeshForRegion(LLPathfindingNavMeshPtr navMeshPtr, LLViewerRegion *pRegion, U32 pNavMeshVersion) +{ + if ((pRegion == NULL) || !pRegion->isAlive()) + { + navMeshPtr->handleNavMeshNotEnabled(); + } + else + { + std::string navMeshURL = getRetrieveNavMeshURLForRegion(pRegion); + + if (navMeshURL.empty()) + { + navMeshPtr->handleNavMeshNotEnabled(); + } + else + { + navMeshPtr->handleNavMeshStart(pNavMeshVersion); + LLHTTPClient::ResponderPtr responder = new NavMeshResponder(navMeshURL, pNavMeshVersion, navMeshPtr); + + LLSD postData; + LLHTTPClient::post(navMeshURL, postData, responder); + } + } +} + LLPathfindingNavMeshPtr LLPathfindingManager::getNavMeshForRegion(const LLUUID &pRegionUUID) { LLPathfindingNavMeshPtr navMeshPtr; @@ -487,9 +566,9 @@ void LLPathfindingManager::handleAgentStateError(U32 pStatus, const std::string setAgentState(kAgentStateError); } -std::string LLPathfindingManager::getRetrieveNavMeshURLForCurrentRegion() const +std::string LLPathfindingManager::getNavMeshStatusURLForRegion(LLViewerRegion *pRegion) const { - return getCapabilityURLForCurrentRegion(CAP_SERVICE_RETRIEVE_NAVMESH); + return getCapabilityURLForRegion(pRegion, CAP_SERVICE_NAVMESH_STATUS); } std::string LLPathfindingManager::getRetrieveNavMeshURLForRegion(LLViewerRegion *pRegion) const @@ -546,9 +625,40 @@ LLViewerRegion *LLPathfindingManager::getCurrentRegion() const void LLNavMeshSimStateChangeNode::post(ResponsePtr pResponse, const LLSD &pContext, const LLSD &pInput) const { - LLViewerRegion *region = gAgent.getRegion(); - U32 navMeshVersion = 0U; - LLPathfindingManager::getInstance()->handleNavMeshUpdate(region->getRegionID(), navMeshVersion); + LLPathfindingNavMeshStatus navMeshStatus(pContext); + LLPathfindingManager::getInstance()->handleNavMeshStatusUpdate(pContext); +} + +//--------------------------------------------------------------------------- +// NavMeshStatusResponder +//--------------------------------------------------------------------------- + +NavMeshStatusResponder::NavMeshStatusResponder(const std::string &pCapabilityURL, LLViewerRegion *pRegion) + : mCapabilityURL(pCapabilityURL), + mRegion(pRegion), + mRegionUUID() +{ + if (mRegion != NULL) + { + mRegionUUID = mRegion->getRegionID(); + } +} + +NavMeshStatusResponder::~NavMeshStatusResponder() +{ +} + +void NavMeshStatusResponder::result(const LLSD &pContent) +{ + LLPathfindingNavMeshStatus navMeshStatus(mRegionUUID, pContent); + LLPathfindingManager::getInstance()->handleNavMeshStatusRequest(navMeshStatus, mRegion); +} + +void NavMeshStatusResponder::error(U32 pStatus, const std::string& pReason) +{ + llwarns << "error with request to URL '" << mCapabilityURL << "' because " << pReason << " (statusCode:" << pStatus << ")" << llendl; + LLPathfindingNavMeshStatus navMeshStatus(mRegionUUID); + LLPathfindingManager::getInstance()->handleNavMeshStatusRequest(navMeshStatus, mRegion); } //--------------------------------------------------------------------------- diff --git a/indra/newview/llpathfindingmanager.h b/indra/newview/llpathfindingmanager.h index 3e85cb1291..3a849d0290 100644 --- a/indra/newview/llpathfindingmanager.h +++ b/indra/newview/llpathfindingmanager.h @@ -42,6 +42,7 @@ class LLFloater; class LLViewerRegion; +class LLPathfindingNavMeshStatus; class LLPathfindingManager : public LLSingleton { @@ -74,13 +75,16 @@ public: virtual ~LLPathfindingManager(); bool isPathfindingEnabledForCurrentRegion() const; + bool isPathfindingEnabledForRegion(LLViewerRegion *pRegion) const; bool isAllowAlterPermanent(); bool isAllowViewTerrainProperties() const; LLPathfindingNavMesh::navmesh_slot_t registerNavMeshListenerForRegion(LLViewerRegion *pRegion, LLPathfindingNavMesh::navmesh_callback_t pNavMeshCallback); void requestGetNavMeshForRegion(LLViewerRegion *pRegion); - void handleNavMeshUpdate(const LLUUID &pRegionUUID, U32 pNavMeshVersion); + + void handleNavMeshStatusRequest(const LLPathfindingNavMeshStatus &pNavMeshStatus, LLViewerRegion *pRegion); + void handleNavMeshStatusUpdate(const LLPathfindingNavMeshStatus &pNavMeshStatus); agent_state_slot_t registerAgentStateListener(agent_state_callback_t pAgentStateCallback); EAgentState getAgentState(); @@ -93,6 +97,8 @@ public: protected: private: + void sendRequestGetNavMeshForRegion(LLPathfindingNavMeshPtr navMeshPtr, LLViewerRegion *pRegion, U32 pNavMeshVersion); + LLPathfindingNavMeshPtr getNavMeshForRegion(const LLUUID &pRegionUUID); LLPathfindingNavMeshPtr getNavMeshForRegion(LLViewerRegion *pRegion); @@ -103,7 +109,7 @@ private: void handleAgentStateResult(const LLSD &pContent, EAgentState pRequestedAgentState); void handleAgentStateError(U32 pStatus, const std::string &pReason, const std::string &pURL); - std::string getRetrieveNavMeshURLForCurrentRegion() const; + std::string getNavMeshStatusURLForRegion(LLViewerRegion *pRegion) const; std::string getRetrieveNavMeshURLForRegion(LLViewerRegion *pRegion) const; std::string getAgentStateURLForCurrentRegion() const; std::string getObjectLinksetsURLForCurrentRegion() const; @@ -114,7 +120,6 @@ private: LLViewerRegion *getCurrentRegion() const; NavMeshMap mNavMeshMap; - U32 mNavMeshVersionXXX; // XXX stinson 03/02/2012 : a hacky way of doing versions for now agent_state_signal_t mAgentStateSignal; EAgentState mAgentState; diff --git a/indra/newview/llpathfindingnavmesh.cpp b/indra/newview/llpathfindingnavmesh.cpp index 84343cf31e..81fa7b24db 100644 --- a/indra/newview/llpathfindingnavmesh.cpp +++ b/indra/newview/llpathfindingnavmesh.cpp @@ -66,9 +66,12 @@ void LLPathfindingNavMesh::handleRefresh() void LLPathfindingNavMesh::handleNavMeshNewVersion(U32 pNavMeshVersion) { - mNavMeshData.clear(); - mNavMeshVersion = pNavMeshVersion; - setRequestStatus(kNavMeshRequestNeedsUpdate); + if (mNavMeshVersion != pNavMeshVersion) + { + mNavMeshData.clear(); + mNavMeshVersion = pNavMeshVersion; + setRequestStatus(kNavMeshRequestNeedsUpdate); + } } void LLPathfindingNavMesh::handleNavMeshStart(U32 pNavMeshVersion) @@ -121,13 +124,18 @@ void LLPathfindingNavMesh::handleNavMeshNotEnabled() setRequestStatus(kNavMeshRequestNotEnabled); } +void LLPathfindingNavMesh::handleNavMeshError() +{ + mNavMeshData.clear(); + setRequestStatus(kNavMeshRequestError); +} + void LLPathfindingNavMesh::handleNavMeshError(U32 pStatus, const std::string &pReason, const std::string &pURL, U32 pNavMeshVersion) { llwarns << "error with request to URL '" << pURL << "' because " << pReason << " (statusCode:" << pStatus << ")" << llendl; if (mNavMeshVersion == pNavMeshVersion) { - mNavMeshData.clear(); - setRequestStatus(kNavMeshRequestError); + handleNavMeshError(); } } diff --git a/indra/newview/llpathfindingnavmesh.h b/indra/newview/llpathfindingnavmesh.h index eb9ef9683d..3bdb485d37 100644 --- a/indra/newview/llpathfindingnavmesh.h +++ b/indra/newview/llpathfindingnavmesh.h @@ -42,6 +42,9 @@ class LLPathfindingNavMesh; typedef boost::shared_ptr LLPathfindingNavMeshPtr; +// XXX stinson 03/12/2012 : This definition is in place to support an older version of the pathfinding simulator that does not have versioned information +#define DEPRECATED_UNVERSIONED_NAVMESH + class LLPathfindingNavMesh { public: @@ -63,6 +66,10 @@ public: navmesh_slot_t registerNavMeshListener(navmesh_callback_t pNavMeshCallback); +#ifdef DEPRECATED_UNVERSIONED_NAVMESH + U32 getNavMeshVersion() const {return mNavMeshVersion;}; +#endif // DEPRECATED_UNVERSIONED_NAVMESH + bool hasNavMeshVersion(U32 pNavMeshVersion) const; void handleRefresh(); @@ -70,6 +77,7 @@ public: void handleNavMeshStart(U32 pNavMeshVersion); void handleNavMeshResult(const LLSD &pContent, U32 pNavMeshVersion); void handleNavMeshNotEnabled(); + void handleNavMeshError(); void handleNavMeshError(U32 pStatus, const std::string &pReason, const std::string &pURL, U32 pNavMeshVersion); protected: diff --git a/indra/newview/llpathfindingnavmeshstatus.cpp b/indra/newview/llpathfindingnavmeshstatus.cpp new file mode 100644 index 0000000000..67be0459a5 --- /dev/null +++ b/indra/newview/llpathfindingnavmeshstatus.cpp @@ -0,0 +1,134 @@ +/** + * @file llpathfindingnavmeshstatus.cpp + * @author William Todd Stinson + * @brief A class for representing the navmesh status of a pathfinding region. + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llsd.h" +#include "lluuid.h" +#include "llstring.h" +#include "llpathfindingnavmeshstatus.h" + +#include + +#define REGION_FIELD "region" +#define STATE_FIELD "state" +#define VERSION_FIELD "version" + +const std::string LLPathfindingNavMeshStatus::sStatusPending("pending"); +const std::string LLPathfindingNavMeshStatus::sStatusBuilding("building"); +const std::string LLPathfindingNavMeshStatus::sStatusComplete("complete"); +const std::string LLPathfindingNavMeshStatus::sStatusRepending("repending"); + + +//--------------------------------------------------------------------------- +// LLPathfindingNavMeshStatus +//--------------------------------------------------------------------------- + +LLPathfindingNavMeshStatus::LLPathfindingNavMeshStatus(const LLUUID &pRegionUUID) + : mIsValid(false), + mRegionUUID(pRegionUUID), + mVersion(0U), + mStatus(kComplete) +{ +} + +LLPathfindingNavMeshStatus::LLPathfindingNavMeshStatus(const LLUUID &pRegionUUID, const LLSD &pContent) + : mIsValid(true), + mRegionUUID(pRegionUUID), + mVersion(0U), + mStatus(kComplete) +{ + parseStatus(pContent); +} + +LLPathfindingNavMeshStatus::LLPathfindingNavMeshStatus(const LLSD &pContent) + : mIsValid(true), + mRegionUUID(), + mVersion(0U), + mStatus(kComplete) +{ + llassert(pContent.has(REGION_FIELD)); + llassert(pContent.get(REGION_FIELD).isUUID()); + mRegionUUID = pContent.get(REGION_FIELD).asUUID(); + + parseStatus(pContent); +} + +LLPathfindingNavMeshStatus::LLPathfindingNavMeshStatus(const LLPathfindingNavMeshStatus &pOther) + : mIsValid(pOther.mIsValid), + mRegionUUID(pOther.mRegionUUID), + mVersion(pOther.mVersion), + mStatus(pOther.mStatus) +{ +} + +LLPathfindingNavMeshStatus::~LLPathfindingNavMeshStatus() +{ +} + +LLPathfindingNavMeshStatus &LLPathfindingNavMeshStatus::operator =(const LLPathfindingNavMeshStatus &pOther) +{ + mIsValid = pOther.mIsValid; + mRegionUUID = pOther.mRegionUUID; + mVersion = pOther.mVersion; + mStatus = pOther.mStatus; + + return *this; +} + +void LLPathfindingNavMeshStatus::parseStatus(const LLSD &pContent) +{ + llassert(pContent.has(VERSION_FIELD)); + llassert(pContent.get(VERSION_FIELD).isInteger()); + llassert(pContent.get(VERSION_FIELD).asInteger() >= 0); + mVersion = static_cast(pContent.get(VERSION_FIELD).asInteger()); + + llassert(pContent.has(STATE_FIELD)); + llassert(pContent.get(STATE_FIELD).isString()); + std::string status = pContent.get(STATE_FIELD).asString(); + + if (LLStringUtil::compareStrings(status, sStatusPending)) + { + mStatus = kPending; + } + else if (LLStringUtil::compareStrings(status, sStatusBuilding)) + { + mStatus = kBuilding; + } + else if (LLStringUtil::compareStrings(status, sStatusComplete)) + { + mStatus = kComplete; + } + else if (LLStringUtil::compareStrings(status, sStatusRepending)) + { + mStatus = kRepending; + } + else + { + mStatus = kComplete; + llassert(0); + } +} diff --git a/indra/newview/llpathfindingnavmeshstatus.h b/indra/newview/llpathfindingnavmeshstatus.h new file mode 100644 index 0000000000..fcc876059d --- /dev/null +++ b/indra/newview/llpathfindingnavmeshstatus.h @@ -0,0 +1,77 @@ +/** + * @file llpathfindingnavmeshstatus.h + * @author William Todd Stinson + * @brief A class for representing the navmesh status of a pathfinding region. + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLPATHFINDINGNAVMESHSTATUS_H +#define LL_LLPATHFINDINGNAVMESHSTATUS_H + +#include "lluuid.h" + +#include + +class LLSD; + +class LLPathfindingNavMeshStatus +{ +public: + typedef enum + { + kPending, + kBuilding, + kComplete, + kRepending + } ENavMeshStatus; + + LLPathfindingNavMeshStatus(const LLUUID &pRegionUUID); + LLPathfindingNavMeshStatus(const LLUUID &pRegionUUID, const LLSD &pContent); + LLPathfindingNavMeshStatus(const LLSD &pContent); + LLPathfindingNavMeshStatus(const LLPathfindingNavMeshStatus &pOther); + virtual ~LLPathfindingNavMeshStatus(); + + LLPathfindingNavMeshStatus &operator =(const LLPathfindingNavMeshStatus &pOther); + + bool isValid() const {return mIsValid;}; + const LLUUID &getRegionUUID() const {return mRegionUUID;}; + U32 getVersion() const {return mVersion;}; + ENavMeshStatus getStatus() const {return mStatus;}; + +protected: + +private: + void parseStatus(const LLSD &pContent); + + bool mIsValid; + LLUUID mRegionUUID; + U32 mVersion; + ENavMeshStatus mStatus; + + static const std::string sStatusPending; + static const std::string sStatusBuilding; + static const std::string sStatusComplete; + static const std::string sStatusRepending; +}; + +#endif // LL_LLPATHFINDINGNAVMESHSTATUS_H diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp index 3767834655..83238ec869 100644 --- a/indra/newview/llpathfindingnavmeshzone.cpp +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -311,10 +311,15 @@ LLPathfindingNavMesh::ENavMeshRequestStatus LLPathfindingNavMeshZone::NavMeshLoc void LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLUUID &pRegionUUID, U32 pNavMeshVersion, const LLSD::Binary &pNavMeshData) { llassert(mRegionUUID == pRegionUUID); - mRequestStatus = pNavMeshRequestStatus; - if ((pNavMeshRequestStatus == LLPathfindingNavMesh::kNavMeshRequestCompleted) && (!mHasNavMesh || (mNavMeshVersion != pNavMeshVersion))) + if (pNavMeshRequestStatus != LLPathfindingNavMesh::kNavMeshRequestCompleted) + { + mRequestStatus = pNavMeshRequestStatus; + mLocationCallback(); + } + else if (!mHasNavMesh || (mNavMeshVersion != pNavMeshVersion)) { llassert(!pNavMeshData.empty()); + mRequestStatus = pNavMeshRequestStatus; mHasNavMesh = true; mNavMeshVersion = pNavMeshVersion; llassert(LLPathingLib::getInstance() != NULL); @@ -322,8 +327,8 @@ void LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh(LLPathfindingNavMe { LLPathingLib::getInstance()->extractNavMeshSrcFromLLSD(pNavMeshData, mDirection); } + mLocationCallback(); } - mLocationCallback(); } void LLPathfindingNavMeshZone::NavMeshLocation::clear() diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 6e422a5821..fc04546bb8 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1522,6 +1522,7 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) capabilityNames.append("MapLayer"); capabilityNames.append("MapLayerGod"); capabilityNames.append("MeshUploadFlag"); + capabilityNames.append("NavMeshGenerationStatus"); capabilityNames.append("NavMeshUpload"); capabilityNames.append("NewFileAgentInventory"); capabilityNames.append("ObjectNavMeshProperties"); -- cgit v1.3 From c990cc71ce124059a072c7778ac962253bacb199 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 12 Mar 2012 19:18:19 -0700 Subject: PATH-304: Adding an extra state for the pathfinding console to report that the status of the navmesh is being checked. --- indra/newview/llfloaterpathfindingconsole.cpp | 7 +++++++ indra/newview/llfloaterpathfindingconsole.h | 1 + indra/newview/llpathfindingmanager.cpp | 4 +++- indra/newview/llpathfindingnavmesh.cpp | 22 +++++++++++++++++++--- indra/newview/llpathfindingnavmesh.h | 4 +++- indra/newview/llpathfindingnavmeshzone.cpp | 11 +++++++++++ indra/newview/llpathfindingnavmeshzone.h | 1 + .../default/xui/en/floater_pathfinding_console.xml | 1 + 8 files changed, 46 insertions(+), 5 deletions(-) (limited to 'indra/newview/llpathfindingnavmeshzone.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 493b4617b5..487ef0933a 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -618,6 +618,9 @@ void LLFloaterPathfindingConsole::onNavMeshZoneCB(LLPathfindingNavMeshZone::ENav case LLPathfindingNavMeshZone::kNavMeshZoneRequestUnknown : setConsoleState(kConsoleStateUnknown); break; + case LLPathfindingNavMeshZone::kNavMeshZoneRequestChecking : + setConsoleState(kConsoleStateCheckingVersion); + break; case LLPathfindingNavMeshZone::kNavMeshZoneRequestNeedsUpdate : mIsNavMeshUpdating = true; mNavMeshZone.refresh(); @@ -677,6 +680,7 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() mHasStartPoint = false; mHasEndPoint = false; break; + case kConsoleStateCheckingVersion : case kConsoleStateDownloading : case kConsoleStateError : mShowNavMeshCheckBox->setEnabled(FALSE); @@ -736,6 +740,9 @@ void LLFloaterPathfindingConsole::updateStatusOnConsoleState() statusText = getString("navmesh_status_region_not_enabled"); styleParams.color = warningColor; break; + case kConsoleStateCheckingVersion : + statusText = getString("navmesh_status_checking_version"); + break; case kConsoleStateDownloading : if (mIsNavMeshUpdating) { diff --git a/indra/newview/llfloaterpathfindingconsole.h b/indra/newview/llfloaterpathfindingconsole.h index 8c29bf5909..c58dc83653 100644 --- a/indra/newview/llfloaterpathfindingconsole.h +++ b/indra/newview/llfloaterpathfindingconsole.h @@ -120,6 +120,7 @@ private: kConsoleStateUnknown, kConsoleStateLibraryNotImplemented, kConsoleStateRegionNotEnabled, + kConsoleStateCheckingVersion, kConsoleStateDownloading, kConsoleStateHasNavMesh, kConsoleStateError diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index 9cd3d5625c..9abd9fda1a 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -274,11 +274,13 @@ void LLPathfindingManager::requestGetNavMeshForRegion(LLViewerRegion *pRegion) } else { + navMeshPtr->handleNavMeshCheckVersion(); LLHTTPClient::ResponderPtr navMeshStatusResponder = new NavMeshStatusResponder(navMeshStatusURL, pRegion); LLHTTPClient::get(navMeshStatusURL, navMeshStatusResponder); } #else // DEPRECATED_UNVERSIONED_NAVMESH llassert(!navMeshStatusURL.empty()); + navMeshPtr->handleNavMeshCheckVersion(); LLHTTPClient::ResponderPtr navMeshStatusResponder = new NavMeshStatusResponder(navMeshStatusURL, pRegion); LLHTTPClient::get(navMeshStatusURL, navMeshStatusResponder); #endif // DEPRECATED_UNVERSIONED_NAVMESH @@ -297,7 +299,7 @@ void LLPathfindingManager::handleNavMeshStatusRequest(const LLPathfindingNavMesh { if (navMeshPtr->hasNavMeshVersion(pNavMeshStatus.getVersion())) { - navMeshPtr->handleRefresh(); + navMeshPtr->handleRefresh(pNavMeshStatus.getVersion()); } else { diff --git a/indra/newview/llpathfindingnavmesh.cpp b/indra/newview/llpathfindingnavmesh.cpp index 81fa7b24db..138295a8cf 100644 --- a/indra/newview/llpathfindingnavmesh.cpp +++ b/indra/newview/llpathfindingnavmesh.cpp @@ -56,12 +56,28 @@ LLPathfindingNavMesh::navmesh_slot_t LLPathfindingNavMesh::registerNavMeshListen bool LLPathfindingNavMesh::hasNavMeshVersion(U32 pNavMeshVersion) const { - return (((mNavMeshRequestStatus == kNavMeshRequestStarted) || (mNavMeshRequestStatus == kNavMeshRequestCompleted)) && (mNavMeshVersion == pNavMeshVersion)); + return ((mNavMeshVersion == pNavMeshVersion) && + ((mNavMeshRequestStatus == kNavMeshRequestStarted) || (mNavMeshRequestStatus == kNavMeshRequestCompleted) || + ((mNavMeshRequestStatus == kNavMeshRequestChecking) && !mNavMeshData.empty()))); } -void LLPathfindingNavMesh::handleRefresh() +void LLPathfindingNavMesh::handleRefresh(U32 pNavMeshVersion) { - mNavMeshSignal(mNavMeshRequestStatus, mRegionUUID, mNavMeshVersion, mNavMeshData); + llassert(pNavMeshVersion == mNavMeshVersion); + if (mNavMeshRequestStatus == kNavMeshRequestChecking) + { + llassert(!mNavMeshData.empty()); + setRequestStatus(kNavMeshRequestCompleted); + } + else + { + mNavMeshSignal(mNavMeshRequestStatus, mRegionUUID, mNavMeshVersion, mNavMeshData); + } +} + +void LLPathfindingNavMesh::handleNavMeshCheckVersion() +{ + setRequestStatus(kNavMeshRequestChecking); } void LLPathfindingNavMesh::handleNavMeshNewVersion(U32 pNavMeshVersion) diff --git a/indra/newview/llpathfindingnavmesh.h b/indra/newview/llpathfindingnavmesh.h index 3bdb485d37..46a114439a 100644 --- a/indra/newview/llpathfindingnavmesh.h +++ b/indra/newview/llpathfindingnavmesh.h @@ -50,6 +50,7 @@ class LLPathfindingNavMesh public: typedef enum { kNavMeshRequestUnknown, + kNavMeshRequestChecking, kNavMeshRequestNeedsUpdate, kNavMeshRequestStarted, kNavMeshRequestCompleted, @@ -72,7 +73,8 @@ public: bool hasNavMeshVersion(U32 pNavMeshVersion) const; - void handleRefresh(); + void handleNavMeshCheckVersion(); + void handleRefresh(U32 pNavMeshVersion); void handleNavMeshNewVersion(U32 pNavMeshVersion); void handleNavMeshStart(U32 pNavMeshVersion); void handleNavMeshResult(const LLSD &pContent, U32 pNavMeshVersion); diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp index 83238ec869..8e558c3b00 100644 --- a/indra/newview/llpathfindingnavmeshzone.cpp +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -140,6 +140,7 @@ void LLPathfindingNavMeshZone::handleNavMeshLocation() void LLPathfindingNavMeshZone::updateStatus() { bool hasRequestUnknown = false; + bool hasRequestChecking = false; bool hasRequestNeedsUpdate = false; bool hasRequestStarted = false; bool hasRequestCompleted = false; @@ -161,6 +162,9 @@ void LLPathfindingNavMeshZone::updateStatus() case LLPathfindingNavMesh::kNavMeshRequestUnknown : hasRequestUnknown = true; break; + case LLPathfindingNavMesh::kNavMeshRequestChecking : + hasRequestChecking = true; + break; case LLPathfindingNavMesh::kNavMeshRequestNeedsUpdate : hasRequestNeedsUpdate = true; break; @@ -189,6 +193,13 @@ void LLPathfindingNavMeshZone::updateStatus() zoneRequestStatus = kNavMeshZoneRequestNeedsUpdate; #ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE llinfos << "STINSON DEBUG: Navmesh zone update is NEEDS UPDATE" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + } + else if (hasRequestChecking) + { + zoneRequestStatus = kNavMeshZoneRequestChecking; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is CHECKING" << llendl; #endif // XXX_STINSON_DEBUG_NAVMESH_ZONE } else if (hasRequestStarted) diff --git a/indra/newview/llpathfindingnavmeshzone.h b/indra/newview/llpathfindingnavmeshzone.h index 833f3ebb05..7b6583a663 100644 --- a/indra/newview/llpathfindingnavmeshzone.h +++ b/indra/newview/llpathfindingnavmeshzone.h @@ -45,6 +45,7 @@ class LLPathfindingNavMeshZone public: typedef enum { kNavMeshZoneRequestUnknown, + kNavMeshZoneRequestChecking, kNavMeshZoneRequestNeedsUpdate, kNavMeshZoneRequestStarted, kNavMeshZoneRequestCompleted, diff --git a/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml b/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml index 75465f1aea..d23d62674f 100644 --- a/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml +++ b/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml @@ -14,6 +14,7 @@ Cannot find pathing library implementation. This region is not enabled for pathfinding. + Checking the status of the navmesh ... Downloading the navmesh ... The navmesh has changed on the server. Downloading the latest navmesh ... Navmesh received. -- cgit v1.3 From d4fb7c99febf07b4eb7f3a9d2eab485e356d1439 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Wed, 14 Mar 2012 14:09:36 -0700 Subject: PATH-302: Adding in status reporting for the simulator navmesh status. Separating the viewer status messaging from the simulator status. --- indra/newview/llfloaterpathfindingconsole.cpp | 118 ++++++++++++++++--- indra/newview/llfloaterpathfindingconsole.h | 8 +- indra/newview/llpathfindingmanager.cpp | 27 +++-- indra/newview/llpathfindingmanager.h | 5 +- indra/newview/llpathfindingnavmesh.cpp | 65 +++++++---- indra/newview/llpathfindingnavmesh.h | 34 +++--- indra/newview/llpathfindingnavmeshstatus.cpp | 16 ++- indra/newview/llpathfindingnavmeshstatus.h | 8 ++ indra/newview/llpathfindingnavmeshzone.cpp | 130 +++++++++++++++++---- indra/newview/llpathfindingnavmeshzone.h | 25 +++- .../default/xui/en/floater_pathfinding_console.xml | 86 +++++++++++--- 11 files changed, 399 insertions(+), 123 deletions(-) (limited to 'indra/newview/llpathfindingnavmeshzone.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 7e86819568..65a558b778 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -129,8 +129,11 @@ BOOL LLFloaterPathfindingConsole::postBuild() llassert(mFreezeButton != NULL); mFreezeButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onFreezeClicked, this)); - mPathfindingStatus = findChild("pathfinding_status"); - llassert(mPathfindingStatus != NULL); + mPathfindingViewerStatus = findChild("pathfinding_viewer_status"); + llassert(mPathfindingViewerStatus != NULL); + + mPathfindingSimulatorStatus = findChild("pathfinding_simulator_status"); + llassert(mPathfindingSimulatorStatus != NULL); mCharacterWidthSlider = findChild("character_width"); llassert(mCharacterWidthSlider != NULL); @@ -469,7 +472,8 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mShowMaterialVolumesCheckBox(NULL), mShowExclusionVolumesCheckBox(NULL), mShowWorldCheckBox(NULL), - mPathfindingStatus(NULL), + mPathfindingViewerStatus(NULL), + mPathfindingSimulatorStatus(NULL), mViewCharactersButton(NULL), mEditTestTabContainer(NULL), mEditTab(NULL), @@ -731,50 +735,126 @@ void LLFloaterPathfindingConsole::updateStatusOnConsoleState() { static const LLColor4 warningColor = LLUIColorTable::instance().getColor("DrYellow"); - std::string statusText(""); - LLStyle::Params styleParams; + std::string simulatorStatusText(""); + std::string viewerStatusText(""); + LLStyle::Params viewerStyleParams; switch (mConsoleState) { case kConsoleStateUnknown : - statusText = getString("navmesh_status_unknown"); + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + viewerStatusText = getString("navmesh_viewer_status_unknown"); break; case kConsoleStateLibraryNotImplemented : - statusText = getString("navmesh_status_library_not_implemented"); - styleParams.color = warningColor; + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + viewerStatusText = getString("navmesh_viewer_status_library_not_implemented"); + viewerStyleParams.color = warningColor; break; case kConsoleStateRegionNotEnabled : - statusText = getString("navmesh_status_region_not_enabled"); - styleParams.color = warningColor; + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + viewerStatusText = getString("navmesh_viewer_status_region_not_enabled"); + viewerStyleParams.color = warningColor; break; case kConsoleStateCheckingVersion : - statusText = getString("navmesh_status_checking_version"); + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + viewerStatusText = getString("navmesh_viewer_status_checking_version"); break; case kConsoleStateDownloading : + simulatorStatusText = getSimulatorStatusText(); if (mIsNavMeshUpdating) { - statusText = getString("navmesh_status_updating"); + viewerStatusText = getString("navmesh_viewer_status_updating"); } else { - statusText = getString("navmesh_status_downloading"); + viewerStatusText = getString("navmesh_viewer_status_downloading"); } break; case kConsoleStateHasNavMesh : - statusText = getString("navmesh_status_has_navmesh"); + simulatorStatusText = getSimulatorStatusText(); + viewerStatusText = getString("navmesh_viewer_status_has_navmesh"); break; case kConsoleStateError : - statusText = getString("navmesh_status_error"); - styleParams.color = warningColor; + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + viewerStatusText = getString("navmesh_viewer_status_error"); + viewerStyleParams.color = warningColor; break; default : - statusText = getString("navmesh_status_unknown"); + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + viewerStatusText = getString("navmesh_viewer_status_unknown"); llassert(0); break; } - mPathfindingStatus->setText((LLStringExplicit)statusText, styleParams); + mPathfindingViewerStatus->setText((LLStringExplicit)viewerStatusText, viewerStyleParams); + mPathfindingSimulatorStatus->setText((LLStringExplicit)simulatorStatusText); } + +std::string LLFloaterPathfindingConsole::getSimulatorStatusText() const +{ + std::string simulatorStatusText(""); + +#ifdef DEPRECATED_UNVERSIONED_NAVMESH + if (LLPathfindingManager::getInstance()->isPathfindingNavMeshVersioningEnabledForCurrentRegionXXX()) + { + switch (mNavMeshZone.getNavMeshZoneStatus()) + { + case LLPathfindingNavMeshZone::kNavMeshZonePending : + simulatorStatusText = getString("navmesh_simulator_status_pending"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneBuilding : + simulatorStatusText = getString("navmesh_simulator_status_building"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneSomePending : + simulatorStatusText = getString("navmesh_simulator_status_some_pending"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneSomeBuilding : + simulatorStatusText = getString("navmesh_simulator_status_some_building"); + break; + case LLPathfindingNavMeshZone::kNavMeshZonePendingAndBuilding : + simulatorStatusText = getString("navmesh_simulator_status_pending_and_building"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneComplete : + simulatorStatusText = getString("navmesh_simulator_status_complete"); + break; + default : + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + break; + } + } + else + { + simulatorStatusText = getString("navmesh_simulator_status_region_not_enabled"); + } +#else // DEPRECATED_UNVERSIONED_NAVMESH + switch (mNavMeshZone.getNavMeshZoneStatus()) + { + case LLPathfindingNavMeshZone::kNavMeshZonePending : + simulatorStatusText = getString("navmesh_simulator_status_pending"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneBuilding : + simulatorStatusText = getString("navmesh_simulator_status_building"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneSomePending : + simulatorStatusText = getString("navmesh_simulator_status_some_pending"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneSomeBuilding : + simulatorStatusText = getString("navmesh_simulator_status_some_building"); + break; + case LLPathfindingNavMeshZone::kNavMeshZonePendingAndBuilding : + simulatorStatusText = getString("navmesh_simulator_status_pending_and_building"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneComplete : + simulatorStatusText = getString("navmesh_simulator_status_complete"); + break; + default : + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + break; + } +#endif // DEPRECATED_UNVERSIONED_NAVMESH + + return simulatorStatusText; +} void LLFloaterPathfindingConsole::setAgentState(LLPathfindingManager::EAgentState pAgentState) { @@ -894,5 +974,5 @@ void LLFloaterPathfindingConsole::regionCrossingOccured() LLStyle::Params styleParams; styleParams.color = LLUIColorTable::instance().getColor("DrYellow"); statusText = getString("navmesh_update_needed"); - mPathfindingStatus->setText((LLStringExplicit)statusText, styleParams); + mPathfindingViewerStatus->setText((LLStringExplicit)statusText, styleParams); } \ No newline at end of file diff --git a/indra/newview/llfloaterpathfindingconsole.h b/indra/newview/llfloaterpathfindingconsole.h index a1973e0985..8c22e5ead7 100644 --- a/indra/newview/llfloaterpathfindingconsole.h +++ b/indra/newview/llfloaterpathfindingconsole.h @@ -147,8 +147,9 @@ private: void setConsoleState(EConsoleState pConsoleState); - void updateControlsOnConsoleState(); - void updateStatusOnConsoleState(); + void updateControlsOnConsoleState(); + void updateStatusOnConsoleState(); + std::string getSimulatorStatusText() const; void setAgentState(LLPathfindingManager::EAgentState pAgentState); @@ -165,7 +166,8 @@ private: LLCheckBoxCtrl *mShowMaterialVolumesCheckBox; LLCheckBoxCtrl *mShowExclusionVolumesCheckBox; LLCheckBoxCtrl *mShowWorldCheckBox; - LLTextBase *mPathfindingStatus; + LLTextBase *mPathfindingViewerStatus; + LLTextBase *mPathfindingSimulatorStatus; LLButton *mViewCharactersButton; LLTabContainer *mEditTestTabContainer; LLPanel *mEditTab; diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index 46bfbe0bb0..e3242de812 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -41,7 +41,6 @@ #include "llpathfindinglinkset.h" #include "llpathfindinglinksetlist.h" #include "llhttpnode.h" -//#include "llpathfindingnavmeshzone.h" // XXX #include #include @@ -254,6 +253,14 @@ bool LLPathfindingManager::isPathfindingEnabledForRegion(LLViewerRegion *pRegion return !retrieveNavMeshURL.empty(); } +#ifdef DEPRECATED_UNVERSIONED_NAVMESH +bool LLPathfindingManager::isPathfindingNavMeshVersioningEnabledForCurrentRegionXXX() const +{ + std::string navMeshStatusURL = getNavMeshStatusURLForRegion(getCurrentRegion()); + return !navMeshStatusURL.empty(); +} +#endif // DEPRECATED_UNVERSIONED_NAVMESH + bool LLPathfindingManager::isAllowAlterPermanent() { return (!isPathfindingEnabledForCurrentRegion() || (getAgentState() == kAgentStateUnfrozen)); @@ -285,7 +292,9 @@ void LLPathfindingManager::requestGetNavMeshForRegion(LLViewerRegion *pRegion) #ifdef DEPRECATED_UNVERSIONED_NAVMESH if (navMeshStatusURL.empty()) { - sendRequestGetNavMeshForRegion(navMeshPtr, pRegion, navMeshPtr->getNavMeshVersion() + 1U); + LLPathfindingNavMeshStatus navMeshStatus = navMeshPtr->getNavMeshStatusXXX(); + navMeshStatus.incrementNavMeshVersionXXX(); + sendRequestGetNavMeshForRegion(navMeshPtr, pRegion, navMeshStatus); } else { @@ -312,13 +321,13 @@ void LLPathfindingManager::handleNavMeshStatusRequest(const LLPathfindingNavMesh } else { - if (navMeshPtr->hasNavMeshVersion(pNavMeshStatus.getVersion())) + if (navMeshPtr->hasNavMeshVersion(pNavMeshStatus)) { - navMeshPtr->handleRefresh(pNavMeshStatus.getVersion()); + navMeshPtr->handleRefresh(pNavMeshStatus); } else { - sendRequestGetNavMeshForRegion(navMeshPtr, pRegion, pNavMeshStatus.getVersion()); + sendRequestGetNavMeshForRegion(navMeshPtr, pRegion, pNavMeshStatus); } } } @@ -333,7 +342,7 @@ void LLPathfindingManager::handleNavMeshStatusUpdate(const LLPathfindingNavMeshS } else { - navMeshPtr->handleNavMeshNewVersion(pNavMeshStatus.getVersion()); + navMeshPtr->handleNavMeshNewVersion(pNavMeshStatus); } } @@ -462,7 +471,7 @@ LLPathfindingManager::ELinksetsRequestStatus LLPathfindingManager::requestSetLin return status; } -void LLPathfindingManager::sendRequestGetNavMeshForRegion(LLPathfindingNavMeshPtr navMeshPtr, LLViewerRegion *pRegion, U32 pNavMeshVersion) +void LLPathfindingManager::sendRequestGetNavMeshForRegion(LLPathfindingNavMeshPtr navMeshPtr, LLViewerRegion *pRegion, const LLPathfindingNavMeshStatus &pNavMeshStatus) { if ((pRegion == NULL) || !pRegion->isAlive()) { @@ -478,8 +487,8 @@ void LLPathfindingManager::sendRequestGetNavMeshForRegion(LLPathfindingNavMeshPt } else { - navMeshPtr->handleNavMeshStart(pNavMeshVersion); - LLHTTPClient::ResponderPtr responder = new NavMeshResponder(navMeshURL, pNavMeshVersion, navMeshPtr); + navMeshPtr->handleNavMeshStart(pNavMeshStatus); + LLHTTPClient::ResponderPtr responder = new NavMeshResponder(navMeshURL, pNavMeshStatus.getVersion(), navMeshPtr); LLSD postData; LLHTTPClient::post(navMeshURL, postData, responder); diff --git a/indra/newview/llpathfindingmanager.h b/indra/newview/llpathfindingmanager.h index 1cfd870897..b458d6513a 100644 --- a/indra/newview/llpathfindingmanager.h +++ b/indra/newview/llpathfindingmanager.h @@ -77,6 +77,9 @@ public: bool isPathfindingEnabledForCurrentRegion() const; bool isPathfindingEnabledForRegion(LLViewerRegion *pRegion) const; +#ifdef DEPRECATED_UNVERSIONED_NAVMESH + bool isPathfindingNavMeshVersioningEnabledForCurrentRegionXXX() const; +#endif // DEPRECATED_UNVERSIONED_NAVMESH bool isAllowAlterPermanent(); bool isAllowViewTerrainProperties() const; @@ -98,7 +101,7 @@ public: protected: private: - void sendRequestGetNavMeshForRegion(LLPathfindingNavMeshPtr navMeshPtr, LLViewerRegion *pRegion, U32 pNavMeshVersion); + void sendRequestGetNavMeshForRegion(LLPathfindingNavMeshPtr navMeshPtr, LLViewerRegion *pRegion, const LLPathfindingNavMeshStatus &pNavMeshStatus); LLPathfindingNavMeshPtr getNavMeshForRegion(const LLUUID &pRegionUUID); LLPathfindingNavMeshPtr getNavMeshForRegion(LLViewerRegion *pRegion); diff --git a/indra/newview/llpathfindingnavmesh.cpp b/indra/newview/llpathfindingnavmesh.cpp index 740d1cde24..10e9abaf0c 100644 --- a/indra/newview/llpathfindingnavmesh.cpp +++ b/indra/newview/llpathfindingnavmesh.cpp @@ -28,6 +28,7 @@ #include "llviewerprecompiledheaders.h" #include "lluuid.h" #include "llpathfindingnavmesh.h" +#include "llpathfindingnavmeshstatus.h" #include "llsdserialize.h" #include @@ -40,11 +41,11 @@ //--------------------------------------------------------------------------- LLPathfindingNavMesh::LLPathfindingNavMesh(const LLUUID &pRegionUUID) - : mRegionUUID(pRegionUUID), + : mNavMeshStatus(pRegionUUID), mNavMeshRequestStatus(kNavMeshRequestUnknown), mNavMeshSignal(), - mNavMeshData(), - mNavMeshVersion(0U) + mNavMeshData() + { } @@ -57,16 +58,23 @@ LLPathfindingNavMesh::navmesh_slot_t LLPathfindingNavMesh::registerNavMeshListen return mNavMeshSignal.connect(pNavMeshCallback); } -bool LLPathfindingNavMesh::hasNavMeshVersion(U32 pNavMeshVersion) const +bool LLPathfindingNavMesh::hasNavMeshVersion(const LLPathfindingNavMeshStatus &pNavMeshStatus) const { - return ((mNavMeshVersion == pNavMeshVersion) && + return ((mNavMeshStatus.getVersion() == pNavMeshStatus.getVersion()) && ((mNavMeshRequestStatus == kNavMeshRequestStarted) || (mNavMeshRequestStatus == kNavMeshRequestCompleted) || ((mNavMeshRequestStatus == kNavMeshRequestChecking) && !mNavMeshData.empty()))); } -void LLPathfindingNavMesh::handleRefresh(U32 pNavMeshVersion) +void LLPathfindingNavMesh::handleNavMeshCheckVersion() +{ + setRequestStatus(kNavMeshRequestChecking); +} + +void LLPathfindingNavMesh::handleRefresh(const LLPathfindingNavMeshStatus &pNavMeshStatus) { - llassert(pNavMeshVersion == mNavMeshVersion); + llassert(mNavMeshStatus.getRegionUUID() == pNavMeshStatus.getRegionUUID()); + llassert(mNavMeshStatus.getVersion() == pNavMeshStatus.getVersion()); + mNavMeshStatus = pNavMeshStatus; if (mNavMeshRequestStatus == kNavMeshRequestChecking) { llassert(!mNavMeshData.empty()); @@ -74,28 +82,30 @@ void LLPathfindingNavMesh::handleRefresh(U32 pNavMeshVersion) } else { - mNavMeshSignal(mNavMeshRequestStatus, mRegionUUID, mNavMeshVersion, mNavMeshData); + sendStatus(); } } -void LLPathfindingNavMesh::handleNavMeshCheckVersion() -{ - setRequestStatus(kNavMeshRequestChecking); -} - -void LLPathfindingNavMesh::handleNavMeshNewVersion(U32 pNavMeshVersion) +void LLPathfindingNavMesh::handleNavMeshNewVersion(const LLPathfindingNavMeshStatus &pNavMeshStatus) { - if (mNavMeshVersion != pNavMeshVersion) + llassert(mNavMeshStatus.getRegionUUID() == pNavMeshStatus.getRegionUUID()); + if (mNavMeshStatus.getVersion() == pNavMeshStatus.getVersion()) + { + mNavMeshStatus = pNavMeshStatus; + sendStatus(); + } + else { mNavMeshData.clear(); - mNavMeshVersion = pNavMeshVersion; + mNavMeshStatus = pNavMeshStatus; setRequestStatus(kNavMeshRequestNeedsUpdate); } } -void LLPathfindingNavMesh::handleNavMeshStart(U32 pNavMeshVersion) +void LLPathfindingNavMesh::handleNavMeshStart(const LLPathfindingNavMeshStatus &pNavMeshStatus) { - mNavMeshVersion = pNavMeshVersion; + llassert(mNavMeshStatus.getRegionUUID() == pNavMeshStatus.getRegionUUID()); + mNavMeshStatus = pNavMeshStatus; setRequestStatus(kNavMeshRequestStarted); } @@ -114,8 +124,9 @@ void LLPathfindingNavMesh::handleNavMeshResult(const LLSD &pContent, U32 pNavMes } } - if (mNavMeshVersion == pNavMeshVersion) + if (mNavMeshStatus.getVersion() == pNavMeshVersion) { + ENavMeshRequestStatus status; if ( pContent.has(NAVMESH_DATA_FIELD) ) { const LLSD::Binary &value = pContent.get(NAVMESH_DATA_FIELD).asBinary(); @@ -128,14 +139,14 @@ void LLPathfindingNavMesh::handleNavMeshResult(const LLSD &pContent, U32 pNavMes if ( !valid ) { llwarns << "Unable to decompress the navmesh llsd." << llendl; - setRequestStatus(kNavMeshRequestError); + status = kNavMeshRequestError; } else { llassert(pUncompressedNavMeshContainer); mNavMeshData.resize( decompBinSize ); memcpy( &mNavMeshData[0], &pUncompressedNavMeshContainer[0], decompBinSize ); - setRequestStatus(kNavMeshRequestCompleted); + status = kNavMeshRequestCompleted; } if ( pUncompressedNavMeshContainer ) { @@ -145,8 +156,9 @@ void LLPathfindingNavMesh::handleNavMeshResult(const LLSD &pContent, U32 pNavMes else { llwarns << "No mesh data received" << llendl; - setRequestStatus(kNavMeshRequestError); + status = kNavMeshRequestError; } + setRequestStatus(status); } } @@ -165,7 +177,7 @@ void LLPathfindingNavMesh::handleNavMeshError() void LLPathfindingNavMesh::handleNavMeshError(U32 pStatus, const std::string &pReason, const std::string &pURL, U32 pNavMeshVersion) { llwarns << "error with request to URL '" << pURL << "' because " << pReason << " (statusCode:" << pStatus << ")" << llendl; - if (mNavMeshVersion == pNavMeshVersion) + if (mNavMeshStatus.getVersion() == pNavMeshVersion) { handleNavMeshError(); } @@ -174,5 +186,10 @@ void LLPathfindingNavMesh::handleNavMeshError(U32 pStatus, const std::string &pR void LLPathfindingNavMesh::setRequestStatus(ENavMeshRequestStatus pNavMeshRequestStatus) { mNavMeshRequestStatus = pNavMeshRequestStatus; - mNavMeshSignal(mNavMeshRequestStatus, mRegionUUID, mNavMeshVersion, mNavMeshData); + sendStatus(); +} + +void LLPathfindingNavMesh::sendStatus() +{ + mNavMeshSignal(mNavMeshRequestStatus, mNavMeshStatus, mNavMeshData); } diff --git a/indra/newview/llpathfindingnavmesh.h b/indra/newview/llpathfindingnavmesh.h index 46a114439a..290f7a2cdf 100644 --- a/indra/newview/llpathfindingnavmesh.h +++ b/indra/newview/llpathfindingnavmesh.h @@ -29,7 +29,6 @@ #define LL_LLPATHFINDINGNAVMESH_H #include "llsd.h" -#include "lluuid.h" #include @@ -37,14 +36,13 @@ #include #include -class LLSD; +#include "llpathfindingnavmeshstatus.h" + +class LLUUID; class LLPathfindingNavMesh; typedef boost::shared_ptr LLPathfindingNavMeshPtr; -// XXX stinson 03/12/2012 : This definition is in place to support an older version of the pathfinding simulator that does not have versioned information -#define DEPRECATED_UNVERSIONED_NAVMESH - class LLPathfindingNavMesh { public: @@ -58,9 +56,9 @@ public: kNavMeshRequestError } ENavMeshRequestStatus; - typedef boost::function navmesh_callback_t; - typedef boost::signals2::signal navmesh_signal_t; - typedef boost::signals2::connection navmesh_slot_t; + typedef boost::function navmesh_callback_t; + typedef boost::signals2::signal navmesh_signal_t; + typedef boost::signals2::connection navmesh_slot_t; LLPathfindingNavMesh(const LLUUID &pRegionUUID); virtual ~LLPathfindingNavMesh(); @@ -68,15 +66,15 @@ public: navmesh_slot_t registerNavMeshListener(navmesh_callback_t pNavMeshCallback); #ifdef DEPRECATED_UNVERSIONED_NAVMESH - U32 getNavMeshVersion() const {return mNavMeshVersion;}; + const LLPathfindingNavMeshStatus &getNavMeshStatusXXX() const {return mNavMeshStatus;}; #endif // DEPRECATED_UNVERSIONED_NAVMESH - bool hasNavMeshVersion(U32 pNavMeshVersion) const; + bool hasNavMeshVersion(const LLPathfindingNavMeshStatus &pNavMeshStatus) const; void handleNavMeshCheckVersion(); - void handleRefresh(U32 pNavMeshVersion); - void handleNavMeshNewVersion(U32 pNavMeshVersion); - void handleNavMeshStart(U32 pNavMeshVersion); + void handleRefresh(const LLPathfindingNavMeshStatus &pNavMeshStatus); + void handleNavMeshNewVersion(const LLPathfindingNavMeshStatus &pNavMeshStatus); + void handleNavMeshStart(const LLPathfindingNavMeshStatus &pNavMeshStatus); void handleNavMeshResult(const LLSD &pContent, U32 pNavMeshVersion); void handleNavMeshNotEnabled(); void handleNavMeshError(); @@ -86,12 +84,12 @@ protected: private: void setRequestStatus(ENavMeshRequestStatus pNavMeshRequestStatus); + void sendStatus(); - LLUUID mRegionUUID; - ENavMeshRequestStatus mNavMeshRequestStatus; - navmesh_signal_t mNavMeshSignal; - LLSD::Binary mNavMeshData; - U32 mNavMeshVersion; + LLPathfindingNavMeshStatus mNavMeshStatus; + ENavMeshRequestStatus mNavMeshRequestStatus; + navmesh_signal_t mNavMeshSignal; + LLSD::Binary mNavMeshData; }; #endif // LL_LLPATHFINDINGNAVMESH_H diff --git a/indra/newview/llpathfindingnavmeshstatus.cpp b/indra/newview/llpathfindingnavmeshstatus.cpp index 2ef892c8cd..0ba28e0297 100644 --- a/indra/newview/llpathfindingnavmeshstatus.cpp +++ b/indra/newview/llpathfindingnavmeshstatus.cpp @@ -48,6 +48,14 @@ const std::string LLPathfindingNavMeshStatus::sStatusRepending("repending"); // LLPathfindingNavMeshStatus //--------------------------------------------------------------------------- +LLPathfindingNavMeshStatus::LLPathfindingNavMeshStatus() + : mIsValid(false), + mRegionUUID(), + mVersion(0U), + mStatus(kComplete) +{ +} + LLPathfindingNavMeshStatus::LLPathfindingNavMeshStatus(const LLUUID &pRegionUUID) : mIsValid(false), mRegionUUID(pRegionUUID), @@ -127,19 +135,19 @@ void LLPathfindingNavMeshStatus::parseStatus(const LLSD &pContent) std::string status = pContent.get(STATUS_FIELD).asString(); #endif // DEPRECATED_STATE_FIELD - if (LLStringUtil::compareStrings(status, sStatusPending)) + if (LLStringUtil::compareStrings(status, sStatusPending) == 0) { mStatus = kPending; } - else if (LLStringUtil::compareStrings(status, sStatusBuilding)) + else if (LLStringUtil::compareStrings(status, sStatusBuilding) == 0) { mStatus = kBuilding; } - else if (LLStringUtil::compareStrings(status, sStatusComplete)) + else if (LLStringUtil::compareStrings(status, sStatusComplete) == 0) { mStatus = kComplete; } - else if (LLStringUtil::compareStrings(status, sStatusRepending)) + else if (LLStringUtil::compareStrings(status, sStatusRepending) == 0) { mStatus = kRepending; } diff --git a/indra/newview/llpathfindingnavmeshstatus.h b/indra/newview/llpathfindingnavmeshstatus.h index fcc876059d..7147fcdf36 100644 --- a/indra/newview/llpathfindingnavmeshstatus.h +++ b/indra/newview/llpathfindingnavmeshstatus.h @@ -32,6 +32,9 @@ #include +// XXX stinson 03/12/2012 : This definition is in place to support an older version of the pathfinding simulator that does not have versioned information +#define DEPRECATED_UNVERSIONED_NAVMESH + class LLSD; class LLPathfindingNavMeshStatus @@ -45,6 +48,7 @@ public: kRepending } ENavMeshStatus; + LLPathfindingNavMeshStatus(); LLPathfindingNavMeshStatus(const LLUUID &pRegionUUID); LLPathfindingNavMeshStatus(const LLUUID &pRegionUUID, const LLSD &pContent); LLPathfindingNavMeshStatus(const LLSD &pContent); @@ -53,6 +57,10 @@ public: LLPathfindingNavMeshStatus &operator =(const LLPathfindingNavMeshStatus &pOther); +#ifdef DEPRECATED_UNVERSIONED_NAVMESH + void incrementNavMeshVersionXXX() {++mVersion;}; +#endif // DEPRECATED_UNVERSIONED_NAVMESH + bool isValid() const {return mIsValid;}; const LLUUID &getRegionUUID() const {return mRegionUUID;}; U32 getVersion() const {return mVersion;}; diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp index 8e558c3b00..f871204454 100644 --- a/indra/newview/llpathfindingnavmeshzone.cpp +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -50,6 +50,7 @@ LLPathfindingNavMeshZone::LLPathfindingNavMeshZone() : mNavMeshLocationPtrs(), + mNavMeshZoneRequestStatus(kNavMeshZoneRequestUnknown), mNavMeshZoneSignal() { } @@ -132,6 +133,71 @@ void LLPathfindingNavMeshZone::refresh() } } +LLPathfindingNavMeshZone::ENavMeshZoneStatus LLPathfindingNavMeshZone::getNavMeshZoneStatus() const +{ + bool hasPending = false; + bool hasBuilding = false; + bool hasComplete = false; + bool hasRepending = false; + + for (NavMeshLocationPtrs::const_iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); + navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) + { + const NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; + + switch (navMeshLocationPtr->getNavMeshStatus()) + { + case LLPathfindingNavMeshStatus::kPending : + hasPending = true; + break; + case LLPathfindingNavMeshStatus::kBuilding : + hasBuilding = true; + break; + case LLPathfindingNavMeshStatus::kComplete : + hasComplete = true; + break; + case LLPathfindingNavMeshStatus::kRepending : + hasRepending = true; + break; + default : + hasPending = true; + llassert(0); + break; + } + } + + ENavMeshZoneStatus zoneStatus = kNavMeshZoneComplete; + if (hasRepending || (hasPending && hasBuilding)) + { + zoneStatus = kNavMeshZonePendingAndBuilding; + } + else if (hasComplete) + { + if (hasPending) + { + zoneStatus = kNavMeshZoneSomePending; + } + else if (hasBuilding) + { + zoneStatus = kNavMeshZoneSomeBuilding; + } + else + { + zoneStatus = kNavMeshZoneComplete; + } + } + else if (hasPending) + { + zoneStatus = kNavMeshZonePending; + } + else if (hasBuilding) + { + zoneStatus = kNavMeshZoneBuilding; + } + + return zoneStatus; +} + void LLPathfindingNavMeshZone::handleNavMeshLocation() { updateStatus(); @@ -150,10 +216,10 @@ void LLPathfindingNavMeshZone::updateStatus() #ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE llinfos << "STINSON DEBUG: Navmesh zone update BEGIN" << llendl; #endif // XXX_STINSON_DEBUG_NAVMESH_ZONE - for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); + for (NavMeshLocationPtrs::const_iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) { - NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; + const NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; #ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE llinfos << "STINSON DEBUG: region #" << navMeshLocationPtr->getDirection() << ": region(" << navMeshLocationPtr->getRegionUUID().asString() << ") status:" << navMeshLocationPtr->getRequestStatus() << llendl; #endif // XXX_STINSON_DEBUG_NAVMESH_ZONE @@ -226,14 +292,6 @@ void LLPathfindingNavMeshZone::updateStatus() else if (hasRequestCompleted) { zoneRequestStatus = kNavMeshZoneRequestCompleted; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is stitching" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE - llassert(LLPathingLib::getInstance() != NULL); - if (LLPathingLib::getInstance() != NULL) - { - LLPathingLib::getInstance()->stitchNavMeshes( gSavedSettings.getBOOL("EnableVBOForNavMeshVisualization") ); - } #ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE llinfos << "STINSON DEBUG: Navmesh zone update is COMPLETED" << llendl; #endif // XXX_STINSON_DEBUG_NAVMESH_ZONE @@ -254,7 +312,24 @@ void LLPathfindingNavMeshZone::updateStatus() llassert(0); } - mNavMeshZoneSignal(zoneRequestStatus); + if ((mNavMeshZoneRequestStatus != kNavMeshZoneRequestCompleted) && + (zoneRequestStatus == kNavMeshZoneRequestCompleted)) + { +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is stitching" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + llassert(LLPathingLib::getInstance() != NULL); + if (LLPathingLib::getInstance() != NULL) + { + LLPathingLib::getInstance()->stitchNavMeshes( gSavedSettings.getBOOL("EnableVBOForNavMeshVisualization") ); + } +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update stitching is done" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + } + + mNavMeshZoneRequestStatus = zoneRequestStatus; + mNavMeshZoneSignal(mNavMeshZoneRequestStatus); } //--------------------------------------------------------------------------- @@ -266,6 +341,7 @@ LLPathfindingNavMeshZone::NavMeshLocation::NavMeshLocation(S32 pDirection, navme mRegionUUID(), mHasNavMesh(false), mNavMeshVersion(0U), + mNavMeshStatus(LLPathfindingNavMeshStatus::kComplete), mLocationCallback(pLocationCallback), mRequestStatus(LLPathfindingNavMesh::kNavMeshRequestUnknown), mNavMeshSlot() @@ -288,7 +364,7 @@ void LLPathfindingNavMeshZone::NavMeshLocation::enable() else { mRegionUUID = region->getRegionID(); - mNavMeshSlot = LLPathfindingManager::getInstance()->registerNavMeshListenerForRegion(region, boost::bind(&LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh, this, _1, _2, _3, _4)); + mNavMeshSlot = LLPathfindingManager::getInstance()->registerNavMeshListenerForRegion(region, boost::bind(&LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh, this, _1, _2, _3)); } } @@ -299,8 +375,9 @@ void LLPathfindingNavMeshZone::NavMeshLocation::refresh() if (region == NULL) { llassert(mRegionUUID.isNull()); + LLPathfindingNavMeshStatus newNavMeshStatus(mRegionUUID); LLSD::Binary nullData; - handleNavMesh(LLPathfindingNavMesh::kNavMeshRequestNotEnabled, mRegionUUID, 0U, nullData); + handleNavMesh(LLPathfindingNavMesh::kNavMeshRequestNotEnabled, newNavMeshStatus, nullData); } else { @@ -319,33 +396,38 @@ LLPathfindingNavMesh::ENavMeshRequestStatus LLPathfindingNavMeshZone::NavMeshLoc return mRequestStatus; } -void LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLUUID &pRegionUUID, U32 pNavMeshVersion, const LLSD::Binary &pNavMeshData) +LLPathfindingNavMeshStatus::ENavMeshStatus LLPathfindingNavMeshZone::NavMeshLocation::getNavMeshStatus() const { - llassert(mRegionUUID == pRegionUUID); - if (pNavMeshRequestStatus != LLPathfindingNavMesh::kNavMeshRequestCompleted) - { - mRequestStatus = pNavMeshRequestStatus; - mLocationCallback(); - } - else if (!mHasNavMesh || (mNavMeshVersion != pNavMeshVersion)) + return mNavMeshStatus; +} + +void LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLPathfindingNavMeshStatus &pNavMeshStatus, const LLSD::Binary &pNavMeshData) +{ + llassert(mRegionUUID == pNavMeshStatus.getRegionUUID()); + + if ((pNavMeshRequestStatus == LLPathfindingNavMesh::kNavMeshRequestCompleted) && + (!mHasNavMesh || (mNavMeshVersion != pNavMeshStatus.getVersion()))) { llassert(!pNavMeshData.empty()); - mRequestStatus = pNavMeshRequestStatus; mHasNavMesh = true; - mNavMeshVersion = pNavMeshVersion; + mNavMeshVersion = pNavMeshStatus.getVersion(); llassert(LLPathingLib::getInstance() != NULL); if (LLPathingLib::getInstance() != NULL) { LLPathingLib::getInstance()->extractNavMeshSrcFromLLSD(pNavMeshData, mDirection); } - mLocationCallback(); } + + mRequestStatus = pNavMeshRequestStatus; + mNavMeshStatus = pNavMeshStatus.getStatus(); + mLocationCallback(); } void LLPathfindingNavMeshZone::NavMeshLocation::clear() { mHasNavMesh = false; mRequestStatus = LLPathfindingNavMesh::kNavMeshRequestUnknown; + mNavMeshStatus = LLPathfindingNavMeshStatus::kComplete; if (mNavMeshSlot.connected()) { mNavMeshSlot.disconnect(); diff --git a/indra/newview/llpathfindingnavmeshzone.h b/indra/newview/llpathfindingnavmeshzone.h index 7b6583a663..7f83e9d37b 100644 --- a/indra/newview/llpathfindingnavmeshzone.h +++ b/indra/newview/llpathfindingnavmeshzone.h @@ -31,6 +31,7 @@ #include "llsd.h" #include "lluuid.h" #include "llpathfindingnavmesh.h" +#include "llpathfindingnavmeshstatus.h" #include @@ -38,6 +39,8 @@ #include #include +class LLPathfindingNavMeshStatus; + //#define XXX_STINSON_DEBUG_NAVMESH_ZONE class LLPathfindingNavMeshZone @@ -53,9 +56,18 @@ public: kNavMeshZoneRequestError } ENavMeshZoneRequestStatus; + typedef enum { + kNavMeshZonePending, + kNavMeshZoneBuilding, + kNavMeshZoneSomePending, + kNavMeshZoneSomeBuilding, + kNavMeshZonePendingAndBuilding, + kNavMeshZoneComplete + } ENavMeshZoneStatus; + typedef boost::function navmesh_zone_callback_t; typedef boost::signals2::signal navmesh_zone_signal_t; - typedef boost::signals2::connection navmesh_zone_slot_t; + typedef boost::signals2::connection navmesh_zone_slot_t; LLPathfindingNavMeshZone(); virtual ~LLPathfindingNavMeshZone(); @@ -67,6 +79,8 @@ public: void disable(); void refresh(); + ENavMeshZoneStatus getNavMeshZoneStatus() const; + protected: private: @@ -82,6 +96,7 @@ private: void disable(); LLPathfindingNavMesh::ENavMeshRequestStatus getRequestStatus() const; + LLPathfindingNavMeshStatus::ENavMeshStatus getNavMeshStatus() const; #ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE const LLUUID &getRegionUUID() const {return mRegionUUID;}; S32 getDirection() const {return mDirection;}; @@ -90,7 +105,7 @@ private: protected: private: - void handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLUUID &pRegionUUID, U32 pNavMeshVersion, const LLSD::Binary &pNavMeshData); + void handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLPathfindingNavMeshStatus &pNavMeshStatus, const LLSD::Binary &pNavMeshData); void clear(); LLViewerRegion *getRegion() const; @@ -99,6 +114,7 @@ private: LLUUID mRegionUUID; bool mHasNavMesh; U32 mNavMeshVersion; + LLPathfindingNavMeshStatus::ENavMeshStatus mNavMeshStatus; navmesh_location_callback_t mLocationCallback; LLPathfindingNavMesh::ENavMeshRequestStatus mRequestStatus; LLPathfindingNavMesh::navmesh_slot_t mNavMeshSlot; @@ -110,8 +126,9 @@ private: void handleNavMeshLocation(); void updateStatus(); - NavMeshLocationPtrs mNavMeshLocationPtrs; - navmesh_zone_signal_t mNavMeshZoneSignal; + NavMeshLocationPtrs mNavMeshLocationPtrs; + ENavMeshZoneRequestStatus mNavMeshZoneRequestStatus; + navmesh_zone_signal_t mNavMeshZoneSignal; }; #endif // LL_LLPATHFINDINGNAVMESHZONE_H diff --git a/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml b/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml index aaf94483df..0373305941 100644 --- a/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml +++ b/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml @@ -2,7 +2,7 @@ - - Cannot find pathing library implementation. - This region is not enabled for pathfinding. - Checking the status of the navmesh ... - Downloading the navmesh ... - The navmesh has changed on the server. Downloading the latest navmesh ... - Navmesh received. - Unable to download navmesh successfully. + + Cannot find pathing library implementation. + This region is not enabled for pathfinding. + Checking the status of the navmesh. + Downloading the navmesh. + The navmesh has changed on the server. Downloading the latest navmesh. + Latest navmesh has been downloaded. + Unable to download navmesh successfully. + + This region does not expose the navmesh status. + Navmesh has pending changes. + Navmesh is building. + Some navmesh regions have pending changes. + Some navmesh regions are building. + Some navmesh regions have pending changes and others are building. + Navmesh is up-to-date. Please choose start and end points. Please choose start point. Please choose end point. Path is shown in blue. - Region boundary hit, navmesh may not be accurate. Update. + Region boundary hit, navmesh may not be accurate. + width="188"> Show walkability map: - Status + Viewer status + + + + + + + + Simulator status @@ -210,7 +262,7 @@ layout="topleft" left="230" top="35" - height="305" + height="373" width="214" visible="true" /> Prevent object / terrain changes and update the navmesh: @@ -306,7 +358,7 @@ label="Freeze" layout="topleft" name="enter_frozen_mode" - top_pad="9" + top_pad="3" width="116"/> Date: Mon, 9 Apr 2012 15:48:13 -0400 Subject: Fix for path-506. Removed usevbo flag from stitchnavmesh api --- indra/newview/llpathfindingnavmeshzone.cpp | 930 ++++++++++++++--------------- 1 file changed, 465 insertions(+), 465 deletions(-) (limited to 'indra/newview/llpathfindingnavmeshzone.cpp') diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp index f871204454..4f8ca39987 100644 --- a/indra/newview/llpathfindingnavmeshzone.cpp +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -1,465 +1,465 @@ -/** - * @file llpathfindingnavmeshzone.cpp - * @author William Todd Stinson - * @brief A class for representing the zone of navmeshes containing and possible surrounding the current region. - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" -#include "llsd.h" -#include "lluuid.h" -#include "llagent.h" -#include "llviewerregion.h" -#include "llpathfindingnavmesh.h" -#include "llpathfindingnavmeshzone.h" -#include "llpathfindingmanager.h" -#include "llviewercontrol.h" - -#include "LLPathingLib.h" - -#include -#include - -#include - -#define CENTER_REGION 99 - -//--------------------------------------------------------------------------- -// LLPathfindingNavMeshZone -//--------------------------------------------------------------------------- - -LLPathfindingNavMeshZone::LLPathfindingNavMeshZone() - : mNavMeshLocationPtrs(), - mNavMeshZoneRequestStatus(kNavMeshZoneRequestUnknown), - mNavMeshZoneSignal() -{ -} - -LLPathfindingNavMeshZone::~LLPathfindingNavMeshZone() -{ -} - -LLPathfindingNavMeshZone::navmesh_zone_slot_t LLPathfindingNavMeshZone::registerNavMeshZoneListener(navmesh_zone_callback_t pNavMeshZoneCallback) -{ - return mNavMeshZoneSignal.connect(pNavMeshZoneCallback); -} - -void LLPathfindingNavMeshZone::initialize() -{ - mNavMeshLocationPtrs.clear(); - -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - LLViewerRegion *currentRegion = gAgent.getRegion(); - if (currentRegion != NULL) - { - llinfos << "STINSON DEBUG: currentRegion: '" << currentRegion->getName() << "' (" << currentRegion->getRegionID().asString() << ")" << llendl; - std::vector availableRegions; - currentRegion->getNeighboringRegionsStatus( availableRegions ); - std::vector neighborRegionsPtrs; - currentRegion->getNeighboringRegions( neighborRegionsPtrs ); - for (std::vector::const_iterator statusIter = availableRegions.begin(); - statusIter != availableRegions.end(); ++statusIter) - { - LLViewerRegion *region = neighborRegionsPtrs[statusIter - availableRegions.begin()]; - llinfos << "STINSON DEBUG: region #" << *statusIter << ": '" << region->getName() << "' (" << region->getRegionID().asString() << ")" << llendl; - } - } - -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE - NavMeshLocationPtr centerNavMeshPtr(new NavMeshLocation(CENTER_REGION, boost::bind(&LLPathfindingNavMeshZone::handleNavMeshLocation, this))); - mNavMeshLocationPtrs.push_back(centerNavMeshPtr); - - U32 neighborRegionDir = gSavedSettings.getU32("RetrieveNeighboringRegion"); - if (neighborRegionDir != CENTER_REGION) - { - NavMeshLocationPtr neighborNavMeshPtr(new NavMeshLocation(neighborRegionDir, boost::bind(&LLPathfindingNavMeshZone::handleNavMeshLocation, this))); - mNavMeshLocationPtrs.push_back(neighborNavMeshPtr); - } -} - -void LLPathfindingNavMeshZone::enable() -{ - for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); - navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) - { - NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; - navMeshLocationPtr->enable(); - } -} - -void LLPathfindingNavMeshZone::disable() -{ - for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); - navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) - { - NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; - navMeshLocationPtr->disable(); - } -} - -void LLPathfindingNavMeshZone::refresh() -{ - llassert(LLPathingLib::getInstance() != NULL); - if (LLPathingLib::getInstance() != NULL) - { - LLPathingLib::getInstance()->cleanupResidual(); - } - - for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); - navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) - { - NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; - navMeshLocationPtr->refresh(); - } -} - -LLPathfindingNavMeshZone::ENavMeshZoneStatus LLPathfindingNavMeshZone::getNavMeshZoneStatus() const -{ - bool hasPending = false; - bool hasBuilding = false; - bool hasComplete = false; - bool hasRepending = false; - - for (NavMeshLocationPtrs::const_iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); - navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) - { - const NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; - - switch (navMeshLocationPtr->getNavMeshStatus()) - { - case LLPathfindingNavMeshStatus::kPending : - hasPending = true; - break; - case LLPathfindingNavMeshStatus::kBuilding : - hasBuilding = true; - break; - case LLPathfindingNavMeshStatus::kComplete : - hasComplete = true; - break; - case LLPathfindingNavMeshStatus::kRepending : - hasRepending = true; - break; - default : - hasPending = true; - llassert(0); - break; - } - } - - ENavMeshZoneStatus zoneStatus = kNavMeshZoneComplete; - if (hasRepending || (hasPending && hasBuilding)) - { - zoneStatus = kNavMeshZonePendingAndBuilding; - } - else if (hasComplete) - { - if (hasPending) - { - zoneStatus = kNavMeshZoneSomePending; - } - else if (hasBuilding) - { - zoneStatus = kNavMeshZoneSomeBuilding; - } - else - { - zoneStatus = kNavMeshZoneComplete; - } - } - else if (hasPending) - { - zoneStatus = kNavMeshZonePending; - } - else if (hasBuilding) - { - zoneStatus = kNavMeshZoneBuilding; - } - - return zoneStatus; -} - -void LLPathfindingNavMeshZone::handleNavMeshLocation() -{ - updateStatus(); -} - -void LLPathfindingNavMeshZone::updateStatus() -{ - bool hasRequestUnknown = false; - bool hasRequestChecking = false; - bool hasRequestNeedsUpdate = false; - bool hasRequestStarted = false; - bool hasRequestCompleted = false; - bool hasRequestNotEnabled = false; - bool hasRequestError = false; - -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update BEGIN" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE - for (NavMeshLocationPtrs::const_iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); - navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) - { - const NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: region #" << navMeshLocationPtr->getDirection() << ": region(" << navMeshLocationPtr->getRegionUUID().asString() << ") status:" << navMeshLocationPtr->getRequestStatus() << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE - switch (navMeshLocationPtr->getRequestStatus()) - { - case LLPathfindingNavMesh::kNavMeshRequestUnknown : - hasRequestUnknown = true; - break; - case LLPathfindingNavMesh::kNavMeshRequestChecking : - hasRequestChecking = true; - break; - case LLPathfindingNavMesh::kNavMeshRequestNeedsUpdate : - hasRequestNeedsUpdate = true; - break; - case LLPathfindingNavMesh::kNavMeshRequestStarted : - hasRequestStarted = true; - break; - case LLPathfindingNavMesh::kNavMeshRequestCompleted : - hasRequestCompleted = true; - break; - case LLPathfindingNavMesh::kNavMeshRequestNotEnabled : - hasRequestNotEnabled = true; - break; - case LLPathfindingNavMesh::kNavMeshRequestError : - hasRequestError = true; - break; - default : - hasRequestError = true; - llassert(0); - break; - } - } - - ENavMeshZoneRequestStatus zoneRequestStatus = kNavMeshZoneRequestUnknown; - if (hasRequestNeedsUpdate) - { - zoneRequestStatus = kNavMeshZoneRequestNeedsUpdate; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is NEEDS UPDATE" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE - } - else if (hasRequestChecking) - { - zoneRequestStatus = kNavMeshZoneRequestChecking; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is CHECKING" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE - } - else if (hasRequestStarted) - { - zoneRequestStatus = kNavMeshZoneRequestStarted; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is STARTED" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE - } - else if (hasRequestError) - { - zoneRequestStatus = kNavMeshZoneRequestError; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is ERROR" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE - } - else if (hasRequestUnknown) - { - zoneRequestStatus = kNavMeshZoneRequestUnknown; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is UNKNOWN" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE - } - else if (hasRequestCompleted) - { - zoneRequestStatus = kNavMeshZoneRequestCompleted; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is COMPLETED" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE - } - else if (hasRequestNotEnabled) - { - zoneRequestStatus = kNavMeshZoneRequestNotEnabled; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is NOT ENABLED" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE - } - else - { - zoneRequestStatus = kNavMeshZoneRequestError; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is BAD ERROR" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE - llassert(0); - } - - if ((mNavMeshZoneRequestStatus != kNavMeshZoneRequestCompleted) && - (zoneRequestStatus == kNavMeshZoneRequestCompleted)) - { -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is stitching" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE - llassert(LLPathingLib::getInstance() != NULL); - if (LLPathingLib::getInstance() != NULL) - { - LLPathingLib::getInstance()->stitchNavMeshes( gSavedSettings.getBOOL("EnableVBOForNavMeshVisualization") ); - } -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update stitching is done" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE - } - - mNavMeshZoneRequestStatus = zoneRequestStatus; - mNavMeshZoneSignal(mNavMeshZoneRequestStatus); -} - -//--------------------------------------------------------------------------- -// LLPathfindingNavMeshZone::NavMeshLocation -//--------------------------------------------------------------------------- - -LLPathfindingNavMeshZone::NavMeshLocation::NavMeshLocation(S32 pDirection, navmesh_location_callback_t pLocationCallback) - : mDirection(pDirection), - mRegionUUID(), - mHasNavMesh(false), - mNavMeshVersion(0U), - mNavMeshStatus(LLPathfindingNavMeshStatus::kComplete), - mLocationCallback(pLocationCallback), - mRequestStatus(LLPathfindingNavMesh::kNavMeshRequestUnknown), - mNavMeshSlot() -{ -} - -LLPathfindingNavMeshZone::NavMeshLocation::~NavMeshLocation() -{ -} - -void LLPathfindingNavMeshZone::NavMeshLocation::enable() -{ - clear(); - - LLViewerRegion *region = getRegion(); - if (region == NULL) - { - mRegionUUID.setNull(); - } - else - { - mRegionUUID = region->getRegionID(); - mNavMeshSlot = LLPathfindingManager::getInstance()->registerNavMeshListenerForRegion(region, boost::bind(&LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh, this, _1, _2, _3)); - } -} - -void LLPathfindingNavMeshZone::NavMeshLocation::refresh() -{ - LLViewerRegion *region = getRegion(); - - if (region == NULL) - { - llassert(mRegionUUID.isNull()); - LLPathfindingNavMeshStatus newNavMeshStatus(mRegionUUID); - LLSD::Binary nullData; - handleNavMesh(LLPathfindingNavMesh::kNavMeshRequestNotEnabled, newNavMeshStatus, nullData); - } - else - { - llassert(mRegionUUID == region->getRegionID()); - LLPathfindingManager::getInstance()->requestGetNavMeshForRegion(region); - } -} - -void LLPathfindingNavMeshZone::NavMeshLocation::disable() -{ - clear(); -} - -LLPathfindingNavMesh::ENavMeshRequestStatus LLPathfindingNavMeshZone::NavMeshLocation::getRequestStatus() const -{ - return mRequestStatus; -} - -LLPathfindingNavMeshStatus::ENavMeshStatus LLPathfindingNavMeshZone::NavMeshLocation::getNavMeshStatus() const -{ - return mNavMeshStatus; -} - -void LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLPathfindingNavMeshStatus &pNavMeshStatus, const LLSD::Binary &pNavMeshData) -{ - llassert(mRegionUUID == pNavMeshStatus.getRegionUUID()); - - if ((pNavMeshRequestStatus == LLPathfindingNavMesh::kNavMeshRequestCompleted) && - (!mHasNavMesh || (mNavMeshVersion != pNavMeshStatus.getVersion()))) - { - llassert(!pNavMeshData.empty()); - mHasNavMesh = true; - mNavMeshVersion = pNavMeshStatus.getVersion(); - llassert(LLPathingLib::getInstance() != NULL); - if (LLPathingLib::getInstance() != NULL) - { - LLPathingLib::getInstance()->extractNavMeshSrcFromLLSD(pNavMeshData, mDirection); - } - } - - mRequestStatus = pNavMeshRequestStatus; - mNavMeshStatus = pNavMeshStatus.getStatus(); - mLocationCallback(); -} - -void LLPathfindingNavMeshZone::NavMeshLocation::clear() -{ - mHasNavMesh = false; - mRequestStatus = LLPathfindingNavMesh::kNavMeshRequestUnknown; - mNavMeshStatus = LLPathfindingNavMeshStatus::kComplete; - if (mNavMeshSlot.connected()) - { - mNavMeshSlot.disconnect(); - } -} - -LLViewerRegion *LLPathfindingNavMeshZone::NavMeshLocation::getRegion() const -{ - LLViewerRegion *region = NULL; - - LLViewerRegion *currentRegion = gAgent.getRegion(); - if (currentRegion != NULL) - { - if (mDirection == CENTER_REGION) - { - region = currentRegion; - } - else - { - //User wants to pull in a neighboring region - std::vector availableRegions; - currentRegion->getNeighboringRegionsStatus( availableRegions ); - //Is the desired region in the available list - std::vector::iterator foundElem = std::find(availableRegions.begin(),availableRegions.end(),mDirection); - if ( foundElem != availableRegions.end() ) - { - std::vector neighborRegionsPtrs; - currentRegion->getNeighboringRegions( neighborRegionsPtrs ); - region = neighborRegionsPtrs[foundElem - availableRegions.begin()]; - } - } - } - - return region; -} +/** + * @file llpathfindingnavmeshzone.cpp + * @author William Todd Stinson + * @brief A class for representing the zone of navmeshes containing and possible surrounding the current region. + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llsd.h" +#include "lluuid.h" +#include "llagent.h" +#include "llviewerregion.h" +#include "llpathfindingnavmesh.h" +#include "llpathfindingnavmeshzone.h" +#include "llpathfindingmanager.h" +#include "llviewercontrol.h" + +#include "LLPathingLib.h" + +#include +#include + +#include + +#define CENTER_REGION 99 + +//--------------------------------------------------------------------------- +// LLPathfindingNavMeshZone +//--------------------------------------------------------------------------- + +LLPathfindingNavMeshZone::LLPathfindingNavMeshZone() + : mNavMeshLocationPtrs(), + mNavMeshZoneRequestStatus(kNavMeshZoneRequestUnknown), + mNavMeshZoneSignal() +{ +} + +LLPathfindingNavMeshZone::~LLPathfindingNavMeshZone() +{ +} + +LLPathfindingNavMeshZone::navmesh_zone_slot_t LLPathfindingNavMeshZone::registerNavMeshZoneListener(navmesh_zone_callback_t pNavMeshZoneCallback) +{ + return mNavMeshZoneSignal.connect(pNavMeshZoneCallback); +} + +void LLPathfindingNavMeshZone::initialize() +{ + mNavMeshLocationPtrs.clear(); + +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + LLViewerRegion *currentRegion = gAgent.getRegion(); + if (currentRegion != NULL) + { + llinfos << "STINSON DEBUG: currentRegion: '" << currentRegion->getName() << "' (" << currentRegion->getRegionID().asString() << ")" << llendl; + std::vector availableRegions; + currentRegion->getNeighboringRegionsStatus( availableRegions ); + std::vector neighborRegionsPtrs; + currentRegion->getNeighboringRegions( neighborRegionsPtrs ); + for (std::vector::const_iterator statusIter = availableRegions.begin(); + statusIter != availableRegions.end(); ++statusIter) + { + LLViewerRegion *region = neighborRegionsPtrs[statusIter - availableRegions.begin()]; + llinfos << "STINSON DEBUG: region #" << *statusIter << ": '" << region->getName() << "' (" << region->getRegionID().asString() << ")" << llendl; + } + } + +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + NavMeshLocationPtr centerNavMeshPtr(new NavMeshLocation(CENTER_REGION, boost::bind(&LLPathfindingNavMeshZone::handleNavMeshLocation, this))); + mNavMeshLocationPtrs.push_back(centerNavMeshPtr); + + U32 neighborRegionDir = gSavedSettings.getU32("RetrieveNeighboringRegion"); + if (neighborRegionDir != CENTER_REGION) + { + NavMeshLocationPtr neighborNavMeshPtr(new NavMeshLocation(neighborRegionDir, boost::bind(&LLPathfindingNavMeshZone::handleNavMeshLocation, this))); + mNavMeshLocationPtrs.push_back(neighborNavMeshPtr); + } +} + +void LLPathfindingNavMeshZone::enable() +{ + for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); + navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) + { + NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; + navMeshLocationPtr->enable(); + } +} + +void LLPathfindingNavMeshZone::disable() +{ + for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); + navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) + { + NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; + navMeshLocationPtr->disable(); + } +} + +void LLPathfindingNavMeshZone::refresh() +{ + llassert(LLPathingLib::getInstance() != NULL); + if (LLPathingLib::getInstance() != NULL) + { + LLPathingLib::getInstance()->cleanupResidual(); + } + + for (NavMeshLocationPtrs::iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); + navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) + { + NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; + navMeshLocationPtr->refresh(); + } +} + +LLPathfindingNavMeshZone::ENavMeshZoneStatus LLPathfindingNavMeshZone::getNavMeshZoneStatus() const +{ + bool hasPending = false; + bool hasBuilding = false; + bool hasComplete = false; + bool hasRepending = false; + + for (NavMeshLocationPtrs::const_iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); + navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) + { + const NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; + + switch (navMeshLocationPtr->getNavMeshStatus()) + { + case LLPathfindingNavMeshStatus::kPending : + hasPending = true; + break; + case LLPathfindingNavMeshStatus::kBuilding : + hasBuilding = true; + break; + case LLPathfindingNavMeshStatus::kComplete : + hasComplete = true; + break; + case LLPathfindingNavMeshStatus::kRepending : + hasRepending = true; + break; + default : + hasPending = true; + llassert(0); + break; + } + } + + ENavMeshZoneStatus zoneStatus = kNavMeshZoneComplete; + if (hasRepending || (hasPending && hasBuilding)) + { + zoneStatus = kNavMeshZonePendingAndBuilding; + } + else if (hasComplete) + { + if (hasPending) + { + zoneStatus = kNavMeshZoneSomePending; + } + else if (hasBuilding) + { + zoneStatus = kNavMeshZoneSomeBuilding; + } + else + { + zoneStatus = kNavMeshZoneComplete; + } + } + else if (hasPending) + { + zoneStatus = kNavMeshZonePending; + } + else if (hasBuilding) + { + zoneStatus = kNavMeshZoneBuilding; + } + + return zoneStatus; +} + +void LLPathfindingNavMeshZone::handleNavMeshLocation() +{ + updateStatus(); +} + +void LLPathfindingNavMeshZone::updateStatus() +{ + bool hasRequestUnknown = false; + bool hasRequestChecking = false; + bool hasRequestNeedsUpdate = false; + bool hasRequestStarted = false; + bool hasRequestCompleted = false; + bool hasRequestNotEnabled = false; + bool hasRequestError = false; + +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update BEGIN" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + for (NavMeshLocationPtrs::const_iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); + navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) + { + const NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: region #" << navMeshLocationPtr->getDirection() << ": region(" << navMeshLocationPtr->getRegionUUID().asString() << ") status:" << navMeshLocationPtr->getRequestStatus() << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + switch (navMeshLocationPtr->getRequestStatus()) + { + case LLPathfindingNavMesh::kNavMeshRequestUnknown : + hasRequestUnknown = true; + break; + case LLPathfindingNavMesh::kNavMeshRequestChecking : + hasRequestChecking = true; + break; + case LLPathfindingNavMesh::kNavMeshRequestNeedsUpdate : + hasRequestNeedsUpdate = true; + break; + case LLPathfindingNavMesh::kNavMeshRequestStarted : + hasRequestStarted = true; + break; + case LLPathfindingNavMesh::kNavMeshRequestCompleted : + hasRequestCompleted = true; + break; + case LLPathfindingNavMesh::kNavMeshRequestNotEnabled : + hasRequestNotEnabled = true; + break; + case LLPathfindingNavMesh::kNavMeshRequestError : + hasRequestError = true; + break; + default : + hasRequestError = true; + llassert(0); + break; + } + } + + ENavMeshZoneRequestStatus zoneRequestStatus = kNavMeshZoneRequestUnknown; + if (hasRequestNeedsUpdate) + { + zoneRequestStatus = kNavMeshZoneRequestNeedsUpdate; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is NEEDS UPDATE" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + } + else if (hasRequestChecking) + { + zoneRequestStatus = kNavMeshZoneRequestChecking; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is CHECKING" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + } + else if (hasRequestStarted) + { + zoneRequestStatus = kNavMeshZoneRequestStarted; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is STARTED" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + } + else if (hasRequestError) + { + zoneRequestStatus = kNavMeshZoneRequestError; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is ERROR" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + } + else if (hasRequestUnknown) + { + zoneRequestStatus = kNavMeshZoneRequestUnknown; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is UNKNOWN" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + } + else if (hasRequestCompleted) + { + zoneRequestStatus = kNavMeshZoneRequestCompleted; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is COMPLETED" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + } + else if (hasRequestNotEnabled) + { + zoneRequestStatus = kNavMeshZoneRequestNotEnabled; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is NOT ENABLED" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + } + else + { + zoneRequestStatus = kNavMeshZoneRequestError; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is BAD ERROR" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + llassert(0); + } + + if ((mNavMeshZoneRequestStatus != kNavMeshZoneRequestCompleted) && + (zoneRequestStatus == kNavMeshZoneRequestCompleted)) + { +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is stitching" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + llassert(LLPathingLib::getInstance() != NULL); + if (LLPathingLib::getInstance() != NULL) + { + LLPathingLib::getInstance()->stitchNavMeshes(); + } +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update stitching is done" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + } + + mNavMeshZoneRequestStatus = zoneRequestStatus; + mNavMeshZoneSignal(mNavMeshZoneRequestStatus); +} + +//--------------------------------------------------------------------------- +// LLPathfindingNavMeshZone::NavMeshLocation +//--------------------------------------------------------------------------- + +LLPathfindingNavMeshZone::NavMeshLocation::NavMeshLocation(S32 pDirection, navmesh_location_callback_t pLocationCallback) + : mDirection(pDirection), + mRegionUUID(), + mHasNavMesh(false), + mNavMeshVersion(0U), + mNavMeshStatus(LLPathfindingNavMeshStatus::kComplete), + mLocationCallback(pLocationCallback), + mRequestStatus(LLPathfindingNavMesh::kNavMeshRequestUnknown), + mNavMeshSlot() +{ +} + +LLPathfindingNavMeshZone::NavMeshLocation::~NavMeshLocation() +{ +} + +void LLPathfindingNavMeshZone::NavMeshLocation::enable() +{ + clear(); + + LLViewerRegion *region = getRegion(); + if (region == NULL) + { + mRegionUUID.setNull(); + } + else + { + mRegionUUID = region->getRegionID(); + mNavMeshSlot = LLPathfindingManager::getInstance()->registerNavMeshListenerForRegion(region, boost::bind(&LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh, this, _1, _2, _3)); + } +} + +void LLPathfindingNavMeshZone::NavMeshLocation::refresh() +{ + LLViewerRegion *region = getRegion(); + + if (region == NULL) + { + llassert(mRegionUUID.isNull()); + LLPathfindingNavMeshStatus newNavMeshStatus(mRegionUUID); + LLSD::Binary nullData; + handleNavMesh(LLPathfindingNavMesh::kNavMeshRequestNotEnabled, newNavMeshStatus, nullData); + } + else + { + llassert(mRegionUUID == region->getRegionID()); + LLPathfindingManager::getInstance()->requestGetNavMeshForRegion(region); + } +} + +void LLPathfindingNavMeshZone::NavMeshLocation::disable() +{ + clear(); +} + +LLPathfindingNavMesh::ENavMeshRequestStatus LLPathfindingNavMeshZone::NavMeshLocation::getRequestStatus() const +{ + return mRequestStatus; +} + +LLPathfindingNavMeshStatus::ENavMeshStatus LLPathfindingNavMeshZone::NavMeshLocation::getNavMeshStatus() const +{ + return mNavMeshStatus; +} + +void LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLPathfindingNavMeshStatus &pNavMeshStatus, const LLSD::Binary &pNavMeshData) +{ + llassert(mRegionUUID == pNavMeshStatus.getRegionUUID()); + + if ((pNavMeshRequestStatus == LLPathfindingNavMesh::kNavMeshRequestCompleted) && + (!mHasNavMesh || (mNavMeshVersion != pNavMeshStatus.getVersion()))) + { + llassert(!pNavMeshData.empty()); + mHasNavMesh = true; + mNavMeshVersion = pNavMeshStatus.getVersion(); + llassert(LLPathingLib::getInstance() != NULL); + if (LLPathingLib::getInstance() != NULL) + { + LLPathingLib::getInstance()->extractNavMeshSrcFromLLSD(pNavMeshData, mDirection); + } + } + + mRequestStatus = pNavMeshRequestStatus; + mNavMeshStatus = pNavMeshStatus.getStatus(); + mLocationCallback(); +} + +void LLPathfindingNavMeshZone::NavMeshLocation::clear() +{ + mHasNavMesh = false; + mRequestStatus = LLPathfindingNavMesh::kNavMeshRequestUnknown; + mNavMeshStatus = LLPathfindingNavMeshStatus::kComplete; + if (mNavMeshSlot.connected()) + { + mNavMeshSlot.disconnect(); + } +} + +LLViewerRegion *LLPathfindingNavMeshZone::NavMeshLocation::getRegion() const +{ + LLViewerRegion *region = NULL; + + LLViewerRegion *currentRegion = gAgent.getRegion(); + if (currentRegion != NULL) + { + if (mDirection == CENTER_REGION) + { + region = currentRegion; + } + else + { + //User wants to pull in a neighboring region + std::vector availableRegions; + currentRegion->getNeighboringRegionsStatus( availableRegions ); + //Is the desired region in the available list + std::vector::iterator foundElem = std::find(availableRegions.begin(),availableRegions.end(),mDirection); + if ( foundElem != availableRegions.end() ) + { + std::vector neighborRegionsPtrs; + currentRegion->getNeighboringRegions( neighborRegionsPtrs ); + region = neighborRegionsPtrs[foundElem - availableRegions.begin()]; + } + } + } + + return region; +} -- cgit v1.3 From 1cdef4903daea1622923550b1328b659a594b029 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Wed, 18 Apr 2012 16:03:33 -0700 Subject: Updating to the latest llphysicextensions pre-built package with the now lowercased version of the header file names. --- autobuild.xml | 8 ++++---- indra/llprimitive/llmodel.cpp | 2 +- indra/newview/llappviewer.cpp | 2 +- indra/newview/llfloaterpathfindingconsole.cpp | 2 +- indra/newview/llfloaterpathfindingconsole.h | 2 +- indra/newview/llmeshrepository.h | 2 +- indra/newview/llpathfindingnavmeshzone.cpp | 2 +- indra/newview/llpathfindingpathtool.cpp | 2 +- indra/newview/llpathfindingpathtool.h | 2 +- indra/newview/pipeline.cpp | 2 +- 10 files changed, 13 insertions(+), 13 deletions(-) (limited to 'indra/newview/llpathfindingnavmeshzone.cpp') diff --git a/autobuild.xml b/autobuild.xml index 6833401ec9..0072ff9eb1 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -1122,9 +1122,9 @@ archive hash - 92b2ffc0f0cfe8567f3c33c61d68d500 + 06446d6e1afa0f796473e75ba92190f3 url - http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/stinson_llpathinglibrary/rev/254001/arch/Linux/installer/llphysicsextensions-0.1-linux-20120417.tar.bz2 + http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/stinson_llpathinglibrary/rev/254110/arch/Linux/installer/llphysicsextensions-0.1-linux-20120418.tar.bz2 name linux @@ -1134,9 +1134,9 @@ archive hash - 4533982dc840a35682d06909222f059e + f187c07e492ee0e011d1efe64dc766ef url - http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/stinson_llpathinglibrary/rev/254001/arch/CYGWIN/installer/llphysicsextensions-0.1-windows-20120416.tar.bz2 + http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/stinson_llpathinglibrary/rev/254110/arch/CYGWIN/installer/llphysicsextensions-0.1-windows-20120418.tar.bz2 name windows diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index 768d3a6ae8..cb32a510b8 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -28,7 +28,7 @@ #include "llmodel.h" #include "llmemory.h" -#include "LLConvexDecomposition.h" +#include "llconvexdecomposition.h" #include "llsdserialize.h" #include "llvector4a.h" #if LL_MSVC diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index c1217fc402..b7afea89ce 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -106,7 +106,7 @@ #include "llvfsthread.h" #include "llvolumemgr.h" #include "llxfermanager.h" -#include "LLPhysicsExtensions.h" +#include "llphysicsextensions.h" #include "llnotificationmanager.h" #include "llnotifications.h" diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index fec26f9722..59f72edc61 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -48,7 +48,7 @@ #include "lltoolmgr.h" #include "lltoolfocus.h" -#include "LLPathingLib.h" +#include "llpathinglib.h" #define XUI_RENDER_HEATMAP_NONE 0 #define XUI_RENDER_HEATMAP_A 1 diff --git a/indra/newview/llfloaterpathfindingconsole.h b/indra/newview/llfloaterpathfindingconsole.h index 7e0f8a4eaa..ff8a1d5517 100644 --- a/indra/newview/llfloaterpathfindingconsole.h +++ b/indra/newview/llfloaterpathfindingconsole.h @@ -30,7 +30,7 @@ #include "llfloater.h" #include "llhandle.h" -#include "LLPathingLib.h" +#include "llpathinglib.h" #include "llpathfindingmanager.h" #include "llpathfindingnavmeshzone.h" #include "llpathfindingpathtool.h" diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h index 4139b9725b..da81bb057b 100644 --- a/indra/newview/llmeshrepository.h +++ b/indra/newview/llmeshrepository.h @@ -35,7 +35,7 @@ #define LLCONVEXDECOMPINTER_STATIC 1 -#include "LLConvexDecomposition.h" +#include "llconvexdecomposition.h" #include "lluploadfloaterobservers.h" class LLVOVolume; diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp index 4f8ca39987..9c7b493701 100644 --- a/indra/newview/llpathfindingnavmeshzone.cpp +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -35,7 +35,7 @@ #include "llpathfindingmanager.h" #include "llviewercontrol.h" -#include "LLPathingLib.h" +#include "llpathinglib.h" #include #include diff --git a/indra/newview/llpathfindingpathtool.cpp b/indra/newview/llpathfindingpathtool.cpp index 23fdd43b0b..04ea400090 100644 --- a/indra/newview/llpathfindingpathtool.cpp +++ b/indra/newview/llpathfindingpathtool.cpp @@ -32,7 +32,7 @@ #include "llviewerwindow.h" #include "llviewercamera.h" #include "llpathfindingmanager.h" -#include "LLPathingLib.h" +#include "llpathinglib.h" #include #include diff --git a/indra/newview/llpathfindingpathtool.h b/indra/newview/llpathfindingpathtool.h index fd55dd8335..492304e4a4 100644 --- a/indra/newview/llpathfindingpathtool.h +++ b/indra/newview/llpathfindingpathtool.h @@ -30,7 +30,7 @@ #include "llsingleton.h" #include "lltool.h" -#include "LLPathingLib.h" +#include "llpathinglib.h" #include #include diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index f069c1f06a..9120d0efa2 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -104,7 +104,7 @@ #include "lltoolpie.h" #include "llcurl.h" #include "llnotifications.h" -#include "LLPathingLib.h" +#include "llpathinglib.h" #include "llfloaterpathfindingconsole.h" #include "llpathfindingpathtool.h" -- cgit v1.3 From a72034fa42ebaf7e2f56c4a8cb0f445f12d22fe4 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 24 Apr 2012 19:23:20 -0700 Subject: PATH-580: BUGFIX Adding functionality to detect when the region's capabilities have not yet been loading and deferring requests for the navmesh query until the capabilities are fully loaded. --- indra/newview/llfloaterpathfindingconsole.cpp | 9 + indra/newview/llfloaterpathfindingconsole.h | 1 + indra/newview/llpathfindingmanager.cpp | 1984 ++++++++++---------- indra/newview/llpathfindingmanager.h | 289 +-- indra/newview/llpathfindingnavmesh.cpp | 396 ++-- indra/newview/llpathfindingnavmesh.h | 193 +- indra/newview/llpathfindingnavmeshzone.cpp | 13 +- indra/newview/llpathfindingnavmeshzone.h | 270 +-- .../default/xui/en/floater_pathfinding_console.xml | 1 + 9 files changed, 1606 insertions(+), 1550 deletions(-) (limited to 'indra/newview/llpathfindingnavmeshzone.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index e89d0c2cab..ca78042c2b 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -605,6 +605,9 @@ void LLFloaterPathfindingConsole::onNavMeshZoneCB(LLPathfindingNavMeshZone::ENav case LLPathfindingNavMeshZone::kNavMeshZoneRequestUnknown : setConsoleState(kConsoleStateUnknown); break; + case LLPathfindingNavMeshZone::kNavMeshZoneRequestWaiting : + setConsoleState(kConsoleStateRegionLoading); + break; case LLPathfindingNavMeshZone::kNavMeshZoneRequestChecking : setConsoleState(kConsoleStateCheckingVersion); break; @@ -723,6 +726,7 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() { case kConsoleStateUnknown : case kConsoleStateRegionNotEnabled : + case kConsoleStateRegionLoading : mShowLabel->setEnabled(FALSE); mShowWorldCheckBox->setEnabled(FALSE); mShowWorldMovablesOnlyCheckBox->setEnabled(FALSE); @@ -857,6 +861,11 @@ void LLFloaterPathfindingConsole::updateStatusOnConsoleState() viewerStatusText = getString("navmesh_viewer_status_region_not_enabled"); viewerStyleParams.color = errorColor; break; + case kConsoleStateRegionLoading : + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + viewerStatusText = getString("navmesh_viewer_status_region_loading"); + viewerStyleParams.color = warningColor; + break; case kConsoleStateCheckingVersion : simulatorStatusText = getString("navmesh_simulator_status_unknown"); viewerStatusText = getString("navmesh_viewer_status_checking_version"); diff --git a/indra/newview/llfloaterpathfindingconsole.h b/indra/newview/llfloaterpathfindingconsole.h index fcb13955c3..3fdadfafad 100644 --- a/indra/newview/llfloaterpathfindingconsole.h +++ b/indra/newview/llfloaterpathfindingconsole.h @@ -103,6 +103,7 @@ private: kConsoleStateUnknown, kConsoleStateLibraryNotImplemented, kConsoleStateRegionNotEnabled, + kConsoleStateRegionLoading, kConsoleStateCheckingVersion, kConsoleStateDownloading, kConsoleStateHasNavMesh, diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index cefff175a3..e754e77588 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -1,982 +1,1002 @@ -/** - * @file llpathfindingmanager.cpp - * @author William Todd Stinson - * @brief A state manager for the various pathfinding states. - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include -#include - -#include "llviewerprecompiledheaders.h" -#include "llsd.h" -#include "lluuid.h" -#include "llpathfindingmanager.h" -#include "llsingleton.h" -#include "llhttpclient.h" -#include "llagent.h" -#include "llviewerregion.h" -#include "llpathfindingnavmesh.h" -#include "llpathfindingnavmeshstatus.h" -#include "llpathfindinglinkset.h" -#include "llpathfindinglinksetlist.h" -#include "llpathfindingcharacterlist.h" -#include "llhttpnode.h" - -#include -#include - -#define CAP_SERVICE_RETRIEVE_NAVMESH "RetrieveNavMeshSrc" - -#define CAP_SERVICE_NAVMESH_STATUS "NavMeshGenerationStatus" - -#define CAP_SERVICE_AGENT_STATE "AgentPreferences" -#define ALTER_NAVMESH_OBJECTS_FIELD "alter_navmesh_objects" -#define DEPRECATED_ALTER_NAVMESH_OBJECTS_FIELD "alter_permanent_objects" - -#define CAP_SERVICE_OBJECT_LINKSETS "ObjectNavMeshProperties" -#define CAP_SERVICE_TERRAIN_LINKSETS "TerrainNavMeshProperties" - -#define CAP_SERVICE_CHARACTERS "CharacterProperties" - -#define SIM_MESSAGE_NAVMESH_STATUS_UPDATE "/message/NavMeshStatusUpdate" -#define SIM_MESSAGE_AGENT_STATE_UPDATE "/message/AgentPreferencesUpdate" -#define SIM_MESSAGE_BODY_FIELD "body" - -//--------------------------------------------------------------------------- -// LLNavMeshSimStateChangeNode -//--------------------------------------------------------------------------- - -class LLNavMeshSimStateChangeNode : public LLHTTPNode -{ -public: - virtual void post(ResponsePtr pResponse, const LLSD &pContext, const LLSD &pInput) const; -}; - -LLHTTPRegistration gHTTPRegistrationNavMeshSimStateChangeNode(SIM_MESSAGE_NAVMESH_STATUS_UPDATE); - -//--------------------------------------------------------------------------- -// LLAgentStateChangeNode -//--------------------------------------------------------------------------- - -class LLAgentStateChangeNode : public LLHTTPNode -{ -public: - virtual void post(ResponsePtr pResponse, const LLSD &pContext, const LLSD &pInput) const; -}; - -LLHTTPRegistration gHTTPRegistrationAgentStateChangeNode(SIM_MESSAGE_AGENT_STATE_UPDATE); - -//--------------------------------------------------------------------------- -// NavMeshStatusResponder -//--------------------------------------------------------------------------- - -class NavMeshStatusResponder : public LLHTTPClient::Responder -{ -public: - NavMeshStatusResponder(const std::string &pCapabilityURL, LLViewerRegion *pRegion); - virtual ~NavMeshStatusResponder(); - - virtual void result(const LLSD &pContent); - virtual void error(U32 pStatus, const std::string& pReason); - -protected: - -private: - std::string mCapabilityURL; - LLViewerRegion *mRegion; - LLUUID mRegionUUID; -}; - -//--------------------------------------------------------------------------- -// NavMeshResponder -//--------------------------------------------------------------------------- - -class NavMeshResponder : public LLHTTPClient::Responder -{ -public: - NavMeshResponder(const std::string &pCapabilityURL, U32 pNavMeshVersion, LLPathfindingNavMeshPtr pNavMeshPtr); - virtual ~NavMeshResponder(); - - virtual void result(const LLSD &pContent); - virtual void error(U32 pStatus, const std::string& pReason); - -protected: - -private: - std::string mCapabilityURL; - U32 mNavMeshVersion; - LLPathfindingNavMeshPtr mNavMeshPtr; -}; - -//--------------------------------------------------------------------------- -// AgentStateResponder -//--------------------------------------------------------------------------- - -class AgentStateResponder : public LLHTTPClient::Responder -{ -public: - AgentStateResponder(const std::string &pCapabilityURL, LLPathfindingManager::EAgentState pRequestedAgentState = LLPathfindingManager::kAgentStateUnknown); - virtual ~AgentStateResponder(); - - virtual void result(const LLSD &pContent); - virtual void error(U32 pStatus, const std::string& pReason); - -protected: - -private: - std::string mCapabilityURL; - LLPathfindingManager::EAgentState mRequestedAgentState; -}; - -//--------------------------------------------------------------------------- -// LinksetsResponder -//--------------------------------------------------------------------------- - -class LinksetsResponder -{ -public: - LinksetsResponder(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::linksets_callback_t pLinksetsCallback, bool pIsObjectRequested, bool pIsTerrainRequested); - virtual ~LinksetsResponder(); - - void handleObjectLinksetsResult(const LLSD &pContent); - void handleObjectLinksetsError(U32 pStatus, const std::string &pReason, const std::string &pURL); - void handleTerrainLinksetsResult(const LLSD &pContent); - void handleTerrainLinksetsError(U32 pStatus, const std::string &pReason, const std::string &pURL); - -protected: - -private: - void sendCallback(); - - typedef enum - { - kNotRequested, - kWaiting, - kReceivedGood, - kReceivedError - } EMessagingState; - - LLPathfindingManager::request_id_t mRequestId; - LLPathfindingManager::linksets_callback_t mLinksetsCallback; - - EMessagingState mObjectMessagingState; - EMessagingState mTerrainMessagingState; - - LLPathfindingLinksetListPtr mObjectLinksetListPtr; - LLPathfindingLinksetPtr mTerrainLinksetPtr; -}; - -typedef boost::shared_ptr LinksetsResponderPtr; - -//--------------------------------------------------------------------------- -// ObjectLinksetsResponder -//--------------------------------------------------------------------------- - -class ObjectLinksetsResponder : public LLHTTPClient::Responder -{ -public: - ObjectLinksetsResponder(const std::string &pCapabilityURL, LinksetsResponderPtr pLinksetsResponsderPtr); - virtual ~ObjectLinksetsResponder(); - - virtual void result(const LLSD &pContent); - virtual void error(U32 pStatus, const std::string &pReason); - -protected: - -private: - std::string mCapabilityURL; - LinksetsResponderPtr mLinksetsResponsderPtr; -}; - -//--------------------------------------------------------------------------- -// TerrainLinksetsResponder -//--------------------------------------------------------------------------- - -class TerrainLinksetsResponder : public LLHTTPClient::Responder -{ -public: - TerrainLinksetsResponder(const std::string &pCapabilityURL, LinksetsResponderPtr pLinksetsResponsderPtr); - virtual ~TerrainLinksetsResponder(); - - virtual void result(const LLSD &pContent); - virtual void error(U32 pStatus, const std::string &pReason); - -protected: - -private: - std::string mCapabilityURL; - LinksetsResponderPtr mLinksetsResponsderPtr; -}; - -//--------------------------------------------------------------------------- -// CharactersResponder -//--------------------------------------------------------------------------- - -class CharactersResponder : public LLHTTPClient::Responder -{ -public: - CharactersResponder(const std::string &pCapabilityURL, LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::characters_callback_t pCharactersCallback); - virtual ~CharactersResponder(); - - virtual void result(const LLSD &pContent); - virtual void error(U32 pStatus, const std::string &pReason); - -protected: - -private: - std::string mCapabilityURL; - LLPathfindingManager::request_id_t mRequestId; - LLPathfindingManager::characters_callback_t mCharactersCallback; -}; - -//--------------------------------------------------------------------------- -// LLPathfindingManager -//--------------------------------------------------------------------------- - -LLPathfindingManager::LLPathfindingManager() - : LLSingleton(), - mNavMeshMap(), - mAgentStateSignal(), - mAgentState(kAgentStateUnknown), - mLastKnownNonErrorAgentState(kAgentStateUnknown) -{ -} - -LLPathfindingManager::~LLPathfindingManager() -{ -} - -bool LLPathfindingManager::isPathfindingEnabledForCurrentRegion() const -{ - return isPathfindingEnabledForRegion(getCurrentRegion()); -} - -bool LLPathfindingManager::isPathfindingEnabledForRegion(LLViewerRegion *pRegion) const -{ - std::string retrieveNavMeshURL = getRetrieveNavMeshURLForRegion(pRegion); - return !retrieveNavMeshURL.empty(); -} - -#ifdef DEPRECATED_UNVERSIONED_NAVMESH -bool LLPathfindingManager::isPathfindingNavMeshVersioningEnabledForCurrentRegionXXX() const -{ - std::string navMeshStatusURL = getNavMeshStatusURLForRegion(getCurrentRegion()); - return !navMeshStatusURL.empty(); -} -#endif // DEPRECATED_UNVERSIONED_NAVMESH - -bool LLPathfindingManager::isAllowAlterPermanent() -{ - return (!isPathfindingEnabledForCurrentRegion() || (getAgentState() == kAgentStateUnfrozen)); -} - -bool LLPathfindingManager::isAllowViewTerrainProperties() const -{ - LLViewerRegion* region = getCurrentRegion(); - return (gAgent.isGodlike() || ((region != NULL) && region->canManageEstate())); -} - -LLPathfindingNavMesh::navmesh_slot_t LLPathfindingManager::registerNavMeshListenerForRegion(LLViewerRegion *pRegion, LLPathfindingNavMesh::navmesh_callback_t pNavMeshCallback) -{ - LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pRegion); - return navMeshPtr->registerNavMeshListener(pNavMeshCallback); -} - -void LLPathfindingManager::requestGetNavMeshForRegion(LLViewerRegion *pRegion) -{ - LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pRegion); - - if ((pRegion == NULL) || !isPathfindingEnabledForRegion(pRegion)) - { - navMeshPtr->handleNavMeshNotEnabled(); - } - else - { - std::string navMeshStatusURL = getNavMeshStatusURLForRegion(pRegion); -#ifdef DEPRECATED_UNVERSIONED_NAVMESH - if (navMeshStatusURL.empty()) - { - LLPathfindingNavMeshStatus navMeshStatus = navMeshPtr->getNavMeshStatusXXX(); - navMeshStatus.incrementNavMeshVersionXXX(); - sendRequestGetNavMeshForRegion(navMeshPtr, pRegion, navMeshStatus); - } - else - { - navMeshPtr->handleNavMeshCheckVersion(); - LLHTTPClient::ResponderPtr navMeshStatusResponder = new NavMeshStatusResponder(navMeshStatusURL, pRegion); - LLHTTPClient::get(navMeshStatusURL, navMeshStatusResponder); - } -#else // DEPRECATED_UNVERSIONED_NAVMESH - llassert(!navMeshStatusURL.empty()); - navMeshPtr->handleNavMeshCheckVersion(); - LLHTTPClient::ResponderPtr navMeshStatusResponder = new NavMeshStatusResponder(navMeshStatusURL, pRegion); - LLHTTPClient::get(navMeshStatusURL, navMeshStatusResponder); -#endif // DEPRECATED_UNVERSIONED_NAVMESH - } -} - -LLPathfindingManager::agent_state_slot_t LLPathfindingManager::registerAgentStateListener(agent_state_callback_t pAgentStateCallback) -{ - return mAgentStateSignal.connect(pAgentStateCallback); -} - -LLPathfindingManager::EAgentState LLPathfindingManager::getAgentState() -{ - if (!isPathfindingEnabledForCurrentRegion()) - { - setAgentState(kAgentStateNotEnabled); - } - else - { - if (!isValidAgentState(mAgentState)) - { - requestGetAgentState(); - } - } - - return mAgentState; -} - -LLPathfindingManager::EAgentState LLPathfindingManager::getLastKnownNonErrorAgentState() const -{ - return mLastKnownNonErrorAgentState; -} - -void LLPathfindingManager::requestSetAgentState(EAgentState pRequestedAgentState) -{ - llassert(isValidAgentState(pRequestedAgentState)); - std::string agentStateURL = getAgentStateURLForCurrentRegion(); - - if (agentStateURL.empty()) - { - setAgentState(kAgentStateNotEnabled); - } - else - { - LLSD request; - request[ALTER_NAVMESH_OBJECTS_FIELD] = static_cast(pRequestedAgentState == kAgentStateUnfrozen); -#ifdef DEPRECATED_ALTER_NAVMESH_OBJECTS_FIELD - request[DEPRECATED_ALTER_NAVMESH_OBJECTS_FIELD] = static_cast(pRequestedAgentState == kAgentStateUnfrozen); -#endif // DEPRECATED_ALTER_NAVMESH_OBJECTS_FIELD - - LLHTTPClient::ResponderPtr responder = new AgentStateResponder(agentStateURL, pRequestedAgentState); - LLHTTPClient::post(agentStateURL, request, responder); - } -} - -LLPathfindingManager::ERequestStatus LLPathfindingManager::requestGetLinksets(request_id_t pRequestId, linksets_callback_t pLinksetsCallback) const -{ - ERequestStatus status; - - std::string objectLinksetsURL = getObjectLinksetsURLForCurrentRegion(); - std::string terrainLinksetsURL = getTerrainLinksetsURLForCurrentRegion(); - if (objectLinksetsURL.empty() || terrainLinksetsURL.empty()) - { - status = kRequestNotEnabled; - } - else - { - bool doRequestTerrain = isAllowViewTerrainProperties(); - LinksetsResponderPtr linksetsResponderPtr(new LinksetsResponder(pRequestId, pLinksetsCallback, true, doRequestTerrain)); - - LLHTTPClient::ResponderPtr objectLinksetsResponder = new ObjectLinksetsResponder(objectLinksetsURL, linksetsResponderPtr); - LLHTTPClient::get(objectLinksetsURL, objectLinksetsResponder); - - if (doRequestTerrain) - { - LLHTTPClient::ResponderPtr terrainLinksetsResponder = new TerrainLinksetsResponder(terrainLinksetsURL, linksetsResponderPtr); - LLHTTPClient::get(terrainLinksetsURL, terrainLinksetsResponder); - } - - status = kRequestStarted; - } - - return status; -} - -LLPathfindingManager::ERequestStatus LLPathfindingManager::requestSetLinksets(request_id_t pRequestId, LLPathfindingLinksetListPtr pLinksetList, LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD, linksets_callback_t pLinksetsCallback) const -{ - ERequestStatus status = kRequestNotEnabled; - - std::string objectLinksetsURL = getObjectLinksetsURLForCurrentRegion(); - std::string terrainLinksetsURL = getTerrainLinksetsURLForCurrentRegion(); - if (objectLinksetsURL.empty() || terrainLinksetsURL.empty()) - { - status = kRequestNotEnabled; - } - else - { - LLSD objectPostData = pLinksetList->encodeObjectFields(pLinksetUse, pA, pB, pC, pD); - LLSD terrainPostData; - if (isAllowViewTerrainProperties()) - { - terrainPostData = pLinksetList->encodeTerrainFields(pLinksetUse, pA, pB, pC, pD); - } - - if (objectPostData.isUndefined() && terrainPostData.isUndefined()) - { - status = kRequestCompleted; - } - else - { - LinksetsResponderPtr linksetsResponderPtr(new LinksetsResponder(pRequestId, pLinksetsCallback, !objectPostData.isUndefined(), !terrainPostData.isUndefined())); - - if (!objectPostData.isUndefined()) - { - LLHTTPClient::ResponderPtr objectLinksetsResponder = new ObjectLinksetsResponder(objectLinksetsURL, linksetsResponderPtr); - LLHTTPClient::put(objectLinksetsURL, objectPostData, objectLinksetsResponder); - } - - if (!terrainPostData.isUndefined()) - { - LLHTTPClient::ResponderPtr terrainLinksetsResponder = new TerrainLinksetsResponder(terrainLinksetsURL, linksetsResponderPtr); - LLHTTPClient::put(terrainLinksetsURL, terrainPostData, terrainLinksetsResponder); - } - - status = kRequestStarted; - } - } - - return status; -} - -LLPathfindingManager::ERequestStatus LLPathfindingManager::requestGetCharacters(request_id_t pRequestId, characters_callback_t pCharactersCallback) const -{ - ERequestStatus status; - - std::string charactersURL = getCharactersURLForCurrentRegion(); - if (charactersURL.empty()) - { - status = kRequestNotEnabled; - } - else - { - LLHTTPClient::ResponderPtr charactersResponder = new CharactersResponder(charactersURL, pRequestId, pCharactersCallback); - LLHTTPClient::get(charactersURL, charactersResponder); - - status = kRequestStarted; - } - - return status; -} - -void LLPathfindingManager::sendRequestGetNavMeshForRegion(LLPathfindingNavMeshPtr navMeshPtr, LLViewerRegion *pRegion, const LLPathfindingNavMeshStatus &pNavMeshStatus) -{ - if ((pRegion == NULL) || !pRegion->isAlive()) - { - navMeshPtr->handleNavMeshNotEnabled(); - } - else - { - std::string navMeshURL = getRetrieveNavMeshURLForRegion(pRegion); - - if (navMeshURL.empty()) - { - navMeshPtr->handleNavMeshNotEnabled(); - } - else - { - navMeshPtr->handleNavMeshStart(pNavMeshStatus); - LLHTTPClient::ResponderPtr responder = new NavMeshResponder(navMeshURL, pNavMeshStatus.getVersion(), navMeshPtr); - - LLSD postData; - LLHTTPClient::post(navMeshURL, postData, responder); - } - } -} - -void LLPathfindingManager::handleNavMeshStatusRequest(const LLPathfindingNavMeshStatus &pNavMeshStatus, LLViewerRegion *pRegion) -{ - LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pNavMeshStatus.getRegionUUID()); - - if (!pNavMeshStatus.isValid()) - { - navMeshPtr->handleNavMeshError(); - } - else - { - if (navMeshPtr->hasNavMeshVersion(pNavMeshStatus)) - { - navMeshPtr->handleRefresh(pNavMeshStatus); - } - else - { - sendRequestGetNavMeshForRegion(navMeshPtr, pRegion, pNavMeshStatus); - } - } -} - -void LLPathfindingManager::handleNavMeshStatusUpdate(const LLPathfindingNavMeshStatus &pNavMeshStatus) -{ - LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pNavMeshStatus.getRegionUUID()); - - if (!pNavMeshStatus.isValid()) - { - navMeshPtr->handleNavMeshError(); - } - else - { - navMeshPtr->handleNavMeshNewVersion(pNavMeshStatus); - } -} - -LLPathfindingNavMeshPtr LLPathfindingManager::getNavMeshForRegion(const LLUUID &pRegionUUID) -{ - LLPathfindingNavMeshPtr navMeshPtr; - NavMeshMap::iterator navMeshIter = mNavMeshMap.find(pRegionUUID); - if (navMeshIter == mNavMeshMap.end()) - { - navMeshPtr = LLPathfindingNavMeshPtr(new LLPathfindingNavMesh(pRegionUUID)); - mNavMeshMap.insert(std::pair(pRegionUUID, navMeshPtr)); - } - else - { - navMeshPtr = navMeshIter->second; - } - - return navMeshPtr; -} - -LLPathfindingNavMeshPtr LLPathfindingManager::getNavMeshForRegion(LLViewerRegion *pRegion) -{ - LLUUID regionUUID; - if (pRegion != NULL) - { - regionUUID = pRegion->getRegionID(); - } - - return getNavMeshForRegion(regionUUID); -} - -bool LLPathfindingManager::isValidAgentState(EAgentState pAgentState) -{ - return ((pAgentState == kAgentStateFrozen) || (pAgentState == kAgentStateUnfrozen)); -} - -void LLPathfindingManager::requestGetAgentState() -{ - std::string agentStateURL = getAgentStateURLForCurrentRegion(); - - if (agentStateURL.empty()) - { - setAgentState(kAgentStateNotEnabled); - } - else - { - LLHTTPClient::ResponderPtr responder = new AgentStateResponder(agentStateURL); - LLHTTPClient::get(agentStateURL, responder); - } -} - -void LLPathfindingManager::setAgentState(EAgentState pAgentState) -{ - mAgentState = pAgentState; - - if (mAgentState != kAgentStateError) - { - mLastKnownNonErrorAgentState = mAgentState; - } - - mAgentStateSignal(mAgentState); -} - -void LLPathfindingManager::handleAgentStateResult(const LLSD &pContent, EAgentState pRequestedAgentState) -{ -#ifndef DEPRECATED_ALTER_NAVMESH_OBJECTS_FIELD - llassert(pContent.has(ALTER_NAVMESH_OBJECTS_FIELD)); - llassert(pContent.get(ALTER_NAVMESH_OBJECTS_FIELD).isBoolean()); - EAgentState agentState = (pContent.get(ALTER_NAVMESH_OBJECTS_FIELD).asBoolean() ? kAgentStateUnfrozen : kAgentStateFrozen); -#else // DEPRECATED_ALTER_NAVMESH_OBJECTS_FIELD - EAgentState agentState = kAgentStateUnknown; - if (pContent.has(ALTER_NAVMESH_OBJECTS_FIELD)) - { - llassert(pContent.get(ALTER_NAVMESH_OBJECTS_FIELD).isBoolean()); - agentState = (pContent.get(ALTER_NAVMESH_OBJECTS_FIELD).asBoolean() ? kAgentStateUnfrozen : kAgentStateFrozen); - } - else - { - llassert(pContent.has(DEPRECATED_ALTER_NAVMESH_OBJECTS_FIELD)); - llassert(pContent.get(DEPRECATED_ALTER_NAVMESH_OBJECTS_FIELD).isBoolean()); - agentState = (pContent.get(DEPRECATED_ALTER_NAVMESH_OBJECTS_FIELD).asBoolean() ? kAgentStateUnfrozen : kAgentStateFrozen); - } -#endif // DEPRECATED_ALTER_NAVMESH_OBJECTS_FIELD - - if (isValidAgentState(pRequestedAgentState) && (agentState != pRequestedAgentState)) - { - agentState = kAgentStateError; - llassert(0); - } - - setAgentState(agentState); -} - -void LLPathfindingManager::handleAgentStateError(U32 pStatus, const std::string &pReason, const std::string &pURL) -{ - llwarns << "error with request to URL '" << pURL << "' because " << pReason << " (statusCode:" << pStatus << ")" << llendl; - setAgentState(kAgentStateError); -} - -void LLPathfindingManager::handleAgentStateUpdate(const LLSD &pContent) -{ - llassert(pContent.has(ALTER_NAVMESH_OBJECTS_FIELD)); - llassert(pContent.get(ALTER_NAVMESH_OBJECTS_FIELD).isBoolean()); - EAgentState agentState = (pContent.get(ALTER_NAVMESH_OBJECTS_FIELD).asBoolean() ? kAgentStateUnfrozen : kAgentStateFrozen); - - setAgentState(agentState); -} - -std::string LLPathfindingManager::getNavMeshStatusURLForRegion(LLViewerRegion *pRegion) const -{ - return getCapabilityURLForRegion(pRegion, CAP_SERVICE_NAVMESH_STATUS); -} - -std::string LLPathfindingManager::getRetrieveNavMeshURLForRegion(LLViewerRegion *pRegion) const -{ - return getCapabilityURLForRegion(pRegion, CAP_SERVICE_RETRIEVE_NAVMESH); -} - -std::string LLPathfindingManager::getAgentStateURLForCurrentRegion() const -{ - return getCapabilityURLForCurrentRegion(CAP_SERVICE_AGENT_STATE); -} - -std::string LLPathfindingManager::getObjectLinksetsURLForCurrentRegion() const -{ - return getCapabilityURLForCurrentRegion(CAP_SERVICE_OBJECT_LINKSETS); -} - -std::string LLPathfindingManager::getTerrainLinksetsURLForCurrentRegion() const -{ - return getCapabilityURLForCurrentRegion(CAP_SERVICE_TERRAIN_LINKSETS); -} - -std::string LLPathfindingManager::getCharactersURLForCurrentRegion() const -{ - return getCapabilityURLForCurrentRegion(CAP_SERVICE_CHARACTERS); -} - -std::string LLPathfindingManager::getCapabilityURLForCurrentRegion(const std::string &pCapabilityName) const -{ - return getCapabilityURLForRegion(getCurrentRegion(), pCapabilityName); -} - -std::string LLPathfindingManager::getCapabilityURLForRegion(LLViewerRegion *pRegion, const std::string &pCapabilityName) const -{ - std::string capabilityURL(""); - - if (pRegion != NULL) - { - capabilityURL = pRegion->getCapability(pCapabilityName); - } - - if (capabilityURL.empty()) - { - llwarns << "cannot find capability '" << pCapabilityName << "' for current region '" - << ((pRegion != NULL) ? pRegion->getName() : "") << "'" << llendl; - } - - return capabilityURL; -} - -LLViewerRegion *LLPathfindingManager::getCurrentRegion() const -{ - return gAgent.getRegion(); -} - -//--------------------------------------------------------------------------- -// LLNavMeshSimStateChangeNode -//--------------------------------------------------------------------------- - -void LLNavMeshSimStateChangeNode::post(ResponsePtr pResponse, const LLSD &pContext, const LLSD &pInput) const -{ -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Received NavMeshStatusUpdate: " << pInput << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE - llassert(pInput.has(SIM_MESSAGE_BODY_FIELD)); - llassert(pInput.get(SIM_MESSAGE_BODY_FIELD).isMap()); - LLPathfindingNavMeshStatus navMeshStatus(pInput.get(SIM_MESSAGE_BODY_FIELD)); - LLPathfindingManager::getInstance()->handleNavMeshStatusUpdate(navMeshStatus); -} - -//--------------------------------------------------------------------------- -// LLAgentStateChangeNode -//--------------------------------------------------------------------------- - -void LLAgentStateChangeNode::post(ResponsePtr pResponse, const LLSD &pContext, const LLSD &pInput) const -{ -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Received AgentPreferencesUpdate: " << pInput << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE - llassert(pInput.has(SIM_MESSAGE_BODY_FIELD)); - llassert(pInput.get(SIM_MESSAGE_BODY_FIELD).isMap()); - LLPathfindingManager::getInstance()->handleAgentStateUpdate(pInput.get(SIM_MESSAGE_BODY_FIELD)); -} - -//--------------------------------------------------------------------------- -// NavMeshStatusResponder -//--------------------------------------------------------------------------- - -NavMeshStatusResponder::NavMeshStatusResponder(const std::string &pCapabilityURL, LLViewerRegion *pRegion) - : LLHTTPClient::Responder(), - mCapabilityURL(pCapabilityURL), - mRegion(pRegion), - mRegionUUID() -{ - if (mRegion != NULL) - { - mRegionUUID = mRegion->getRegionID(); - } -} - -NavMeshStatusResponder::~NavMeshStatusResponder() -{ -} - -void NavMeshStatusResponder::result(const LLSD &pContent) -{ -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Received requested NavMeshStatus: " << pContent << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE - LLPathfindingNavMeshStatus navMeshStatus(mRegionUUID, pContent); - LLPathfindingManager::getInstance()->handleNavMeshStatusRequest(navMeshStatus, mRegion); -} - -void NavMeshStatusResponder::error(U32 pStatus, const std::string& pReason) -{ - llwarns << "error with request to URL '" << mCapabilityURL << "' because " << pReason << " (statusCode:" << pStatus << ")" << llendl; - LLPathfindingNavMeshStatus navMeshStatus(mRegionUUID); - LLPathfindingManager::getInstance()->handleNavMeshStatusRequest(navMeshStatus, mRegion); -} - -//--------------------------------------------------------------------------- -// NavMeshResponder -//--------------------------------------------------------------------------- - -NavMeshResponder::NavMeshResponder(const std::string &pCapabilityURL, U32 pNavMeshVersion, LLPathfindingNavMeshPtr pNavMeshPtr) - : LLHTTPClient::Responder(), - mCapabilityURL(pCapabilityURL), - mNavMeshVersion(pNavMeshVersion), - mNavMeshPtr(pNavMeshPtr) -{ -} - -NavMeshResponder::~NavMeshResponder() -{ -} - -void NavMeshResponder::result(const LLSD &pContent) -{ - mNavMeshPtr->handleNavMeshResult(pContent, mNavMeshVersion); -} - -void NavMeshResponder::error(U32 pStatus, const std::string& pReason) -{ - mNavMeshPtr->handleNavMeshError(pStatus, pReason, mCapabilityURL, mNavMeshVersion); -} - -//--------------------------------------------------------------------------- -// AgentStateResponder -//--------------------------------------------------------------------------- - -AgentStateResponder::AgentStateResponder(const std::string &pCapabilityURL, LLPathfindingManager::EAgentState pRequestedAgentState) - : LLHTTPClient::Responder(), - mCapabilityURL(pCapabilityURL), - mRequestedAgentState(pRequestedAgentState) -{ -} - -AgentStateResponder::~AgentStateResponder() -{ -} - -void AgentStateResponder::result(const LLSD &pContent) -{ - LLPathfindingManager::getInstance()->handleAgentStateResult(pContent, mRequestedAgentState); -} - -void AgentStateResponder::error(U32 pStatus, const std::string &pReason) -{ - LLPathfindingManager::getInstance()->handleAgentStateError(pStatus, pReason, mCapabilityURL); -} - -//--------------------------------------------------------------------------- -// LinksetsResponder -//--------------------------------------------------------------------------- - -LinksetsResponder::LinksetsResponder(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::linksets_callback_t pLinksetsCallback, bool pIsObjectRequested, bool pIsTerrainRequested) - : mRequestId(pRequestId), - mLinksetsCallback(pLinksetsCallback), - mObjectMessagingState(pIsObjectRequested ? kWaiting : kNotRequested), - mTerrainMessagingState(pIsTerrainRequested ? kWaiting : kNotRequested), - mObjectLinksetListPtr(), - mTerrainLinksetPtr() -{ -} - -LinksetsResponder::~LinksetsResponder() -{ -} - -void LinksetsResponder::handleObjectLinksetsResult(const LLSD &pContent) -{ - mObjectLinksetListPtr = LLPathfindingLinksetListPtr(new LLPathfindingLinksetList(pContent)); - - mObjectMessagingState = kReceivedGood; - if (mTerrainMessagingState != kWaiting) - { - sendCallback(); - } -} - -void LinksetsResponder::handleObjectLinksetsError(U32 pStatus, const std::string &pReason, const std::string &pURL) -{ - llwarns << "error with request to URL '" << pURL << "' because " << pReason << " (statusCode:" << pStatus << ")" << llendl; - mObjectMessagingState = kReceivedError; - if (mTerrainMessagingState != kWaiting) - { - sendCallback(); - } -} - -void LinksetsResponder::handleTerrainLinksetsResult(const LLSD &pContent) -{ - mTerrainLinksetPtr = LLPathfindingLinksetPtr(new LLPathfindingLinkset(pContent)); - - mTerrainMessagingState = kReceivedGood; - if (mObjectMessagingState != kWaiting) - { - sendCallback(); - } -} - -void LinksetsResponder::handleTerrainLinksetsError(U32 pStatus, const std::string &pReason, const std::string &pURL) -{ - mTerrainMessagingState = kReceivedError; - if (mObjectMessagingState != kWaiting) - { - sendCallback(); - } -} - -void LinksetsResponder::sendCallback() -{ - llassert(mObjectMessagingState != kWaiting); - llassert(mTerrainMessagingState != kWaiting); - LLPathfindingManager::ERequestStatus requestStatus = - ((((mObjectMessagingState == kReceivedGood) || (mObjectMessagingState == kNotRequested)) && - ((mTerrainMessagingState == kReceivedGood) || (mTerrainMessagingState == kNotRequested))) ? - LLPathfindingManager::kRequestCompleted : LLPathfindingManager::kRequestError); - - if (mObjectMessagingState != kReceivedGood) - { - mObjectLinksetListPtr = LLPathfindingLinksetListPtr(new LLPathfindingLinksetList()); - } - - if (mTerrainMessagingState == kReceivedGood) - { - mObjectLinksetListPtr->insert(std::pair(mTerrainLinksetPtr->getUUID().asString(), mTerrainLinksetPtr)); - } - - mLinksetsCallback(mRequestId, requestStatus, mObjectLinksetListPtr); -} - -//--------------------------------------------------------------------------- -// ObjectLinksetsResponder -//--------------------------------------------------------------------------- - -ObjectLinksetsResponder::ObjectLinksetsResponder(const std::string &pCapabilityURL, LinksetsResponderPtr pLinksetsResponsderPtr) - : LLHTTPClient::Responder(), - mCapabilityURL(pCapabilityURL), - mLinksetsResponsderPtr(pLinksetsResponsderPtr) -{ -} - -ObjectLinksetsResponder::~ObjectLinksetsResponder() -{ -} - -void ObjectLinksetsResponder::result(const LLSD &pContent) -{ - mLinksetsResponsderPtr->handleObjectLinksetsResult(pContent); -} - -void ObjectLinksetsResponder::error(U32 pStatus, const std::string &pReason) -{ - mLinksetsResponsderPtr->handleObjectLinksetsError(pStatus, pReason, mCapabilityURL); -} - -//--------------------------------------------------------------------------- -// TerrainLinksetsResponder -//--------------------------------------------------------------------------- - -TerrainLinksetsResponder::TerrainLinksetsResponder(const std::string &pCapabilityURL, LinksetsResponderPtr pLinksetsResponsderPtr) - : LLHTTPClient::Responder(), - mCapabilityURL(pCapabilityURL), - mLinksetsResponsderPtr(pLinksetsResponsderPtr) -{ -} - -TerrainLinksetsResponder::~TerrainLinksetsResponder() -{ -} - -void TerrainLinksetsResponder::result(const LLSD &pContent) -{ - mLinksetsResponsderPtr->handleTerrainLinksetsResult(pContent); -} - -void TerrainLinksetsResponder::error(U32 pStatus, const std::string &pReason) -{ - mLinksetsResponsderPtr->handleTerrainLinksetsError(pStatus, pReason, mCapabilityURL); -} - -//--------------------------------------------------------------------------- -// CharactersResponder -//--------------------------------------------------------------------------- - -CharactersResponder::CharactersResponder(const std::string &pCapabilityURL, LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::characters_callback_t pCharactersCallback) - : LLHTTPClient::Responder(), - mCapabilityURL(pCapabilityURL), - mRequestId(pRequestId), - mCharactersCallback(pCharactersCallback) -{ -} - -CharactersResponder::~CharactersResponder() -{ -} - -void CharactersResponder::result(const LLSD &pContent) -{ - LLPathfindingCharacterListPtr characterListPtr = LLPathfindingCharacterListPtr(new LLPathfindingCharacterList(pContent)); - mCharactersCallback(mRequestId, LLPathfindingManager::kRequestCompleted, characterListPtr); -} - -void CharactersResponder::error(U32 pStatus, const std::string &pReason) -{ - llwarns << "error with request to URL '" << mCapabilityURL << "' because " << pReason << " (statusCode:" << pStatus << ")" << llendl; - - LLPathfindingCharacterListPtr characterListPtr; - mCharactersCallback(mRequestId, LLPathfindingManager::kRequestError, characterListPtr); -} +/** + * @file llpathfindingmanager.cpp + * @author William Todd Stinson + * @brief A state manager for the various pathfinding states. + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include +#include + +#include "llviewerprecompiledheaders.h" +#include "llsd.h" +#include "lluuid.h" +#include "llpathfindingmanager.h" +#include "llsingleton.h" +#include "llhttpclient.h" +#include "llagent.h" +#include "llviewerregion.h" +#include "llpathfindingnavmesh.h" +#include "llpathfindingnavmeshstatus.h" +#include "llpathfindinglinkset.h" +#include "llpathfindinglinksetlist.h" +#include "llpathfindingcharacterlist.h" +#include "llhttpnode.h" + +#include +#include + +#define CAP_SERVICE_RETRIEVE_NAVMESH "RetrieveNavMeshSrc" + +#define CAP_SERVICE_NAVMESH_STATUS "NavMeshGenerationStatus" + +#define CAP_SERVICE_AGENT_STATE "AgentPreferences" +#define ALTER_NAVMESH_OBJECTS_FIELD "alter_navmesh_objects" +#define DEPRECATED_ALTER_NAVMESH_OBJECTS_FIELD "alter_permanent_objects" + +#define CAP_SERVICE_OBJECT_LINKSETS "ObjectNavMeshProperties" +#define CAP_SERVICE_TERRAIN_LINKSETS "TerrainNavMeshProperties" + +#define CAP_SERVICE_CHARACTERS "CharacterProperties" + +#define SIM_MESSAGE_NAVMESH_STATUS_UPDATE "/message/NavMeshStatusUpdate" +#define SIM_MESSAGE_AGENT_STATE_UPDATE "/message/AgentPreferencesUpdate" +#define SIM_MESSAGE_BODY_FIELD "body" + +//--------------------------------------------------------------------------- +// LLNavMeshSimStateChangeNode +//--------------------------------------------------------------------------- + +class LLNavMeshSimStateChangeNode : public LLHTTPNode +{ +public: + virtual void post(ResponsePtr pResponse, const LLSD &pContext, const LLSD &pInput) const; +}; + +LLHTTPRegistration gHTTPRegistrationNavMeshSimStateChangeNode(SIM_MESSAGE_NAVMESH_STATUS_UPDATE); + +//--------------------------------------------------------------------------- +// LLAgentStateChangeNode +//--------------------------------------------------------------------------- + +class LLAgentStateChangeNode : public LLHTTPNode +{ +public: + virtual void post(ResponsePtr pResponse, const LLSD &pContext, const LLSD &pInput) const; +}; + +LLHTTPRegistration gHTTPRegistrationAgentStateChangeNode(SIM_MESSAGE_AGENT_STATE_UPDATE); + +//--------------------------------------------------------------------------- +// NavMeshStatusResponder +//--------------------------------------------------------------------------- + +class NavMeshStatusResponder : public LLHTTPClient::Responder +{ +public: + NavMeshStatusResponder(const std::string &pCapabilityURL, LLViewerRegion *pRegion); + virtual ~NavMeshStatusResponder(); + + virtual void result(const LLSD &pContent); + virtual void error(U32 pStatus, const std::string& pReason); + +protected: + +private: + std::string mCapabilityURL; + LLViewerRegion *mRegion; + LLUUID mRegionUUID; +}; + +//--------------------------------------------------------------------------- +// NavMeshResponder +//--------------------------------------------------------------------------- + +class NavMeshResponder : public LLHTTPClient::Responder +{ +public: + NavMeshResponder(const std::string &pCapabilityURL, U32 pNavMeshVersion, LLPathfindingNavMeshPtr pNavMeshPtr); + virtual ~NavMeshResponder(); + + virtual void result(const LLSD &pContent); + virtual void error(U32 pStatus, const std::string& pReason); + +protected: + +private: + std::string mCapabilityURL; + U32 mNavMeshVersion; + LLPathfindingNavMeshPtr mNavMeshPtr; +}; + +//--------------------------------------------------------------------------- +// AgentStateResponder +//--------------------------------------------------------------------------- + +class AgentStateResponder : public LLHTTPClient::Responder +{ +public: + AgentStateResponder(const std::string &pCapabilityURL, LLPathfindingManager::EAgentState pRequestedAgentState = LLPathfindingManager::kAgentStateUnknown); + virtual ~AgentStateResponder(); + + virtual void result(const LLSD &pContent); + virtual void error(U32 pStatus, const std::string& pReason); + +protected: + +private: + std::string mCapabilityURL; + LLPathfindingManager::EAgentState mRequestedAgentState; +}; + +//--------------------------------------------------------------------------- +// LinksetsResponder +//--------------------------------------------------------------------------- + +class LinksetsResponder +{ +public: + LinksetsResponder(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::linksets_callback_t pLinksetsCallback, bool pIsObjectRequested, bool pIsTerrainRequested); + virtual ~LinksetsResponder(); + + void handleObjectLinksetsResult(const LLSD &pContent); + void handleObjectLinksetsError(U32 pStatus, const std::string &pReason, const std::string &pURL); + void handleTerrainLinksetsResult(const LLSD &pContent); + void handleTerrainLinksetsError(U32 pStatus, const std::string &pReason, const std::string &pURL); + +protected: + +private: + void sendCallback(); + + typedef enum + { + kNotRequested, + kWaiting, + kReceivedGood, + kReceivedError + } EMessagingState; + + LLPathfindingManager::request_id_t mRequestId; + LLPathfindingManager::linksets_callback_t mLinksetsCallback; + + EMessagingState mObjectMessagingState; + EMessagingState mTerrainMessagingState; + + LLPathfindingLinksetListPtr mObjectLinksetListPtr; + LLPathfindingLinksetPtr mTerrainLinksetPtr; +}; + +typedef boost::shared_ptr LinksetsResponderPtr; + +//--------------------------------------------------------------------------- +// ObjectLinksetsResponder +//--------------------------------------------------------------------------- + +class ObjectLinksetsResponder : public LLHTTPClient::Responder +{ +public: + ObjectLinksetsResponder(const std::string &pCapabilityURL, LinksetsResponderPtr pLinksetsResponsderPtr); + virtual ~ObjectLinksetsResponder(); + + virtual void result(const LLSD &pContent); + virtual void error(U32 pStatus, const std::string &pReason); + +protected: + +private: + std::string mCapabilityURL; + LinksetsResponderPtr mLinksetsResponsderPtr; +}; + +//--------------------------------------------------------------------------- +// TerrainLinksetsResponder +//--------------------------------------------------------------------------- + +class TerrainLinksetsResponder : public LLHTTPClient::Responder +{ +public: + TerrainLinksetsResponder(const std::string &pCapabilityURL, LinksetsResponderPtr pLinksetsResponsderPtr); + virtual ~TerrainLinksetsResponder(); + + virtual void result(const LLSD &pContent); + virtual void error(U32 pStatus, const std::string &pReason); + +protected: + +private: + std::string mCapabilityURL; + LinksetsResponderPtr mLinksetsResponsderPtr; +}; + +//--------------------------------------------------------------------------- +// CharactersResponder +//--------------------------------------------------------------------------- + +class CharactersResponder : public LLHTTPClient::Responder +{ +public: + CharactersResponder(const std::string &pCapabilityURL, LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::characters_callback_t pCharactersCallback); + virtual ~CharactersResponder(); + + virtual void result(const LLSD &pContent); + virtual void error(U32 pStatus, const std::string &pReason); + +protected: + +private: + std::string mCapabilityURL; + LLPathfindingManager::request_id_t mRequestId; + LLPathfindingManager::characters_callback_t mCharactersCallback; +}; + +//--------------------------------------------------------------------------- +// LLPathfindingManager +//--------------------------------------------------------------------------- + +LLPathfindingManager::LLPathfindingManager() + : LLSingleton(), + mNavMeshMap(), + mAgentStateSignal(), + mAgentState(kAgentStateUnknown), + mLastKnownNonErrorAgentState(kAgentStateUnknown) +{ +} + +LLPathfindingManager::~LLPathfindingManager() +{ +} + +bool LLPathfindingManager::isPathfindingEnabledForCurrentRegion() const +{ + return isPathfindingEnabledForRegion(getCurrentRegion()); +} + +bool LLPathfindingManager::isPathfindingEnabledForRegion(LLViewerRegion *pRegion) const +{ + std::string retrieveNavMeshURL = getRetrieveNavMeshURLForRegion(pRegion); + return !retrieveNavMeshURL.empty(); +} + +#ifdef DEPRECATED_UNVERSIONED_NAVMESH +bool LLPathfindingManager::isPathfindingNavMeshVersioningEnabledForCurrentRegionXXX() const +{ + std::string navMeshStatusURL = getNavMeshStatusURLForRegion(getCurrentRegion()); + return !navMeshStatusURL.empty(); +} +#endif // DEPRECATED_UNVERSIONED_NAVMESH + +bool LLPathfindingManager::isAllowAlterPermanent() +{ + return (!isPathfindingEnabledForCurrentRegion() || (getAgentState() == kAgentStateUnfrozen)); +} + +bool LLPathfindingManager::isAllowViewTerrainProperties() const +{ + LLViewerRegion* region = getCurrentRegion(); + return (gAgent.isGodlike() || ((region != NULL) && region->canManageEstate())); +} + +LLPathfindingNavMesh::navmesh_slot_t LLPathfindingManager::registerNavMeshListenerForRegion(LLViewerRegion *pRegion, LLPathfindingNavMesh::navmesh_callback_t pNavMeshCallback) +{ + LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pRegion); + return navMeshPtr->registerNavMeshListener(pNavMeshCallback); +} + +void LLPathfindingManager::requestGetNavMeshForRegion(LLViewerRegion *pRegion) +{ + LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pRegion); + + if (pRegion == NULL) + { + navMeshPtr->handleNavMeshNotEnabled(); + } + else if (!pRegion->capabilitiesReceived()) + { + navMeshPtr->handleNavMeshWaitForRegionLoad(); + pRegion->setCapabilitiesReceivedCallback(boost::bind(&LLPathfindingManager::handleDeferredGetNavMeshForRegion, this, _1)); + } + else if (!isPathfindingEnabledForRegion(pRegion)) + { + navMeshPtr->handleNavMeshNotEnabled(); + } + else + { + std::string navMeshStatusURL = getNavMeshStatusURLForRegion(pRegion); +#ifdef DEPRECATED_UNVERSIONED_NAVMESH + if (navMeshStatusURL.empty()) + { + LLPathfindingNavMeshStatus navMeshStatus = navMeshPtr->getNavMeshStatusXXX(); + navMeshStatus.incrementNavMeshVersionXXX(); + sendRequestGetNavMeshForRegion(navMeshPtr, pRegion, navMeshStatus); + } + else + { + navMeshPtr->handleNavMeshCheckVersion(); + LLHTTPClient::ResponderPtr navMeshStatusResponder = new NavMeshStatusResponder(navMeshStatusURL, pRegion); + LLHTTPClient::get(navMeshStatusURL, navMeshStatusResponder); + } +#else // DEPRECATED_UNVERSIONED_NAVMESH + llassert(!navMeshStatusURL.empty()); + navMeshPtr->handleNavMeshCheckVersion(); + LLHTTPClient::ResponderPtr navMeshStatusResponder = new NavMeshStatusResponder(navMeshStatusURL, pRegion); + LLHTTPClient::get(navMeshStatusURL, navMeshStatusResponder); +#endif // DEPRECATED_UNVERSIONED_NAVMESH + } +} + +LLPathfindingManager::agent_state_slot_t LLPathfindingManager::registerAgentStateListener(agent_state_callback_t pAgentStateCallback) +{ + return mAgentStateSignal.connect(pAgentStateCallback); +} + +LLPathfindingManager::EAgentState LLPathfindingManager::getAgentState() +{ + if (!isPathfindingEnabledForCurrentRegion()) + { + setAgentState(kAgentStateNotEnabled); + } + else + { + if (!isValidAgentState(mAgentState)) + { + requestGetAgentState(); + } + } + + return mAgentState; +} + +LLPathfindingManager::EAgentState LLPathfindingManager::getLastKnownNonErrorAgentState() const +{ + return mLastKnownNonErrorAgentState; +} + +void LLPathfindingManager::requestSetAgentState(EAgentState pRequestedAgentState) +{ + llassert(isValidAgentState(pRequestedAgentState)); + std::string agentStateURL = getAgentStateURLForCurrentRegion(); + + if (agentStateURL.empty()) + { + setAgentState(kAgentStateNotEnabled); + } + else + { + LLSD request; + request[ALTER_NAVMESH_OBJECTS_FIELD] = static_cast(pRequestedAgentState == kAgentStateUnfrozen); +#ifdef DEPRECATED_ALTER_NAVMESH_OBJECTS_FIELD + request[DEPRECATED_ALTER_NAVMESH_OBJECTS_FIELD] = static_cast(pRequestedAgentState == kAgentStateUnfrozen); +#endif // DEPRECATED_ALTER_NAVMESH_OBJECTS_FIELD + + LLHTTPClient::ResponderPtr responder = new AgentStateResponder(agentStateURL, pRequestedAgentState); + LLHTTPClient::post(agentStateURL, request, responder); + } +} + +LLPathfindingManager::ERequestStatus LLPathfindingManager::requestGetLinksets(request_id_t pRequestId, linksets_callback_t pLinksetsCallback) const +{ + ERequestStatus status; + + std::string objectLinksetsURL = getObjectLinksetsURLForCurrentRegion(); + std::string terrainLinksetsURL = getTerrainLinksetsURLForCurrentRegion(); + if (objectLinksetsURL.empty() || terrainLinksetsURL.empty()) + { + status = kRequestNotEnabled; + } + else + { + bool doRequestTerrain = isAllowViewTerrainProperties(); + LinksetsResponderPtr linksetsResponderPtr(new LinksetsResponder(pRequestId, pLinksetsCallback, true, doRequestTerrain)); + + LLHTTPClient::ResponderPtr objectLinksetsResponder = new ObjectLinksetsResponder(objectLinksetsURL, linksetsResponderPtr); + LLHTTPClient::get(objectLinksetsURL, objectLinksetsResponder); + + if (doRequestTerrain) + { + LLHTTPClient::ResponderPtr terrainLinksetsResponder = new TerrainLinksetsResponder(terrainLinksetsURL, linksetsResponderPtr); + LLHTTPClient::get(terrainLinksetsURL, terrainLinksetsResponder); + } + + status = kRequestStarted; + } + + return status; +} + +LLPathfindingManager::ERequestStatus LLPathfindingManager::requestSetLinksets(request_id_t pRequestId, LLPathfindingLinksetListPtr pLinksetList, LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD, linksets_callback_t pLinksetsCallback) const +{ + ERequestStatus status = kRequestNotEnabled; + + std::string objectLinksetsURL = getObjectLinksetsURLForCurrentRegion(); + std::string terrainLinksetsURL = getTerrainLinksetsURLForCurrentRegion(); + if (objectLinksetsURL.empty() || terrainLinksetsURL.empty()) + { + status = kRequestNotEnabled; + } + else + { + LLSD objectPostData = pLinksetList->encodeObjectFields(pLinksetUse, pA, pB, pC, pD); + LLSD terrainPostData; + if (isAllowViewTerrainProperties()) + { + terrainPostData = pLinksetList->encodeTerrainFields(pLinksetUse, pA, pB, pC, pD); + } + + if (objectPostData.isUndefined() && terrainPostData.isUndefined()) + { + status = kRequestCompleted; + } + else + { + LinksetsResponderPtr linksetsResponderPtr(new LinksetsResponder(pRequestId, pLinksetsCallback, !objectPostData.isUndefined(), !terrainPostData.isUndefined())); + + if (!objectPostData.isUndefined()) + { + LLHTTPClient::ResponderPtr objectLinksetsResponder = new ObjectLinksetsResponder(objectLinksetsURL, linksetsResponderPtr); + LLHTTPClient::put(objectLinksetsURL, objectPostData, objectLinksetsResponder); + } + + if (!terrainPostData.isUndefined()) + { + LLHTTPClient::ResponderPtr terrainLinksetsResponder = new TerrainLinksetsResponder(terrainLinksetsURL, linksetsResponderPtr); + LLHTTPClient::put(terrainLinksetsURL, terrainPostData, terrainLinksetsResponder); + } + + status = kRequestStarted; + } + } + + return status; +} + +LLPathfindingManager::ERequestStatus LLPathfindingManager::requestGetCharacters(request_id_t pRequestId, characters_callback_t pCharactersCallback) const +{ + ERequestStatus status; + + std::string charactersURL = getCharactersURLForCurrentRegion(); + if (charactersURL.empty()) + { + status = kRequestNotEnabled; + } + else + { + LLHTTPClient::ResponderPtr charactersResponder = new CharactersResponder(charactersURL, pRequestId, pCharactersCallback); + LLHTTPClient::get(charactersURL, charactersResponder); + + status = kRequestStarted; + } + + return status; +} + +void LLPathfindingManager::sendRequestGetNavMeshForRegion(LLPathfindingNavMeshPtr navMeshPtr, LLViewerRegion *pRegion, const LLPathfindingNavMeshStatus &pNavMeshStatus) +{ + if ((pRegion == NULL) || !pRegion->isAlive()) + { + navMeshPtr->handleNavMeshNotEnabled(); + } + else + { + std::string navMeshURL = getRetrieveNavMeshURLForRegion(pRegion); + + if (navMeshURL.empty()) + { + navMeshPtr->handleNavMeshNotEnabled(); + } + else + { + navMeshPtr->handleNavMeshStart(pNavMeshStatus); + LLHTTPClient::ResponderPtr responder = new NavMeshResponder(navMeshURL, pNavMeshStatus.getVersion(), navMeshPtr); + + LLSD postData; + LLHTTPClient::post(navMeshURL, postData, responder); + } + } +} + +void LLPathfindingManager::handleDeferredGetNavMeshForRegion(const LLUUID &pRegionUUID) +{ + LLViewerRegion *currentRegion = getCurrentRegion(); + + if ((currentRegion != NULL) && (currentRegion->getRegionID() == pRegionUUID)) + { + requestGetNavMeshForRegion(currentRegion); + } +} + +void LLPathfindingManager::handleNavMeshStatusRequest(const LLPathfindingNavMeshStatus &pNavMeshStatus, LLViewerRegion *pRegion) +{ + LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pNavMeshStatus.getRegionUUID()); + + if (!pNavMeshStatus.isValid()) + { + navMeshPtr->handleNavMeshError(); + } + else + { + if (navMeshPtr->hasNavMeshVersion(pNavMeshStatus)) + { + navMeshPtr->handleRefresh(pNavMeshStatus); + } + else + { + sendRequestGetNavMeshForRegion(navMeshPtr, pRegion, pNavMeshStatus); + } + } +} + +void LLPathfindingManager::handleNavMeshStatusUpdate(const LLPathfindingNavMeshStatus &pNavMeshStatus) +{ + LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pNavMeshStatus.getRegionUUID()); + + if (!pNavMeshStatus.isValid()) + { + navMeshPtr->handleNavMeshError(); + } + else + { + navMeshPtr->handleNavMeshNewVersion(pNavMeshStatus); + } +} + +LLPathfindingNavMeshPtr LLPathfindingManager::getNavMeshForRegion(const LLUUID &pRegionUUID) +{ + LLPathfindingNavMeshPtr navMeshPtr; + NavMeshMap::iterator navMeshIter = mNavMeshMap.find(pRegionUUID); + if (navMeshIter == mNavMeshMap.end()) + { + navMeshPtr = LLPathfindingNavMeshPtr(new LLPathfindingNavMesh(pRegionUUID)); + mNavMeshMap.insert(std::pair(pRegionUUID, navMeshPtr)); + } + else + { + navMeshPtr = navMeshIter->second; + } + + return navMeshPtr; +} + +LLPathfindingNavMeshPtr LLPathfindingManager::getNavMeshForRegion(LLViewerRegion *pRegion) +{ + LLUUID regionUUID; + if (pRegion != NULL) + { + regionUUID = pRegion->getRegionID(); + } + + return getNavMeshForRegion(regionUUID); +} + +bool LLPathfindingManager::isValidAgentState(EAgentState pAgentState) +{ + return ((pAgentState == kAgentStateFrozen) || (pAgentState == kAgentStateUnfrozen)); +} + +void LLPathfindingManager::requestGetAgentState() +{ + std::string agentStateURL = getAgentStateURLForCurrentRegion(); + + if (agentStateURL.empty()) + { + setAgentState(kAgentStateNotEnabled); + } + else + { + LLHTTPClient::ResponderPtr responder = new AgentStateResponder(agentStateURL); + LLHTTPClient::get(agentStateURL, responder); + } +} + +void LLPathfindingManager::setAgentState(EAgentState pAgentState) +{ + mAgentState = pAgentState; + + if (mAgentState != kAgentStateError) + { + mLastKnownNonErrorAgentState = mAgentState; + } + + mAgentStateSignal(mAgentState); +} + +void LLPathfindingManager::handleAgentStateResult(const LLSD &pContent, EAgentState pRequestedAgentState) +{ +#ifndef DEPRECATED_ALTER_NAVMESH_OBJECTS_FIELD + llassert(pContent.has(ALTER_NAVMESH_OBJECTS_FIELD)); + llassert(pContent.get(ALTER_NAVMESH_OBJECTS_FIELD).isBoolean()); + EAgentState agentState = (pContent.get(ALTER_NAVMESH_OBJECTS_FIELD).asBoolean() ? kAgentStateUnfrozen : kAgentStateFrozen); +#else // DEPRECATED_ALTER_NAVMESH_OBJECTS_FIELD + EAgentState agentState = kAgentStateUnknown; + if (pContent.has(ALTER_NAVMESH_OBJECTS_FIELD)) + { + llassert(pContent.get(ALTER_NAVMESH_OBJECTS_FIELD).isBoolean()); + agentState = (pContent.get(ALTER_NAVMESH_OBJECTS_FIELD).asBoolean() ? kAgentStateUnfrozen : kAgentStateFrozen); + } + else + { + llassert(pContent.has(DEPRECATED_ALTER_NAVMESH_OBJECTS_FIELD)); + llassert(pContent.get(DEPRECATED_ALTER_NAVMESH_OBJECTS_FIELD).isBoolean()); + agentState = (pContent.get(DEPRECATED_ALTER_NAVMESH_OBJECTS_FIELD).asBoolean() ? kAgentStateUnfrozen : kAgentStateFrozen); + } +#endif // DEPRECATED_ALTER_NAVMESH_OBJECTS_FIELD + + if (isValidAgentState(pRequestedAgentState) && (agentState != pRequestedAgentState)) + { + agentState = kAgentStateError; + llassert(0); + } + + setAgentState(agentState); +} + +void LLPathfindingManager::handleAgentStateError(U32 pStatus, const std::string &pReason, const std::string &pURL) +{ + llwarns << "error with request to URL '" << pURL << "' because " << pReason << " (statusCode:" << pStatus << ")" << llendl; + setAgentState(kAgentStateError); +} + +void LLPathfindingManager::handleAgentStateUpdate(const LLSD &pContent) +{ + llassert(pContent.has(ALTER_NAVMESH_OBJECTS_FIELD)); + llassert(pContent.get(ALTER_NAVMESH_OBJECTS_FIELD).isBoolean()); + EAgentState agentState = (pContent.get(ALTER_NAVMESH_OBJECTS_FIELD).asBoolean() ? kAgentStateUnfrozen : kAgentStateFrozen); + + setAgentState(agentState); +} + +std::string LLPathfindingManager::getNavMeshStatusURLForRegion(LLViewerRegion *pRegion) const +{ + return getCapabilityURLForRegion(pRegion, CAP_SERVICE_NAVMESH_STATUS); +} + +std::string LLPathfindingManager::getRetrieveNavMeshURLForRegion(LLViewerRegion *pRegion) const +{ + return getCapabilityURLForRegion(pRegion, CAP_SERVICE_RETRIEVE_NAVMESH); +} + +std::string LLPathfindingManager::getAgentStateURLForCurrentRegion() const +{ + return getCapabilityURLForCurrentRegion(CAP_SERVICE_AGENT_STATE); +} + +std::string LLPathfindingManager::getObjectLinksetsURLForCurrentRegion() const +{ + return getCapabilityURLForCurrentRegion(CAP_SERVICE_OBJECT_LINKSETS); +} + +std::string LLPathfindingManager::getTerrainLinksetsURLForCurrentRegion() const +{ + return getCapabilityURLForCurrentRegion(CAP_SERVICE_TERRAIN_LINKSETS); +} + +std::string LLPathfindingManager::getCharactersURLForCurrentRegion() const +{ + return getCapabilityURLForCurrentRegion(CAP_SERVICE_CHARACTERS); +} + +std::string LLPathfindingManager::getCapabilityURLForCurrentRegion(const std::string &pCapabilityName) const +{ + return getCapabilityURLForRegion(getCurrentRegion(), pCapabilityName); +} + +std::string LLPathfindingManager::getCapabilityURLForRegion(LLViewerRegion *pRegion, const std::string &pCapabilityName) const +{ + std::string capabilityURL(""); + + if (pRegion != NULL) + { + capabilityURL = pRegion->getCapability(pCapabilityName); + } + + if (capabilityURL.empty()) + { + llwarns << "cannot find capability '" << pCapabilityName << "' for current region '" + << ((pRegion != NULL) ? pRegion->getName() : "") << "'" << llendl; + } + + return capabilityURL; +} + +LLViewerRegion *LLPathfindingManager::getCurrentRegion() const +{ + return gAgent.getRegion(); +} + +//--------------------------------------------------------------------------- +// LLNavMeshSimStateChangeNode +//--------------------------------------------------------------------------- + +void LLNavMeshSimStateChangeNode::post(ResponsePtr pResponse, const LLSD &pContext, const LLSD &pInput) const +{ +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Received NavMeshStatusUpdate: " << pInput << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + llassert(pInput.has(SIM_MESSAGE_BODY_FIELD)); + llassert(pInput.get(SIM_MESSAGE_BODY_FIELD).isMap()); + LLPathfindingNavMeshStatus navMeshStatus(pInput.get(SIM_MESSAGE_BODY_FIELD)); + LLPathfindingManager::getInstance()->handleNavMeshStatusUpdate(navMeshStatus); +} + +//--------------------------------------------------------------------------- +// LLAgentStateChangeNode +//--------------------------------------------------------------------------- + +void LLAgentStateChangeNode::post(ResponsePtr pResponse, const LLSD &pContext, const LLSD &pInput) const +{ +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Received AgentPreferencesUpdate: " << pInput << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + llassert(pInput.has(SIM_MESSAGE_BODY_FIELD)); + llassert(pInput.get(SIM_MESSAGE_BODY_FIELD).isMap()); + LLPathfindingManager::getInstance()->handleAgentStateUpdate(pInput.get(SIM_MESSAGE_BODY_FIELD)); +} + +//--------------------------------------------------------------------------- +// NavMeshStatusResponder +//--------------------------------------------------------------------------- + +NavMeshStatusResponder::NavMeshStatusResponder(const std::string &pCapabilityURL, LLViewerRegion *pRegion) + : LLHTTPClient::Responder(), + mCapabilityURL(pCapabilityURL), + mRegion(pRegion), + mRegionUUID() +{ + if (mRegion != NULL) + { + mRegionUUID = mRegion->getRegionID(); + } +} + +NavMeshStatusResponder::~NavMeshStatusResponder() +{ +} + +void NavMeshStatusResponder::result(const LLSD &pContent) +{ +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Received requested NavMeshStatus: " << pContent << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + LLPathfindingNavMeshStatus navMeshStatus(mRegionUUID, pContent); + LLPathfindingManager::getInstance()->handleNavMeshStatusRequest(navMeshStatus, mRegion); +} + +void NavMeshStatusResponder::error(U32 pStatus, const std::string& pReason) +{ + llwarns << "error with request to URL '" << mCapabilityURL << "' because " << pReason << " (statusCode:" << pStatus << ")" << llendl; + LLPathfindingNavMeshStatus navMeshStatus(mRegionUUID); + LLPathfindingManager::getInstance()->handleNavMeshStatusRequest(navMeshStatus, mRegion); +} + +//--------------------------------------------------------------------------- +// NavMeshResponder +//--------------------------------------------------------------------------- + +NavMeshResponder::NavMeshResponder(const std::string &pCapabilityURL, U32 pNavMeshVersion, LLPathfindingNavMeshPtr pNavMeshPtr) + : LLHTTPClient::Responder(), + mCapabilityURL(pCapabilityURL), + mNavMeshVersion(pNavMeshVersion), + mNavMeshPtr(pNavMeshPtr) +{ +} + +NavMeshResponder::~NavMeshResponder() +{ +} + +void NavMeshResponder::result(const LLSD &pContent) +{ + mNavMeshPtr->handleNavMeshResult(pContent, mNavMeshVersion); +} + +void NavMeshResponder::error(U32 pStatus, const std::string& pReason) +{ + mNavMeshPtr->handleNavMeshError(pStatus, pReason, mCapabilityURL, mNavMeshVersion); +} + +//--------------------------------------------------------------------------- +// AgentStateResponder +//--------------------------------------------------------------------------- + +AgentStateResponder::AgentStateResponder(const std::string &pCapabilityURL, LLPathfindingManager::EAgentState pRequestedAgentState) + : LLHTTPClient::Responder(), + mCapabilityURL(pCapabilityURL), + mRequestedAgentState(pRequestedAgentState) +{ +} + +AgentStateResponder::~AgentStateResponder() +{ +} + +void AgentStateResponder::result(const LLSD &pContent) +{ + LLPathfindingManager::getInstance()->handleAgentStateResult(pContent, mRequestedAgentState); +} + +void AgentStateResponder::error(U32 pStatus, const std::string &pReason) +{ + LLPathfindingManager::getInstance()->handleAgentStateError(pStatus, pReason, mCapabilityURL); +} + +//--------------------------------------------------------------------------- +// LinksetsResponder +//--------------------------------------------------------------------------- + +LinksetsResponder::LinksetsResponder(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::linksets_callback_t pLinksetsCallback, bool pIsObjectRequested, bool pIsTerrainRequested) + : mRequestId(pRequestId), + mLinksetsCallback(pLinksetsCallback), + mObjectMessagingState(pIsObjectRequested ? kWaiting : kNotRequested), + mTerrainMessagingState(pIsTerrainRequested ? kWaiting : kNotRequested), + mObjectLinksetListPtr(), + mTerrainLinksetPtr() +{ +} + +LinksetsResponder::~LinksetsResponder() +{ +} + +void LinksetsResponder::handleObjectLinksetsResult(const LLSD &pContent) +{ + mObjectLinksetListPtr = LLPathfindingLinksetListPtr(new LLPathfindingLinksetList(pContent)); + + mObjectMessagingState = kReceivedGood; + if (mTerrainMessagingState != kWaiting) + { + sendCallback(); + } +} + +void LinksetsResponder::handleObjectLinksetsError(U32 pStatus, const std::string &pReason, const std::string &pURL) +{ + llwarns << "error with request to URL '" << pURL << "' because " << pReason << " (statusCode:" << pStatus << ")" << llendl; + mObjectMessagingState = kReceivedError; + if (mTerrainMessagingState != kWaiting) + { + sendCallback(); + } +} + +void LinksetsResponder::handleTerrainLinksetsResult(const LLSD &pContent) +{ + mTerrainLinksetPtr = LLPathfindingLinksetPtr(new LLPathfindingLinkset(pContent)); + + mTerrainMessagingState = kReceivedGood; + if (mObjectMessagingState != kWaiting) + { + sendCallback(); + } +} + +void LinksetsResponder::handleTerrainLinksetsError(U32 pStatus, const std::string &pReason, const std::string &pURL) +{ + mTerrainMessagingState = kReceivedError; + if (mObjectMessagingState != kWaiting) + { + sendCallback(); + } +} + +void LinksetsResponder::sendCallback() +{ + llassert(mObjectMessagingState != kWaiting); + llassert(mTerrainMessagingState != kWaiting); + LLPathfindingManager::ERequestStatus requestStatus = + ((((mObjectMessagingState == kReceivedGood) || (mObjectMessagingState == kNotRequested)) && + ((mTerrainMessagingState == kReceivedGood) || (mTerrainMessagingState == kNotRequested))) ? + LLPathfindingManager::kRequestCompleted : LLPathfindingManager::kRequestError); + + if (mObjectMessagingState != kReceivedGood) + { + mObjectLinksetListPtr = LLPathfindingLinksetListPtr(new LLPathfindingLinksetList()); + } + + if (mTerrainMessagingState == kReceivedGood) + { + mObjectLinksetListPtr->insert(std::pair(mTerrainLinksetPtr->getUUID().asString(), mTerrainLinksetPtr)); + } + + mLinksetsCallback(mRequestId, requestStatus, mObjectLinksetListPtr); +} + +//--------------------------------------------------------------------------- +// ObjectLinksetsResponder +//--------------------------------------------------------------------------- + +ObjectLinksetsResponder::ObjectLinksetsResponder(const std::string &pCapabilityURL, LinksetsResponderPtr pLinksetsResponsderPtr) + : LLHTTPClient::Responder(), + mCapabilityURL(pCapabilityURL), + mLinksetsResponsderPtr(pLinksetsResponsderPtr) +{ +} + +ObjectLinksetsResponder::~ObjectLinksetsResponder() +{ +} + +void ObjectLinksetsResponder::result(const LLSD &pContent) +{ + mLinksetsResponsderPtr->handleObjectLinksetsResult(pContent); +} + +void ObjectLinksetsResponder::error(U32 pStatus, const std::string &pReason) +{ + mLinksetsResponsderPtr->handleObjectLinksetsError(pStatus, pReason, mCapabilityURL); +} + +//--------------------------------------------------------------------------- +// TerrainLinksetsResponder +//--------------------------------------------------------------------------- + +TerrainLinksetsResponder::TerrainLinksetsResponder(const std::string &pCapabilityURL, LinksetsResponderPtr pLinksetsResponsderPtr) + : LLHTTPClient::Responder(), + mCapabilityURL(pCapabilityURL), + mLinksetsResponsderPtr(pLinksetsResponsderPtr) +{ +} + +TerrainLinksetsResponder::~TerrainLinksetsResponder() +{ +} + +void TerrainLinksetsResponder::result(const LLSD &pContent) +{ + mLinksetsResponsderPtr->handleTerrainLinksetsResult(pContent); +} + +void TerrainLinksetsResponder::error(U32 pStatus, const std::string &pReason) +{ + mLinksetsResponsderPtr->handleTerrainLinksetsError(pStatus, pReason, mCapabilityURL); +} + +//--------------------------------------------------------------------------- +// CharactersResponder +//--------------------------------------------------------------------------- + +CharactersResponder::CharactersResponder(const std::string &pCapabilityURL, LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::characters_callback_t pCharactersCallback) + : LLHTTPClient::Responder(), + mCapabilityURL(pCapabilityURL), + mRequestId(pRequestId), + mCharactersCallback(pCharactersCallback) +{ +} + +CharactersResponder::~CharactersResponder() +{ +} + +void CharactersResponder::result(const LLSD &pContent) +{ + LLPathfindingCharacterListPtr characterListPtr = LLPathfindingCharacterListPtr(new LLPathfindingCharacterList(pContent)); + mCharactersCallback(mRequestId, LLPathfindingManager::kRequestCompleted, characterListPtr); +} + +void CharactersResponder::error(U32 pStatus, const std::string &pReason) +{ + llwarns << "error with request to URL '" << mCapabilityURL << "' because " << pReason << " (statusCode:" << pStatus << ")" << llendl; + + LLPathfindingCharacterListPtr characterListPtr; + mCharactersCallback(mRequestId, LLPathfindingManager::kRequestError, characterListPtr); +} + diff --git a/indra/newview/llpathfindingmanager.h b/indra/newview/llpathfindingmanager.h index 795ee88f3d..9797c783b5 100644 --- a/indra/newview/llpathfindingmanager.h +++ b/indra/newview/llpathfindingmanager.h @@ -1,143 +1,146 @@ -/** - * @file llpathfindingmanager.h - * @author William Todd Stinson - * @brief A state manager for the various pathfinding states. - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLPATHFINDINGMANAGER_H -#define LL_LLPATHFINDINGMANAGER_H - -#include "llsingleton.h" -#include "lluuid.h" -#include "llpathfindingnavmesh.h" -#include "llpathfindinglinkset.h" -#include "llpathfindinglinksetlist.h" -#include "llpathfindingcharacterlist.h" - -#include -#include - -#include -#include - -class LLFloater; -class LLViewerRegion; -class LLPathfindingNavMeshStatus; - -class LLPathfindingManager : public LLSingleton -{ - friend class LLNavMeshSimStateChangeNode; - friend class LLAgentStateChangeNode; - friend class NavMeshStatusResponder; - friend class AgentStateResponder; -public: - typedef std::map NavMeshMap; - - typedef enum { - kAgentStateUnknown, - kAgentStateFrozen, - kAgentStateUnfrozen, - kAgentStateNotEnabled, - kAgentStateError - } EAgentState; - - typedef boost::function agent_state_callback_t; - typedef boost::signals2::signal agent_state_signal_t; - typedef boost::signals2::connection agent_state_slot_t; - - typedef enum { - kRequestStarted, - kRequestCompleted, - kRequestNotEnabled, - kRequestError - } ERequestStatus; - - typedef U32 request_id_t; - - typedef boost::function linksets_callback_t; - typedef boost::function characters_callback_t; - - LLPathfindingManager(); - virtual ~LLPathfindingManager(); - - bool isPathfindingEnabledForCurrentRegion() const; - bool isPathfindingEnabledForRegion(LLViewerRegion *pRegion) const; -#ifdef DEPRECATED_UNVERSIONED_NAVMESH - bool isPathfindingNavMeshVersioningEnabledForCurrentRegionXXX() const; -#endif // DEPRECATED_UNVERSIONED_NAVMESH - - bool isAllowAlterPermanent(); - bool isAllowViewTerrainProperties() const; - - LLPathfindingNavMesh::navmesh_slot_t registerNavMeshListenerForRegion(LLViewerRegion *pRegion, LLPathfindingNavMesh::navmesh_callback_t pNavMeshCallback); - void requestGetNavMeshForRegion(LLViewerRegion *pRegion); - - agent_state_slot_t registerAgentStateListener(agent_state_callback_t pAgentStateCallback); - EAgentState getAgentState(); - EAgentState getLastKnownNonErrorAgentState() const; - void requestSetAgentState(EAgentState pAgentState); - - ERequestStatus requestGetLinksets(request_id_t pRequestId, linksets_callback_t pLinksetsCallback) const; - ERequestStatus requestSetLinksets(request_id_t pRequestId, LLPathfindingLinksetListPtr pLinksetList, LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD, linksets_callback_t pLinksetsCallback) const; - - ERequestStatus requestGetCharacters(request_id_t pRequestId, characters_callback_t pCharactersCallback) const; - -protected: - -private: - void sendRequestGetNavMeshForRegion(LLPathfindingNavMeshPtr navMeshPtr, LLViewerRegion *pRegion, const LLPathfindingNavMeshStatus &pNavMeshStatus); - - void handleNavMeshStatusRequest(const LLPathfindingNavMeshStatus &pNavMeshStatus, LLViewerRegion *pRegion); - void handleNavMeshStatusUpdate(const LLPathfindingNavMeshStatus &pNavMeshStatus); - - LLPathfindingNavMeshPtr getNavMeshForRegion(const LLUUID &pRegionUUID); - LLPathfindingNavMeshPtr getNavMeshForRegion(LLViewerRegion *pRegion); - - static bool isValidAgentState(EAgentState pAgentState); - - void requestGetAgentState(); - void setAgentState(EAgentState pAgentState); - void handleAgentStateResult(const LLSD &pContent, EAgentState pRequestedAgentState); - void handleAgentStateError(U32 pStatus, const std::string &pReason, const std::string &pURL); - void handleAgentStateUpdate(const LLSD &pContent); - - std::string getNavMeshStatusURLForRegion(LLViewerRegion *pRegion) const; - std::string getRetrieveNavMeshURLForRegion(LLViewerRegion *pRegion) const; - std::string getAgentStateURLForCurrentRegion() const; - std::string getObjectLinksetsURLForCurrentRegion() const; - std::string getTerrainLinksetsURLForCurrentRegion() const; - std::string getCharactersURLForCurrentRegion() const; - - std::string getCapabilityURLForCurrentRegion(const std::string &pCapabilityName) const; - std::string getCapabilityURLForRegion(LLViewerRegion *pRegion, const std::string &pCapabilityName) const; - LLViewerRegion *getCurrentRegion() const; - - NavMeshMap mNavMeshMap; - - agent_state_signal_t mAgentStateSignal; - EAgentState mAgentState; - EAgentState mLastKnownNonErrorAgentState; -}; - -#endif // LL_LLPATHFINDINGMANAGER_H +/** + * @file llpathfindingmanager.h + * @author William Todd Stinson + * @brief A state manager for the various pathfinding states. + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLPATHFINDINGMANAGER_H +#define LL_LLPATHFINDINGMANAGER_H + +#include "llsingleton.h" +#include "lluuid.h" +#include "llpathfindingnavmesh.h" +#include "llpathfindinglinkset.h" +#include "llpathfindinglinksetlist.h" +#include "llpathfindingcharacterlist.h" + +#include +#include + +#include +#include + +class LLFloater; +class LLViewerRegion; +class LLPathfindingNavMeshStatus; + +class LLPathfindingManager : public LLSingleton +{ + friend class LLNavMeshSimStateChangeNode; + friend class LLAgentStateChangeNode; + friend class NavMeshStatusResponder; + friend class AgentStateResponder; +public: + typedef std::map NavMeshMap; + + typedef enum { + kAgentStateUnknown, + kAgentStateFrozen, + kAgentStateUnfrozen, + kAgentStateNotEnabled, + kAgentStateError + } EAgentState; + + typedef boost::function agent_state_callback_t; + typedef boost::signals2::signal agent_state_signal_t; + typedef boost::signals2::connection agent_state_slot_t; + + typedef enum { + kRequestStarted, + kRequestCompleted, + kRequestNotEnabled, + kRequestError + } ERequestStatus; + + typedef U32 request_id_t; + + typedef boost::function linksets_callback_t; + typedef boost::function characters_callback_t; + + LLPathfindingManager(); + virtual ~LLPathfindingManager(); + + bool isPathfindingEnabledForCurrentRegion() const; + bool isPathfindingEnabledForRegion(LLViewerRegion *pRegion) const; +#ifdef DEPRECATED_UNVERSIONED_NAVMESH + bool isPathfindingNavMeshVersioningEnabledForCurrentRegionXXX() const; +#endif // DEPRECATED_UNVERSIONED_NAVMESH + + bool isAllowAlterPermanent(); + bool isAllowViewTerrainProperties() const; + + LLPathfindingNavMesh::navmesh_slot_t registerNavMeshListenerForRegion(LLViewerRegion *pRegion, LLPathfindingNavMesh::navmesh_callback_t pNavMeshCallback); + void requestGetNavMeshForRegion(LLViewerRegion *pRegion); + + agent_state_slot_t registerAgentStateListener(agent_state_callback_t pAgentStateCallback); + EAgentState getAgentState(); + EAgentState getLastKnownNonErrorAgentState() const; + void requestSetAgentState(EAgentState pAgentState); + + ERequestStatus requestGetLinksets(request_id_t pRequestId, linksets_callback_t pLinksetsCallback) const; + ERequestStatus requestSetLinksets(request_id_t pRequestId, LLPathfindingLinksetListPtr pLinksetList, LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD, linksets_callback_t pLinksetsCallback) const; + + ERequestStatus requestGetCharacters(request_id_t pRequestId, characters_callback_t pCharactersCallback) const; + +protected: + +private: + void sendRequestGetNavMeshForRegion(LLPathfindingNavMeshPtr navMeshPtr, LLViewerRegion *pRegion, const LLPathfindingNavMeshStatus &pNavMeshStatus); + + void handleDeferredGetNavMeshForRegion(const LLUUID &pRegionUUID); + + void handleNavMeshStatusRequest(const LLPathfindingNavMeshStatus &pNavMeshStatus, LLViewerRegion *pRegion); + void handleNavMeshStatusUpdate(const LLPathfindingNavMeshStatus &pNavMeshStatus); + + LLPathfindingNavMeshPtr getNavMeshForRegion(const LLUUID &pRegionUUID); + LLPathfindingNavMeshPtr getNavMeshForRegion(LLViewerRegion *pRegion); + + static bool isValidAgentState(EAgentState pAgentState); + + void requestGetAgentState(); + void setAgentState(EAgentState pAgentState); + void handleAgentStateResult(const LLSD &pContent, EAgentState pRequestedAgentState); + void handleAgentStateError(U32 pStatus, const std::string &pReason, const std::string &pURL); + void handleAgentStateUpdate(const LLSD &pContent); + + std::string getNavMeshStatusURLForRegion(LLViewerRegion *pRegion) const; + std::string getRetrieveNavMeshURLForRegion(LLViewerRegion *pRegion) const; + std::string getAgentStateURLForCurrentRegion() const; + std::string getObjectLinksetsURLForCurrentRegion() const; + std::string getTerrainLinksetsURLForCurrentRegion() const; + std::string getCharactersURLForCurrentRegion() const; + + std::string getCapabilityURLForCurrentRegion(const std::string &pCapabilityName) const; + std::string getCapabilityURLForRegion(LLViewerRegion *pRegion, const std::string &pCapabilityName) const; + LLViewerRegion *getCurrentRegion() const; + + NavMeshMap mNavMeshMap; + + agent_state_signal_t mAgentStateSignal; + EAgentState mAgentState; + EAgentState mLastKnownNonErrorAgentState; +}; + +#endif // LL_LLPATHFINDINGMANAGER_H + diff --git a/indra/newview/llpathfindingnavmesh.cpp b/indra/newview/llpathfindingnavmesh.cpp index 10e9abaf0c..4e4e9fceef 100644 --- a/indra/newview/llpathfindingnavmesh.cpp +++ b/indra/newview/llpathfindingnavmesh.cpp @@ -1,195 +1,201 @@ -/** - * @file llpathfindingnavmesh.cpp - * @author William Todd Stinson - * @brief A class for representing the navmesh of a pathfinding region. - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" -#include "lluuid.h" -#include "llpathfindingnavmesh.h" -#include "llpathfindingnavmeshstatus.h" -#include "llsdserialize.h" - -#include - -#define NAVMESH_VERSION_FIELD "navmesh_version" -#define NAVMESH_DATA_FIELD "navmesh_data" - -//--------------------------------------------------------------------------- -// LLPathfindingNavMesh -//--------------------------------------------------------------------------- - -LLPathfindingNavMesh::LLPathfindingNavMesh(const LLUUID &pRegionUUID) - : mNavMeshStatus(pRegionUUID), - mNavMeshRequestStatus(kNavMeshRequestUnknown), - mNavMeshSignal(), - mNavMeshData() - -{ -} - -LLPathfindingNavMesh::~LLPathfindingNavMesh() -{ -} - -LLPathfindingNavMesh::navmesh_slot_t LLPathfindingNavMesh::registerNavMeshListener(navmesh_callback_t pNavMeshCallback) -{ - return mNavMeshSignal.connect(pNavMeshCallback); -} - -bool LLPathfindingNavMesh::hasNavMeshVersion(const LLPathfindingNavMeshStatus &pNavMeshStatus) const -{ - return ((mNavMeshStatus.getVersion() == pNavMeshStatus.getVersion()) && - ((mNavMeshRequestStatus == kNavMeshRequestStarted) || (mNavMeshRequestStatus == kNavMeshRequestCompleted) || - ((mNavMeshRequestStatus == kNavMeshRequestChecking) && !mNavMeshData.empty()))); -} - -void LLPathfindingNavMesh::handleNavMeshCheckVersion() -{ - setRequestStatus(kNavMeshRequestChecking); -} - -void LLPathfindingNavMesh::handleRefresh(const LLPathfindingNavMeshStatus &pNavMeshStatus) -{ - llassert(mNavMeshStatus.getRegionUUID() == pNavMeshStatus.getRegionUUID()); - llassert(mNavMeshStatus.getVersion() == pNavMeshStatus.getVersion()); - mNavMeshStatus = pNavMeshStatus; - if (mNavMeshRequestStatus == kNavMeshRequestChecking) - { - llassert(!mNavMeshData.empty()); - setRequestStatus(kNavMeshRequestCompleted); - } - else - { - sendStatus(); - } -} - -void LLPathfindingNavMesh::handleNavMeshNewVersion(const LLPathfindingNavMeshStatus &pNavMeshStatus) -{ - llassert(mNavMeshStatus.getRegionUUID() == pNavMeshStatus.getRegionUUID()); - if (mNavMeshStatus.getVersion() == pNavMeshStatus.getVersion()) - { - mNavMeshStatus = pNavMeshStatus; - sendStatus(); - } - else - { - mNavMeshData.clear(); - mNavMeshStatus = pNavMeshStatus; - setRequestStatus(kNavMeshRequestNeedsUpdate); - } -} - -void LLPathfindingNavMesh::handleNavMeshStart(const LLPathfindingNavMeshStatus &pNavMeshStatus) -{ - llassert(mNavMeshStatus.getRegionUUID() == pNavMeshStatus.getRegionUUID()); - mNavMeshStatus = pNavMeshStatus; - setRequestStatus(kNavMeshRequestStarted); -} - -void LLPathfindingNavMesh::handleNavMeshResult(const LLSD &pContent, U32 pNavMeshVersion) -{ - if (pContent.has(NAVMESH_VERSION_FIELD)) - { - llassert(pContent.get(NAVMESH_VERSION_FIELD).isInteger()); - llassert(pContent.get(NAVMESH_VERSION_FIELD).asInteger() >= 0); - U32 embeddedNavMeshVersion = static_cast(pContent.get(NAVMESH_VERSION_FIELD).asInteger()); - llassert(embeddedNavMeshVersion == pNavMeshVersion); // stinson 03/13/2012 : does this ever occur? - if (embeddedNavMeshVersion != pNavMeshVersion) - { - llwarns << "Mismatch between expected and embedded navmesh versions occurred" << llendl; - pNavMeshVersion = embeddedNavMeshVersion; - } - } - - if (mNavMeshStatus.getVersion() == pNavMeshVersion) - { - ENavMeshRequestStatus status; - if ( pContent.has(NAVMESH_DATA_FIELD) ) - { - const LLSD::Binary &value = pContent.get(NAVMESH_DATA_FIELD).asBinary(); - unsigned int binSize = value.size(); - std::string newStr(reinterpret_cast(&value[0]), binSize); - std::istringstream streamdecomp( newStr ); - unsigned int decompBinSize = 0; - bool valid = false; - U8* pUncompressedNavMeshContainer = unzip_llsdNavMesh( valid, decompBinSize, streamdecomp, binSize ) ; - if ( !valid ) - { - llwarns << "Unable to decompress the navmesh llsd." << llendl; - status = kNavMeshRequestError; - } - else - { - llassert(pUncompressedNavMeshContainer); - mNavMeshData.resize( decompBinSize ); - memcpy( &mNavMeshData[0], &pUncompressedNavMeshContainer[0], decompBinSize ); - status = kNavMeshRequestCompleted; - } - if ( pUncompressedNavMeshContainer ) - { - free( pUncompressedNavMeshContainer ); - } - } - else - { - llwarns << "No mesh data received" << llendl; - status = kNavMeshRequestError; - } - setRequestStatus(status); - } -} - -void LLPathfindingNavMesh::handleNavMeshNotEnabled() -{ - mNavMeshData.clear(); - setRequestStatus(kNavMeshRequestNotEnabled); -} - -void LLPathfindingNavMesh::handleNavMeshError() -{ - mNavMeshData.clear(); - setRequestStatus(kNavMeshRequestError); -} - -void LLPathfindingNavMesh::handleNavMeshError(U32 pStatus, const std::string &pReason, const std::string &pURL, U32 pNavMeshVersion) -{ - llwarns << "error with request to URL '" << pURL << "' because " << pReason << " (statusCode:" << pStatus << ")" << llendl; - if (mNavMeshStatus.getVersion() == pNavMeshVersion) - { - handleNavMeshError(); - } -} - -void LLPathfindingNavMesh::setRequestStatus(ENavMeshRequestStatus pNavMeshRequestStatus) -{ - mNavMeshRequestStatus = pNavMeshRequestStatus; - sendStatus(); -} - -void LLPathfindingNavMesh::sendStatus() -{ - mNavMeshSignal(mNavMeshRequestStatus, mNavMeshStatus, mNavMeshData); -} +/** + * @file llpathfindingnavmesh.cpp + * @author William Todd Stinson + * @brief A class for representing the navmesh of a pathfinding region. + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "lluuid.h" +#include "llpathfindingnavmesh.h" +#include "llpathfindingnavmeshstatus.h" +#include "llsdserialize.h" + +#include + +#define NAVMESH_VERSION_FIELD "navmesh_version" +#define NAVMESH_DATA_FIELD "navmesh_data" + +//--------------------------------------------------------------------------- +// LLPathfindingNavMesh +//--------------------------------------------------------------------------- + +LLPathfindingNavMesh::LLPathfindingNavMesh(const LLUUID &pRegionUUID) + : mNavMeshStatus(pRegionUUID), + mNavMeshRequestStatus(kNavMeshRequestUnknown), + mNavMeshSignal(), + mNavMeshData() + +{ +} + +LLPathfindingNavMesh::~LLPathfindingNavMesh() +{ +} + +LLPathfindingNavMesh::navmesh_slot_t LLPathfindingNavMesh::registerNavMeshListener(navmesh_callback_t pNavMeshCallback) +{ + return mNavMeshSignal.connect(pNavMeshCallback); +} + +bool LLPathfindingNavMesh::hasNavMeshVersion(const LLPathfindingNavMeshStatus &pNavMeshStatus) const +{ + return ((mNavMeshStatus.getVersion() == pNavMeshStatus.getVersion()) && + ((mNavMeshRequestStatus == kNavMeshRequestStarted) || (mNavMeshRequestStatus == kNavMeshRequestCompleted) || + ((mNavMeshRequestStatus == kNavMeshRequestChecking) && !mNavMeshData.empty()))); +} + +void LLPathfindingNavMesh::handleNavMeshWaitForRegionLoad() +{ + setRequestStatus(kNavMeshRequestWaiting); +} + +void LLPathfindingNavMesh::handleNavMeshCheckVersion() +{ + setRequestStatus(kNavMeshRequestChecking); +} + +void LLPathfindingNavMesh::handleRefresh(const LLPathfindingNavMeshStatus &pNavMeshStatus) +{ + llassert(mNavMeshStatus.getRegionUUID() == pNavMeshStatus.getRegionUUID()); + llassert(mNavMeshStatus.getVersion() == pNavMeshStatus.getVersion()); + mNavMeshStatus = pNavMeshStatus; + if (mNavMeshRequestStatus == kNavMeshRequestChecking) + { + llassert(!mNavMeshData.empty()); + setRequestStatus(kNavMeshRequestCompleted); + } + else + { + sendStatus(); + } +} + +void LLPathfindingNavMesh::handleNavMeshNewVersion(const LLPathfindingNavMeshStatus &pNavMeshStatus) +{ + llassert(mNavMeshStatus.getRegionUUID() == pNavMeshStatus.getRegionUUID()); + if (mNavMeshStatus.getVersion() == pNavMeshStatus.getVersion()) + { + mNavMeshStatus = pNavMeshStatus; + sendStatus(); + } + else + { + mNavMeshData.clear(); + mNavMeshStatus = pNavMeshStatus; + setRequestStatus(kNavMeshRequestNeedsUpdate); + } +} + +void LLPathfindingNavMesh::handleNavMeshStart(const LLPathfindingNavMeshStatus &pNavMeshStatus) +{ + llassert(mNavMeshStatus.getRegionUUID() == pNavMeshStatus.getRegionUUID()); + mNavMeshStatus = pNavMeshStatus; + setRequestStatus(kNavMeshRequestStarted); +} + +void LLPathfindingNavMesh::handleNavMeshResult(const LLSD &pContent, U32 pNavMeshVersion) +{ + if (pContent.has(NAVMESH_VERSION_FIELD)) + { + llassert(pContent.get(NAVMESH_VERSION_FIELD).isInteger()); + llassert(pContent.get(NAVMESH_VERSION_FIELD).asInteger() >= 0); + U32 embeddedNavMeshVersion = static_cast(pContent.get(NAVMESH_VERSION_FIELD).asInteger()); + llassert(embeddedNavMeshVersion == pNavMeshVersion); // stinson 03/13/2012 : does this ever occur? + if (embeddedNavMeshVersion != pNavMeshVersion) + { + llwarns << "Mismatch between expected and embedded navmesh versions occurred" << llendl; + pNavMeshVersion = embeddedNavMeshVersion; + } + } + + if (mNavMeshStatus.getVersion() == pNavMeshVersion) + { + ENavMeshRequestStatus status; + if ( pContent.has(NAVMESH_DATA_FIELD) ) + { + const LLSD::Binary &value = pContent.get(NAVMESH_DATA_FIELD).asBinary(); + unsigned int binSize = value.size(); + std::string newStr(reinterpret_cast(&value[0]), binSize); + std::istringstream streamdecomp( newStr ); + unsigned int decompBinSize = 0; + bool valid = false; + U8* pUncompressedNavMeshContainer = unzip_llsdNavMesh( valid, decompBinSize, streamdecomp, binSize ) ; + if ( !valid ) + { + llwarns << "Unable to decompress the navmesh llsd." << llendl; + status = kNavMeshRequestError; + } + else + { + llassert(pUncompressedNavMeshContainer); + mNavMeshData.resize( decompBinSize ); + memcpy( &mNavMeshData[0], &pUncompressedNavMeshContainer[0], decompBinSize ); + status = kNavMeshRequestCompleted; + } + if ( pUncompressedNavMeshContainer ) + { + free( pUncompressedNavMeshContainer ); + } + } + else + { + llwarns << "No mesh data received" << llendl; + status = kNavMeshRequestError; + } + setRequestStatus(status); + } +} + +void LLPathfindingNavMesh::handleNavMeshNotEnabled() +{ + mNavMeshData.clear(); + setRequestStatus(kNavMeshRequestNotEnabled); +} + +void LLPathfindingNavMesh::handleNavMeshError() +{ + mNavMeshData.clear(); + setRequestStatus(kNavMeshRequestError); +} + +void LLPathfindingNavMesh::handleNavMeshError(U32 pStatus, const std::string &pReason, const std::string &pURL, U32 pNavMeshVersion) +{ + llwarns << "error with request to URL '" << pURL << "' because " << pReason << " (statusCode:" << pStatus << ")" << llendl; + if (mNavMeshStatus.getVersion() == pNavMeshVersion) + { + handleNavMeshError(); + } +} + +void LLPathfindingNavMesh::setRequestStatus(ENavMeshRequestStatus pNavMeshRequestStatus) +{ + mNavMeshRequestStatus = pNavMeshRequestStatus; + sendStatus(); +} + +void LLPathfindingNavMesh::sendStatus() +{ + mNavMeshSignal(mNavMeshRequestStatus, mNavMeshStatus, mNavMeshData); +} + diff --git a/indra/newview/llpathfindingnavmesh.h b/indra/newview/llpathfindingnavmesh.h index 290f7a2cdf..55fdd9aaa7 100644 --- a/indra/newview/llpathfindingnavmesh.h +++ b/indra/newview/llpathfindingnavmesh.h @@ -1,95 +1,98 @@ -/** - * @file llpathfindingnavmesh.h - * @author William Todd Stinson - * @brief A class for representing the navmesh of a pathfinding region. - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLPATHFINDINGNAVMESH_H -#define LL_LLPATHFINDINGNAVMESH_H - -#include "llsd.h" - -#include - -#include -#include -#include - -#include "llpathfindingnavmeshstatus.h" - -class LLUUID; -class LLPathfindingNavMesh; - -typedef boost::shared_ptr LLPathfindingNavMeshPtr; - -class LLPathfindingNavMesh -{ -public: - typedef enum { - kNavMeshRequestUnknown, - kNavMeshRequestChecking, - kNavMeshRequestNeedsUpdate, - kNavMeshRequestStarted, - kNavMeshRequestCompleted, - kNavMeshRequestNotEnabled, - kNavMeshRequestError - } ENavMeshRequestStatus; - - typedef boost::function navmesh_callback_t; - typedef boost::signals2::signal navmesh_signal_t; - typedef boost::signals2::connection navmesh_slot_t; - - LLPathfindingNavMesh(const LLUUID &pRegionUUID); - virtual ~LLPathfindingNavMesh(); - - navmesh_slot_t registerNavMeshListener(navmesh_callback_t pNavMeshCallback); - -#ifdef DEPRECATED_UNVERSIONED_NAVMESH - const LLPathfindingNavMeshStatus &getNavMeshStatusXXX() const {return mNavMeshStatus;}; -#endif // DEPRECATED_UNVERSIONED_NAVMESH - - bool hasNavMeshVersion(const LLPathfindingNavMeshStatus &pNavMeshStatus) const; - - void handleNavMeshCheckVersion(); - void handleRefresh(const LLPathfindingNavMeshStatus &pNavMeshStatus); - void handleNavMeshNewVersion(const LLPathfindingNavMeshStatus &pNavMeshStatus); - void handleNavMeshStart(const LLPathfindingNavMeshStatus &pNavMeshStatus); - void handleNavMeshResult(const LLSD &pContent, U32 pNavMeshVersion); - void handleNavMeshNotEnabled(); - void handleNavMeshError(); - void handleNavMeshError(U32 pStatus, const std::string &pReason, const std::string &pURL, U32 pNavMeshVersion); - -protected: - -private: - void setRequestStatus(ENavMeshRequestStatus pNavMeshRequestStatus); - void sendStatus(); - - LLPathfindingNavMeshStatus mNavMeshStatus; - ENavMeshRequestStatus mNavMeshRequestStatus; - navmesh_signal_t mNavMeshSignal; - LLSD::Binary mNavMeshData; -}; - -#endif // LL_LLPATHFINDINGNAVMESH_H +/** + * @file llpathfindingnavmesh.h + * @author William Todd Stinson + * @brief A class for representing the navmesh of a pathfinding region. + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLPATHFINDINGNAVMESH_H +#define LL_LLPATHFINDINGNAVMESH_H + +#include "llsd.h" + +#include + +#include +#include +#include + +#include "llpathfindingnavmeshstatus.h" + +class LLUUID; +class LLPathfindingNavMesh; + +typedef boost::shared_ptr LLPathfindingNavMeshPtr; + +class LLPathfindingNavMesh +{ +public: + typedef enum { + kNavMeshRequestUnknown, + kNavMeshRequestWaiting, + kNavMeshRequestChecking, + kNavMeshRequestNeedsUpdate, + kNavMeshRequestStarted, + kNavMeshRequestCompleted, + kNavMeshRequestNotEnabled, + kNavMeshRequestError + } ENavMeshRequestStatus; + + typedef boost::function navmesh_callback_t; + typedef boost::signals2::signal navmesh_signal_t; + typedef boost::signals2::connection navmesh_slot_t; + + LLPathfindingNavMesh(const LLUUID &pRegionUUID); + virtual ~LLPathfindingNavMesh(); + + navmesh_slot_t registerNavMeshListener(navmesh_callback_t pNavMeshCallback); + +#ifdef DEPRECATED_UNVERSIONED_NAVMESH + const LLPathfindingNavMeshStatus &getNavMeshStatusXXX() const {return mNavMeshStatus;}; +#endif // DEPRECATED_UNVERSIONED_NAVMESH + + bool hasNavMeshVersion(const LLPathfindingNavMeshStatus &pNavMeshStatus) const; + + void handleNavMeshWaitForRegionLoad(); + void handleNavMeshCheckVersion(); + void handleRefresh(const LLPathfindingNavMeshStatus &pNavMeshStatus); + void handleNavMeshNewVersion(const LLPathfindingNavMeshStatus &pNavMeshStatus); + void handleNavMeshStart(const LLPathfindingNavMeshStatus &pNavMeshStatus); + void handleNavMeshResult(const LLSD &pContent, U32 pNavMeshVersion); + void handleNavMeshNotEnabled(); + void handleNavMeshError(); + void handleNavMeshError(U32 pStatus, const std::string &pReason, const std::string &pURL, U32 pNavMeshVersion); + +protected: + +private: + void setRequestStatus(ENavMeshRequestStatus pNavMeshRequestStatus); + void sendStatus(); + + LLPathfindingNavMeshStatus mNavMeshStatus; + ENavMeshRequestStatus mNavMeshRequestStatus; + navmesh_signal_t mNavMeshSignal; + LLSD::Binary mNavMeshData; +}; + +#endif // LL_LLPATHFINDINGNAVMESH_H + diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp index 9c7b493701..f7872f6e29 100644 --- a/indra/newview/llpathfindingnavmeshzone.cpp +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -206,6 +206,7 @@ void LLPathfindingNavMeshZone::handleNavMeshLocation() void LLPathfindingNavMeshZone::updateStatus() { bool hasRequestUnknown = false; + bool hasRequestWaiting = false; bool hasRequestChecking = false; bool hasRequestNeedsUpdate = false; bool hasRequestStarted = false; @@ -228,6 +229,9 @@ void LLPathfindingNavMeshZone::updateStatus() case LLPathfindingNavMesh::kNavMeshRequestUnknown : hasRequestUnknown = true; break; + case LLPathfindingNavMesh::kNavMeshRequestWaiting : + hasRequestWaiting = true; + break; case LLPathfindingNavMesh::kNavMeshRequestChecking : hasRequestChecking = true; break; @@ -254,7 +258,14 @@ void LLPathfindingNavMeshZone::updateStatus() } ENavMeshZoneRequestStatus zoneRequestStatus = kNavMeshZoneRequestUnknown; - if (hasRequestNeedsUpdate) + if (hasRequestWaiting) + { + zoneRequestStatus = kNavMeshZoneRequestWaiting; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + llinfos << "STINSON DEBUG: Navmesh zone update is WAITING" << llendl; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + } + else if (hasRequestNeedsUpdate) { zoneRequestStatus = kNavMeshZoneRequestNeedsUpdate; #ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE diff --git a/indra/newview/llpathfindingnavmeshzone.h b/indra/newview/llpathfindingnavmeshzone.h index 7f83e9d37b..8c330559a9 100644 --- a/indra/newview/llpathfindingnavmeshzone.h +++ b/indra/newview/llpathfindingnavmeshzone.h @@ -1,134 +1,136 @@ -/** - * @file llpathfindingnavmeshzone.h - * @author William Todd Stinson - * @brief A class for representing the zone of navmeshes containing and possible surrounding the current region. - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLPATHFINDINGNAVMESHZONE_H -#define LL_LLPATHFINDINGNAVMESHZONE_H - -#include "llsd.h" -#include "lluuid.h" -#include "llpathfindingnavmesh.h" -#include "llpathfindingnavmeshstatus.h" - -#include - -#include -#include -#include - -class LLPathfindingNavMeshStatus; - -//#define XXX_STINSON_DEBUG_NAVMESH_ZONE - -class LLPathfindingNavMeshZone -{ -public: - typedef enum { - kNavMeshZoneRequestUnknown, - kNavMeshZoneRequestChecking, - kNavMeshZoneRequestNeedsUpdate, - kNavMeshZoneRequestStarted, - kNavMeshZoneRequestCompleted, - kNavMeshZoneRequestNotEnabled, - kNavMeshZoneRequestError - } ENavMeshZoneRequestStatus; - - typedef enum { - kNavMeshZonePending, - kNavMeshZoneBuilding, - kNavMeshZoneSomePending, - kNavMeshZoneSomeBuilding, - kNavMeshZonePendingAndBuilding, - kNavMeshZoneComplete - } ENavMeshZoneStatus; - - typedef boost::function navmesh_zone_callback_t; - typedef boost::signals2::signal navmesh_zone_signal_t; - typedef boost::signals2::connection navmesh_zone_slot_t; - - LLPathfindingNavMeshZone(); - virtual ~LLPathfindingNavMeshZone(); - - navmesh_zone_slot_t registerNavMeshZoneListener(navmesh_zone_callback_t pNavMeshZoneCallback); - void initialize(); - - void enable(); - void disable(); - void refresh(); - - ENavMeshZoneStatus getNavMeshZoneStatus() const; - -protected: - -private: - typedef boost::function navmesh_location_callback_t; - class NavMeshLocation - { - public: - NavMeshLocation(S32 pDirection, navmesh_location_callback_t pLocationCallback); - virtual ~NavMeshLocation(); - - void enable(); - void refresh(); - void disable(); - - LLPathfindingNavMesh::ENavMeshRequestStatus getRequestStatus() const; - LLPathfindingNavMeshStatus::ENavMeshStatus getNavMeshStatus() const; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - const LLUUID &getRegionUUID() const {return mRegionUUID;}; - S32 getDirection() const {return mDirection;}; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE - - protected: - - private: - void handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLPathfindingNavMeshStatus &pNavMeshStatus, const LLSD::Binary &pNavMeshData); - - void clear(); - LLViewerRegion *getRegion() const; - - S32 mDirection; - LLUUID mRegionUUID; - bool mHasNavMesh; - U32 mNavMeshVersion; - LLPathfindingNavMeshStatus::ENavMeshStatus mNavMeshStatus; - navmesh_location_callback_t mLocationCallback; - LLPathfindingNavMesh::ENavMeshRequestStatus mRequestStatus; - LLPathfindingNavMesh::navmesh_slot_t mNavMeshSlot; - }; - - typedef boost::shared_ptr NavMeshLocationPtr; - typedef std::vector NavMeshLocationPtrs; - - void handleNavMeshLocation(); - void updateStatus(); - - NavMeshLocationPtrs mNavMeshLocationPtrs; - ENavMeshZoneRequestStatus mNavMeshZoneRequestStatus; - navmesh_zone_signal_t mNavMeshZoneSignal; -}; - -#endif // LL_LLPATHFINDINGNAVMESHZONE_H +/** + * @file llpathfindingnavmeshzone.h + * @author William Todd Stinson + * @brief A class for representing the zone of navmeshes containing and possible surrounding the current region. + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLPATHFINDINGNAVMESHZONE_H +#define LL_LLPATHFINDINGNAVMESHZONE_H + +#include "llsd.h" +#include "lluuid.h" +#include "llpathfindingnavmesh.h" +#include "llpathfindingnavmeshstatus.h" + +#include + +#include +#include +#include + +class LLPathfindingNavMeshStatus; + +//#define XXX_STINSON_DEBUG_NAVMESH_ZONE + +class LLPathfindingNavMeshZone +{ +public: + typedef enum { + kNavMeshZoneRequestUnknown, + kNavMeshZoneRequestWaiting, + kNavMeshZoneRequestChecking, + kNavMeshZoneRequestNeedsUpdate, + kNavMeshZoneRequestStarted, + kNavMeshZoneRequestCompleted, + kNavMeshZoneRequestNotEnabled, + kNavMeshZoneRequestError + } ENavMeshZoneRequestStatus; + + typedef enum { + kNavMeshZonePending, + kNavMeshZoneBuilding, + kNavMeshZoneSomePending, + kNavMeshZoneSomeBuilding, + kNavMeshZonePendingAndBuilding, + kNavMeshZoneComplete + } ENavMeshZoneStatus; + + typedef boost::function navmesh_zone_callback_t; + typedef boost::signals2::signal navmesh_zone_signal_t; + typedef boost::signals2::connection navmesh_zone_slot_t; + + LLPathfindingNavMeshZone(); + virtual ~LLPathfindingNavMeshZone(); + + navmesh_zone_slot_t registerNavMeshZoneListener(navmesh_zone_callback_t pNavMeshZoneCallback); + void initialize(); + + void enable(); + void disable(); + void refresh(); + + ENavMeshZoneStatus getNavMeshZoneStatus() const; + +protected: + +private: + typedef boost::function navmesh_location_callback_t; + class NavMeshLocation + { + public: + NavMeshLocation(S32 pDirection, navmesh_location_callback_t pLocationCallback); + virtual ~NavMeshLocation(); + + void enable(); + void refresh(); + void disable(); + + LLPathfindingNavMesh::ENavMeshRequestStatus getRequestStatus() const; + LLPathfindingNavMeshStatus::ENavMeshStatus getNavMeshStatus() const; +#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE + const LLUUID &getRegionUUID() const {return mRegionUUID;}; + S32 getDirection() const {return mDirection;}; +#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE + + protected: + + private: + void handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLPathfindingNavMeshStatus &pNavMeshStatus, const LLSD::Binary &pNavMeshData); + + void clear(); + LLViewerRegion *getRegion() const; + + S32 mDirection; + LLUUID mRegionUUID; + bool mHasNavMesh; + U32 mNavMeshVersion; + LLPathfindingNavMeshStatus::ENavMeshStatus mNavMeshStatus; + navmesh_location_callback_t mLocationCallback; + LLPathfindingNavMesh::ENavMeshRequestStatus mRequestStatus; + LLPathfindingNavMesh::navmesh_slot_t mNavMeshSlot; + }; + + typedef boost::shared_ptr NavMeshLocationPtr; + typedef std::vector NavMeshLocationPtrs; + + void handleNavMeshLocation(); + void updateStatus(); + + NavMeshLocationPtrs mNavMeshLocationPtrs; + ENavMeshZoneRequestStatus mNavMeshZoneRequestStatus; + navmesh_zone_signal_t mNavMeshZoneSignal; +}; + +#endif // LL_LLPATHFINDINGNAVMESHZONE_H + diff --git a/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml b/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml index a951106640..54d44be015 100644 --- a/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml +++ b/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml @@ -14,6 +14,7 @@ Cannot find pathing library implementation. This region is not enabled for pathfinding. + Waiting for the region to finish loading. Checking the status of the navmesh. Downloading the navmesh. The navmesh has changed on the server. Downloading the latest navmesh. -- cgit v1.3 From b1013ca76072531340779919d55a1a4f628989e5 Mon Sep 17 00:00:00 2001 From: prep Date: Tue, 22 May 2012 14:59:00 -0400 Subject: Fix for path-648: shapes are now positioned correctly in neighboring regions. Renamed api to better reflect it's purpose --- autobuild.xml | 12 ++++++------ indra/newview/llpathfindingnavmeshzone.cpp | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'indra/newview/llpathfindingnavmeshzone.cpp') diff --git a/autobuild.xml b/autobuild.xml index db67f2556e..f306a3daab 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -1110,9 +1110,9 @@ archive hash - a1c20a15a9e62c422c6c21afcca4695d + 63b8600252fc018d653f9fe005f0f012 url - http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/stinson_llpathinglibrary/rev/256784/arch/Darwin/installer/llphysicsextensions-0.1-darwin-20120514.tar.bz2 + http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/stinson_llpathinglibrary/rev/257778/arch/Darwin/installer/llphysicsextensions-0.1-darwin-20120522.tar.bz2 name darwin @@ -1122,9 +1122,9 @@ archive hash - c2a41401c6b6e4f34f3404dd68a17b92 + a613fe925aeb8d4d1a7ab0cfbb15a0d6 url - http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/stinson_llpathinglibrary/rev/256784/arch/Linux/installer/llphysicsextensions-0.1-linux-20120514.tar.bz2 + http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/stinson_llpathinglibrary/rev/257778/arch/Linux/installer/llphysicsextensions-0.1-linux-20120522.tar.bz2 name linux @@ -1134,9 +1134,9 @@ archive hash - 25d9403584f13f3fcbbcff14eb2d923c + 022a014a7efffdf5296c9e4d4692d171 url - http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/stinson_llpathinglibrary/rev/256784/arch/CYGWIN/installer/llphysicsextensions-0.1-windows-20120514.tar.bz2 + http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/stinson_llpathinglibrary/rev/257778/arch/CYGWIN/installer/llphysicsextensions-0.1-windows-20120522.tar.bz2 name windows diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp index f7872f6e29..816c94e25e 100644 --- a/indra/newview/llpathfindingnavmeshzone.cpp +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -332,7 +332,7 @@ void LLPathfindingNavMeshZone::updateStatus() llassert(LLPathingLib::getInstance() != NULL); if (LLPathingLib::getInstance() != NULL) { - LLPathingLib::getInstance()->stitchNavMeshes(); + LLPathingLib::getInstance()->processNavMeshData(); } #ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE llinfos << "STINSON DEBUG: Navmesh zone update stitching is done" << llendl; -- cgit v1.3 From b59a82fc8ea5a23a886d3eb5d3c27b7c1d97d8d6 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 18 Jun 2012 17:21:42 -0700 Subject: PATH-705: Creating a path to pull in the state of the current region navmesh without downloading the navmesh binary. --- indra/newview/llpathfindingmanager.cpp | 118 +++++++++++++++++++++++------ indra/newview/llpathfindingmanager.h | 22 +++--- indra/newview/llpathfindingnavmeshzone.cpp | 2 +- 3 files changed, 106 insertions(+), 36 deletions(-) (limited to 'indra/newview/llpathfindingnavmeshzone.cpp') diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index a77d6bcc4c..674a96a439 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -102,7 +102,7 @@ LLHTTPRegistration gHTTPRegistrationAgentStateChangeNode class NavMeshStatusResponder : public LLHTTPClient::Responder { public: - NavMeshStatusResponder(const std::string &pCapabilityURL, LLViewerRegion *pRegion); + NavMeshStatusResponder(const std::string &pCapabilityURL, LLViewerRegion *pRegion, bool pIsGetStatusOnly); virtual ~NavMeshStatusResponder(); virtual void result(const LLSD &pContent); @@ -114,6 +114,7 @@ private: std::string mCapabilityURL; LLViewerRegion *mRegion; LLUUID mRegionUUID; + bool mIsGetStatusOnly; }; //--------------------------------------------------------------------------- @@ -282,23 +283,30 @@ private: LLPathfindingManager::LLPathfindingManager() : LLSingleton(), mNavMeshMap(), - mShowNavMeshRebake(false), - mCrossingSlot() + mCrossingSlot(), + mAgentStateSignal(), + mNavMeshSlot() { - } void LLPathfindingManager::onRegionBoundaryCrossed() { + if (mNavMeshSlot.connected()) + { + mNavMeshSlot.disconnect(); + } + LLViewerRegion *currentRegion = getCurrentRegion(); + if (currentRegion != NULL) + { + mNavMeshSlot = registerNavMeshListenerForRegion(currentRegion, boost::bind(&LLPathfindingManager::handleNavMeshStatus, this, _1, _2)); + requestGetNavMeshForRegion(currentRegion, true); + } displayNavMeshRebakePanel(); } LLPathfindingManager::~LLPathfindingManager() { - if (mCrossingSlot.connected()) - { - mCrossingSlot.disconnect(); - } + quitSystem(); } void LLPathfindingManager::initSystem() @@ -307,6 +315,40 @@ void LLPathfindingManager::initSystem() { LLPathingLib::initSystem(); } + + if ( !mCrossingSlot.connected() ) + { + mCrossingSlot = LLEnvManagerNew::getInstance()->setRegionChangeCallback(boost::bind(&LLPathfindingManager::onRegionBoundaryCrossed, this)); + } + + if (mNavMeshSlot.connected()) + { + mNavMeshSlot.disconnect(); + } + LLViewerRegion *currentRegion = getCurrentRegion(); + if (currentRegion != NULL) + { + mNavMeshSlot = registerNavMeshListenerForRegion(currentRegion, boost::bind(&LLPathfindingManager::handleNavMeshStatus, this, _1, _2)); + requestGetNavMeshForRegion(currentRegion, true); + } +} + +void LLPathfindingManager::quitSystem() +{ + if (mNavMeshSlot.connected()) + { + mNavMeshSlot.disconnect(); + } + + if (mCrossingSlot.connected()) + { + mCrossingSlot.disconnect(); + } + + if (LLPathingLib::getInstance() != NULL) + { + LLPathingLib::quitSystem(); + } } bool LLPathfindingManager::isPathfindingEnabledForCurrentRegion() const @@ -337,7 +379,7 @@ LLPathfindingNavMesh::navmesh_slot_t LLPathfindingManager::registerNavMeshListen return navMeshPtr->registerNavMeshListener(pNavMeshCallback); } -void LLPathfindingManager::requestGetNavMeshForRegion(LLViewerRegion *pRegion) +void LLPathfindingManager::requestGetNavMeshForRegion(LLViewerRegion *pRegion, bool pIsGetStatusOnly) { LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pRegion); @@ -348,7 +390,7 @@ void LLPathfindingManager::requestGetNavMeshForRegion(LLViewerRegion *pRegion) else if (!pRegion->capabilitiesReceived()) { navMeshPtr->handleNavMeshWaitForRegionLoad(); - pRegion->setCapabilitiesReceivedCallback(boost::bind(&LLPathfindingManager::handleDeferredGetNavMeshForRegion, this, _1)); + pRegion->setCapabilitiesReceivedCallback(boost::bind(&LLPathfindingManager::handleDeferredGetNavMeshForRegion, this, _1, pIsGetStatusOnly)); } else if (!isPathfindingEnabledForRegion(pRegion)) { @@ -359,7 +401,7 @@ void LLPathfindingManager::requestGetNavMeshForRegion(LLViewerRegion *pRegion) std::string navMeshStatusURL = getNavMeshStatusURLForRegion(pRegion); llassert(!navMeshStatusURL.empty()); navMeshPtr->handleNavMeshCheckVersion(); - LLHTTPClient::ResponderPtr navMeshStatusResponder = new NavMeshStatusResponder(navMeshStatusURL, pRegion); + LLHTTPClient::ResponderPtr navMeshStatusResponder = new NavMeshStatusResponder(navMeshStatusURL, pRegion, pIsGetStatusOnly); LLHTTPClient::get(navMeshStatusURL, navMeshStatusResponder); } } @@ -518,13 +560,13 @@ void LLPathfindingManager::sendRequestGetNavMeshForRegion(LLPathfindingNavMeshPt } } -void LLPathfindingManager::handleDeferredGetNavMeshForRegion(const LLUUID &pRegionUUID) +void LLPathfindingManager::handleDeferredGetNavMeshForRegion(const LLUUID &pRegionUUID, bool pIsGetStatusOnly) { LLViewerRegion *currentRegion = getCurrentRegion(); if ((currentRegion != NULL) && (currentRegion->getRegionID() == pRegionUUID)) { - requestGetNavMeshForRegion(currentRegion); + requestGetNavMeshForRegion(currentRegion, pIsGetStatusOnly); } } @@ -548,7 +590,7 @@ void LLPathfindingManager::handleDeferredGetCharactersForRegion(const LLUUID &pR } } -void LLPathfindingManager::handleNavMeshStatusRequest(const LLPathfindingNavMeshStatus &pNavMeshStatus, LLViewerRegion *pRegion) +void LLPathfindingManager::handleNavMeshStatusRequest(const LLPathfindingNavMeshStatus &pNavMeshStatus, LLViewerRegion *pRegion, bool pIsGetStatusOnly) { LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pNavMeshStatus.getRegionUUID()); @@ -562,6 +604,10 @@ void LLPathfindingManager::handleNavMeshStatusRequest(const LLPathfindingNavMesh { navMeshPtr->handleRefresh(pNavMeshStatus); } + else if (pIsGetStatusOnly) + { + navMeshPtr->handleNavMeshNewVersion(pNavMeshStatus); + } else { sendRequestGetNavMeshForRegion(navMeshPtr, pRegion, pNavMeshStatus); @@ -613,11 +659,6 @@ LLPathfindingNavMeshPtr LLPathfindingManager::getNavMeshForRegion(LLViewerRegion void LLPathfindingManager::requestGetAgentState() { - if ( !mCrossingSlot.connected() ) - { - mCrossingSlot = LLEnvManagerNew::getInstance()->setRegionChangeCallback(boost::bind(&LLPathfindingManager::onRegionBoundaryCrossed, this)); - } - std::string agentStateURL = getAgentStateURLForCurrentRegion( getCurrentRegion() ); if ( !agentStateURL.empty() ) @@ -696,6 +737,36 @@ LLViewerRegion *LLPathfindingManager::getCurrentRegion() const return gAgent.getRegion(); } +void LLPathfindingManager::handleNavMeshStatus(LLPathfindingNavMesh::ENavMeshRequestStatus pRequestStatus, const LLPathfindingNavMeshStatus &pNavMeshStatus) +{ + if (!pNavMeshStatus.isValid()) + { + llinfos << "STINSON DEBUG: navmesh status is invalid" << llendl; + } + else + { + switch (pNavMeshStatus.getStatus()) + { + case LLPathfindingNavMeshStatus::kPending : + llinfos << "STINSON DEBUG: navmesh status is kPending" << llendl; + break; + case LLPathfindingNavMeshStatus::kBuilding : + llinfos << "STINSON DEBUG: navmesh status is kBuilding" << llendl; + break; + case LLPathfindingNavMeshStatus::kComplete : + llinfos << "STINSON DEBUG: navmesh status is kComplete" << llendl; + break; + case LLPathfindingNavMeshStatus::kRepending : + llinfos << "STINSON DEBUG: navmesh status is kRepending" << llendl; + break; + default : + llinfos << "STINSON DEBUG: navmesh status is default" << llendl; + llassert(0); + break; + } + } +} + void LLPathfindingManager::displayNavMeshRebakePanel() { LLView* rootp = LLUI::getRootView(); @@ -771,11 +842,12 @@ void LLPathfindingManager::handleAgentStateUpdate() // NavMeshStatusResponder //--------------------------------------------------------------------------- -NavMeshStatusResponder::NavMeshStatusResponder(const std::string &pCapabilityURL, LLViewerRegion *pRegion) +NavMeshStatusResponder::NavMeshStatusResponder(const std::string &pCapabilityURL, LLViewerRegion *pRegion, bool pIsGetStatusOnly) : LLHTTPClient::Responder(), mCapabilityURL(pCapabilityURL), mRegion(pRegion), - mRegionUUID() + mRegionUUID(), + mIsGetStatusOnly(pIsGetStatusOnly) { if (mRegion != NULL) { @@ -793,14 +865,14 @@ void NavMeshStatusResponder::result(const LLSD &pContent) llinfos << "STINSON DEBUG: Received requested NavMeshStatus: " << pContent << llendl; #endif // XXX_STINSON_DEBUG_NAVMESH_ZONE LLPathfindingNavMeshStatus navMeshStatus(mRegionUUID, pContent); - LLPathfindingManager::getInstance()->handleNavMeshStatusRequest(navMeshStatus, mRegion); + LLPathfindingManager::getInstance()->handleNavMeshStatusRequest(navMeshStatus, mRegion, mIsGetStatusOnly); } void NavMeshStatusResponder::error(U32 pStatus, const std::string& pReason) { llwarns << "error with request to URL '" << mCapabilityURL << "' because " << pReason << " (statusCode:" << pStatus << ")" << llendl; LLPathfindingNavMeshStatus navMeshStatus(mRegionUUID); - LLPathfindingManager::getInstance()->handleNavMeshStatusRequest(navMeshStatus, mRegion); + LLPathfindingManager::getInstance()->handleNavMeshStatusRequest(navMeshStatus, mRegion, mIsGetStatusOnly); } //--------------------------------------------------------------------------- diff --git a/indra/newview/llpathfindingmanager.h b/indra/newview/llpathfindingmanager.h index 1de9fd6525..a8ece11302 100644 --- a/indra/newview/llpathfindingmanager.h +++ b/indra/newview/llpathfindingmanager.h @@ -63,6 +63,7 @@ public: virtual ~LLPathfindingManager(); void initSystem(); + void quitSystem(); bool isPathfindingEnabledForCurrentRegion() const; bool isPathfindingEnabledForRegion(LLViewerRegion *pRegion) const; @@ -72,7 +73,7 @@ public: bool isAllowViewTerrainProperties() const; LLPathfindingNavMesh::navmesh_slot_t registerNavMeshListenerForRegion(LLViewerRegion *pRegion, LLPathfindingNavMesh::navmesh_callback_t pNavMeshCallback); - void requestGetNavMeshForRegion(LLViewerRegion *pRegion); + void requestGetNavMeshForRegion(LLViewerRegion *pRegion, bool pIsGetStatusOnly); typedef U32 request_id_t; typedef boost::function object_request_callback_t; @@ -89,9 +90,6 @@ public: typedef boost::signals2::signal< void () > agent_state_signal_t; typedef boost::signals2::connection agent_state_slot_t; - agent_state_slot_t mCrossingSlot; - agent_state_signal_t mAgentStateSignal; - agent_state_slot_t registerAgentStateListener(agent_state_callback_t pAgentStateCallback); void handleNavMeshRebakeResult( const LLSD &pContent ); @@ -105,11 +103,11 @@ protected: private: void sendRequestGetNavMeshForRegion(LLPathfindingNavMeshPtr navMeshPtr, LLViewerRegion *pRegion, const LLPathfindingNavMeshStatus &pNavMeshStatus); - void handleDeferredGetNavMeshForRegion(const LLUUID &pRegionUUID); + void handleDeferredGetNavMeshForRegion(const LLUUID &pRegionUUID, bool pIsGetStatusOnly); void handleDeferredGetLinksetsForRegion(const LLUUID &pRegionUUID, request_id_t pRequestId, object_request_callback_t pLinksetsCallback) const; void handleDeferredGetCharactersForRegion(const LLUUID &pRegionUUID, request_id_t pRequestId, object_request_callback_t pCharactersCallback) const; - void handleNavMeshStatusRequest(const LLPathfindingNavMeshStatus &pNavMeshStatus, LLViewerRegion *pRegion); + void handleNavMeshStatusRequest(const LLPathfindingNavMeshStatus &pNavMeshStatus, LLViewerRegion *pRegion, bool pIsGetStatusOnly); void handleNavMeshStatusUpdate(const LLPathfindingNavMeshStatus &pNavMeshStatus); void handleAgentStateUpdate(); @@ -127,17 +125,17 @@ private: std::string getCapabilityURLForRegion(LLViewerRegion *pRegion, const std::string &pCapabilityName) const; LLViewerRegion *getCurrentRegion() const; - + 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); - - NavMeshMap mNavMeshMap; - - //prep#stinson# set this flag instead of directly showing/hiding the rebake panel - BOOL mShowNavMeshRebake; + NavMeshMap mNavMeshMap; + agent_state_slot_t mCrossingSlot; + agent_state_signal_t mAgentStateSignal; + LLPathfindingNavMesh::navmesh_slot_t mNavMeshSlot; }; diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp index 816c94e25e..69c76c9407 100644 --- a/indra/newview/llpathfindingnavmeshzone.cpp +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -393,7 +393,7 @@ void LLPathfindingNavMeshZone::NavMeshLocation::refresh() else { llassert(mRegionUUID == region->getRegionID()); - LLPathfindingManager::getInstance()->requestGetNavMeshForRegion(region); + LLPathfindingManager::getInstance()->requestGetNavMeshForRegion(region, false); } } -- cgit v1.3 From 7cc44fb7fe40706e2017343d76ed226f477dad8d Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Fri, 22 Jun 2012 18:15:56 -0700 Subject: PATH-759: Removing XXX_STINSON_DEBUG_NAVMESH_ZONE ifdefs. --- indra/newview/llpathfindingmanager.cpp | 6 ---- indra/newview/llpathfindingnavmeshzone.cpp | 57 ------------------------------ indra/newview/llpathfindingnavmeshzone.h | 6 ---- 3 files changed, 69 deletions(-) (limited to 'indra/newview/llpathfindingnavmeshzone.cpp') diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index 44dab04583..a01874296d 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -737,9 +737,6 @@ LLViewerRegion *LLPathfindingManager::getCurrentRegion() const void LLNavMeshSimStateChangeNode::post(ResponsePtr pResponse, const LLSD &pContext, const LLSD &pInput) const { -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Received NavMeshStatusUpdate: " << pInput << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE llassert(pInput.has(SIM_MESSAGE_BODY_FIELD)); llassert(pInput.get(SIM_MESSAGE_BODY_FIELD).isMap()); LLPathfindingNavMeshStatus navMeshStatus(pInput.get(SIM_MESSAGE_BODY_FIELD)); @@ -784,9 +781,6 @@ NavMeshStatusResponder::~NavMeshStatusResponder() void NavMeshStatusResponder::result(const LLSD &pContent) { -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Received requested NavMeshStatus: " << pContent << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE LLPathfindingNavMeshStatus navMeshStatus(mRegionUUID, pContent); LLPathfindingManager::getInstance()->handleNavMeshStatusRequest(navMeshStatus, mRegion, mIsGetStatusOnly); } diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp index 69c76c9407..d8670062e9 100644 --- a/indra/newview/llpathfindingnavmeshzone.cpp +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -68,24 +68,6 @@ void LLPathfindingNavMeshZone::initialize() { mNavMeshLocationPtrs.clear(); -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - LLViewerRegion *currentRegion = gAgent.getRegion(); - if (currentRegion != NULL) - { - llinfos << "STINSON DEBUG: currentRegion: '" << currentRegion->getName() << "' (" << currentRegion->getRegionID().asString() << ")" << llendl; - std::vector availableRegions; - currentRegion->getNeighboringRegionsStatus( availableRegions ); - std::vector neighborRegionsPtrs; - currentRegion->getNeighboringRegions( neighborRegionsPtrs ); - for (std::vector::const_iterator statusIter = availableRegions.begin(); - statusIter != availableRegions.end(); ++statusIter) - { - LLViewerRegion *region = neighborRegionsPtrs[statusIter - availableRegions.begin()]; - llinfos << "STINSON DEBUG: region #" << *statusIter << ": '" << region->getName() << "' (" << region->getRegionID().asString() << ")" << llendl; - } - } - -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE NavMeshLocationPtr centerNavMeshPtr(new NavMeshLocation(CENTER_REGION, boost::bind(&LLPathfindingNavMeshZone::handleNavMeshLocation, this))); mNavMeshLocationPtrs.push_back(centerNavMeshPtr); @@ -214,16 +196,10 @@ void LLPathfindingNavMeshZone::updateStatus() bool hasRequestNotEnabled = false; bool hasRequestError = false; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update BEGIN" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE for (NavMeshLocationPtrs::const_iterator navMeshLocationPtrIter = mNavMeshLocationPtrs.begin(); navMeshLocationPtrIter != mNavMeshLocationPtrs.end(); ++navMeshLocationPtrIter) { const NavMeshLocationPtr navMeshLocationPtr = *navMeshLocationPtrIter; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: region #" << navMeshLocationPtr->getDirection() << ": region(" << navMeshLocationPtr->getRegionUUID().asString() << ") status:" << navMeshLocationPtr->getRequestStatus() << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE switch (navMeshLocationPtr->getRequestStatus()) { case LLPathfindingNavMesh::kNavMeshRequestUnknown : @@ -261,82 +237,49 @@ void LLPathfindingNavMeshZone::updateStatus() if (hasRequestWaiting) { zoneRequestStatus = kNavMeshZoneRequestWaiting; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is WAITING" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE } else if (hasRequestNeedsUpdate) { zoneRequestStatus = kNavMeshZoneRequestNeedsUpdate; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is NEEDS UPDATE" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE } else if (hasRequestChecking) { zoneRequestStatus = kNavMeshZoneRequestChecking; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is CHECKING" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE } else if (hasRequestStarted) { zoneRequestStatus = kNavMeshZoneRequestStarted; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is STARTED" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE } else if (hasRequestError) { zoneRequestStatus = kNavMeshZoneRequestError; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is ERROR" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE } else if (hasRequestUnknown) { zoneRequestStatus = kNavMeshZoneRequestUnknown; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is UNKNOWN" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE } else if (hasRequestCompleted) { zoneRequestStatus = kNavMeshZoneRequestCompleted; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is COMPLETED" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE } else if (hasRequestNotEnabled) { zoneRequestStatus = kNavMeshZoneRequestNotEnabled; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is NOT ENABLED" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE } else { zoneRequestStatus = kNavMeshZoneRequestError; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is BAD ERROR" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE llassert(0); } if ((mNavMeshZoneRequestStatus != kNavMeshZoneRequestCompleted) && (zoneRequestStatus == kNavMeshZoneRequestCompleted)) { -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update is stitching" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE llassert(LLPathingLib::getInstance() != NULL); if (LLPathingLib::getInstance() != NULL) { LLPathingLib::getInstance()->processNavMeshData(); } -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - llinfos << "STINSON DEBUG: Navmesh zone update stitching is done" << llendl; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE } mNavMeshZoneRequestStatus = zoneRequestStatus; diff --git a/indra/newview/llpathfindingnavmeshzone.h b/indra/newview/llpathfindingnavmeshzone.h index 679e72c978..d4e7a717b2 100644 --- a/indra/newview/llpathfindingnavmeshzone.h +++ b/indra/newview/llpathfindingnavmeshzone.h @@ -42,8 +42,6 @@ class LLPathfindingNavMeshStatus; -//#define XXX_STINSON_DEBUG_NAVMESH_ZONE - class LLPathfindingNavMeshZone { public: @@ -99,10 +97,6 @@ private: LLPathfindingNavMesh::ENavMeshRequestStatus getRequestStatus() const; LLPathfindingNavMeshStatus::ENavMeshStatus getNavMeshStatus() const; -#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE - const LLUUID &getRegionUUID() const {return mRegionUUID;}; - S32 getDirection() const {return mDirection;}; -#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE protected: -- cgit v1.3 From 2cd321eaa9b9b9872318ce3977acd9a2f782872f Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 26 Jun 2012 14:09:07 -0700 Subject: Updating the pathfinding-specific settings with appropriate comments and an unified naming scheme. --- indra/newview/app_settings/settings.xml | 44 +++++++++++++-------------- indra/newview/llfloaterpathfindingconsole.cpp | 6 ++-- indra/newview/llpathfindingnavmeshzone.cpp | 2 +- 3 files changed, 26 insertions(+), 26 deletions(-) (limited to 'indra/newview/llpathfindingnavmeshzone.cpp') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index f144e9f007..0f3ae89fa8 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -13595,10 +13595,10 @@ Value 0 - RetrieveNeighboringRegion + PathfindingRetrieveNeighboringRegion Comment - Download a neighboring region when visualize a navmesh (default val 99 is for the current region). + Download a neighboring region when visualizing a pathfinding navmesh (default val 99 means do not download neighbors). Persist 1 Type @@ -13609,7 +13609,7 @@ PathfindingNavMeshClear Comment - Background color + Background color when displaying pathfinding navmesh. Persist 0 Type @@ -13625,7 +13625,7 @@ PathfindingWalkable Comment - Walkable color + Color of walkable objects when displaying pathfinding navmesh object types. Persist 0 Type @@ -13641,7 +13641,7 @@ PathfindingObstacle Comment - Obstacle color + Color of static obstacle objects when displaying pathfinding navmesh object types. Persist 0 Type @@ -13657,7 +13657,7 @@ PathfindingMaterial Comment - Material volume color + Color of material volumes when displaying pathfinding navmesh object types. Persist 0 Type @@ -13673,7 +13673,7 @@ PathfindingExclusion Comment - Exclusion volume color + Color of exclusion volumes when displaying pathfinding navmesh object types. Persist 0 Type @@ -13689,7 +13689,7 @@ PathfindingConnectedEdge Comment - Connected edge color + Color of a connected (crossable) edge when displaying pathfinding navmesh. Persist 0 Type @@ -13705,7 +13705,7 @@ PathfindingBoundaryEdge Comment - Boundary edge color + Color of a boundary (non-crossable) edge when displaying pathfinding navmesh. Persist 0 Type @@ -13721,7 +13721,7 @@ PathfindingHeatColorBase Comment - Least walkable heat map color + Color of the least walkable value when displaying the pathfinding navmesh as a heatmap. Persist 0 Type @@ -13737,7 +13737,7 @@ PathfindingHeatColorMax Comment - Most walkable heat map color + Color of the most walkable value when displaying the pathfinding navmesh as a heatmap. Persist 0 Type @@ -13753,7 +13753,7 @@ PathfindingFaceColor Comment - Nav mesh color? + Color of the faces when displaying the default view of the pathfinding navmesh. Persist 0 Type @@ -13766,10 +13766,10 @@ 1.0 - PathfindingStarValidColor + PathfindingTestPathValidEndColor Comment - yay! + Color of the pathfinding test-pathing tool end-point when the path is valid. Persist 0 Type @@ -13782,10 +13782,10 @@ 1.0 - PathfindingStarInvalidColor + PathfindingTestPathInvalidEndColor Comment - yay! + Color of the pathfinding test-pathing tool end-point when the path is invalid. Persist 0 Type @@ -13801,7 +13801,7 @@ PathfindingTestPathColor Comment - yay! + Color of the pathfinding test-path when the path is valid. Persist 0 Type @@ -13817,7 +13817,7 @@ PathfindingAmbiance Comment - Ambiance of lit pathfinding displays. + Ambiance of lit pathfinding navmesh displays. Persist 0 Type @@ -13829,7 +13829,7 @@ PathfindingXRayTint Comment - Amount to darken/lighten x-ray lines in pathfinding display + Amount to darken/lighten x-ray lines in pathfinding display. Persist 0 Type @@ -13853,7 +13853,7 @@ PathfindingXRayWireframe Comment - Render pathfinding xray as a wireframe. + Render pathfinding navmesh xray as a wireframe. Persist 0 Type @@ -13865,7 +13865,7 @@ PathfindingLineWidth Comment - Width of volume outlines in pathfinding display. + Width of volume outlines in pathfinding navmesh display. Persist 0 Type @@ -13922,7 +13922,7 @@ PathfindingWaterColor Comment - yay! + Color of water plane when displaying pathfinding navmesh. Persist 0 Type diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 2cf7f3aeb1..c2d19bfb9a 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -70,7 +70,7 @@ #define SET_SHAPE_RENDER_FLAG(_flag,_type) _flag |= (1U << _type) -#define CONTROL_NAME_RETRIEVE_NEIGHBOR "RetrieveNeighboringRegion" +#define CONTROL_NAME_RETRIEVE_NEIGHBOR "PathfindingRetrieveNeighboringRegion" #define CONTROL_NAME_WALKABLE_OBJECTS "PathfindingWalkable" #define CONTROL_NAME_STATIC_OBSTACLE_OBJECTS "PathfindingObstacle" #define CONTROL_NAME_MATERIAL_VOLUMES "PathfindingMaterial" @@ -80,8 +80,8 @@ #define CONTROL_NAME_HEATMAP_MIN "PathfindingHeatColorBase" #define CONTROL_NAME_HEATMAP_MAX "PathfindingHeatColorMax" #define CONTROL_NAME_NAVMESH_FACE "PathfindingFaceColor" -#define CONTROL_NAME_TEST_PATH_VALID_END "PathfindingStarValidColor" -#define CONTROL_NAME_TEST_PATH_INVALID_END "PathfindingStarInvalidColor" +#define CONTROL_NAME_TEST_PATH_VALID_END "PathfindingTestPathValidEndColor" +#define CONTROL_NAME_TEST_PATH_INVALID_END "PathfindingTestPathInvalidEndColor" #define CONTROL_NAME_TEST_PATH "PathfindingTestPathColor" #define CONTROL_NAME_WATER "PathfindingWaterColor" diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp index d8670062e9..ee81762792 100644 --- a/indra/newview/llpathfindingnavmeshzone.cpp +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -71,7 +71,7 @@ void LLPathfindingNavMeshZone::initialize() NavMeshLocationPtr centerNavMeshPtr(new NavMeshLocation(CENTER_REGION, boost::bind(&LLPathfindingNavMeshZone::handleNavMeshLocation, this))); mNavMeshLocationPtrs.push_back(centerNavMeshPtr); - U32 neighborRegionDir = gSavedSettings.getU32("RetrieveNeighboringRegion"); + U32 neighborRegionDir = gSavedSettings.getU32("PathfindingRetrieveNeighboringRegion"); if (neighborRegionDir != CENTER_REGION) { NavMeshLocationPtr neighborNavMeshPtr(new NavMeshLocation(neighborRegionDir, boost::bind(&LLPathfindingNavMeshZone::handleNavMeshLocation, this))); -- cgit v1.3 From 78910cf3016fc55eaf8214640b348df0f8bcdeda Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 26 Jun 2012 18:04:19 -0700 Subject: Updating the header licensing comments. --- indra/llrender/llrendernavprim.cpp | 53 +++++++++++---------- indra/llrender/llrendernavprim.h | 56 +++++++++++----------- indra/newview/llfloaterpathfindingcharacters.cpp | 51 ++++++++++---------- indra/newview/llfloaterpathfindingcharacters.h | 19 ++++---- indra/newview/llfloaterpathfindingconsole.cpp | 19 ++++---- indra/newview/llfloaterpathfindingconsole.h | 51 ++++++++++---------- indra/newview/llfloaterpathfindinglinksets.cpp | 17 +++---- indra/newview/llfloaterpathfindinglinksets.h | 51 ++++++++++---------- indra/newview/llfloaterpathfindingobjects.cpp | 2 +- indra/newview/llfloaterpathfindingobjects.h | 2 +- indra/newview/llpathfindingcharacter.cpp | 51 ++++++++++---------- indra/newview/llpathfindingcharacter.h | 51 ++++++++++---------- indra/newview/llpathfindingcharacterlist.cpp | 51 ++++++++++---------- indra/newview/llpathfindingcharacterlist.h | 51 ++++++++++---------- indra/newview/llpathfindinglinkset.cpp | 51 ++++++++++---------- indra/newview/llpathfindinglinkset.h | 51 ++++++++++---------- indra/newview/llpathfindinglinksetlist.cpp | 51 ++++++++++---------- indra/newview/llpathfindinglinksetlist.h | 51 ++++++++++---------- indra/newview/llpathfindingmanager.cpp | 53 ++++++++++----------- indra/newview/llpathfindingmanager.h | 53 +++++++++++---------- indra/newview/llpathfindingnavmesh.cpp | 58 ++++++++++++----------- indra/newview/llpathfindingnavmesh.h | 54 +++++++++++----------- indra/newview/llpathfindingnavmeshstatus.cpp | 59 +++++++++++++----------- indra/newview/llpathfindingnavmeshstatus.h | 51 ++++++++++---------- indra/newview/llpathfindingnavmeshzone.cpp | 55 +++++++++++----------- indra/newview/llpathfindingnavmeshzone.h | 54 +++++++++++----------- indra/newview/llpathfindingpathtool.cpp | 52 +++++++++++---------- indra/newview/llpathfindingpathtool.h | 51 ++++++++++---------- 28 files changed, 639 insertions(+), 630 deletions(-) (limited to 'indra/newview/llpathfindingnavmeshzone.cpp') diff --git a/indra/llrender/llrendernavprim.cpp b/indra/llrender/llrendernavprim.cpp index c24a09028f..e7bc89396c 100644 --- a/indra/llrender/llrendernavprim.cpp +++ b/indra/llrender/llrendernavprim.cpp @@ -1,36 +1,39 @@ /** - * @file LLRenderNavPrim.cpp - * @brief Renderable primitives used by the pathing library - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ +* @file llrendernavprim.cpp +* @brief Implementation of llrendernavprim +* @author Prep@lindenlab.com +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ #include "linden_common.h" + #include "llrendernavprim.h" + #include "llerror.h" #include "llglheaders.h" -#include "llvertexbuffer.h" #include "llglslshader.h" +#include "llvertexbuffer.h" //============================================================================= LLRenderNavPrim gRenderNav; diff --git a/indra/llrender/llrendernavprim.h b/indra/llrender/llrendernavprim.h index eb45e259d2..a0c5e4005d 100644 --- a/indra/llrender/llrendernavprim.h +++ b/indra/llrender/llrendernavprim.h @@ -1,31 +1,31 @@ /** - * @file LLRenderNavPrim.h - * @brief - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_RENDER_NAVPRIM_H -#define LL_RENDER_NAVPRIM_H +* @file llrendernavprim.h +* @brief Header file for llrendernavprim +* @author Prep@lindenlab.com +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ +#ifndef LL_LLRENDERNAVPRIM_H +#define LL_LLRENDERNAVPRIM_H #include "llmath.h" #include "v3math.h" @@ -56,4 +56,4 @@ private: extern LLRenderNavPrim gRenderNav; -#endif +#endif // LL_LLRENDERNAVPRIM_H diff --git a/indra/newview/llfloaterpathfindingcharacters.cpp b/indra/newview/llfloaterpathfindingcharacters.cpp index 5245b78871..c20e78ade1 100644 --- a/indra/newview/llfloaterpathfindingcharacters.cpp +++ b/indra/newview/llfloaterpathfindingcharacters.cpp @@ -1,29 +1,30 @@ /** - * @file llfloaterpathfindingcharacters.cpp - * @author William Todd Stinson - * @brief "Pathfinding characters" floater, allowing for identification of pathfinding characters and their cpu usage. - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ +* @file llfloaterpathfindingcharacters.cpp +* @brief "Pathfinding characters" floater, allowing for identification of pathfinding characters and their cpu usage. +* @author Stinson@lindenlab.com +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + #include "llviewerprecompiledheaders.h" diff --git a/indra/newview/llfloaterpathfindingcharacters.h b/indra/newview/llfloaterpathfindingcharacters.h index 56e08b7603..94cc39a06a 100644 --- a/indra/newview/llfloaterpathfindingcharacters.h +++ b/indra/newview/llfloaterpathfindingcharacters.h @@ -1,30 +1,29 @@ /** -* @file llfloaterpathfindingcharacters.h -* @author William Todd Stinson -* @brief "Pathfinding characters" floater, allowing for identification of pathfinding characters and their cpu usage. +* @file llfloaterpathfindingcharacters.h +* @brief "Pathfinding characters" floater, allowing for identification of pathfinding characters and their cpu usage. +* @author Stinson@lindenlab.com * -* $LicenseInfo:firstyear=2002&license=viewerlgpl$ +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ * Second Life Viewer Source Code -* Copyright (C) 2010, Linden Research, Inc. -* +* Copyright (C) 2012, Linden Research, Inc. +* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. -* +* * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. -* +* * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -* +* * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ - #ifndef LL_LLFLOATERPATHFINDINGCHARACTERS_H #define LL_LLFLOATERPATHFINDINGCHARACTERS_H diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index c2d19bfb9a..ab5775de06 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -1,32 +1,35 @@ /** * @file llfloaterpathfindingconsole.cpp -* @author William Todd Stinson -* @brief "Pathfinding console" floater, allowing manipulation of the Havok AI pathfinding settings. +* @brief "Pathfinding console" floater, allowing for viewing and testing of the pathfinding navmesh through Havok AI utilities. +* @author Stinson@lindenlab.com * -* $LicenseInfo:firstyear=2002&license=viewerlgpl$ +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ * Second Life Viewer Source Code -* Copyright (C) 2010, Linden Research, Inc. -* +* Copyright (C) 2012, Linden Research, Inc. +* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. -* +* * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. -* +* * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -* +* * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ + #include "llviewerprecompiledheaders.h" + #include "llfloaterpathfindingconsole.h" + #include "llfloaterpathfindinglinksets.h" #include "llfloaterpathfindingcharacters.h" diff --git a/indra/newview/llfloaterpathfindingconsole.h b/indra/newview/llfloaterpathfindingconsole.h index b0c14e5345..97300520d6 100644 --- a/indra/newview/llfloaterpathfindingconsole.h +++ b/indra/newview/llfloaterpathfindingconsole.h @@ -1,30 +1,29 @@ /** - * @file llfloaterpathfindingconsole.h - * @author William Todd Stinson - * @brief "Pathfinding console" floater, allowing manipulation of the Havok AI pathfinding settings. - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - +* @file llfloaterpathfindingconsole.h +* @brief "Pathfinding console" floater, allowing for viewing and testing of the pathfinding navmesh through Havok AI utilities. +* @author Stinson@lindenlab.com +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ #ifndef LL_LLFLOATERPATHFINDINGCONSOLE_H #define LL_LLFLOATERPATHFINDINGCONSOLE_H diff --git a/indra/newview/llfloaterpathfindinglinksets.cpp b/indra/newview/llfloaterpathfindinglinksets.cpp index ae814b0087..ae83bcfaee 100644 --- a/indra/newview/llfloaterpathfindinglinksets.cpp +++ b/indra/newview/llfloaterpathfindinglinksets.cpp @@ -1,30 +1,31 @@ /** * @file llfloaterpathfindinglinksets.cpp -* @author William Todd Stinson -* @brief "Pathfinding linksets" floater, allowing manipulation of the Havok AI pathfinding settings. +* @brief "Pathfinding linksets" floater, allowing manipulation of the linksets on the current region. +* @author Stinson@lindenlab.com * -* $LicenseInfo:firstyear=2002&license=viewerlgpl$ +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ * Second Life Viewer Source Code -* Copyright (C) 2010, Linden Research, Inc. -* +* Copyright (C) 2012, Linden Research, Inc. +* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. -* +* * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. -* +* * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -* +* * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ + #include "llviewerprecompiledheaders.h" #include "llfloaterpathfindinglinksets.h" diff --git a/indra/newview/llfloaterpathfindinglinksets.h b/indra/newview/llfloaterpathfindinglinksets.h index 8e82992dbf..2db41ce479 100644 --- a/indra/newview/llfloaterpathfindinglinksets.h +++ b/indra/newview/llfloaterpathfindinglinksets.h @@ -1,30 +1,29 @@ /** - * @file llfloaterpathfindinglinksets.h - * @author William Todd Stinson - * @brief "Pathfinding linksets" floater, allowing manipulation of the Havok AI pathfinding settings. - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - +* @file llfloaterpathfindinglinksets.h +* @brief "Pathfinding linksets" floater, allowing manipulation of the linksets on the current region. +* @author Stinson@lindenlab.com +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ #ifndef LL_LLFLOATERPATHFINDINGLINKSETS_H #define LL_LLFLOATERPATHFINDINGLINKSETS_H diff --git a/indra/newview/llfloaterpathfindingobjects.cpp b/indra/newview/llfloaterpathfindingobjects.cpp index eb18fa00d5..da664038cf 100644 --- a/indra/newview/llfloaterpathfindingobjects.cpp +++ b/indra/newview/llfloaterpathfindingobjects.cpp @@ -1,6 +1,6 @@ /** * @file llfloaterpathfindingobjects.cpp -* @brief Implementation of llfloaterpathfindingobjects +* @brief Base class for both the pathfinding linksets and characters floater. * @author Stinson@lindenlab.com * * $LicenseInfo:firstyear=2012&license=viewerlgpl$ diff --git a/indra/newview/llfloaterpathfindingobjects.h b/indra/newview/llfloaterpathfindingobjects.h index 84b0f3f3fe..42db7bba65 100644 --- a/indra/newview/llfloaterpathfindingobjects.h +++ b/indra/newview/llfloaterpathfindingobjects.h @@ -1,6 +1,6 @@ /** * @file llfloaterpathfindingobjects.h -* @brief Header file for llfloaterpathfindingobjects +* @brief Base class for both the pathfinding linksets and characters floater. * @author Stinson@lindenlab.com * * $LicenseInfo:firstyear=2012&license=viewerlgpl$ diff --git a/indra/newview/llpathfindingcharacter.cpp b/indra/newview/llpathfindingcharacter.cpp index c9f3555e9c..9dd9fa503b 100644 --- a/indra/newview/llpathfindingcharacter.cpp +++ b/indra/newview/llpathfindingcharacter.cpp @@ -1,29 +1,30 @@ /** - * @file llpathfindingcharacter.cpp - * @author William Todd Stinson - * @brief Definition of a pathfinding character that contains various properties required for havok pathfinding. - * - * $LicenseInfo:firstyear=2012&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2012, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ +* @file llpathfindingcharacter.cpp +* @brief Definition of a pathfinding character that contains various properties required for havok pathfinding. +* @author Stinson@lindenlab.com +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + #include "llviewerprecompiledheaders.h" diff --git a/indra/newview/llpathfindingcharacter.h b/indra/newview/llpathfindingcharacter.h index 1b0a154d77..6317f5224a 100644 --- a/indra/newview/llpathfindingcharacter.h +++ b/indra/newview/llpathfindingcharacter.h @@ -1,30 +1,29 @@ /** - * @file llpathfindingcharacter.h - * @author William Todd Stinson - * @brief Definition of a pathfinding character that contains various properties required for havok pathfinding. - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - +* @file llpathfindingcharacter.h +* @brief Definition of a pathfinding character that contains various properties required for havok pathfinding. +* @author Stinson@lindenlab.com +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ #ifndef LL_LLPATHFINDINGCHARACTER_H #define LL_LLPATHFINDINGCHARACTER_H diff --git a/indra/newview/llpathfindingcharacterlist.cpp b/indra/newview/llpathfindingcharacterlist.cpp index 9b0ed14e35..12340cebfa 100644 --- a/indra/newview/llpathfindingcharacterlist.cpp +++ b/indra/newview/llpathfindingcharacterlist.cpp @@ -1,29 +1,30 @@ /** - * @file llpathfindingcharacterlist.cpp - * @author William Todd Stinson - * @brief Class to implement the list of a set of pathfinding characters - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ +* @file llpathfindingcharacterlist.cpp +* @brief Implementation of llpathfindingcharacterlist +* @author Stinson@lindenlab.com +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + #include "llviewerprecompiledheaders.h" diff --git a/indra/newview/llpathfindingcharacterlist.h b/indra/newview/llpathfindingcharacterlist.h index 734cfcafa1..4ecf70001d 100644 --- a/indra/newview/llpathfindingcharacterlist.h +++ b/indra/newview/llpathfindingcharacterlist.h @@ -1,30 +1,29 @@ /** - * @file llpathfindingcharacterlist.h - * @author William Todd Stinson - * @brief Class to implement the list of a set of pathfinding characters - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - +* @file llpathfindingcharacterlist.h +* @brief Header file for llpathfindingcharacterlist +* @author Stinson@lindenlab.com +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ #ifndef LL_LLPATHFINDINGCHARACTERLIST_H #define LL_LLPATHFINDINGCHARACTERLIST_H diff --git a/indra/newview/llpathfindinglinkset.cpp b/indra/newview/llpathfindinglinkset.cpp index 4cb749b3ca..fe4daabd89 100644 --- a/indra/newview/llpathfindinglinkset.cpp +++ b/indra/newview/llpathfindinglinkset.cpp @@ -1,29 +1,30 @@ /** - * @file llpathfindinglinksets.cpp - * @author William Todd Stinson - * @brief Definition of a pathfinding linkset that contains various properties required for havok pathfinding. - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ +* @file llpathfindinglinkset.cpp +* @brief Definition of a pathfinding linkset that contains various properties required for havok pathfinding. +* @author Stinson@lindenlab.com +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + #include "llviewerprecompiledheaders.h" diff --git a/indra/newview/llpathfindinglinkset.h b/indra/newview/llpathfindinglinkset.h index 03c526560c..73b4d6bad4 100644 --- a/indra/newview/llpathfindinglinkset.h +++ b/indra/newview/llpathfindinglinkset.h @@ -1,30 +1,29 @@ /** - * @file llpathfindinglinkset.h - * @author William Todd Stinson - * @brief Definition of a pathfinding linkset that contains various properties required for havok pathfinding. - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - +* @file llpathfindinglinkset.h +* @brief Definition of a pathfinding linkset that contains various properties required for havok pathfinding. +* @author Stinson@lindenlab.com +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ #ifndef LL_LLPATHFINDINGLINKSET_H #define LL_LLPATHFINDINGLINKSET_H diff --git a/indra/newview/llpathfindinglinksetlist.cpp b/indra/newview/llpathfindinglinksetlist.cpp index 5323635438..746fa342a1 100644 --- a/indra/newview/llpathfindinglinksetlist.cpp +++ b/indra/newview/llpathfindinglinksetlist.cpp @@ -1,29 +1,30 @@ /** - * @file llpathfindinglinksetlist.cpp - * @author William Todd Stinson - * @brief Class to implement the list of a set of pathfinding linksets - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ +* @file llpathfindinglinksetlist.cpp +* @brief Implementation of llpathfindinglinksetlist +* @author Stinson@lindenlab.com +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + #include "llviewerprecompiledheaders.h" diff --git a/indra/newview/llpathfindinglinksetlist.h b/indra/newview/llpathfindinglinksetlist.h index 50a8e069d0..77c6358640 100644 --- a/indra/newview/llpathfindinglinksetlist.h +++ b/indra/newview/llpathfindinglinksetlist.h @@ -1,30 +1,29 @@ /** - * @file llpathfindinglinksetlist.h - * @author William Todd Stinson - * @brief Class to implement the list of a set of pathfinding linksets - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - +* @file llpathfindinglinksetlist.h +* @brief Header file for llpathfindinglinksetlist +* @author Stinson@lindenlab.com +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ #ifndef LL_LLPATHFINDINGLINKSETLIST_H #define LL_LLPATHFINDINGLINKSETLIST_H diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index bafcf57944..019ddbfe96 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -1,29 +1,30 @@ -/** - * @file llpathfindingmanager.cpp - * @author William Todd Stinson - * @brief A state manager for the various pathfinding states. - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ +/** +* @file llpathfindingmanager.cpp +* @brief Implementation of llpathfindingmanager +* @author Stinson@lindenlab.com +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + #include "llviewerprecompiledheaders.h" diff --git a/indra/newview/llpathfindingmanager.h b/indra/newview/llpathfindingmanager.h index 9aa3065d89..65589fe3a0 100644 --- a/indra/newview/llpathfindingmanager.h +++ b/indra/newview/llpathfindingmanager.h @@ -1,30 +1,29 @@ -/** - * @file llpathfindingmanager.h - * @author William Todd Stinson - * @brief A state manager for the various pathfinding states. - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - +/** +* @file llpathfindingmanager.h +* @brief Header file for llpathfindingmanager +* @author Stinson@lindenlab.com +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ #ifndef LL_LLPATHFINDINGMANAGER_H #define LL_LLPATHFINDINGMANAGER_H diff --git a/indra/newview/llpathfindingnavmesh.cpp b/indra/newview/llpathfindingnavmesh.cpp index 4e4e9fceef..1a49560712 100644 --- a/indra/newview/llpathfindingnavmesh.cpp +++ b/indra/newview/llpathfindingnavmesh.cpp @@ -1,35 +1,38 @@ -/** - * @file llpathfindingnavmesh.cpp - * @author William Todd Stinson - * @brief A class for representing the navmesh of a pathfinding region. - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ +/** +* @file llpathfindingnavmesh.cpp +* @brief Implementation of llpathfindingnavmesh +* @author Stinson@lindenlab.com +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + #include "llviewerprecompiledheaders.h" -#include "lluuid.h" + #include "llpathfindingnavmesh.h" + #include "llpathfindingnavmeshstatus.h" #include "llsdserialize.h" +#include "lluuid.h" #include @@ -198,4 +201,3 @@ void LLPathfindingNavMesh::sendStatus() { mNavMeshSignal(mNavMeshRequestStatus, mNavMeshStatus, mNavMeshData); } - diff --git a/indra/newview/llpathfindingnavmesh.h b/indra/newview/llpathfindingnavmesh.h index 02b403ab75..17618d8724 100644 --- a/indra/newview/llpathfindingnavmesh.h +++ b/indra/newview/llpathfindingnavmesh.h @@ -1,30 +1,29 @@ -/** - * @file llpathfindingnavmesh.h - * @author William Todd Stinson - * @brief A class for representing the navmesh of a pathfinding region. - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - +/** +* @file llpathfindingnavmesh.h +* @brief Header file for llpathfindingnavmesh +* @author Stinson@lindenlab.com +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ #ifndef LL_LLPATHFINDINGNAVMESH_H #define LL_LLPATHFINDINGNAVMESH_H @@ -91,4 +90,3 @@ private: }; #endif // LL_LLPATHFINDINGNAVMESH_H - diff --git a/indra/newview/llpathfindingnavmeshstatus.cpp b/indra/newview/llpathfindingnavmeshstatus.cpp index 5cddb995a4..4bb0bc5a18 100644 --- a/indra/newview/llpathfindingnavmeshstatus.cpp +++ b/indra/newview/llpathfindingnavmeshstatus.cpp @@ -1,38 +1,41 @@ /** - * @file llpathfindingnavmeshstatus.cpp - * @author William Todd Stinson - * @brief A class for representing the navmesh status of a pathfinding region. - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ +* @file llpathfindingnavmeshstatus.cpp +* @brief Implementation of llpathfindingnavmeshstatus +* @author Stinson@lindenlab.com +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + #include "llviewerprecompiledheaders.h" -#include "llsd.h" -#include "lluuid.h" -#include "llstring.h" + #include "llpathfindingnavmeshstatus.h" #include +#include "llsd.h" +#include "lluuid.h" +#include "llstring.h" + #define REGION_FIELD "region_id" #define STATUS_FIELD "status" #define VERSION_FIELD "version" diff --git a/indra/newview/llpathfindingnavmeshstatus.h b/indra/newview/llpathfindingnavmeshstatus.h index 837fc43cc5..3834aa2ab8 100644 --- a/indra/newview/llpathfindingnavmeshstatus.h +++ b/indra/newview/llpathfindingnavmeshstatus.h @@ -1,30 +1,29 @@ /** - * @file llpathfindingnavmeshstatus.h - * @author William Todd Stinson - * @brief A class for representing the navmesh status of a pathfinding region. - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - +* @file llpathfindingnavmeshstatus.h +* @brief Header file for llpathfindingnavmeshstatus +* @author Stinson@lindenlab.com +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ #ifndef LL_LLPATHFINDINGNAVMESHSTATUS_H #define LL_LLPATHFINDINGNAVMESHSTATUS_H diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp index ee81762792..0298eedfef 100644 --- a/indra/newview/llpathfindingnavmeshzone.cpp +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -1,37 +1,40 @@ /** - * @file llpathfindingnavmeshzone.cpp - * @author William Todd Stinson - * @brief A class for representing the zone of navmeshes containing and possible surrounding the current region. - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ +* @file llpathfindingnavmeshzone.cpp +* @brief Implementation of llpathfindingnavmeshzone +* @author Stinson@lindenlab.com +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + #include "llviewerprecompiledheaders.h" + +#include "llpathfindingnavmeshzone.h" + #include "llsd.h" #include "lluuid.h" #include "llagent.h" #include "llviewerregion.h" #include "llpathfindingnavmesh.h" -#include "llpathfindingnavmeshzone.h" #include "llpathfindingmanager.h" #include "llviewercontrol.h" diff --git a/indra/newview/llpathfindingnavmeshzone.h b/indra/newview/llpathfindingnavmeshzone.h index d4e7a717b2..0229de50ec 100644 --- a/indra/newview/llpathfindingnavmeshzone.h +++ b/indra/newview/llpathfindingnavmeshzone.h @@ -1,30 +1,29 @@ -/** - * @file llpathfindingnavmeshzone.h - * @author William Todd Stinson - * @brief A class for representing the zone of navmeshes containing and possible surrounding the current region. - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - +/** +* @file llpathfindingnavmeshzone.h +* @brief Header file for llpathfindingnavmeshzone +* @author Stinson@lindenlab.com +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ #ifndef LL_LLPATHFINDINGNAVMESHZONE_H #define LL_LLPATHFINDINGNAVMESHZONE_H @@ -128,4 +127,3 @@ private: }; #endif // LL_LLPATHFINDINGNAVMESHZONE_H - diff --git a/indra/newview/llpathfindingpathtool.cpp b/indra/newview/llpathfindingpathtool.cpp index 6cf90addab..ac4a2fffb9 100644 --- a/indra/newview/llpathfindingpathtool.cpp +++ b/indra/newview/llpathfindingpathtool.cpp @@ -1,31 +1,33 @@ /** - * @file llpathfindingpathtool.cpp - * @author William Todd Stinson - * @brief XXX - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ +* @file llpathfindingpathtool.cpp +* @brief Implementation of llpathfindingpathtool +* @author Stinson@lindenlab.com +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + #include "llviewerprecompiledheaders.h" + #include "llpathfindingpathtool.h" #include "llagent.h" diff --git a/indra/newview/llpathfindingpathtool.h b/indra/newview/llpathfindingpathtool.h index 8a79da43c9..e0db87d1ed 100644 --- a/indra/newview/llpathfindingpathtool.h +++ b/indra/newview/llpathfindingpathtool.h @@ -1,30 +1,29 @@ /** - * @file llpathfindingpathtool.h - * @author William Todd Stinson - * @brief XXX - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - +* @file llpathfindingpathtool.h +* @brief Header file for llpathfindingpathtool +* @author Stinson@lindenlab.com +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ #ifndef LL_LLPATHFINDINGPATHTOOL_H #define LL_LLPATHFINDINGPATHTOOL_H -- cgit v1.3 From 685a672b74550ca0dbf8a816257c84c9c44fd34d Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Thu, 28 Jun 2012 15:37:55 -0700 Subject: Cleaning up new files in preparation for merge into viewer-release. --- indra/newview/llfloaterpathfindingcharacters.cpp | 4 ++ indra/newview/llfloaterpathfindingcharacters.h | 6 ++- indra/newview/llfloaterpathfindingconsole.cpp | 51 ++++++++++++---------- indra/newview/llfloaterpathfindingconsole.h | 23 +++++----- indra/newview/llfloaterpathfindinglinksets.cpp | 4 ++ indra/newview/llfloaterpathfindinglinksets.h | 49 +++++++++++---------- indra/newview/llfloaterpathfindingobjects.cpp | 2 - indra/newview/llfloaterpathfindingobjects.h | 1 + indra/newview/llpanelpathfindingrebakenavmesh.cpp | 5 +-- indra/newview/llpanelpathfindingrebakenavmesh.h | 3 -- indra/newview/llpathfindingcharacter.cpp | 2 + indra/newview/llpathfindingcharacter.h | 4 +- indra/newview/llpathfindingmanager.cpp | 47 ++++++++++++-------- indra/newview/llpathfindingmanager.h | 10 ++--- indra/newview/llpathfindingnavmesh.cpp | 6 ++- indra/newview/llpathfindingnavmesh.h | 5 +-- indra/newview/llpathfindingnavmeshstatus.cpp | 2 +- indra/newview/llpathfindingnavmeshstatus.h | 4 +- indra/newview/llpathfindingnavmeshzone.cpp | 25 ++++++----- indra/newview/llpathfindingnavmeshzone.h | 13 +++--- indra/newview/llpathfindingobject.cpp | 2 +- indra/newview/llpathfindingobject.h | 8 ++-- indra/newview/llpathfindingobjectlist.h | 1 - indra/newview/llpathfindingpathtool.cpp | 10 ++--- indra/newview/llpathfindingpathtool.h | 8 ++-- .../xui/en/floater_pathfinding_characters.xml | 16 +++---- .../skins/default/xui/en/panel_navmesh_rebake.xml | 1 - 27 files changed, 167 insertions(+), 145 deletions(-) (limited to 'indra/newview/llpathfindingnavmeshzone.cpp') diff --git a/indra/newview/llfloaterpathfindingcharacters.cpp b/indra/newview/llfloaterpathfindingcharacters.cpp index c20e78ade1..739e56a7c3 100644 --- a/indra/newview/llfloaterpathfindingcharacters.cpp +++ b/indra/newview/llfloaterpathfindingcharacters.cpp @@ -40,11 +40,15 @@ #include "llpathfindingobject.h" #include "llpathfindingobjectlist.h" #include "llpathinglib.h" +#include "llquaternion.h" #include "llsd.h" #include "lluicolortable.h" +#include "lluuid.h" #include "llviewerobject.h" #include "llviewerobjectlist.h" #include "pipeline.h" +#include "v3math.h" +#include "v4color.h" LLHandle LLFloaterPathfindingCharacters::sInstanceHandle; diff --git a/indra/newview/llfloaterpathfindingcharacters.h b/indra/newview/llfloaterpathfindingcharacters.h index 94cc39a06a..ef389ad428 100644 --- a/indra/newview/llfloaterpathfindingcharacters.h +++ b/indra/newview/llfloaterpathfindingcharacters.h @@ -30,10 +30,14 @@ #include "llfloaterpathfindingobjects.h" #include "llhandle.h" #include "llpathfindingobjectlist.h" +#include "lluuid.h" #include "v4color.h" +class LLCheckBoxCtrl; class LLPathfindingCharacter; +class LLQuaternion; class LLSD; +class LLVector3; class LLFloaterPathfindingCharacters : public LLFloaterPathfindingObjects { @@ -43,7 +47,7 @@ public: BOOL isShowPhysicsCapsule() const; void setShowPhysicsCapsule(BOOL pIsShowPhysicsCapsule); - BOOL isPhysicsCapsuleEnabled(LLUUID& id, LLVector3& pos, LLQuaternion& rot ) const; + BOOL isPhysicsCapsuleEnabled(LLUUID& id, LLVector3& pos, LLQuaternion& rot) const; static void openCharactersWithSelectedObjects(); static LLHandle getInstanceHandle(); diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 0bd5dc0263..2fe60a8d8f 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -30,30 +30,31 @@ #include "llfloaterpathfindingconsole.h" -#include "llfloaterpathfindinglinksets.h" -#include "llfloaterpathfindingcharacters.h" +#include + +#include -#include "llsd.h" -#include "llhandle.h" -#include "llcontrol.h" -#include "llpanel.h" #include "llbutton.h" #include "llcheckboxctrl.h" -#include "llsliderctrl.h" -#include "lllineeditor.h" -#include "lltextbase.h" -#include "lltabcontainer.h" #include "llcombobox.h" +#include "llcontrol.h" +#include "llenvmanager.h" +#include "llfloaterpathfindingcharacters.h" +#include "llfloaterpathfindinglinksets.h" #include "llfloaterreg.h" +#include "llhandle.h" +#include "llpanel.h" #include "llpathfindingnavmeshzone.h" -#include "llpathfindingmanager.h" -#include "llenvmanager.h" #include "llpathfindingpathtool.h" +#include "llpathinglib.h" +#include "llsliderctrl.h" +#include "llsd.h" +#include "lltabcontainer.h" +#include "lltextbase.h" #include "lltoolmgr.h" #include "lltoolfocus.h" -#include "pipeline.h" -#include "llpathinglib.h" #include "llviewerparcelmgr.h" +#include "pipeline.h" #define XUI_RENDER_HEATMAP_NONE 0 #define XUI_RENDER_HEATMAP_A 1 @@ -89,8 +90,6 @@ LLHandle LLFloaterPathfindingConsole::sInstanceHandle; -extern LLPipeline gPipeline; - //--------------------------------------------------------------------------- // LLFloaterPathfindingConsole //--------------------------------------------------------------------------- @@ -213,7 +212,7 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) { if (!mNavMeshZoneSlot.connected()) { - mNavMeshZoneSlot = mNavMeshZone.registerNavMeshZoneListener(boost::bind(&LLFloaterPathfindingConsole::onNavMeshZoneCB, this, _1)); + mNavMeshZoneSlot = mNavMeshZone.registerNavMeshZoneListener(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshZoneStatus, this, _1)); } mIsNavMeshUpdating = false; @@ -500,9 +499,10 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mSavedSettingNavMeshFaceSlot(), mSavedSettingTestPathValidEndSlot(), mSavedSettingTestPathInvalidEndSlot(), - mSavedSettingWaterSlot(), mSavedSettingTestPathSlot(), - mConsoleState(kConsoleStateUnknown) + mSavedSettingWaterSlot(), + mConsoleState(kConsoleStateUnknown), + mRenderableRestoreList() { mSelfHandle.bind(this); } @@ -541,7 +541,10 @@ void LLFloaterPathfindingConsole::onShowNavMeshSet() void LLFloaterPathfindingConsole::onShowWalkabilitySet() { - LLPathingLib::getInstance()->setNavMeshMaterialType(getRenderHeatmapType()); + if (LLPathingLib::getInstance() != NULL) + { + LLPathingLib::getInstance()->setNavMeshMaterialType(getRenderHeatmapType()); + } } void LLFloaterPathfindingConsole::onCharacterWidthSet() @@ -559,7 +562,7 @@ void LLFloaterPathfindingConsole::onClearPathClicked() clearPath(); } -void LLFloaterPathfindingConsole::onNavMeshZoneCB(LLPathfindingNavMeshZone::ENavMeshZoneRequestStatus pNavMeshZoneRequestStatus) +void LLFloaterPathfindingConsole::handleNavMeshZoneStatus(LLPathfindingNavMeshZone::ENavMeshZoneRequestStatus pNavMeshZoneRequestStatus) { switch (pNavMeshZoneRequestStatus) { @@ -641,6 +644,7 @@ void LLFloaterPathfindingConsole::setDefaultInputs() { mViewTestTabContainer->selectTab(XUI_VIEW_TAB_INDEX); setRenderWorld(TRUE); + setRenderWorldMovablesOnly(FALSE); setRenderNavMesh(FALSE); setRenderWalkables(FALSE); setRenderMaterialVolumes(FALSE); @@ -648,7 +652,6 @@ void LLFloaterPathfindingConsole::setDefaultInputs() setRenderExclusionVolumes(FALSE); setRenderWaterPlane(FALSE); setRenderXRay(FALSE); - setRenderWorldMovablesOnly(FALSE); } void LLFloaterPathfindingConsole::setConsoleState(EConsoleState pConsoleState) @@ -1205,6 +1208,10 @@ void LLFloaterPathfindingConsole::deregisterSavedSettingsListeners() { mSavedSettingTestPathSlot.disconnect(); } + if (mSavedSettingWaterSlot.connected()) + { + mSavedSettingWaterSlot.disconnect(); + } } void LLFloaterPathfindingConsole::handleRetrieveNeighborChange(LLControlVariable *pControl, const LLSD &pNewValue) diff --git a/indra/newview/llfloaterpathfindingconsole.h b/indra/newview/llfloaterpathfindingconsole.h index 97300520d6..4b2f7672e4 100644 --- a/indra/newview/llfloaterpathfindingconsole.h +++ b/indra/newview/llfloaterpathfindingconsole.h @@ -27,26 +27,27 @@ #ifndef LL_LLFLOATERPATHFINDINGCONSOLE_H #define LL_LLFLOATERPATHFINDINGCONSOLE_H +#include + +#include + #include "llfloater.h" #include "llhandle.h" -#include "llpathinglib.h" #include "llpathfindingnavmeshzone.h" #include "llpathfindingpathtool.h" +#include "llpathinglib.h" #include "v4color.h" -#include - -class LLSD; +class LLButton; +class LLCheckBoxCtrl; +class LLComboBox; +class LLControlVariable; class LLPanel; +class LLSD; class LLSliderCtrl; -class LLLineEditor; -class LLTextBase; -class LLCheckBoxCtrl; class LLTabContainer; -class LLComboBox; -class LLButton; +class LLTextBase; class LLToolset; -class LLControlVariable; class LLFloaterPathfindingConsole : public LLFloater @@ -122,7 +123,7 @@ private: void onCharacterTypeSwitch(); void onClearPathClicked(); - void onNavMeshZoneCB(LLPathfindingNavMeshZone::ENavMeshZoneRequestStatus pNavMeshZoneRequestStatus); + void handleNavMeshZoneStatus(LLPathfindingNavMeshZone::ENavMeshZoneRequestStatus pNavMeshZoneRequestStatus); void onRegionBoundaryCross(); void onPathEvent(); diff --git a/indra/newview/llfloaterpathfindinglinksets.cpp b/indra/newview/llfloaterpathfindinglinksets.cpp index ae83bcfaee..15490ff87e 100644 --- a/indra/newview/llfloaterpathfindinglinksets.cpp +++ b/indra/newview/llfloaterpathfindinglinksets.cpp @@ -30,11 +30,14 @@ #include "llfloaterpathfindinglinksets.h" +#include + #include #include "llagent.h" #include "llbutton.h" #include "llcombobox.h" +#include "llfloaterpathfindingobjects.h" #include "llfloaterreg.h" #include "lllineeditor.h" #include "llnotificationsutil.h" @@ -46,6 +49,7 @@ #include "lltextbase.h" #include "lltextvalidate.h" #include "lluicolortable.h" +#include "lluictrl.h" #include "v3math.h" #include "v4color.h" diff --git a/indra/newview/llfloaterpathfindinglinksets.h b/indra/newview/llfloaterpathfindinglinksets.h index 2db41ce479..b3e7acfbfe 100644 --- a/indra/newview/llfloaterpathfindinglinksets.h +++ b/indra/newview/llfloaterpathfindinglinksets.h @@ -27,9 +27,10 @@ #ifndef LL_LLFLOATERPATHFINDINGLINKSETS_H #define LL_LLFLOATERPATHFINDINGLINKSETS_H +#include + #include "llfloaterpathfindingobjects.h" #include "llpathfindinglinkset.h" -#include "llpathfindingmanager.h" #include "llpathfindingobjectlist.h" #include "v4color.h" @@ -102,29 +103,29 @@ private: LLPathfindingLinkset::ELinksetUse convertToLinksetUse(LLSD pXuiValue) const; LLSD convertToXuiValue(LLPathfindingLinkset::ELinksetUse pLinksetUse) const; - LLLineEditor *mFilterByName; - LLLineEditor *mFilterByDescription; - LLComboBox *mFilterByLinksetUse; - LLComboBox *mEditLinksetUse; - LLScrollListItem *mEditLinksetUseUnset; - LLScrollListItem *mEditLinksetUseWalkable; - LLScrollListItem *mEditLinksetUseStaticObstacle; - LLScrollListItem *mEditLinksetUseDynamicObstacle; - LLScrollListItem *mEditLinksetUseMaterialVolume; - LLScrollListItem *mEditLinksetUseExclusionVolume; - LLScrollListItem *mEditLinksetUseDynamicPhantom; - LLTextBase *mLabelWalkabilityCoefficients; - LLTextBase *mLabelEditA; - LLLineEditor *mEditA; - LLTextBase *mLabelEditB; - LLLineEditor *mEditB; - LLTextBase *mLabelEditC; - LLLineEditor *mEditC; - LLTextBase *mLabelEditD; - LLLineEditor *mEditD; - LLButton *mApplyEditsButton; - - LLColor4 mBeaconColor; + LLLineEditor *mFilterByName; + LLLineEditor *mFilterByDescription; + LLComboBox *mFilterByLinksetUse; + LLComboBox *mEditLinksetUse; + LLScrollListItem *mEditLinksetUseUnset; + LLScrollListItem *mEditLinksetUseWalkable; + LLScrollListItem *mEditLinksetUseStaticObstacle; + LLScrollListItem *mEditLinksetUseDynamicObstacle; + LLScrollListItem *mEditLinksetUseMaterialVolume; + LLScrollListItem *mEditLinksetUseExclusionVolume; + LLScrollListItem *mEditLinksetUseDynamicPhantom; + LLTextBase *mLabelWalkabilityCoefficients; + LLTextBase *mLabelEditA; + LLLineEditor *mEditA; + LLTextBase *mLabelEditB; + LLLineEditor *mEditB; + LLTextBase *mLabelEditC; + LLLineEditor *mEditC; + LLTextBase *mLabelEditD; + LLLineEditor *mEditD; + LLButton *mApplyEditsButton; + + LLColor4 mBeaconColor; }; #endif // LL_LLFLOATERPATHFINDINGLINKSETS_H diff --git a/indra/newview/llfloaterpathfindingobjects.cpp b/indra/newview/llfloaterpathfindingobjects.cpp index da664038cf..847997836b 100644 --- a/indra/newview/llfloaterpathfindingobjects.cpp +++ b/indra/newview/llfloaterpathfindingobjects.cpp @@ -57,7 +57,6 @@ #include "llviewerobject.h" #include "llviewerobjectlist.h" #include "llviewerregion.h" -#include "pipeline.h" #include "v3dmath.h" #include "v3math.h" #include "v4color.h" @@ -835,4 +834,3 @@ LLPathfindingObjectPtr LLFloaterPathfindingObjects::findObject(const LLScrollLis return objectPtr; } - diff --git a/indra/newview/llfloaterpathfindingobjects.h b/indra/newview/llfloaterpathfindingobjects.h index 42db7bba65..e8d446b598 100644 --- a/indra/newview/llfloaterpathfindingobjects.h +++ b/indra/newview/llfloaterpathfindingobjects.h @@ -28,6 +28,7 @@ #define LL_LLFLOATERPATHFINDINGOBJECTS_H #include + #include #include "llagent.h" diff --git a/indra/newview/llpanelpathfindingrebakenavmesh.cpp b/indra/newview/llpanelpathfindingrebakenavmesh.cpp index f423b5891f..2c8c46c7bc 100644 --- a/indra/newview/llpanelpathfindingrebakenavmesh.cpp +++ b/indra/newview/llpanelpathfindingrebakenavmesh.cpp @@ -36,7 +36,6 @@ #include "llagent.h" #include "llbutton.h" #include "llenvmanager.h" -#include "llhandle.h" #include "llhints.h" #include "llnotificationsutil.h" #include "llpanel.h" @@ -45,9 +44,7 @@ #include "llpathfindingnavmeshstatus.h" #include "lltoolbar.h" #include "lltoolbarview.h" -#include "lltoolmgr.h" #include "lltooltip.h" -#include "llview.h" #include "llviewercontrol.h" #include "llviewerregion.h" @@ -218,6 +215,7 @@ void LLPanelPathfindingRebakeNavmesh::handleNavMeshStatus(const LLPathfindingNav void LLPanelPathfindingRebakeNavmesh::handleRegionBoundaryCrossed() { createNavMeshStatusListenerForCurrentRegion(); + mCanRebakeRegion = FALSE; LLPathfindingManager::getInstance()->requestGetAgentState(); } @@ -227,7 +225,6 @@ void LLPanelPathfindingRebakeNavmesh::createNavMeshStatusListenerForCurrentRegio { mNavMeshSlot.disconnect(); } - mCanRebakeRegion = FALSE; LLViewerRegion *currentRegion = gAgent.getRegion(); if (currentRegion != NULL) diff --git a/indra/newview/llpanelpathfindingrebakenavmesh.h b/indra/newview/llpanelpathfindingrebakenavmesh.h index a77cddbc50..5fe581ec2f 100644 --- a/indra/newview/llpanelpathfindingrebakenavmesh.h +++ b/indra/newview/llpanelpathfindingrebakenavmesh.h @@ -27,17 +27,14 @@ #ifndef LL_LLPANELPATHFINDINGREBAKENAVMESH_H #define LL_LLPANELPATHFINDINGREBAKENAVMESH_H -#include #include -#include "llhandle.h" #include "llpanel.h" #include "llpathfindingmanager.h" #include "llpathfindingnavmesh.h" class LLButton; class LLPathfindingNavMeshStatus; -class LLView; class LLPanelPathfindingRebakeNavmesh : public LLPanel { diff --git a/indra/newview/llpathfindingcharacter.cpp b/indra/newview/llpathfindingcharacter.cpp index 9dd9fa503b..00f2ebc4bb 100644 --- a/indra/newview/llpathfindingcharacter.cpp +++ b/indra/newview/llpathfindingcharacter.cpp @@ -30,6 +30,8 @@ #include "llpathfindingcharacter.h" +#include + #include "llpathfindingobject.h" #include "llsd.h" diff --git a/indra/newview/llpathfindingcharacter.h b/indra/newview/llpathfindingcharacter.h index 6317f5224a..7cf9f401b0 100644 --- a/indra/newview/llpathfindingcharacter.h +++ b/indra/newview/llpathfindingcharacter.h @@ -27,6 +27,8 @@ #ifndef LL_LLPATHFINDINGCHARACTER_H #define LL_LLPATHFINDINGCHARACTER_H +#include + #include "llpathfindingobject.h" class LLSD; @@ -48,8 +50,6 @@ public: protected: -public: - private: void parseCharacterData(const LLSD &pCharacterData); diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index 90199a9cae..2dd01e931e 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -33,7 +33,9 @@ #include #include +#include #include +#include #include #include "llagent.h" @@ -53,7 +55,6 @@ #include "lluuid.h" #include "llviewerregion.h" #include "llweb.h" -#include "llenvmanager.h" #define CAP_SERVICE_RETRIEVE_NAVMESH "RetrieveNavMeshSrc" @@ -366,12 +367,6 @@ void LLPathfindingManager::requestGetNavMeshForRegion(LLViewerRegion *pRegion, b } } -LLPathfindingManager::agent_state_slot_t LLPathfindingManager::registerAgentStateListener(agent_state_callback_t pAgentStateCallback) -{ - return mAgentStateSignal.connect(pAgentStateCallback); -} - - void LLPathfindingManager::requestGetLinksets(request_id_t pRequestId, object_request_callback_t pLinksetsCallback) const { LLPathfindingObjectListPtr emptyLinksetListPtr; @@ -495,6 +490,11 @@ void LLPathfindingManager::requestGetCharacters(request_id_t pRequestId, object_ } } +LLPathfindingManager::agent_state_slot_t LLPathfindingManager::registerAgentStateListener(agent_state_callback_t pAgentStateCallback) +{ + return mAgentStateSignal.connect(pAgentStateCallback); +} + void LLPathfindingManager::requestGetAgentState() { LLViewerRegion *currentRegion = getCurrentRegion(); @@ -525,14 +525,24 @@ void LLPathfindingManager::requestGetAgentState() void LLPathfindingManager::requestRebakeNavMesh(rebake_navmesh_callback_t pRebakeNavMeshCallback) { - std::string navMeshStatusURL = getNavMeshStatusURLForCurrentRegion(); - llassert(!navMeshStatusURL.empty()) - if (!navMeshStatusURL.empty()) + LLViewerRegion *currentRegion = getCurrentRegion(); + + if (currentRegion == NULL) + { + pRebakeNavMeshCallback(false); + } + else if (!isPathfindingEnabledForRegion(currentRegion)) { - LLSD mPostData; - mPostData["command"] = "rebuild"; + pRebakeNavMeshCallback(false); + } + else + { + std::string navMeshStatusURL = getNavMeshStatusURLForCurrentRegion(); + llassert(!navMeshStatusURL.empty()); + LLSD postData; + postData["command"] = "rebuild"; LLHTTPClient::ResponderPtr responder = new NavMeshRebakeResponder(navMeshStatusURL, pRebakeNavMeshCallback); - LLHTTPClient::post(navMeshStatusURL, mPostData, responder); + LLHTTPClient::post(navMeshStatusURL, postData, responder); } } @@ -673,11 +683,6 @@ LLPathfindingNavMeshPtr LLPathfindingManager::getNavMeshForRegion(LLViewerRegion return getNavMeshForRegion(regionUUID); } -std::string LLPathfindingManager::getAgentStateURLForRegion(LLViewerRegion *pRegion) const -{ - return getCapabilityURLForRegion(pRegion, CAP_SERVICE_AGENT_STATE); -} - std::string LLPathfindingManager::getNavMeshStatusURLForCurrentRegion() const { return getNavMeshStatusURLForRegion(getCurrentRegion()); @@ -708,6 +713,11 @@ std::string LLPathfindingManager::getCharactersURLForCurrentRegion() const return getCapabilityURLForCurrentRegion(CAP_SERVICE_CHARACTERS); } +std::string LLPathfindingManager::getAgentStateURLForRegion(LLViewerRegion *pRegion) const +{ + return getCapabilityURLForRegion(pRegion, CAP_SERVICE_AGENT_STATE); +} + std::string LLPathfindingManager::getCapabilityURLForCurrentRegion(const std::string &pCapabilityName) const { return getCapabilityURLForRegion(getCurrentRegion(), pCapabilityName); @@ -1037,4 +1047,3 @@ void CharactersResponder::error(U32 pStatus, const std::string &pReason) LLPathfindingObjectListPtr characterListPtr = LLPathfindingObjectListPtr(new LLPathfindingCharacterList()); mCharactersCallback(mRequestId, LLPathfindingManager::kRequestError, characterListPtr); } - diff --git a/indra/newview/llpathfindingmanager.h b/indra/newview/llpathfindingmanager.h index 65589fe3a0..c61ff244fc 100644 --- a/indra/newview/llpathfindingmanager.h +++ b/indra/newview/llpathfindingmanager.h @@ -37,12 +37,10 @@ #include "llpathfindingobjectlist.h" #include "llpathfindingnavmesh.h" #include "llsingleton.h" -#include "lluuid.h" -#include "llpanel.h" -#include "llmoveview.h" -class LLViewerRegion; class LLPathfindingNavMeshStatus; +class LLUUID; +class LLViewerRegion; class LLPathfindingManager : public LLSingleton { @@ -51,8 +49,6 @@ class LLPathfindingManager : public LLSingleton friend class LLAgentStateChangeNode; friend class AgentStateResponder; public: - typedef std::map NavMeshMap; - typedef enum { kRequestStarted, kRequestCompleted, @@ -96,6 +92,8 @@ public: protected: private: + typedef std::map NavMeshMap; + void sendRequestGetNavMeshForRegion(LLPathfindingNavMeshPtr navMeshPtr, LLViewerRegion *pRegion, const LLPathfindingNavMeshStatus &pNavMeshStatus); void handleDeferredGetAgentStateForRegion(const LLUUID &pRegionUUID); diff --git a/indra/newview/llpathfindingnavmesh.cpp b/indra/newview/llpathfindingnavmesh.cpp index 1a49560712..e01dd3a152 100644 --- a/indra/newview/llpathfindingnavmesh.cpp +++ b/indra/newview/llpathfindingnavmesh.cpp @@ -30,12 +30,13 @@ #include "llpathfindingnavmesh.h" +#include + #include "llpathfindingnavmeshstatus.h" +#include "llsd.h" #include "llsdserialize.h" #include "lluuid.h" -#include - #define NAVMESH_VERSION_FIELD "navmesh_version" #define NAVMESH_DATA_FIELD "navmesh_data" @@ -119,6 +120,7 @@ void LLPathfindingNavMesh::handleNavMeshStart(const LLPathfindingNavMeshStatus & void LLPathfindingNavMesh::handleNavMeshResult(const LLSD &pContent, U32 pNavMeshVersion) { + llassert(pContent.has(NAVMESH_VERSION_FIELD)); if (pContent.has(NAVMESH_VERSION_FIELD)) { llassert(pContent.get(NAVMESH_VERSION_FIELD).isInteger()); diff --git a/indra/newview/llpathfindingnavmesh.h b/indra/newview/llpathfindingnavmesh.h index 17618d8724..7a844f54ce 100644 --- a/indra/newview/llpathfindingnavmesh.h +++ b/indra/newview/llpathfindingnavmesh.h @@ -27,8 +27,6 @@ #ifndef LL_LLPATHFINDINGNAVMESH_H #define LL_LLPATHFINDINGNAVMESH_H -#include "llsd.h" - #include #include @@ -36,9 +34,10 @@ #include #include "llpathfindingnavmeshstatus.h" +#include "llsd.h" -class LLUUID; class LLPathfindingNavMesh; +class LLUUID; typedef boost::shared_ptr LLPathfindingNavMeshPtr; diff --git a/indra/newview/llpathfindingnavmeshstatus.cpp b/indra/newview/llpathfindingnavmeshstatus.cpp index 4bb0bc5a18..2eaa6075ca 100644 --- a/indra/newview/llpathfindingnavmeshstatus.cpp +++ b/indra/newview/llpathfindingnavmeshstatus.cpp @@ -33,8 +33,8 @@ #include #include "llsd.h" -#include "lluuid.h" #include "llstring.h" +#include "lluuid.h" #define REGION_FIELD "region_id" #define STATUS_FIELD "status" diff --git a/indra/newview/llpathfindingnavmeshstatus.h b/indra/newview/llpathfindingnavmeshstatus.h index 3834aa2ab8..74533fa484 100644 --- a/indra/newview/llpathfindingnavmeshstatus.h +++ b/indra/newview/llpathfindingnavmeshstatus.h @@ -27,10 +27,10 @@ #ifndef LL_LLPATHFINDINGNAVMESHSTATUS_H #define LL_LLPATHFINDINGNAVMESHSTATUS_H -#include "lluuid.h" - #include +#include "lluuid.h" + class LLSD; class LLPathfindingNavMeshStatus diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp index 0298eedfef..e190dbba65 100644 --- a/indra/newview/llpathfindingnavmeshzone.cpp +++ b/indra/newview/llpathfindingnavmeshzone.cpp @@ -30,20 +30,22 @@ #include "llpathfindingnavmeshzone.h" -#include "llsd.h" -#include "lluuid.h" -#include "llagent.h" -#include "llviewerregion.h" -#include "llpathfindingnavmesh.h" -#include "llpathfindingmanager.h" -#include "llviewercontrol.h" - -#include "llpathinglib.h" - -#include #include #include +#include +#include +#include + +#include "llagent.h" +#include "llpathfindingmanager.h" +#include "llpathfindingnavmesh.h" +#include "llpathfindingnavmeshstatus.h" +#include "llpathinglib.h" +#include "llsd.h" +#include "lluuid.h" +#include "llviewercontrol.h" +#include "llviewerregion.h" #define CENTER_REGION 99 @@ -104,7 +106,6 @@ void LLPathfindingNavMeshZone::disable() void LLPathfindingNavMeshZone::refresh() { - llassert(LLPathingLib::getInstance() != NULL); if (LLPathingLib::getInstance() != NULL) { LLPathingLib::getInstance()->cleanupResidual(); diff --git a/indra/newview/llpathfindingnavmeshzone.h b/indra/newview/llpathfindingnavmeshzone.h index 0229de50ec..baa1cc5979 100644 --- a/indra/newview/llpathfindingnavmeshzone.h +++ b/indra/newview/llpathfindingnavmeshzone.h @@ -27,19 +27,18 @@ #ifndef LL_LLPATHFINDINGNAVMESHZONE_H #define LL_LLPATHFINDINGNAVMESHZONE_H -#include "llsd.h" -#include "lluuid.h" -#include "llpathfindingnavmesh.h" -#include "llpathfindingnavmeshstatus.h" -#include "llviewerregion.h" - #include #include #include #include -class LLPathfindingNavMeshStatus; +#include "llpathfindingnavmesh.h" +#include "llpathfindingnavmeshstatus.h" +#include "llsd.h" +#include "lluuid.h" + +class LLViewerRegion; class LLPathfindingNavMeshZone { diff --git a/indra/newview/llpathfindingobject.cpp b/indra/newview/llpathfindingobject.cpp index 65fcedf2f5..f5c0f7874d 100644 --- a/indra/newview/llpathfindingobject.cpp +++ b/indra/newview/llpathfindingobject.cpp @@ -32,11 +32,11 @@ #include -#include "v3math.h" #include "llavatarname.h" #include "llavatarnamecache.h" #include "llsd.h" #include "lluuid.h" +#include "v3math.h" #define PATHFINDING_OBJECT_NAME_FIELD "name" #define PATHFINDING_OBJECT_DESCRIPTION_FIELD "description" diff --git a/indra/newview/llpathfindingobject.h b/indra/newview/llpathfindingobject.h index 924ea3f298..4b2d546bb1 100644 --- a/indra/newview/llpathfindingobject.h +++ b/indra/newview/llpathfindingobject.h @@ -27,14 +27,14 @@ #ifndef LL_LLPATHFINDINGOBJECT_H #define LL_LLPATHFINDINGOBJECT_H -#include "llavatarname.h" -#include "lluuid.h" -#include "v3math.h" - #include #include +#include "llavatarname.h" +#include "lluuid.h" +#include "v3math.h" + class LLPathfindingObject; class LLSD; diff --git a/indra/newview/llpathfindingobjectlist.h b/indra/newview/llpathfindingobjectlist.h index 94c53f3aba..3ad8e8b096 100644 --- a/indra/newview/llpathfindingobjectlist.h +++ b/indra/newview/llpathfindingobjectlist.h @@ -34,7 +34,6 @@ #include "llpathfindingobject.h" -class LLSD; class LLPathfindingObjectList; typedef boost::shared_ptr LLPathfindingObjectListPtr; diff --git a/indra/newview/llpathfindingpathtool.cpp b/indra/newview/llpathfindingpathtool.cpp index ac4a2fffb9..006755e20b 100644 --- a/indra/newview/llpathfindingpathtool.cpp +++ b/indra/newview/llpathfindingpathtool.cpp @@ -30,17 +30,17 @@ #include "llpathfindingpathtool.h" +#include +#include + #include "llagent.h" +#include "llpathfindingmanager.h" +#include "llpathinglib.h" #include "llsingleton.h" #include "lltool.h" #include "llviewercamera.h" #include "llviewerregion.h" #include "llviewerwindow.h" -#include "llpathfindingmanager.h" -#include "llpathinglib.h" - -#include -#include #define PATH_TOOL_NAME "PathfindingPathTool" diff --git a/indra/newview/llpathfindingpathtool.h b/indra/newview/llpathfindingpathtool.h index e0db87d1ed..97284265f1 100644 --- a/indra/newview/llpathfindingpathtool.h +++ b/indra/newview/llpathfindingpathtool.h @@ -27,13 +27,13 @@ #ifndef LL_LLPATHFINDINGPATHTOOL_H #define LL_LLPATHFINDINGPATHTOOL_H -#include "llsingleton.h" -#include "lltool.h" -#include "llpathinglib.h" - #include #include +#include "llpathinglib.h" +#include "llsingleton.h" +#include "lltool.h" + class LLPathfindingPathTool : public LLTool, public LLSingleton { public: diff --git a/indra/newview/skins/default/xui/en/floater_pathfinding_characters.xml b/indra/newview/skins/default/xui/en/floater_pathfinding_characters.xml index c1f1f60c1b..4331e1f340 100644 --- a/indra/newview/skins/default/xui/en/floater_pathfinding_characters.xml +++ b/indra/newview/skins/default/xui/en/floater_pathfinding_characters.xml @@ -150,14 +150,14 @@ left_pad="0" width="150" /> + height="19" + follows="left|bottom" + label="Show physics capsule" + layout="topleft" + name="show_physics_capsule" + top_pad="-19" + left_pad="0" + width="150" />