diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llfloaterpathfindinglinksets.cpp | 372 | ||||
-rw-r--r-- | indra/newview/llfloaterpathfindinglinksets.h | 19 | ||||
-rw-r--r-- | indra/newview/llstartup.cpp | 10 | ||||
-rw-r--r-- | indra/newview/llviewerregion.cpp | 1 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml | 16 |
5 files changed, 240 insertions, 178 deletions
diff --git a/indra/newview/llfloaterpathfindinglinksets.cpp b/indra/newview/llfloaterpathfindinglinksets.cpp index efcb5a1c80..c16fd8fee6 100644 --- a/indra/newview/llfloaterpathfindinglinksets.cpp +++ b/indra/newview/llfloaterpathfindinglinksets.cpp @@ -27,16 +27,35 @@ #include "llviewerprecompiledheaders.h"
#include "llfloaterpathfindinglinksets.h"
-#include "message.h"
-#include "lluuid.h"
#include "llsd.h"
#include "llagent.h"
-#include "lluictrl.h"
#include "llfloater.h"
#include "llfloaterreg.h"
#include "llscrolllistctrl.h"
-#include "llavatarnamecache.h"
#include "llresmgr.h"
+#include "llviewerregion.h"
+#include "llhttpclient.h"
+#include "lltextbase.h"
+
+//---------------------------------------------------------------------------
+// NavmeshDataGetResponder
+//---------------------------------------------------------------------------
+ +class NavmeshDataGetResponder : public LLHTTPClient::Responder +{ +public: + NavmeshDataGetResponder(const std::string& pNavmeshDataGetURL, LLFloaterPathfindingLinksets *pLinksetsFloater); + virtual ~NavmeshDataGetResponder(); + + virtual void result(const LLSD& pContent); + virtual void error(U32 pStatus, const std::string& pReason); + +private: + NavmeshDataGetResponder(const NavmeshDataGetResponder& pOther); + + std::string mNavmeshDataGetURL; + LLFloaterPathfindingLinksets *mLinksetsFloater; +}; //---------------------------------------------------------------------------
// LLFloaterPathfindingLinksets
@@ -53,7 +72,7 @@ BOOL LLFloaterPathfindingLinksets::postBuild() mLinksetsScrollList->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onLinksetsSelectionChange, this));
mLinksetsScrollList->setCommitOnSelectionChange(true);
- mLinksetsStatus = findChild<LLUICtrl>("linksets_status");
+ mLinksetsStatus = findChild<LLTextBase>("linksets_status");
llassert(mLinksetsStatus != NULL);
updateLinksetsStatus();
@@ -63,16 +82,7 @@ BOOL LLFloaterPathfindingLinksets::postBuild() void LLFloaterPathfindingLinksets::onOpen(const LLSD& pKey)
{
- sendLandStatRequest();
-}
-
-void LLFloaterPathfindingLinksets::handleLandStatReply(LLMessageSystem* pMsg, void** pData)
-{
- LLFloaterPathfindingLinksets *instance = LLFloaterReg::findTypedInstance<LLFloaterPathfindingLinksets>("pathfinding_linksets");
- if (instance != NULL)
- {
- instance->handleLandStatReply(pMsg);
- }
+ sendNavmeshDataGetRequest();
}
void LLFloaterPathfindingLinksets::openLinksetsEditor()
@@ -83,127 +93,141 @@ void LLFloaterPathfindingLinksets::openLinksetsEditor() LLFloaterPathfindingLinksets::LLFloaterPathfindingLinksets(const LLSD& pSeed)
: LLFloater(pSeed),
mLinksetsScrollList(NULL),
- mLinksetsStatus(NULL)
+ mLinksetsStatus(NULL),
+ mNavmeshDataGetResponder(NULL)
{
}
LLFloaterPathfindingLinksets::~LLFloaterPathfindingLinksets()
{
+ clearNavmeshDataResponder();
}
-void LLFloaterPathfindingLinksets::sendLandStatRequest()
+void LLFloaterPathfindingLinksets::sendNavmeshDataGetRequest()
{
- clearLinksetsList();
- updateLinksetsStatusForFetch();
-
- U32 mode = 0;
- U32 flags = 0;
- std::string filter = "";
-
- LLMessageSystem *msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_LandStatRequest);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_RequestData);
- msg->addU32Fast(_PREHASH_ReportType, mode);
- msg->addU32Fast(_PREHASH_RequestFlags, flags);
- msg->addStringFast(_PREHASH_Filter, filter);
- msg->addS32Fast(_PREHASH_ParcelLocalID, 0);
-
- msg->sendReliable(gAgent.getRegionHost());
+ if (mNavmeshDataGetResponder != NULL)
+ {
+ updateLinksetsStatusForFetchInProgress();
+ }
+ else
+ {
+ clearLinksetsList();
+
+ LLViewerRegion* region = gAgent.getRegion(); + if (region != NULL) + { + std::string navmeshDataURL = region->getCapability("ObjectNavmesh"); + if (navmeshDataURL.empty()) + { + llinfos << "cannot query navmesh data from current region '" << region->getName() << "'" << llendl; + } + else + { + updateLinksetsStatusForFetch();
+ mNavmeshDataGetResponder = new NavmeshDataGetResponder(navmeshDataURL, this); + LLHTTPClient::get(navmeshDataURL, mNavmeshDataGetResponder); + } + } + } }
-void LLFloaterPathfindingLinksets::handleLandStatReply(LLMessageSystem *pMsg)
+void LLFloaterPathfindingLinksets::handleNavmeshDataGetReply(const LLSD& pNavmeshData)
{
- U32 request_flags;
- U32 total_count;
- U32 current_mode;
-
- pMsg->getU32Fast(_PREHASH_RequestData, _PREHASH_RequestFlags, request_flags);
- pMsg->getU32Fast(_PREHASH_RequestData, _PREHASH_TotalObjectCount, total_count);
- pMsg->getU32Fast(_PREHASH_RequestData, _PREHASH_ReportType, current_mode);
-
+ clearNavmeshDataResponder(); clearLinksetsList();
const LLVector3& avatarPosition = gAgent.getPositionAgent();
- S32 block_count = pMsg->getNumberOfBlocks("ReportData");
- for (S32 block = 0; block < block_count; ++block)
+ for (LLSD::map_const_iterator itemsIter = pNavmeshData.beginMap();
+ itemsIter != pNavmeshData.endMap(); ++itemsIter)
{
- U32 task_local_id;
- U32 time_stamp = 0;
- LLUUID task_id;
- F32 location_x, location_y, location_z;
- F32 score;
- std::string name_buf;
- std::string owner_buf;
- F32 mono_score = 0.f;
- bool have_extended_data = false;
- S32 public_urls = 0;
-
- pMsg->getU32Fast(_PREHASH_ReportData, _PREHASH_TaskLocalID, task_local_id, block);
- pMsg->getUUIDFast(_PREHASH_ReportData, _PREHASH_TaskID, task_id, block);
- pMsg->getF32Fast(_PREHASH_ReportData, _PREHASH_LocationX, location_x, block);
- pMsg->getF32Fast(_PREHASH_ReportData, _PREHASH_LocationY, location_y, block);
- pMsg->getF32Fast(_PREHASH_ReportData, _PREHASH_LocationZ, location_z, block);
- pMsg->getF32Fast(_PREHASH_ReportData, _PREHASH_Score, score, block);
- pMsg->getStringFast(_PREHASH_ReportData, _PREHASH_TaskName, name_buf, block);
- pMsg->getStringFast(_PREHASH_ReportData, _PREHASH_OwnerName, owner_buf, block);
- if(pMsg->has("DataExtended"))
- {
- have_extended_data = true;
- pMsg->getU32("DataExtended", "TimeStamp", time_stamp, block);
- pMsg->getF32("DataExtended", "MonoScore", mono_score, block);
- pMsg->getS32("DataExtended", "PublicURLs", public_urls, block);
- }
-
- LLSD element;
-
- element["id"] = task_id;
+ const std::string& uuid = itemsIter->first;
+ const LLSD& itemData = itemsIter->second;
+
+ const LLSD::String& itemName = itemData.get("name").asString();
+ const LLSD::String& itemDescription = itemData.get("description").asString();
+ LLSD::Integer itemLandImpact = itemData.get("landimpact").asInteger();
+ LLSD::Boolean isItemFixed = itemData.get("fixed").asBoolean();
+ LLSD::Boolean isItemWalkable = true; // XXX stinson: walkable data not coming from service yet
+ LLSD::Boolean isItemPhantom = itemData.get("phantom").asBoolean();
+ LLSD::Real itemA = itemData.get("A").asReal();
+ LLSD::Real itemB = itemData.get("B").asReal();
+ LLSD::Real itemC = itemData.get("C").asReal();
+ LLSD::Real itemD = itemData.get("D").asReal();
+
+ F32 location_x = 50.0f, location_y = 50.0f, location_z = 50.0f; // XXX stinson: use real location later
+ LLVector3 itemLocation(location_x, location_y, location_z);
+ F32 itemDistance = dist_vec(avatarPosition, itemLocation);
LLSD columns;
columns[0]["column"] = "name";
- columns[0]["value"] = name_buf;
+ columns[0]["value"] = itemName;
columns[0]["font"] = "SANSSERIF";
- // Owner names can have trailing spaces sent from server
- LLStringUtil::trim(owner_buf);
-
- if (LLAvatarNameCache::useDisplayNames())
- {
- // ...convert hard-coded name from server to a username
- // *TODO: Send owner_id from server and look up display name
- owner_buf = LLCacheName::buildUsername(owner_buf);
- }
- else
- {
- // ...just strip out legacy "Resident" name
- owner_buf = LLCacheName::cleanFullName(owner_buf);
- }
columns[1]["column"] = "description";
- columns[1]["value"] = owner_buf;
+ columns[1]["value"] = itemDescription;
columns[1]["font"] = "SANSSERIF";
columns[2]["column"] = "land_impact";
- columns[2]["value"] = llformat("%0.1f", 55.679);
+ columns[2]["value"] = llformat("%1d m", itemLandImpact);
columns[2]["font"] = "SANSSERIF";
- LLVector3 location(location_x, location_y, location_z);
- F32 distance = dist_vec(avatarPosition, location);
-
columns[3]["column"] = "dist_from_you";
- columns[3]["value"] = llformat("%1.0f m", distance);
+ columns[3]["value"] = llformat("%1.0f m", itemDistance);
columns[3]["font"] = "SANSSERIF";
- element["columns"] = columns;
+ columns[4]["column"] = "is_fixed";
+ columns[4]["value"] = getString(isItemFixed ? "linkset_is_fixed" : "linkset_is_not_fixed");
+ columns[4]["font"] = "SANSSERIF";
+
+ columns[5]["column"] = "is_walkable";
+ columns[5]["value"] = getString(isItemWalkable ? "linkset_is_walkable" : "linkset_is_not_walkable");
+ columns[5]["font"] = "SANSSERIF";
+
+ columns[6]["column"] = "is_phantom";
+ columns[6]["value"] = getString(isItemPhantom ? "linkset_is_phantom" : "linkset_is_not_phantom");
+ columns[6]["font"] = "SANSSERIF";
+
+ columns[7]["column"] = "a_percent";
+ columns[7]["value"] = llformat("%2.0f", itemA);
+ columns[7]["font"] = "SANSSERIF";
+
+ columns[8]["column"] = "b_percent";
+ columns[8]["value"] = llformat("%2.0f", itemB);
+ columns[8]["font"] = "SANSSERIF";
+
+ columns[9]["column"] = "c_percent";
+ columns[9]["value"] = llformat("%2.0f", itemC);
+ columns[9]["font"] = "SANSSERIF";
+
+ columns[10]["column"] = "d_percent";
+ columns[10]["value"] = llformat("%2.0f", itemD);
+ columns[10]["font"] = "SANSSERIF";
+
+ LLSD element;
+ element["id"] = uuid;
+ element["column"] = columns;
+
mLinksetsScrollList->addElement(element);
}
- updateLinksetsStatus(); + updateLinksetsStatus();
}
+void LLFloaterPathfindingLinksets::handleNavmeshDataGetError(const std::string& pURL, const std::string& pErrorReason) +{ + clearNavmeshDataResponder(); + clearLinksetsList();
+ updateLinksetsStatusForFetchError(); + llwarns << "Error fetching navmesh data from URL '" << pURL << "' because " << pErrorReason << llendl; +} + +void LLFloaterPathfindingLinksets::clearNavmeshDataResponder() +{ + mNavmeshDataGetResponder = NULL;
+} +
void LLFloaterPathfindingLinksets::onLinksetsSelectionChange()
{
updateLinksetsStatus();
@@ -211,65 +235,99 @@ void LLFloaterPathfindingLinksets::onLinksetsSelectionChange() void LLFloaterPathfindingLinksets::onRefreshLinksetsClicked()
{
- sendLandStatRequest();
+ sendNavmeshDataGetRequest();
}
-void LLFloaterPathfindingLinksets::onSelectAllLinksetsClicked() -{ - selectAllLinksets(); -} - -void LLFloaterPathfindingLinksets::onSelectNoneLinksetsClicked() -{ - selectNoneLinksets(); -} - -void LLFloaterPathfindingLinksets::clearLinksetsList() -{ +void LLFloaterPathfindingLinksets::onSelectAllLinksetsClicked()
+{
+ selectAllLinksets();
+}
+
+void LLFloaterPathfindingLinksets::onSelectNoneLinksetsClicked()
+{
+ selectNoneLinksets();
+}
+
+void LLFloaterPathfindingLinksets::clearLinksetsList()
+{
mLinksetsScrollList->deleteAllItems();
- updateLinksetsStatus(); + updateLinksetsStatus();
}
-void LLFloaterPathfindingLinksets::selectAllLinksets() -{ - mLinksetsScrollList->selectAll(); -} - -void LLFloaterPathfindingLinksets::selectNoneLinksets() -{ - mLinksetsScrollList->deselectAllItems(); -} - -void LLFloaterPathfindingLinksets::updateLinksetsStatus() -{ - std::string statusText(""); - - if (mLinksetsScrollList->isEmpty()) - { - statusText = getString("linksets_none_found"); - } - else - { - S32 numItems = mLinksetsScrollList->getItemCount(); - S32 numSelectedItems = mLinksetsScrollList->getNumSelected(); - - LLLocale locale(LLStringUtil::getLocale()); - std::string numItemsString; - LLResMgr::getInstance()->getIntegerString(numItemsString, numItems); - - std::string numSelectedItemsString; - LLResMgr::getInstance()->getIntegerString(numSelectedItemsString, numSelectedItems); - - LLStringUtil::format_map_t string_args; - string_args["[NUM_SELECTED]"] = numSelectedItemsString; - string_args["[NUM_TOTAL]"] = numItemsString; - statusText = getString("linksets_available", string_args); - } - - mLinksetsStatus->setValue(statusText); -} - -void LLFloaterPathfindingLinksets::updateLinksetsStatusForFetch() -{ - mLinksetsStatus->setValue(getString("linksets_fetching")); -} +void LLFloaterPathfindingLinksets::selectAllLinksets()
+{
+ mLinksetsScrollList->selectAll();
+}
+
+void LLFloaterPathfindingLinksets::selectNoneLinksets()
+{
+ mLinksetsScrollList->deselectAllItems();
+}
+
+void LLFloaterPathfindingLinksets::updateLinksetsStatus()
+{
+ std::string statusText("");
+
+ if (mLinksetsScrollList->isEmpty())
+ {
+ statusText = getString("linksets_none_found");
+ }
+ else
+ {
+ S32 numItems = mLinksetsScrollList->getItemCount();
+ S32 numSelectedItems = mLinksetsScrollList->getNumSelected();
+
+ LLLocale locale(LLStringUtil::getLocale());
+ std::string numItemsString;
+ LLResMgr::getInstance()->getIntegerString(numItemsString, numItems);
+
+ std::string numSelectedItemsString;
+ LLResMgr::getInstance()->getIntegerString(numSelectedItemsString, numSelectedItems);
+
+ LLStringUtil::format_map_t string_args;
+ string_args["[NUM_SELECTED]"] = numSelectedItemsString;
+ string_args["[NUM_TOTAL]"] = numItemsString;
+ statusText = getString("linksets_available", string_args);
+ }
+
+ mLinksetsStatus->setText((LLStringExplicit)statusText);
+}
+
+void LLFloaterPathfindingLinksets::updateLinksetsStatusForFetch()
+{
+ mLinksetsStatus->setText((LLStringExplicit)getString("linksets_fetching"));
+}
+
+void LLFloaterPathfindingLinksets::updateLinksetsStatusForFetchInProgress()
+{
+ mLinksetsStatus->setText((LLStringExplicit)getString("linksets_fetching_inprogress"));
+}
+
+void LLFloaterPathfindingLinksets::updateLinksetsStatusForFetchError()
+{
+ LLColor4 warningColor = LLUIColorTable::instance().getColor("DrYellow");
+ LLStyle::Params styleParams;
+ styleParams.color = warningColor;
+ mLinksetsStatus->setText((LLStringExplicit)getString("linksets_fetching_error"), styleParams);
+}
+
+NavmeshDataGetResponder::NavmeshDataGetResponder(const std::string& pNavmeshDataGetURL, LLFloaterPathfindingLinksets *pLinksetsFloater) + : mNavmeshDataGetURL(pNavmeshDataGetURL),
+ mLinksetsFloater(pLinksetsFloater)
+{
+}
+
+NavmeshDataGetResponder::~NavmeshDataGetResponder()
+{
+ mLinksetsFloater = NULL;
+}
+
+void NavmeshDataGetResponder::result(const LLSD& pContent)
+{
+ mLinksetsFloater->handleNavmeshDataGetReply(pContent);
+}
+
+void NavmeshDataGetResponder::error(U32 status, const std::string& reason)
+{
+ mLinksetsFloater->handleNavmeshDataGetError(mNavmeshDataGetURL, reason);
+}
diff --git a/indra/newview/llfloaterpathfindinglinksets.h b/indra/newview/llfloaterpathfindinglinksets.h index 4bde806e4d..395994d37e 100644 --- a/indra/newview/llfloaterpathfindinglinksets.h +++ b/indra/newview/llfloaterpathfindinglinksets.h @@ -31,35 +31,38 @@ #include "llfloater.h" class LLSD; -class LLUICtrl; -class LLMessageSystem; +class LLTextBase; class LLScrollListCtrl; +class NavmeshDataGetResponder; class LLFloaterPathfindingLinksets : public LLFloater { friend class LLFloaterReg; + friend class NavmeshDataGetResponder; public: virtual BOOL postBuild(); virtual void onOpen(const LLSD& pKey); static void openLinksetsEditor(); - static void handleLandStatReply(LLMessageSystem *pMsg, void **pData); protected: private: - LLScrollListCtrl *mLinksetsScrollList; - LLUICtrl *mLinksetsStatus; + LLScrollListCtrl *mLinksetsScrollList; + LLTextBase *mLinksetsStatus; + NavmeshDataGetResponder *mNavmeshDataGetResponder; // Does its own instance management, so clients not allowed // to allocate or destroy. LLFloaterPathfindingLinksets(const LLSD& pSeed); virtual ~LLFloaterPathfindingLinksets(); - void sendLandStatRequest(); - void handleLandStatReply(LLMessageSystem *pMsg); + void sendNavmeshDataGetRequest(); + void handleNavmeshDataGetReply(const LLSD& pNavmeshData); + void handleNavmeshDataGetError(const std::string& pURL, const std::string& pErrorReason); + void clearNavmeshDataResponder(); void onLinksetsSelectionChange(); void onRefreshLinksetsClicked(); @@ -72,6 +75,8 @@ private: void updateLinksetsStatus(); void updateLinksetsStatusForFetch(); + void updateLinksetsStatusForFetchInProgress(); + void updateLinksetsStatusForFetchError(); }; #endif // LL_LLFLOATERPATHFINDINGLINKSETS_H diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index ef599a7144..7e02a41e7e 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -186,12 +186,6 @@ #include "llappearancemgr.h" #include "llavatariconctrl.h" #include "llvoicechannel.h" -// Uncomment the following define to enable hijaking of the LandStatReply message to test the pathfinding linkset floater. -// For development purposes only until the pathfinding linksets service is built on the server-side. -//#define XXX_STINSON_PATHFINDING_HIJAK_XXX -#ifdef XXX_STINSON_PATHFINDING_HIJAK_XXX -#include "llfloaterpathfindinglinksets.h" -#endif // XXX_STINSON_PATHFINDING_HIJAK_XXX #include "lllogin.h" #include "llevents.h" @@ -2486,11 +2480,7 @@ void register_viewer_callbacks(LLMessageSystem* msg) msg->setHandlerFunc("ParcelObjectOwnersReply", LLPanelLandObjects::processParcelObjectOwnersReply); msg->setHandlerFunc("InitiateDownload", process_initiate_download); -#ifdef XXX_STINSON_PATHFINDING_HIJAK_XXX - msg->setHandlerFunc("LandStatReply", LLFloaterPathfindingLinksets::handleLandStatReply); // XXX stinson -#else // XXX_STINSON_PATHFINDING_HIJAK_XXX msg->setHandlerFunc("LandStatReply", LLFloaterTopObjects::handle_land_reply); -#endif // XXX_STINSON_PATHFINDING_HIJAK_XXX msg->setHandlerFunc("GenericMessage", process_generic_message); msg->setHandlerFuncFast(_PREHASH_FeatureDisabled, process_feature_disabled_message); diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index d294a4bb47..18d23af971 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1522,6 +1522,7 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) capabilityNames.append("MeshUploadFlag"); capabilityNames.append("NavMeshUpload"); capabilityNames.append("NewFileAgentInventory"); + capabilityNames.append("ObjectNavmesh"); capabilityNames.append("ParcelPropertiesUpdate"); capabilityNames.append("ParcelMediaURLFilterList"); capabilityNames.append("ParcelNavigateMedia"); diff --git a/indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml b/indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml index 587b62377b..06f5d92742 100644 --- a/indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml +++ b/indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml @@ -11,9 +11,17 @@ single_instance="true" title="Pathfinding linksets" width="950"> - <floater.string name="linksets_fetching">Finking pathfinding linksets ...</floater.string> + <floater.string name="linksets_fetching">Querying for pathfinding linksets ...</floater.string> + <floater.string name="linksets_fetching_inprogress">Querying for pathfinding linksets (already in progress) ...</floater.string> + <floater.string name="linksets_fetching_error">Error detected while querying for pathfinding linksets</floater.string> <floater.string name="linksets_none_found">No pathfinding linksets</floater.string> <floater.string name="linksets_available">[NUM_SELECTED] linksets selected out of [NUM_TOTAL]</floater.string> + <floater.string name="linkset_is_fixed">Fixed</floater.string> + <floater.string name="linkset_is_not_fixed">Not fixed</floater.string> + <floater.string name="linkset_is_walkable">Walkable</floater.string> + <floater.string name="linkset_is_not_walkable">--</floater.string> + <floater.string name="linkset_is_phantom">Phantom</floater.string> + <floater.string name="linkset_is_not_phantom">--</floater.string> <text height="13" word_wrap="false" @@ -141,15 +149,15 @@ width="87" /> <scroll_list.columns label="Fixed" - name="fixed" + name="is_fixed" width="63" /> <scroll_list.columns label="Walkable" - name="walkable" + name="is_walkable" width="73" /> <scroll_list.columns label="Phantom" - name="phantom" + name="is_phantom" width="74" /> <scroll_list.columns label="A %" |