summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--etc/message.xml2
-rw-r--r--indra/newview/CMakeLists.txt2
-rw-r--r--indra/newview/llfloaterpathfindingconsole.cpp7
-rw-r--r--indra/newview/llfloaterpathfindingconsole.h1
-rw-r--r--indra/newview/llpathfindingmanager.cpp178
-rw-r--r--indra/newview/llpathfindingmanager.h11
-rw-r--r--indra/newview/llpathfindingnavmesh.cpp40
-rw-r--r--indra/newview/llpathfindingnavmesh.h12
-rw-r--r--indra/newview/llpathfindingnavmeshstatus.cpp134
-rw-r--r--indra/newview/llpathfindingnavmeshstatus.h77
-rw-r--r--indra/newview/llpathfindingnavmeshzone.cpp22
-rw-r--r--indra/newview/llpathfindingnavmeshzone.h1
-rw-r--r--indra/newview/llviewerregion.cpp1
-rw-r--r--indra/newview/skins/default/xui/en/floater_pathfinding_console.xml1
14 files changed, 443 insertions, 46 deletions
diff --git a/etc/message.xml b/etc/message.xml
index 9407888a92..244bf7fb06 100644
--- a/etc/message.xml
+++ b/etc/message.xml
@@ -547,7 +547,7 @@
<boolean>true</boolean>
</map>
- <key>NavmeshStatusUpdate</key>
+ <key>NavMeshStatusUpdate</key>
<map>
<key>flavor</key>
<string>llsd</string>
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index b586c6e31f..500163c030 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/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp
index 405b089155..7e86819568 100644
--- a/indra/newview/llfloaterpathfindingconsole.cpp
+++ b/indra/newview/llfloaterpathfindingconsole.cpp
@@ -625,6 +625,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();
@@ -684,6 +687,7 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState()
mHasStartPoint = false;
mHasEndPoint = false;
break;
+ case kConsoleStateCheckingVersion :
case kConsoleStateDownloading :
case kConsoleStateError :
mShowNavMeshCheckBox->setEnabled(FALSE);
@@ -743,6 +747,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 0f9f859924..a1973e0985 100644
--- a/indra/newview/llfloaterpathfindingconsole.h
+++ b/indra/newview/llfloaterpathfindingconsole.h
@@ -122,6 +122,7 @@ private:
kConsoleStateUnknown,
kConsoleStateLibraryNotImplemented,
kConsoleStateRegionNotEnabled,
+ kConsoleStateCheckingVersion,
kConsoleStateDownloading,
kConsoleStateHasNavMesh,
kConsoleStateError
diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp
index ebefebbb64..f3b9bc4b8a 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
@@ -67,6 +71,27 @@ public:
LLHTTPRegistration<LLNavMeshSimStateChangeNode> 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<LLPathfindingManager>(),
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,66 @@ 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);
+ 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
+ }
+}
- 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(pNavMeshStatus.getVersion());
+ }
+ 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 +447,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 +568,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 +627,46 @@ 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);
+#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE
+ llinfos << "Received NavMeshStatusUpdate: " << pContext << llendl;
+#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE
+ 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)
+{
+#ifdef XXX_STINSON_DEBUG_NAVMESH_ZONE
+ llinfos << "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);
}
//---------------------------------------------------------------------------
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<LLPathfindingManager>
{
@@ -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..138295a8cf 100644
--- a/indra/newview/llpathfindingnavmesh.cpp
+++ b/indra/newview/llpathfindingnavmesh.cpp
@@ -56,19 +56,38 @@ 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)
{
- mNavMeshData.clear();
- mNavMeshVersion = pNavMeshVersion;
- setRequestStatus(kNavMeshRequestNeedsUpdate);
+ if (mNavMeshVersion != pNavMeshVersion)
+ {
+ mNavMeshData.clear();
+ mNavMeshVersion = pNavMeshVersion;
+ setRequestStatus(kNavMeshRequestNeedsUpdate);
+ }
}
void LLPathfindingNavMesh::handleNavMeshStart(U32 pNavMeshVersion)
@@ -121,13 +140,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..46a114439a 100644
--- a/indra/newview/llpathfindingnavmesh.h
+++ b/indra/newview/llpathfindingnavmesh.h
@@ -42,11 +42,15 @@ class LLPathfindingNavMesh;
typedef boost::shared_ptr<LLPathfindingNavMesh> 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:
typedef enum {
kNavMeshRequestUnknown,
+ kNavMeshRequestChecking,
kNavMeshRequestNeedsUpdate,
kNavMeshRequestStarted,
kNavMeshRequestCompleted,
@@ -63,13 +67,19 @@ 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();
+ void handleNavMeshCheckVersion();
+ void handleRefresh(U32 pNavMeshVersion);
void handleNavMeshNewVersion(U32 pNavMeshVersion);
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 <string>
+
+#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<U32>(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 <string>
+
+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..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;
@@ -191,6 +195,13 @@ void LLPathfindingNavMeshZone::updateStatus()
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;
@@ -311,10 +322,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 +338,8 @@ void LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh(LLPathfindingNavMe
{
LLPathingLib::getInstance()->extractNavMeshSrcFromLLSD(pNavMeshData, mDirection);
}
+ mLocationCallback();
}
- mLocationCallback();
}
void LLPathfindingNavMeshZone::NavMeshLocation::clear()
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/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");
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 dd31a71e0f..aaf94483df 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 @@
<floater.string name="navmesh_status_unknown"></floater.string>
<floater.string name="navmesh_status_library_not_implemented">Cannot find pathing library implementation.</floater.string>
<floater.string name="navmesh_status_region_not_enabled">This region is not enabled for pathfinding.</floater.string>
+ <floater.string name="navmesh_status_checking_version">Checking the status of the navmesh ...</floater.string>
<floater.string name="navmesh_status_downloading">Downloading the navmesh ...</floater.string>
<floater.string name="navmesh_status_updating">The navmesh has changed on the server. Downloading the latest navmesh ...</floater.string>
<floater.string name="navmesh_status_has_navmesh">Navmesh received.</floater.string>