diff options
author | prep <prep@lindenlab.com> | 2012-06-13 13:30:26 -0400 |
---|---|---|
committer | prep <prep@lindenlab.com> | 2012-06-13 13:30:26 -0400 |
commit | 7d5c4d20b9f99b3e7d5781433ed6046678292627 (patch) | |
tree | c30e1aa3cb640eb5ee4c1934704c2aa3fd184b1e | |
parent | 9215c682d23d4b977f289c9700b24f3bf2d20b03 (diff) |
WIP: path-722. Posting and responders for navmesh rebaking
-rw-r--r-- | indra/newview/llpanelnavmeshrebake.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llpathfindingmanager.cpp | 95 | ||||
-rw-r--r-- | indra/newview/llpathfindingmanager.h | 8 |
3 files changed, 95 insertions, 11 deletions
diff --git a/indra/newview/llpanelnavmeshrebake.cpp b/indra/newview/llpanelnavmeshrebake.cpp index 9281c08059..92a082467f 100644 --- a/indra/newview/llpanelnavmeshrebake.cpp +++ b/indra/newview/llpanelnavmeshrebake.cpp @@ -96,7 +96,6 @@ BOOL LLPanelNavMeshRebake::postBuild() //Baking mNavMeshBakingButton = getChild<LLButton>("navmesh_btn_baking"); - mNavMeshBakingButton->setCommitCallback(boost::bind(&LLPanelNavMeshRebake::onNavMeshRebakeClick, this)); mNavMeshBakingButton->setVisible( FALSE ); LLHints::registerHintTarget("navmesh_btn_baking", mNavMeshBakingButton->getHandle()); return TRUE; @@ -146,6 +145,8 @@ void LLPanelNavMeshRebake::onNavMeshRebakeClick() setFocus(FALSE); mNavMeshRebakeButton->setVisible( FALSE ); mNavMeshBakingButton->setVisible( TRUE ); + mNavMeshBakingButton->setForcePressedState( TRUE ); + //post } /** 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 @@ -163,6 +163,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<LLPathfindingManager>(), - 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<LLPanel>("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<LLPanel>("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 //--------------------------------------------------------------------------- @@ -805,6 +858,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 //--------------------------------------------------------------------------- diff --git a/indra/newview/llpathfindingmanager.h b/indra/newview/llpathfindingmanager.h index 635179e5a0..535c681499 100644 --- a/indra/newview/llpathfindingmanager.h +++ b/indra/newview/llpathfindingmanager.h @@ -92,6 +92,9 @@ public: agent_state_slot_t registerAgentStateListener(agent_state_callback_t pAgentStateCallback); #endif // XXX_STINSON_AGENT_STATE_DELETE_ME + void handleNavMeshRebakeResult( const LLSD &pContent ); + void handleNavMeshRebakeError(U32 pStatus, const std::string &pReason, const std::string &pURL); + protected: private: @@ -117,6 +120,11 @@ private: std::string getCapabilityURLForRegion(LLViewerRegion *pRegion, const std::string &pCapabilityName) const; LLViewerRegion *getCurrentRegion() const; + + void displayNavMeshRebakePanel(); + void hideNavMeshRebakePanel(); + void triggerNavMeshRebuild(); + #ifdef XXX_STINSON_AGENT_STATE_DELETE_ME void requestGetAgentState(); void handleAgentStateResult(const LLSD &pContent, EAgentState pRequestedAgentState); |