From e64ec7e60c9f24cc3dff21f4215624a86670b8d6 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 7 Feb 2012 17:09:44 -0800 Subject: PATH-245: Integrating with the working sim-side cap service. --- indra/newview/llfloaterpathfindingcharacters.cpp | 38 ++++++++++++++++++++++-- indra/newview/llfloaterpathfindingcharacters.h | 2 ++ indra/newview/llpathfindingcharacter.cpp | 16 ++++++---- indra/newview/llpathfindingcharacter.h | 17 ++++++----- 4 files changed, 59 insertions(+), 14 deletions(-) diff --git a/indra/newview/llfloaterpathfindingcharacters.cpp b/indra/newview/llfloaterpathfindingcharacters.cpp index 86b7e86f9e..fe65ee3159 100644 --- a/indra/newview/llfloaterpathfindingcharacters.cpp +++ b/indra/newview/llfloaterpathfindingcharacters.cpp @@ -43,6 +43,9 @@ #include "llviewerregion.h" #include "llhttpclient.h" #include "lluuid.h" +#include "llviewerobject.h" +#include "llviewerobjectlist.h" +#include "llselectmgr.h" //--------------------------------------------------------------------------- // CharactersGetResponder @@ -159,7 +162,8 @@ LLFloaterPathfindingCharacters::LLFloaterPathfindingCharacters(const LLSD& pSeed mTakeCopyBtn(NULL), mReturnBtn(NULL), mDeleteBtn(NULL), - mTeleportBtn(NULL) + mTeleportBtn(NULL), + mSelection() { mSelfHandle.bind(this); } @@ -167,6 +171,7 @@ LLFloaterPathfindingCharacters::LLFloaterPathfindingCharacters(const LLSD& pSeed LLFloaterPathfindingCharacters::~LLFloaterPathfindingCharacters() { mPathfindingCharacters.clear(); + mSelection.clear(); } void LLFloaterPathfindingCharacters::sendCharactersDataGetRequest() @@ -263,6 +268,35 @@ void LLFloaterPathfindingCharacters::setMessagingState(EMessagingState pMessagin void LLFloaterPathfindingCharacters::onCharactersSelectionChange() { + std::vector selectedItems = mCharactersScrollList->getAllSelected(); + + LLSelectMgr::getInstance()->deselectAll(); + if (!selectedItems.empty()) + { + int numSelectedItems = selectedItems.size(); + + std::vector viewerObjects; + viewerObjects.reserve(numSelectedItems); + + for (std::vector::const_iterator selectedItemIter = selectedItems.begin(); + selectedItemIter != selectedItems.end(); ++selectedItemIter) + { + const LLScrollListItem *selectedItem = *selectedItemIter; + + LLViewerObject *viewerObject = gObjectList.findObject(selectedItem->getUUID()); + if (viewerObject != NULL) + { + viewerObject->setSelected(true); + viewerObjects.push_back(viewerObject); + } + } + + if (!viewerObjects.empty()) + { + mSelection = LLSelectMgr::getInstance()->selectObjectAndFamily(viewerObjects); + } + } + updateCharactersStatusMessage(); updateActionFields(); } @@ -347,7 +381,7 @@ void LLFloaterPathfindingCharacters::updateCharactersList() columns[1]["font"] = "SANSSERIF"; columns[2]["column"] = "owner"; - columns[2]["value"] = character.getOwner(); + columns[2]["value"] = character.getOwnerName(); columns[2]["font"] = "SANSSERIF"; columns[3]["column"] = "cpu_time"; diff --git a/indra/newview/llfloaterpathfindingcharacters.h b/indra/newview/llfloaterpathfindingcharacters.h index ae3a34f459..689d2ff418 100644 --- a/indra/newview/llfloaterpathfindingcharacters.h +++ b/indra/newview/llfloaterpathfindingcharacters.h @@ -34,6 +34,7 @@ #include "llhandle.h" #include "llfloater.h" #include "llpathfindingcharacter.h" +#include "llselectmgr.h" class LLSD; class LLTextBase; @@ -84,6 +85,7 @@ private: LLButton *mReturnBtn; LLButton *mDeleteBtn; LLButton *mTeleportBtn; + LLObjectSelectionHandle mSelection; // Does its own instance management, so clients not allowed // to allocate or destroy. diff --git a/indra/newview/llpathfindingcharacter.cpp b/indra/newview/llpathfindingcharacter.cpp index 99e23c546f..e603356889 100644 --- a/indra/newview/llpathfindingcharacter.cpp +++ b/indra/newview/llpathfindingcharacter.cpp @@ -30,6 +30,8 @@ #include "llsd.h" #include "v3math.h" #include "lluuid.h" +#include "llavatarname.h" +#include "llavatarnamecache.h" #define CHARACTER_NAME_FIELD "name" #define CHARACTER_DESCRIPTION_FIELD "description" @@ -45,7 +47,8 @@ LLPathfindingCharacter::LLPathfindingCharacter(const std::string &pUUID, const L : mUUID(pUUID), mName(), mDescription(), - mOwner(), + mOwnerUUID(), + mOwnerName(), mCPUTime(0U), mLocation() { @@ -58,8 +61,9 @@ LLPathfindingCharacter::LLPathfindingCharacter(const std::string &pUUID, const L mDescription = pCharacterItem.get(CHARACTER_DESCRIPTION_FIELD).asString(); llassert(pCharacterItem.has(CHARACTER_OWNER_FIELD)); - llassert(pCharacterItem.get(CHARACTER_OWNER_FIELD).isString()); - mOwner = pCharacterItem.get(CHARACTER_OWNER_FIELD).asString(); + llassert(pCharacterItem.get(CHARACTER_OWNER_FIELD).isUUID()); + mOwnerUUID = pCharacterItem.get(CHARACTER_OWNER_FIELD).asUUID(); + LLAvatarNameCache::get(mOwnerUUID, &mOwnerName); llassert(pCharacterItem.has(CHARACTER_CPU_TIME_FIELD)); llassert(pCharacterItem.get(CHARACTER_CPU_TIME_FIELD).isInteger()); @@ -75,7 +79,8 @@ LLPathfindingCharacter::LLPathfindingCharacter(const LLPathfindingCharacter& pOt : mUUID(pOther.mUUID), mName(pOther.mName), mDescription(pOther.mDescription), - mOwner(pOther.mOwner), + mOwnerUUID(pOther.mOwnerUUID), + mOwnerName(pOther.mOwnerName), mCPUTime(pOther.mCPUTime), mLocation(pOther.mLocation) { @@ -90,7 +95,8 @@ LLPathfindingCharacter& LLPathfindingCharacter::operator =(const LLPathfindingCh mUUID = pOther.mUUID; mName = pOther.mName; mDescription = pOther.mDescription; - mOwner = pOther.mOwner; + mOwnerUUID = pOther.mOwnerUUID; + mOwnerName = pOther.mOwnerName; mCPUTime = pOther.mCPUTime; mLocation = pOther.mLocation; diff --git a/indra/newview/llpathfindingcharacter.h b/indra/newview/llpathfindingcharacter.h index c64d88892a..a7a17bc490 100644 --- a/indra/newview/llpathfindingcharacter.h +++ b/indra/newview/llpathfindingcharacter.h @@ -30,8 +30,10 @@ #include "v3math.h" #include "lluuid.h" +#include "llavatarname.h" class LLSD; +class LLAvatarName; class LLPathfindingCharacter { @@ -45,19 +47,20 @@ public: inline const LLUUID& getUUID() const {return mUUID;}; inline const std::string& getName() const {return mName;}; inline const std::string& getDescription() const {return mDescription;}; - inline const std::string& getOwner() const {return mOwner;}; + inline const std::string getOwnerName() const {return mOwnerName.getCompleteName();}; inline U32 getCPUTime() const {return mCPUTime;}; inline const LLVector3& getLocation() const {return mLocation;}; protected: private: - LLUUID mUUID; - std::string mName; - std::string mDescription; - std::string mOwner; - U32 mCPUTime; - LLVector3 mLocation; + LLUUID mUUID; + std::string mName; + std::string mDescription; + LLUUID mOwnerUUID; + LLAvatarName mOwnerName; + U32 mCPUTime; + LLVector3 mLocation; }; #endif // LL_LLPATHFINDINGCHARACTER_H -- cgit v1.2.3