From 9cac312f57391792e9fce380c2c38ae4060ae1d7 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 11 Jun 2012 10:55:18 -0700 Subject: Backed out changeset: 18b06d44c5a3 --- indra/newview/llpathfindingmanager.cpp | 47 ---------------------------------- 1 file changed, 47 deletions(-) (limited to 'indra/newview/llpathfindingmanager.cpp') diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index 85a315a3e7..e282a3e2f4 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -93,25 +93,6 @@ public: LLHTTPRegistration gHTTPRegistrationAgentStateChangeNode(SIM_MESSAGE_AGENT_STATE_UPDATE); -//--------------------------------------------------------------------------- -// StinsonResponder -//--------------------------------------------------------------------------- - -class StinsonResponder : public LLHTTPClient::Responder -{ -public: - StinsonResponder(const std::string &pCapabilityURL); - virtual ~StinsonResponder(); - - virtual void result(const LLSD &pContent); - virtual void error(U32 pStatus, const std::string& pReason); - -protected: - -private: - std::string mCapabilityURL; -}; - //--------------------------------------------------------------------------- // NavMeshStatusResponder //--------------------------------------------------------------------------- @@ -538,10 +519,6 @@ void LLPathfindingManager::requestGetCharacters(request_id_t pRequestId, object_ LLHTTPClient::ResponderPtr charactersResponder = new CharactersResponder(charactersURL, pRequestId, pCharactersCallback); LLHTTPClient::get(charactersURL, charactersResponder); - - std::string googleURL = "http://www.google.com/"; - LLHTTPClient::ResponderPtr stinsonResponder = new StinsonResponder(googleURL); - LLHTTPClient::get(googleURL, stinsonResponder); } } } @@ -825,30 +802,6 @@ void LLNavMeshSimStateChangeNode::post(ResponsePtr pResponse, const LLSD &pConte LLPathfindingManager::getInstance()->handleNavMeshStatusUpdate(navMeshStatus); } -//--------------------------------------------------------------------------- -// StinsonResponder -//--------------------------------------------------------------------------- - -StinsonResponder::StinsonResponder(const std::string &pCapabilityURL) - : LLHTTPClient::Responder(), - mCapabilityURL(pCapabilityURL) -{ -} - -StinsonResponder::~StinsonResponder() -{ -} - -void StinsonResponder::result(const LLSD &pContent) -{ - llinfos << "STINSON DEBUG: success to URL '" << mCapabilityURL << "' with content " << pContent << llendl; -} - -void StinsonResponder::error(U32 pStatus, const std::string& pReason) -{ - llwarns << "STINSON DEBUG: error with request to URL '" << mCapabilityURL << "' because " << pReason << " (statusCode:" << pStatus << ")" << llendl; -} - //--------------------------------------------------------------------------- // LLAgentStateChangeNode //--------------------------------------------------------------------------- -- cgit v1.2.3 From ff7223fafef58d9f8025e97fee87cf7911d93ccf Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 11 Jun 2012 14:45:59 -0700 Subject: PATH-706: Removing enforcement on frozen/unfrozen state from the linksets floater. Also, removing handlers for agent state change. --- indra/newview/llpathfindingmanager.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'indra/newview/llpathfindingmanager.cpp') diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index e282a3e2f4..5e2a9e1213 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -292,11 +292,6 @@ bool LLPathfindingManager::isPathfindingNavMeshVersioningEnabledForCurrentRegion } #endif // DEPRECATED_UNVERSIONED_NAVMESH -bool LLPathfindingManager::isAllowAlterPermanent() -{ - return (!isPathfindingEnabledForCurrentRegion() || (getAgentState() == kAgentStateUnfrozen)); -} - bool LLPathfindingManager::isAllowViewTerrainProperties() const { LLViewerRegion* region = getCurrentRegion(); -- cgit v1.2.3 From b912c27bf44a45e607adc3b5c94d3fd8a9bbf53e Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 11 Jun 2012 16:40:53 -0700 Subject: PATH-711: Implementing Leo's changes for the pathfinding console. --- indra/newview/llpathfindingmanager.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'indra/newview/llpathfindingmanager.cpp') diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index 5e2a9e1213..ae1c228c69 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -45,6 +45,7 @@ #include "llpathfindingnavmesh.h" #include "llpathfindingnavmeshstatus.h" #include "llpathfindingobject.h" +#include "llpathinglib.h" #include "llsingleton.h" #include "llsd.h" #include "lltrans.h" @@ -273,6 +274,14 @@ LLPathfindingManager::~LLPathfindingManager() { } +void LLPathfindingManager::initSystem() +{ + if (LLPathingLib::getInstance() == NULL) + { + LLPathingLib::initSystem(); + } +} + bool LLPathfindingManager::isPathfindingEnabledForCurrentRegion() const { return isPathfindingEnabledForRegion(getCurrentRegion()); @@ -292,6 +301,11 @@ bool LLPathfindingManager::isPathfindingNavMeshVersioningEnabledForCurrentRegion } #endif // DEPRECATED_UNVERSIONED_NAVMESH +bool LLPathfindingManager::isPathfindingDebugEnabled() const +{ + return (LLPathingLib::getInstance() != NULL); +} + bool LLPathfindingManager::isAllowViewTerrainProperties() const { LLViewerRegion* region = getCurrentRegion(); -- cgit v1.2.3 From e738e704b88d64b8a0183f94045d229d9f498bd1 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 11 Jun 2012 17:03:15 -0700 Subject: PATH-714: Removing the DEPRECATED_UNVERSIONED_NAVMESH as the viewer no longer has to support the Premium Wilderness regions on the old server code. --- indra/newview/llpathfindingmanager.cpp | 23 ----------------------- 1 file changed, 23 deletions(-) (limited to 'indra/newview/llpathfindingmanager.cpp') diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index ae1c228c69..1c3800eed6 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -293,14 +293,6 @@ 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::isPathfindingDebugEnabled() const { return (LLPathingLib::getInstance() != NULL); @@ -338,25 +330,10 @@ void LLPathfindingManager::requestGetNavMeshForRegion(LLViewerRegion *pRegion) 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 } } -- cgit v1.2.3 From 3108d4d180df16dab7b87c01334cf466ef88d349 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 11 Jun 2012 18:38:06 -0700 Subject: PATH-726: Removing the DEPRECATED_ALTER_NAVMESH_OBJECTS_FIELD as the viewer no longer has to support the Premium Wilderness regions on the old server code. --- indra/newview/llpathfindingmanager.cpp | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'indra/newview/llpathfindingmanager.cpp') diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index 1c3800eed6..9893121980 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -59,7 +59,6 @@ #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" @@ -377,9 +376,6 @@ void LLPathfindingManager::requestSetAgentState(EAgentState pRequestedAgentState { 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); @@ -661,24 +657,9 @@ void LLPathfindingManager::setAgentState(EAgentState pAgentState) 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)) { -- cgit v1.2.3 From 42f3648814923edad8a040620cb3db233597cbb9 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 11 Jun 2012 18:59:51 -0700 Subject: PATH-705: First pass at removing the agent state functionality. WIP -- still need to remove XXX_STINSON_AGENT_STATE_DELETE_ME ifdef'ed code. --- indra/newview/llpathfindingmanager.cpp | 125 +++++++-------------------------- 1 file changed, 25 insertions(+), 100 deletions(-) (limited to 'indra/newview/llpathfindingmanager.cpp') diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index 9893121980..f54c9892df 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -53,22 +53,24 @@ #include "llviewerregion.h" #include "llweb.h" -#define CAP_SERVICE_RETRIEVE_NAVMESH "RetrieveNavMeshSrc" +#define CAP_SERVICE_RETRIEVE_NAVMESH "RetrieveNavMeshSrc" -#define CAP_SERVICE_NAVMESH_STATUS "NavMeshGenerationStatus" +#define CAP_SERVICE_NAVMESH_STATUS "NavMeshGenerationStatus" -#define CAP_SERVICE_AGENT_STATE "AgentPreferences" -#define ALTER_NAVMESH_OBJECTS_FIELD "alter_navmesh_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 CAP_SERVICE_CHARACTERS "CharacterProperties" +#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" +#ifdef XXX_STINSON_AGENT_STATE_DELETE_ME +#define CAP_SERVICE_AGENT_STATE "AgentPreferences" +#define ALTER_NAVMESH_OBJECTS_FIELD "alter_navmesh_objects" +#define SIM_MESSAGE_AGENT_STATE_UPDATE "/message/AgentPreferencesUpdate" +#endif // XXX_STINSON_AGENT_STATE_DELETE_ME + //--------------------------------------------------------------------------- // LLNavMeshSimStateChangeNode //--------------------------------------------------------------------------- @@ -81,6 +83,7 @@ public: LLHTTPRegistration gHTTPRegistrationNavMeshSimStateChangeNode(SIM_MESSAGE_NAVMESH_STATUS_UPDATE); +#ifdef XXX_STINSON_AGENT_STATE_DELETE_ME //--------------------------------------------------------------------------- // LLAgentStateChangeNode //--------------------------------------------------------------------------- @@ -92,6 +95,7 @@ public: }; LLHTTPRegistration gHTTPRegistrationAgentStateChangeNode(SIM_MESSAGE_AGENT_STATE_UPDATE); +#endif // XXX_STINSON_AGENT_STATE_DELETE_ME //--------------------------------------------------------------------------- // NavMeshStatusResponder @@ -135,6 +139,7 @@ private: LLPathfindingNavMeshPtr mNavMeshPtr; }; +#ifdef XXX_STINSON_AGENT_STATE_DELETE_ME //--------------------------------------------------------------------------- // AgentStateResponder //--------------------------------------------------------------------------- @@ -154,6 +159,7 @@ private: std::string mCapabilityURL; LLPathfindingManager::EAgentState mRequestedAgentState; }; +#endif // XXX_STINSON_AGENT_STATE_DELETE_ME //--------------------------------------------------------------------------- // LinksetsResponder @@ -262,10 +268,7 @@ private: LLPathfindingManager::LLPathfindingManager() : LLSingleton(), - mNavMeshMap(), - mAgentStateSignal(), - mAgentState(kAgentStateUnknown), - mLastKnownNonErrorAgentState(kAgentStateUnknown) + mNavMeshMap() { } @@ -336,51 +339,12 @@ void LLPathfindingManager::requestGetNavMeshForRegion(LLViewerRegion *pRegion) } } +#ifdef XXX_STINSON_AGENT_STATE_DELETE_ME 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); - - LLHTTPClient::ResponderPtr responder = new AgentStateResponder(agentStateURL, pRequestedAgentState); - LLHTTPClient::post(agentStateURL, request, responder); - } -} +#endif // XXX_STINSON_AGENT_STATE_DELETE_ME void LLPathfindingManager::requestGetLinksets(request_id_t pRequestId, object_request_callback_t pLinksetsCallback) const { @@ -623,18 +587,13 @@ LLPathfindingNavMeshPtr LLPathfindingManager::getNavMeshForRegion(LLViewerRegion return getNavMeshForRegion(regionUUID); } -bool LLPathfindingManager::isValidAgentState(EAgentState pAgentState) -{ - return ((pAgentState == kAgentStateFrozen) || (pAgentState == kAgentStateUnfrozen)); -} - +#ifdef XXX_STINSON_AGENT_STATE_DELETE_ME void LLPathfindingManager::requestGetAgentState() { std::string agentStateURL = getAgentStateURLForCurrentRegion(); if (agentStateURL.empty()) { - setAgentState(kAgentStateNotEnabled); } else { @@ -643,58 +602,25 @@ void LLPathfindingManager::requestGetAgentState() } } -void LLPathfindingManager::setAgentState(EAgentState pAgentState) -{ - mAgentState = pAgentState; - - if (mAgentState != kAgentStateError) - { - mLastKnownNonErrorAgentState = mAgentState; - } - - mAgentStateSignal(mAgentState); -} - void LLPathfindingManager::handleAgentStateResult(const LLSD &pContent, EAgentState pRequestedAgentState) { 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); - if (isValidAgentState(pRequestedAgentState) && (agentState != pRequestedAgentState)) + if ((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); } +#endif // XXX_STINSON_AGENT_STATE_DELETE_ME -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); - - LLSD substitutions, payload; - LLNotificationsUtil::add("AutomaticAgentStateUnfreeze", substitutions, payload, boost::bind(&LLPathfindingManager::handleAgentStateUserNotification, this, _1, _2)); -} - -void LLPathfindingManager::handleAgentStateUserNotification(const LLSD &pNotification, const LLSD &pResponse) -{ - if (LLNotificationsUtil::getSelectedOption(pNotification, pResponse) == 1) - { - LLWeb::loadURL(LLTrans::getString("Pathfinding_Wiki_URL")); - } -} std::string LLPathfindingManager::getNavMeshStatusURLForRegion(LLViewerRegion *pRegion) const { @@ -706,11 +632,6 @@ std::string LLPathfindingManager::getRetrieveNavMeshURLForRegion(LLViewerRegion 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); @@ -769,6 +690,7 @@ void LLNavMeshSimStateChangeNode::post(ResponsePtr pResponse, const LLSD &pConte LLPathfindingManager::getInstance()->handleNavMeshStatusUpdate(navMeshStatus); } +#ifdef XXX_STINSON_AGENT_STATE_DELETE_ME //--------------------------------------------------------------------------- // LLAgentStateChangeNode //--------------------------------------------------------------------------- @@ -782,6 +704,7 @@ void LLAgentStateChangeNode::post(ResponsePtr pResponse, const LLSD &pContext, c llassert(pInput.get(SIM_MESSAGE_BODY_FIELD).isMap()); LLPathfindingManager::getInstance()->handleAgentStateUpdate(pInput.get(SIM_MESSAGE_BODY_FIELD)); } +#endif // XXX_STINSON_AGENT_STATE_DELETE_ME //--------------------------------------------------------------------------- // NavMeshStatusResponder @@ -845,6 +768,7 @@ void NavMeshResponder::error(U32 pStatus, const std::string& pReason) mNavMeshPtr->handleNavMeshError(pStatus, pReason, mCapabilityURL, mNavMeshVersion); } +#ifdef XXX_STINSON_AGENT_STATE_DELETE_ME //--------------------------------------------------------------------------- // AgentStateResponder //--------------------------------------------------------------------------- @@ -869,6 +793,7 @@ void AgentStateResponder::error(U32 pStatus, const std::string &pReason) { LLPathfindingManager::getInstance()->handleAgentStateError(pStatus, pReason, mCapabilityURL); } +#endif // XXX_STINSON_AGENT_STATE_DELETE_ME //--------------------------------------------------------------------------- // LinksetsResponder -- cgit v1.2.3 From de1e1db9600a03ab5b0dc3f04a5bdcee30632f05 Mon Sep 17 00:00:00 2001 From: prep Date: Wed, 13 Jun 2012 10:50:46 -0400 Subject: WIP for path-702. --- indra/newview/llpathfindingmanager.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpathfindingmanager.cpp') diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index f54c9892df..6d0629698a 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -52,6 +52,7 @@ #include "lluuid.h" #include "llviewerregion.h" #include "llweb.h" +#include "llpanelnavmeshrebake.h" #define CAP_SERVICE_RETRIEVE_NAVMESH "RetrieveNavMeshSrc" @@ -268,7 +269,7 @@ private: LLPathfindingManager::LLPathfindingManager() : LLSingleton(), - mNavMeshMap() + mNavMeshMap(),mShowNavMeshRebake(false) { } @@ -315,7 +316,15 @@ LLPathfindingNavMesh::navmesh_slot_t LLPathfindingManager::registerNavMeshListen void LLPathfindingManager::requestGetNavMeshForRegion(LLViewerRegion *pRegion) { LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pRegion); - + //prep#s#test + LLView* rootp = LLUI::getRootView(); + LLPanel* panel_nmr_container = rootp->getChild("navmesh_rebake_container"); + LLPanelNavMeshRebake* panel_namesh_rebake = LLPanelNavMeshRebake::getInstance(); + panel_nmr_container->addChild( panel_namesh_rebake ); + panel_nmr_container->setVisible( TRUE ); + panel_namesh_rebake->reparent( rootp ); + LLPanelNavMeshRebake::getInstance()->setVisible( TRUE ); + //prep#e if (pRegion == NULL) { navMeshPtr->handleNavMeshNotEnabled(); @@ -955,3 +964,4 @@ void CharactersResponder::error(U32 pStatus, const std::string &pReason) LLPathfindingObjectListPtr characterListPtr = LLPathfindingObjectListPtr(new LLPathfindingCharacterList()); mCharactersCallback(mRequestId, LLPathfindingManager::kRequestError, characterListPtr); } + -- cgit v1.2.3 From d7b9af3ab398aedde1229e081c2b245c20a3c6d5 Mon Sep 17 00:00:00 2001 From: prep Date: Wed, 13 Jun 2012 11:08:07 -0400 Subject: path-724: xml navmesh rebake button --- indra/newview/llpathfindingmanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpathfindingmanager.cpp') diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index 6d0629698a..278269b2fa 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -318,7 +318,7 @@ void LLPathfindingManager::requestGetNavMeshForRegion(LLViewerRegion *pRegion) LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pRegion); //prep#s#test LLView* rootp = LLUI::getRootView(); - LLPanel* panel_nmr_container = rootp->getChild("navmesh_rebake_container"); + LLPanel* panel_nmr_container = rootp->getChild("navmesh_rebake_container"); LLPanelNavMeshRebake* panel_namesh_rebake = LLPanelNavMeshRebake::getInstance(); panel_nmr_container->addChild( panel_namesh_rebake ); panel_nmr_container->setVisible( TRUE ); -- cgit v1.2.3 From 7d5c4d20b9f99b3e7d5781433ed6046678292627 Mon Sep 17 00:00:00 2001 From: prep Date: Wed, 13 Jun 2012 13:30:26 -0400 Subject: WIP: path-722. Posting and responders for navmesh rebaking --- indra/newview/llpathfindingmanager.cpp | 95 ++++++++++++++++++++++++++++++---- 1 file changed, 85 insertions(+), 10 deletions(-) (limited to 'indra/newview/llpathfindingmanager.cpp') diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index 278269b2fa..fc296a4b83 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -162,6 +162,23 @@ private: }; #endif // XXX_STINSON_AGENT_STATE_DELETE_ME +//--------------------------------------------------------------------------- +// NavMeshRebakeResponder +//--------------------------------------------------------------------------- +class NavMeshRebakeResponder : public LLHTTPClient::Responder +{ +public: + NavMeshRebakeResponder( const std::string &pCapabilityURL ); + virtual ~NavMeshRebakeResponder(); + + virtual void result( const LLSD &pContent ); + virtual void error( U32 pStatus, const std::string& pReason ); + +protected: + +private: + std::string mCapabilityURL; +}; //--------------------------------------------------------------------------- // LinksetsResponder //--------------------------------------------------------------------------- @@ -269,7 +286,7 @@ private: LLPathfindingManager::LLPathfindingManager() : LLSingleton(), - mNavMeshMap(),mShowNavMeshRebake(false) + mNavMeshMap(), mShowNavMeshRebake(false) { } @@ -316,15 +333,7 @@ LLPathfindingNavMesh::navmesh_slot_t LLPathfindingManager::registerNavMeshListen void LLPathfindingManager::requestGetNavMeshForRegion(LLViewerRegion *pRegion) { LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pRegion); - //prep#s#test - LLView* rootp = LLUI::getRootView(); - LLPanel* panel_nmr_container = rootp->getChild("navmesh_rebake_container"); - LLPanelNavMeshRebake* panel_namesh_rebake = LLPanelNavMeshRebake::getInstance(); - panel_nmr_container->addChild( panel_namesh_rebake ); - panel_nmr_container->setVisible( TRUE ); - panel_namesh_rebake->reparent( rootp ); - LLPanelNavMeshRebake::getInstance()->setVisible( TRUE ); - //prep#e + if (pRegion == NULL) { navMeshPtr->handleNavMeshNotEnabled(); @@ -684,6 +693,50 @@ LLViewerRegion *LLPathfindingManager::getCurrentRegion() const return gAgent.getRegion(); } +void LLPathfindingManager::displayNavMeshRebakePanel() +{ + LLView* rootp = LLUI::getRootView(); + LLPanel* panel_nmr_container = rootp->getChild("navmesh_rebake_container"); + LLPanelNavMeshRebake* panel_namesh_rebake = LLPanelNavMeshRebake::getInstance(); + panel_nmr_container->addChild( panel_namesh_rebake ); + panel_nmr_container->setVisible( TRUE ); + panel_namesh_rebake->reparent( rootp ); + LLPanelNavMeshRebake::getInstance()->setVisible( TRUE ); +} + +void LLPathfindingManager::hideNavMeshRebakePanel() +{ + LLPanelNavMeshRebake::getInstance()->setVisible( FALSE ); +} + +void LLPathfindingManager::handleNavMeshRebakeResult( const LLSD &pContent ) +{ + +} + +void LLPathfindingManager::handleNavMeshRebakeError(U32 pStatus, const std::string &pReason, const std::string &pURL) +{ + llwarns << "error with request to URL '" << pURL << "' because " << pReason << " (statusCode:" << pStatus << ")" << llendl; +} +//prep# +void LLPathfindingManager::triggerNavMeshRebuild() +{ + LLSD mPostData; + std::string url = getNavMeshStatusURLForRegion( getCurrentRegion() ); + + if ( url.empty() ) + { + //prep#fix#error? + } + else + { + LLSD mPostData; + mPostData["command"] = "rebuild"; + LLHTTPClient::ResponderPtr responder = new NavMeshRebakeResponder( url ); + LLHTTPClient::post( url, mPostData, responder ); + } + +} //--------------------------------------------------------------------------- // LLNavMeshSimStateChangeNode //--------------------------------------------------------------------------- @@ -804,6 +857,28 @@ void AgentStateResponder::error(U32 pStatus, const std::string &pReason) } #endif // XXX_STINSON_AGENT_STATE_DELETE_ME +//--------------------------------------------------------------------------- +// navmesh rebake responder +//--------------------------------------------------------------------------- +NavMeshRebakeResponder::NavMeshRebakeResponder(const std::string &pCapabilityURL ) +: LLHTTPClient::Responder() +, mCapabilityURL( pCapabilityURL ) +{ +} + +NavMeshRebakeResponder::~NavMeshRebakeResponder() +{ +} + +void NavMeshRebakeResponder::result(const LLSD &pContent) +{ + LLPathfindingManager::getInstance()->handleNavMeshRebakeResult( pContent ); +} + +void NavMeshRebakeResponder::error(U32 pStatus, const std::string &pReason) +{ + LLPathfindingManager::getInstance()->handleNavMeshRebakeError( pStatus, pReason, mCapabilityURL ); +} //--------------------------------------------------------------------------- // LinksetsResponder //--------------------------------------------------------------------------- -- cgit v1.2.3 From 9767b5a026ba1b442ad1aa438f5957375a997c14 Mon Sep 17 00:00:00 2001 From: prep Date: Wed, 13 Jun 2012 15:31:44 -0400 Subject: Path-722: Reset buttons to default state. --- indra/newview/llpathfindingmanager.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'indra/newview/llpathfindingmanager.cpp') diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index fc296a4b83..7ce34fcfcb 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -333,7 +333,7 @@ LLPathfindingNavMesh::navmesh_slot_t LLPathfindingManager::registerNavMeshListen void LLPathfindingManager::requestGetNavMeshForRegion(LLViewerRegion *pRegion) { LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pRegion); - + if (pRegion == NULL) { navMeshPtr->handleNavMeshNotEnabled(); @@ -702,31 +702,30 @@ void LLPathfindingManager::displayNavMeshRebakePanel() panel_nmr_container->setVisible( TRUE ); panel_namesh_rebake->reparent( rootp ); LLPanelNavMeshRebake::getInstance()->setVisible( TRUE ); + LLPanelNavMeshRebake::getInstance()->resetButtonStates(); } -void LLPathfindingManager::hideNavMeshRebakePanel() +void LLPathfindingManager::hideNavMeshRebakePanel() { LLPanelNavMeshRebake::getInstance()->setVisible( FALSE ); } -void LLPathfindingManager::handleNavMeshRebakeResult( const LLSD &pContent ) +void LLPathfindingManager::handleNavMeshRebakeError(U32 pStatus, const std::string &pReason, const std::string &pURL) { - + llwarns << "error with request to URL '" << pURL << "' because " << pReason << " (statusCode:" << pStatus << ")" << llendl; } -void LLPathfindingManager::handleNavMeshRebakeError(U32 pStatus, const std::string &pReason, const std::string &pURL) +void LLPathfindingManager::handleNavMeshRebakeResult( const LLSD &pContent ) { - llwarns << "error with request to URL '" << pURL << "' because " << pReason << " (statusCode:" << pStatus << ")" << llendl; + hideNavMeshRebakePanel(); } -//prep# + void LLPathfindingManager::triggerNavMeshRebuild() { - LLSD mPostData; std::string url = getNavMeshStatusURLForRegion( getCurrentRegion() ); - if ( url.empty() ) { - //prep#fix#error? + llwarns << "Error with request due to nonexistent URL"< Date: Thu, 14 Jun 2012 16:58:11 -0400 Subject: WIP: path-722. Some agent_state_updates come through (god mode), region crossings, cleanup logic is a TBD, etc.. --- indra/newview/llpathfindingmanager.cpp | 100 ++++++++++++++++----------------- 1 file changed, 49 insertions(+), 51 deletions(-) (limited to 'indra/newview/llpathfindingmanager.cpp') diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index 7ce34fcfcb..16283282fb 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -53,6 +53,7 @@ #include "llviewerregion.h" #include "llweb.h" #include "llpanelnavmeshrebake.h" +#include "llenvmanager.h" #define CAP_SERVICE_RETRIEVE_NAVMESH "RetrieveNavMeshSrc" @@ -66,11 +67,9 @@ #define SIM_MESSAGE_NAVMESH_STATUS_UPDATE "/message/NavMeshStatusUpdate" #define SIM_MESSAGE_BODY_FIELD "body" -#ifdef XXX_STINSON_AGENT_STATE_DELETE_ME -#define CAP_SERVICE_AGENT_STATE "AgentPreferences" -#define ALTER_NAVMESH_OBJECTS_FIELD "alter_navmesh_objects" -#define SIM_MESSAGE_AGENT_STATE_UPDATE "/message/AgentPreferencesUpdate" -#endif // XXX_STINSON_AGENT_STATE_DELETE_ME +#define CAP_SERVICE_AGENT_STATE "AgentState" +#define ALTER_NAVMESH_OBJECTS_FIELD "alter_navmesh_objects" +#define SIM_MESSAGE_AGENT_STATE_UPDATE "/message/AgentStateUpdate" //--------------------------------------------------------------------------- // LLNavMeshSimStateChangeNode @@ -84,11 +83,10 @@ public: LLHTTPRegistration gHTTPRegistrationNavMeshSimStateChangeNode(SIM_MESSAGE_NAVMESH_STATUS_UPDATE); -#ifdef XXX_STINSON_AGENT_STATE_DELETE_ME + //--------------------------------------------------------------------------- // LLAgentStateChangeNode //--------------------------------------------------------------------------- - class LLAgentStateChangeNode : public LLHTTPNode { public: @@ -96,7 +94,6 @@ public: }; LLHTTPRegistration gHTTPRegistrationAgentStateChangeNode(SIM_MESSAGE_AGENT_STATE_UPDATE); -#endif // XXX_STINSON_AGENT_STATE_DELETE_ME //--------------------------------------------------------------------------- // NavMeshStatusResponder @@ -140,7 +137,6 @@ private: LLPathfindingNavMeshPtr mNavMeshPtr; }; -#ifdef XXX_STINSON_AGENT_STATE_DELETE_ME //--------------------------------------------------------------------------- // AgentStateResponder //--------------------------------------------------------------------------- @@ -148,7 +144,7 @@ private: class AgentStateResponder : public LLHTTPClient::Responder { public: - AgentStateResponder(const std::string &pCapabilityURL, LLPathfindingManager::EAgentState pRequestedAgentState = LLPathfindingManager::kAgentStateUnknown); + AgentStateResponder(const std::string &pCapabilityURL); virtual ~AgentStateResponder(); virtual void result(const LLSD &pContent); @@ -158,9 +154,8 @@ protected: private: std::string mCapabilityURL; - LLPathfindingManager::EAgentState mRequestedAgentState; }; -#endif // XXX_STINSON_AGENT_STATE_DELETE_ME + //--------------------------------------------------------------------------- // NavMeshRebakeResponder @@ -286,12 +281,27 @@ private: LLPathfindingManager::LLPathfindingManager() : LLSingleton(), - mNavMeshMap(), mShowNavMeshRebake(false) + mNavMeshMap(), + mShowNavMeshRebake(false), + mCrossingSlot() { + if ( !mCrossingSlot.connected() ) + { + mCrossingSlot = LLEnvManagerNew::getInstance()->setRegionChangeCallback(boost::bind(&LLPathfindingManager::onRegionBoundaryCrossed, this)); + } +} + +void LLPathfindingManager::onRegionBoundaryCrossed() +{ + displayNavMeshRebakePanel(); } LLPathfindingManager::~LLPathfindingManager() -{ +{ + if (mCrossingSlot.connected()) + { + mCrossingSlot.disconnect(); + } } void LLPathfindingManager::initSystem() @@ -357,12 +367,11 @@ void LLPathfindingManager::requestGetNavMeshForRegion(LLViewerRegion *pRegion) } } -#ifdef XXX_STINSON_AGENT_STATE_DELETE_ME LLPathfindingManager::agent_state_slot_t LLPathfindingManager::registerAgentStateListener(agent_state_callback_t pAgentStateCallback) { return mAgentStateSignal.connect(pAgentStateCallback); } -#endif // XXX_STINSON_AGENT_STATE_DELETE_ME + void LLPathfindingManager::requestGetLinksets(request_id_t pRequestId, object_request_callback_t pLinksetsCallback) const { @@ -605,39 +614,31 @@ LLPathfindingNavMeshPtr LLPathfindingManager::getNavMeshForRegion(LLViewerRegion return getNavMeshForRegion(regionUUID); } -#ifdef XXX_STINSON_AGENT_STATE_DELETE_ME void LLPathfindingManager::requestGetAgentState() { - std::string agentStateURL = getAgentStateURLForCurrentRegion(); + std::string agentStateURL = getAgentStateURLForCurrentRegion( getCurrentRegion() ); - if (agentStateURL.empty()) - { - } - else + if ( !agentStateURL.empty() ) { - LLHTTPClient::ResponderPtr responder = new AgentStateResponder(agentStateURL); - LLHTTPClient::get(agentStateURL, responder); + LLHTTPClient::ResponderPtr responder = new AgentStateResponder( agentStateURL ); + LLHTTPClient::get( agentStateURL, responder ); } } -void LLPathfindingManager::handleAgentStateResult(const LLSD &pContent, EAgentState pRequestedAgentState) -{ - 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); - - if ((agentState != pRequestedAgentState)) - { - agentState = kAgentStateError; - llassert(0); - } +void LLPathfindingManager::handleAgentStateResult(const LLSD &pContent) +{ + displayNavMeshRebakePanel(); } 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; } -#endif // XXX_STINSON_AGENT_STATE_DELETE_ME + +std::string LLPathfindingManager::getAgentStateURLForCurrentRegion(LLViewerRegion *pRegion) const +{ + return getCapabilityURLForRegion( pRegion, CAP_SERVICE_AGENT_STATE ); +} std::string LLPathfindingManager::getNavMeshStatusURLForRegion(LLViewerRegion *pRegion) const @@ -750,21 +751,19 @@ void LLNavMeshSimStateChangeNode::post(ResponsePtr pResponse, const LLSD &pConte LLPathfindingManager::getInstance()->handleNavMeshStatusUpdate(navMeshStatus); } -#ifdef XXX_STINSON_AGENT_STATE_DELETE_ME //--------------------------------------------------------------------------- // 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)); + LLPathfindingManager::getInstance()->handleAgentStateUpdate(); +} + +void LLPathfindingManager::handleAgentStateUpdate() +{ + displayNavMeshRebakePanel(); } -#endif // XXX_STINSON_AGENT_STATE_DELETE_ME //--------------------------------------------------------------------------- // NavMeshStatusResponder @@ -828,15 +827,13 @@ void NavMeshResponder::error(U32 pStatus, const std::string& pReason) mNavMeshPtr->handleNavMeshError(pStatus, pReason, mCapabilityURL, mNavMeshVersion); } -#ifdef XXX_STINSON_AGENT_STATE_DELETE_ME //--------------------------------------------------------------------------- // AgentStateResponder //--------------------------------------------------------------------------- -AgentStateResponder::AgentStateResponder(const std::string &pCapabilityURL, LLPathfindingManager::EAgentState pRequestedAgentState) - : LLHTTPClient::Responder(), - mCapabilityURL(pCapabilityURL), - mRequestedAgentState(pRequestedAgentState) +AgentStateResponder::AgentStateResponder(const std::string &pCapabilityURL) +: LLHTTPClient::Responder() +, mCapabilityURL(pCapabilityURL) { } @@ -846,14 +843,14 @@ AgentStateResponder::~AgentStateResponder() void AgentStateResponder::result(const LLSD &pContent) { - LLPathfindingManager::getInstance()->handleAgentStateResult(pContent, mRequestedAgentState); + LLPathfindingManager::getInstance()->handleAgentStateResult(pContent); } void AgentStateResponder::error(U32 pStatus, const std::string &pReason) { LLPathfindingManager::getInstance()->handleAgentStateError(pStatus, pReason, mCapabilityURL); } -#endif // XXX_STINSON_AGENT_STATE_DELETE_ME + //--------------------------------------------------------------------------- // navmesh rebake responder @@ -877,6 +874,7 @@ void NavMeshRebakeResponder::error(U32 pStatus, const std::string &pReason) { LLPathfindingManager::getInstance()->handleNavMeshRebakeError( pStatus, pReason, mCapabilityURL ); } + //--------------------------------------------------------------------------- // LinksetsResponder //--------------------------------------------------------------------------- -- cgit v1.2.3