PATH-702: Refining the behavior of the rebuild navmesh button after it is pushed, and removing unused code.
parent
37f3a016fc
commit
b98cbe00fe
|
|
@ -57,12 +57,14 @@ LLPanelNavMeshRebake* LLPanelNavMeshRebake::getInstance()
|
|||
BOOL LLPanelNavMeshRebake::postBuild()
|
||||
{
|
||||
//Rebake initiated
|
||||
mNavMeshRebakeButton = getChild<LLButton>("navmesh_btn");
|
||||
mNavMeshRebakeButton = findChild<LLButton>("navmesh_btn");
|
||||
llassert(mNavMeshRebakeButton != NULL);
|
||||
mNavMeshRebakeButton->setCommitCallback(boost::bind(&LLPanelNavMeshRebake::onNavMeshRebakeClick, this));
|
||||
LLHints::registerHintTarget("navmesh_btn", mNavMeshRebakeButton->getHandle());
|
||||
|
||||
//Baking...
|
||||
mNavMeshBakingButton = getChild<LLButton>("navmesh_btn_baking");
|
||||
mNavMeshBakingButton = findChild<LLButton>("navmesh_btn_baking");
|
||||
llassert(mNavMeshBakingButton != NULL);
|
||||
LLHints::registerHintTarget("navmesh_btn_baking", mNavMeshBakingButton->getHandle());
|
||||
|
||||
setMode(kRebakeNavMesh_Default);
|
||||
|
|
@ -133,7 +135,13 @@ void LLPanelNavMeshRebake::onNavMeshRebakeClick()
|
|||
mNavMeshBakingButton->setVisible( TRUE );
|
||||
mNavMeshBakingButton->setForcePressedState( TRUE );
|
||||
#endif
|
||||
LLPathfindingManager::getInstance()->triggerNavMeshRebuild();
|
||||
setMode(kRebakeNavMesh_RequestSent);
|
||||
LLPathfindingManager::getInstance()->requestRebakeNavMesh(boost::bind(&LLPanelNavMeshRebake::handleRebakeNavMeshResponse, this, _1));
|
||||
}
|
||||
|
||||
void LLPanelNavMeshRebake::handleRebakeNavMeshResponse(bool pResponseStatus)
|
||||
{
|
||||
setMode(pResponseStatus ? kRebakeNavMesh_NotAvailable : kRebakeNavMesh_Available);
|
||||
}
|
||||
|
||||
void LLPanelNavMeshRebake::handleNavMeshStatus(const LLPathfindingNavMeshStatus &pNavMeshStatus)
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ private:
|
|||
|
||||
void onNavMeshRebakeClick();
|
||||
|
||||
void handleRebakeNavMeshResponse(bool pResponseStatus);
|
||||
void handleNavMeshStatus(const LLPathfindingNavMeshStatus &pNavMeshStatus);
|
||||
void handleRegionBoundaryCrossed();
|
||||
|
||||
|
|
|
|||
|
|
@ -54,9 +54,6 @@
|
|||
#include "llweb.h"
|
||||
#include "llpanelnavmeshrebake.h"
|
||||
#include "llenvmanager.h"
|
||||
#if 0
|
||||
#include "llstartup.h"
|
||||
#endif
|
||||
|
||||
#define CAP_SERVICE_RETRIEVE_NAVMESH "RetrieveNavMeshSrc"
|
||||
|
||||
|
|
@ -167,17 +164,19 @@ private:
|
|||
class NavMeshRebakeResponder : public LLHTTPClient::Responder
|
||||
{
|
||||
public:
|
||||
NavMeshRebakeResponder( const std::string &pCapabilityURL );
|
||||
NavMeshRebakeResponder(const std::string &pCapabilityURL, LLPathfindingManager::rebake_navmesh_callback_t pRebakeNavMeshCallback);
|
||||
virtual ~NavMeshRebakeResponder();
|
||||
|
||||
virtual void result( const LLSD &pContent );
|
||||
virtual void error( U32 pStatus, const std::string& pReason );
|
||||
virtual void result(const LLSD &pContent);
|
||||
virtual void error(U32 pStatus, const std::string& pReason);
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
std::string mCapabilityURL;
|
||||
std::string mCapabilityURL;
|
||||
LLPathfindingManager::rebake_navmesh_callback_t mRebakeNavMeshCallback;
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// LinksetsResponder
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
@ -495,6 +494,19 @@ void LLPathfindingManager::requestGetCharacters(request_id_t pRequestId, object_
|
|||
}
|
||||
}
|
||||
|
||||
void LLPathfindingManager::requestRebakeNavMesh(rebake_navmesh_callback_t pRebakeNavMeshCallback)
|
||||
{
|
||||
std::string navMeshStatusURL = getNavMeshStatusURLForCurrentRegion();
|
||||
llassert(!navMeshStatusURL.empty())
|
||||
if (!navMeshStatusURL.empty())
|
||||
{
|
||||
LLSD mPostData;
|
||||
mPostData["command"] = "rebuild";
|
||||
LLHTTPClient::ResponderPtr responder = new NavMeshRebakeResponder(navMeshStatusURL, pRebakeNavMeshCallback);
|
||||
LLHTTPClient::post(navMeshStatusURL, mPostData, responder);
|
||||
}
|
||||
}
|
||||
|
||||
void LLPathfindingManager::sendRequestGetNavMeshForRegion(LLPathfindingNavMeshPtr navMeshPtr, LLViewerRegion *pRegion, const LLPathfindingNavMeshStatus &pNavMeshStatus)
|
||||
{
|
||||
if ((pRegion == NULL) || !pRegion->isAlive())
|
||||
|
|
@ -630,9 +642,6 @@ void LLPathfindingManager::requestGetAgentState()
|
|||
|
||||
void LLPathfindingManager::handleAgentStateResult(const LLSD &pContent)
|
||||
{
|
||||
#if 0
|
||||
displayNavMeshRebakePanel();
|
||||
#endif
|
||||
}
|
||||
|
||||
void LLPathfindingManager::handleAgentStateError(U32 pStatus, const std::string &pReason, const std::string &pURL)
|
||||
|
|
@ -642,9 +651,13 @@ void LLPathfindingManager::handleAgentStateError(U32 pStatus, const std::string
|
|||
|
||||
std::string LLPathfindingManager::getAgentStateURLForCurrentRegion(LLViewerRegion *pRegion) const
|
||||
{
|
||||
return getCapabilityURLForRegion( pRegion, CAP_SERVICE_AGENT_STATE );
|
||||
return getCapabilityURLForRegion(pRegion, CAP_SERVICE_AGENT_STATE);
|
||||
}
|
||||
|
||||
std::string LLPathfindingManager::getNavMeshStatusURLForCurrentRegion() const
|
||||
{
|
||||
return getNavMeshStatusURLForRegion(getCurrentRegion());
|
||||
}
|
||||
|
||||
std::string LLPathfindingManager::getNavMeshStatusURLForRegion(LLViewerRegion *pRegion) const
|
||||
{
|
||||
|
|
@ -699,46 +712,6 @@ LLViewerRegion *LLPathfindingManager::getCurrentRegion() const
|
|||
return gAgent.getRegion();
|
||||
}
|
||||
|
||||
#if 0
|
||||
void LLPathfindingManager::displayNavMeshRebakePanel()
|
||||
{
|
||||
LLPanelNavMeshRebake::getInstance()->setMode(LLPanelNavMeshRebake::kRebakeNavMesh_Available);
|
||||
}
|
||||
|
||||
void LLPathfindingManager::hideNavMeshRebakePanel()
|
||||
{
|
||||
LLPanelNavMeshRebake::getInstance()->setMode(LLPanelNavMeshRebake::kRebakeNavMesh_NotAvailable);
|
||||
}
|
||||
#endif
|
||||
|
||||
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::handleNavMeshRebakeResult( const LLSD &pContent )
|
||||
{
|
||||
|
||||
#if 0
|
||||
hideNavMeshRebakePanel();
|
||||
#endif
|
||||
}
|
||||
|
||||
void LLPathfindingManager::triggerNavMeshRebuild()
|
||||
{
|
||||
std::string url = getNavMeshStatusURLForRegion( getCurrentRegion() );
|
||||
if ( url.empty() )
|
||||
{
|
||||
llwarns << "Error with request due to nonexistent URL"<<llendl;
|
||||
}
|
||||
else
|
||||
{
|
||||
LLSD mPostData;
|
||||
mPostData["command"] = "rebuild";
|
||||
LLHTTPClient::ResponderPtr responder = new NavMeshRebakeResponder( url );
|
||||
LLHTTPClient::post( url, mPostData, responder );
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
// LLNavMeshSimStateChangeNode
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
@ -766,9 +739,6 @@ void LLAgentStateChangeNode::post(ResponsePtr pResponse, const LLSD &pContext, c
|
|||
void LLPathfindingManager::handleAgentStateUpdate()
|
||||
{
|
||||
//Don't trigger if we are still loading in
|
||||
#if 0
|
||||
if ( LLStartUp::getStartupState() == STATE_STARTED) { displayNavMeshRebakePanel(); }
|
||||
#endif
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
@ -862,9 +832,10 @@ void AgentStateResponder::error(U32 pStatus, const std::string &pReason)
|
|||
//---------------------------------------------------------------------------
|
||||
// navmesh rebake responder
|
||||
//---------------------------------------------------------------------------
|
||||
NavMeshRebakeResponder::NavMeshRebakeResponder(const std::string &pCapabilityURL )
|
||||
: LLHTTPClient::Responder()
|
||||
, mCapabilityURL( pCapabilityURL )
|
||||
NavMeshRebakeResponder::NavMeshRebakeResponder(const std::string &pCapabilityURL, LLPathfindingManager::rebake_navmesh_callback_t pRebakeNavMeshCallback)
|
||||
: LLHTTPClient::Responder(),
|
||||
mCapabilityURL(pCapabilityURL),
|
||||
mRebakeNavMeshCallback(pRebakeNavMeshCallback)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -874,12 +845,13 @@ NavMeshRebakeResponder::~NavMeshRebakeResponder()
|
|||
|
||||
void NavMeshRebakeResponder::result(const LLSD &pContent)
|
||||
{
|
||||
LLPathfindingManager::getInstance()->handleNavMeshRebakeResult( pContent );
|
||||
mRebakeNavMeshCallback(true);
|
||||
}
|
||||
|
||||
void NavMeshRebakeResponder::error(U32 pStatus, const std::string &pReason)
|
||||
{
|
||||
LLPathfindingManager::getInstance()->handleNavMeshRebakeError( pStatus, pReason, mCapabilityURL );
|
||||
llwarns << "error with request to URL '" << mCapabilityURL << "' because " << pReason << " (statusCode:" << pStatus << ")" << llendl;
|
||||
mRebakeNavMeshCallback(false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -91,12 +91,11 @@ public:
|
|||
typedef boost::signals2::connection agent_state_slot_t;
|
||||
|
||||
agent_state_slot_t registerAgentStateListener(agent_state_callback_t pAgentStateCallback);
|
||||
|
||||
void handleNavMeshRebakeResult( const LLSD &pContent );
|
||||
void handleNavMeshRebakeError( U32 pStatus, const std::string &pReason, const std::string &pURL );
|
||||
void triggerNavMeshRebuild();
|
||||
void requestGetAgentState();
|
||||
|
||||
typedef boost::function<void (bool)> rebake_navmesh_callback_t;
|
||||
void requestRebakeNavMesh(rebake_navmesh_callback_t pRebakeNavMeshCallback);
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
|
|
@ -114,6 +113,7 @@ private:
|
|||
LLPathfindingNavMeshPtr getNavMeshForRegion(const LLUUID &pRegionUUID);
|
||||
LLPathfindingNavMeshPtr getNavMeshForRegion(LLViewerRegion *pRegion);
|
||||
|
||||
std::string getNavMeshStatusURLForCurrentRegion() const;
|
||||
std::string getNavMeshStatusURLForRegion(LLViewerRegion *pRegion) const;
|
||||
std::string getRetrieveNavMeshURLForRegion(LLViewerRegion *pRegion) const;
|
||||
std::string getObjectLinksetsURLForCurrentRegion() const;
|
||||
|
|
@ -124,10 +124,6 @@ private:
|
|||
std::string getCapabilityURLForRegion(LLViewerRegion *pRegion, const std::string &pCapabilityName) const;
|
||||
LLViewerRegion *getCurrentRegion() const;
|
||||
|
||||
#if 0
|
||||
void displayNavMeshRebakePanel();
|
||||
void hideNavMeshRebakePanel();
|
||||
#endif
|
||||
void handleAgentStateResult(const LLSD &pContent );
|
||||
void handleAgentStateError(U32 pStatus, const std::string &pReason, const std::string &pURL);
|
||||
|
||||
|
|
@ -135,5 +131,4 @@ private:
|
|||
agent_state_signal_t mAgentStateSignal;
|
||||
};
|
||||
|
||||
|
||||
#endif // LL_LLPATHFINDINGMANAGER_H
|
||||
|
|
|
|||
|
|
@ -1,32 +1,34 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
<panel
|
||||
height="25"
|
||||
layout="topleft"
|
||||
name="panel_navmesh_rebake"
|
||||
mouse_opaque="false"
|
||||
visible="true"
|
||||
width="133">
|
||||
<button
|
||||
follows="left|bottom"
|
||||
height="19"
|
||||
label="Rebake navmesh"
|
||||
layout="topleft"
|
||||
left="10"
|
||||
name="navmesh_btn"
|
||||
tool_tip="Click here to rebake."
|
||||
top="2"
|
||||
visible="false"
|
||||
width="113" />
|
||||
height="25"
|
||||
layout="topleft"
|
||||
name="panel_navmesh_rebake"
|
||||
mouse_opaque="false"
|
||||
visible="true"
|
||||
width="133">
|
||||
<button
|
||||
follows="left|bottom"
|
||||
height="19"
|
||||
label="Navmesh baking..."
|
||||
layout="topleft"
|
||||
left="10"
|
||||
name="navmesh_btn_baking"
|
||||
tool_tip="Navmesh is baking."
|
||||
top="2"
|
||||
visible="false"
|
||||
width="113" />
|
||||
follows="left|bottom"
|
||||
height="19"
|
||||
label="Clean up region"
|
||||
layout="topleft"
|
||||
left="10"
|
||||
name="navmesh_btn"
|
||||
tool_tip="Click here to rebake the region's navmesh."
|
||||
top="2"
|
||||
visible="false"
|
||||
enabled="true"
|
||||
width="113" />
|
||||
<button
|
||||
follows="left|bottom"
|
||||
height="19"
|
||||
label="Region is cleaning"
|
||||
layout="topleft"
|
||||
left="10"
|
||||
name="navmesh_btn_baking"
|
||||
tool_tip="Region is cleaning up."
|
||||
top="2"
|
||||
visible="false"
|
||||
enabled="false"
|
||||
width="113" />
|
||||
</panel>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue