diff options
| -rw-r--r-- | autobuild.xml | 4 | ||||
| -rw-r--r-- | indra/llui/llscrolllistctrl.cpp | 16 | ||||
| -rw-r--r-- | indra/llui/llscrolllistctrl.h | 1 | ||||
| -rw-r--r-- | indra/newview/llfloaterpathfindinglinksets.cpp | 308 | ||||
| -rw-r--r-- | indra/newview/llfloaterpathfindinglinksets.h | 32 | ||||
| -rw-r--r-- | indra/newview/llstartup.cpp | 10 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml | 110 | 
7 files changed, 375 insertions, 106 deletions
| diff --git a/autobuild.xml b/autobuild.xml index fe1f3f972b..d2c22a55cc 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -1822,9 +1822,9 @@              <key>archive</key>              <map>                <key>hash</key> -              <string>935da383b9f98c34c36f9dcbceb1283e</string> +              <string>27710304cfeea6f172eb89b61f51a5c4</string>                <key>url</key> -              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/stinson_llpathinglibrary/rev/247173/arch/CYGWIN/installer/llpathinglibrary-0.1-windows-20120104.tar.bz2</string> +              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/stinson_llpathinglibrary/rev/247206/arch/CYGWIN/installer/llpathinglibrary-0.1-windows-20120104.tar.bz2</string>              </map>              <key>name</key>              <string>windows</string> diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 466fac33ea..f7017064d7 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -389,6 +389,22 @@ std::vector<LLScrollListItem*> LLScrollListCtrl::getAllSelected() const  	return ret;  } +S32 LLScrollListCtrl::getNumSelected() const +{ +	S32 numSelected = 0; + +	for(item_list::const_iterator iter = mItemList.begin(); iter != mItemList.end(); ++iter) +	{ +		LLScrollListItem* item  = *iter; +		if (item->getSelected()) +		{ +			++numSelected; +		} +	} + +	return numSelected; +} +  S32 LLScrollListCtrl::getFirstSelectedIndex() const  {  	S32 CurSelectedIndex = 0; diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index ae8aea9245..44d9635838 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -257,6 +257,7 @@ public:  	LLScrollListItem*	getFirstSelected() const;  	virtual S32			getFirstSelectedIndex() const;  	std::vector<LLScrollListItem*> getAllSelected() const; +	S32                 getNumSelected() const;  	LLScrollListItem*	getLastSelectedItem() const { return mLastSelected; }  	// iterate over all items diff --git a/indra/newview/llfloaterpathfindinglinksets.cpp b/indra/newview/llfloaterpathfindinglinksets.cpp index 4f98834dde..efcb5a1c80 100644 --- a/indra/newview/llfloaterpathfindinglinksets.cpp +++ b/indra/newview/llfloaterpathfindinglinksets.cpp @@ -1,55 +1,275 @@ -/**  - * @file llfloaterpathfindinglinksets.cpp - * @author William Todd Stinson - * @brief "Pathfinding linksets" floater, allowing manipulation of the Havok AI pathfinding settings. - * - * $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 "llfloaterpathfindinglinksets.h" -#include "llsd.h" -#include "llfloater.h" -#include "llfloaterreg.h" - -//--------------------------------------------------------------------------- -// LLFloaterPathfindingLinksets -//--------------------------------------------------------------------------- - -BOOL LLFloaterPathfindingLinksets::postBuild() +/** 
 + * @file llfloaterpathfindinglinksets.cpp
 + * @author William Todd Stinson
 + * @brief "Pathfinding linksets" floater, allowing manipulation of the Havok AI pathfinding settings.
 + *
 + * $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 "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"
 +
 +//---------------------------------------------------------------------------
 +// LLFloaterPathfindingLinksets
 +//---------------------------------------------------------------------------
 +
 +BOOL LLFloaterPathfindingLinksets::postBuild()
 +{
 +	childSetAction("refresh_linksets_list", boost::bind(&LLFloaterPathfindingLinksets::onRefreshLinksetsClicked, this));
 +	childSetAction("select_all_linksets", boost::bind(&LLFloaterPathfindingLinksets::onSelectAllLinksetsClicked, this));
 +	childSetAction("select_none_linksets", boost::bind(&LLFloaterPathfindingLinksets::onSelectNoneLinksetsClicked, this));
 +
 +	mLinksetsScrollList = findChild<LLScrollListCtrl>("pathfinding_linksets");
 +	llassert(mLinksetsScrollList != NULL);
 +	mLinksetsScrollList->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onLinksetsSelectionChange, this));
 +	mLinksetsScrollList->setCommitOnSelectionChange(true);
 +
 +	mLinksetsStatus = findChild<LLUICtrl>("linksets_status");
 +	llassert(mLinksetsStatus != NULL);
 +
 +	updateLinksetsStatus();
 +
 +	return LLFloater::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);
 +	}
 +}
 +
 +void LLFloaterPathfindingLinksets::openLinksetsEditor()
 +{
 +	LLFloaterReg::toggleInstanceOrBringToFront("pathfinding_linksets");
 +}
 +
 +LLFloaterPathfindingLinksets::LLFloaterPathfindingLinksets(const LLSD& pSeed)
 +	: LLFloater(pSeed),
 +	mLinksetsScrollList(NULL),
 +	mLinksetsStatus(NULL)
 +{
 +}
 +
 +LLFloaterPathfindingLinksets::~LLFloaterPathfindingLinksets()
 +{
 +}
 +
 +void LLFloaterPathfindingLinksets::sendLandStatRequest()
 +{
 +	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());
 +}
 +
 +void LLFloaterPathfindingLinksets::handleLandStatReply(LLMessageSystem *pMsg)
 +{
 +	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);
 +
 +	clearLinksetsList();
 +
 +	const LLVector3& avatarPosition = gAgent.getPositionAgent();
 +
 +	S32 block_count = pMsg->getNumberOfBlocks("ReportData");
 +	for (S32 block = 0; block < block_count; ++block)
 +	{
 +		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;
 +
 +		LLSD columns;
 +
 +		columns[0]["column"] = "name";
 +		columns[0]["value"] = name_buf;
 +		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]["font"] = "SANSSERIF";
 +
 +		columns[2]["column"] = "land_impact";
 +		columns[2]["value"] = llformat("%0.1f", 55.679);
 +		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]["font"] = "SANSSERIF";
 +
 +		element["columns"] = columns;
 +		mLinksetsScrollList->addElement(element);
 +	}
 +
 +	updateLinksetsStatus(); +}
 +
 +void LLFloaterPathfindingLinksets::onLinksetsSelectionChange()
 +{
 +	updateLinksetsStatus();
 +}
 +
 +void LLFloaterPathfindingLinksets::onRefreshLinksetsClicked()
 +{
 +	sendLandStatRequest();
 +}
 +
 +void LLFloaterPathfindingLinksets::onSelectAllLinksetsClicked()  { -	return LLFloater::postBuild(); +	selectAllLinksets();  } -void LLFloaterPathfindingLinksets::openLinksetsEditor() +void LLFloaterPathfindingLinksets::onSelectNoneLinksetsClicked()  { -	LLFloaterReg::toggleInstanceOrBringToFront("pathfinding_linksets"); +	selectNoneLinksets();  } -LLFloaterPathfindingLinksets::LLFloaterPathfindingLinksets(const LLSD& seed) -	: LLFloater(seed) +void LLFloaterPathfindingLinksets::clearLinksetsList()  { +	mLinksetsScrollList->deleteAllItems();
 +	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);  } -LLFloaterPathfindingLinksets::~LLFloaterPathfindingLinksets() +void LLFloaterPathfindingLinksets::updateLinksetsStatusForFetch()  { +	mLinksetsStatus->setValue(getString("linksets_fetching"));  } diff --git a/indra/newview/llfloaterpathfindinglinksets.h b/indra/newview/llfloaterpathfindinglinksets.h index de32951462..4bde806e4d 100644 --- a/indra/newview/llfloaterpathfindinglinksets.h +++ b/indra/newview/llfloaterpathfindinglinksets.h @@ -31,6 +31,9 @@  #include "llfloater.h"  class LLSD; +class LLUICtrl; +class LLMessageSystem; +class LLScrollListCtrl;  class LLFloaterPathfindingLinksets  :	public LLFloater @@ -39,23 +42,36 @@ class LLFloaterPathfindingLinksets  public:  	virtual BOOL postBuild(); +	virtual void onOpen(const LLSD& pKey);  	static void openLinksetsEditor(); - -	struct Params : public LLInitParam::Block<Params, LLFloater::Params> -	{ -		Params(); -	}; +	static void handleLandStatReply(LLMessageSystem *pMsg, void **pData);  protected:  private: +	LLScrollListCtrl *mLinksetsScrollList; +	LLUICtrl         *mLinksetsStatus; +  	// Does its own instance management, so clients not allowed  	// to allocate or destroy. -	LLFloaterPathfindingLinksets(const LLSD& seed); +	LLFloaterPathfindingLinksets(const LLSD& pSeed);  	virtual ~LLFloaterPathfindingLinksets(); -		 -	void onVisibilityChange(const LLSD& visible); + +	void sendLandStatRequest(); +	void handleLandStatReply(LLMessageSystem *pMsg); + +	void onLinksetsSelectionChange(); +	void onRefreshLinksetsClicked(); +	void onSelectAllLinksetsClicked(); +	void onSelectNoneLinksetsClicked(); + +	void clearLinksetsList(); +	void selectAllLinksets(); +	void selectNoneLinksets(); + +	void updateLinksetsStatus(); +	void updateLinksetsStatusForFetch();  };  #endif // LL_LLFLOATERPATHFINDINGLINKSETS_H diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 36d6ff3ef2..2e4b8cd2c5 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -186,6 +186,12 @@  #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" @@ -2480,7 +2486,11 @@ 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/skins/default/xui/en/floater_pathfinding_linksets.xml b/indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml index f8da37fe6f..587b62377b 100644 --- a/indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml +++ b/indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml @@ -6,9 +6,14 @@      layout="topleft"      name="floater_pathfinding_linksets"      help_topic="floater_pathfinding_linksets" +    reuse_instance="true"      save_rect="true" +    single_instance="true"      title="Pathfinding linksets"      width="950"> +  <floater.string name="linksets_fetching">Finking 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>    <text        height="13"        word_wrap="false" @@ -107,7 +112,7 @@        top="11"        left="851"        width="73"/> -  <name_list +  <scroll_list        column_padding="0"        draw_heading="true"        follows="all" @@ -115,54 +120,54 @@        layout="topleft"        left="18"        top="48" -      name="owner list" -      name_column="name" +      multi_select="true" +      name="pathfinding_linksets"        width="910"> -    <name_list.columns -	label="Name (root prim)" -	name="name" -	width="152" /> -    <name_list.columns -	label="Description (root prim)" -	name="description" -	width="191" /> -    <name_list.columns -	label="Land impact" -	name="land_impact" -	width="85" /> -    <name_list.columns -	label="Dist from you" -	name="dist_from_you" -	width="87" /> -    <name_list.columns -	label="Fixed" -	name="fixed" -	width="63" /> -    <name_list.columns -	label="Walkable" -	name="walkable" -	width="73" /> -    <name_list.columns -	label="Phantom" -	name="phantom" -	width="74" /> -    <name_list.columns -	label="A %" -	name="a_percent" -	width="41" /> -    <name_list.columns -	label="B %" -	name="b_percent" -	width="41" /> -    <name_list.columns -	label="C %" -	name="c_percent" -	width="41" /> -    <name_list.columns -	label="D %" -	name="d_percent" -	width="41" /> -  </name_list> +    <scroll_list.columns +        label="Name (root prim)" +        name="name" +        width="152" /> +    <scroll_list.columns +        label="Description (root prim)" +        name="description" +        width="191" /> +    <scroll_list.columns +        label="Land impact" +        name="land_impact" +        width="85" /> +    <scroll_list.columns +        label="Dist from you" +        name="dist_from_you" +        width="87" /> +    <scroll_list.columns +        label="Fixed" +        name="fixed" +        width="63" /> +    <scroll_list.columns +        label="Walkable" +        name="walkable" +        width="73" /> +    <scroll_list.columns +        label="Phantom" +        name="phantom" +        width="74" /> +    <scroll_list.columns +        label="A %" +        name="a_percent" +        width="41" /> +    <scroll_list.columns +        label="B %" +        name="b_percent" +        width="41" /> +    <scroll_list.columns +        label="C %" +        name="c_percent" +        width="41" /> +    <scroll_list.columns +        label="D %" +        name="d_percent" +        width="41" /> +  </scroll_list>    <text        height="13"        word_wrap="false" @@ -172,16 +177,17 @@        length="1"        follows="left|top"        layout="topleft" +      name="linksets_status"        top="200"        width="500"> -    0 linsets selected out of 2 +    Linksets:    </text>    <button        follows="right|top"        height="21"        label="Refresh list"        layout="topleft" -      name="linksets" +      name="refresh_linksets_list"        top="200"        left="568"        width="115"/> @@ -190,7 +196,7 @@        height="21"        label="Select all"        layout="topleft" -      name="linksets" +      name="select_all_linksets"        top="200"        left="690"        width="115"/> @@ -199,7 +205,7 @@        height="21"        label="Select none"        layout="topleft" -      name="linksets" +      name="select_none_linksets"        top="200"        left="812"        width="115"/> | 
