summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Stinson <stinson@lindenlab.com>2012-06-04 14:36:43 -0700
committerTodd Stinson <stinson@lindenlab.com>2012-06-04 14:36:43 -0700
commitea23285f8b728bf52c8490610c610f4abd2d6957 (patch)
treeeee90fcec08768ee1ba55adabbedd635a4a4dfe4
parentfb7c7043a467d0d6c2b741ca603b6b1c57a52ae9 (diff)
Ensuring that the scroll list is rebuilt after any missing avatar names are loaded into cache.
-rw-r--r--indra/newview/llfloaterpathfindingcharacters.cpp11
-rw-r--r--indra/newview/llfloaterpathfindingcharacters.h2
-rw-r--r--indra/newview/llfloaterpathfindinglinksets.cpp16
-rw-r--r--indra/newview/llfloaterpathfindinglinksets.h2
-rw-r--r--indra/newview/llfloaterpathfindingobjects.cpp25
-rw-r--r--indra/newview/llfloaterpathfindingobjects.h39
-rw-r--r--indra/newview/llpathfindingobject.cpp28
-rw-r--r--indra/newview/llpathfindingobject.h7
-rw-r--r--indra/newview/skins/default/xui/en/floater_pathfinding_characters.xml2
-rw-r--r--indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml1
10 files changed, 105 insertions, 28 deletions
diff --git a/indra/newview/llfloaterpathfindingcharacters.cpp b/indra/newview/llfloaterpathfindingcharacters.cpp
index 0dbc2a303a..121cb85a6d 100644
--- a/indra/newview/llfloaterpathfindingcharacters.cpp
+++ b/indra/newview/llfloaterpathfindingcharacters.cpp
@@ -93,7 +93,7 @@ void LLFloaterPathfindingCharacters::requestGetObjects()
LLPathfindingManager::getInstance()->requestGetCharacters(getNewRequestId(), boost::bind(&LLFloaterPathfindingCharacters::handleNewObjectList, this, _1, _2, _3));
}
-LLSD LLFloaterPathfindingCharacters::convertObjectsIntoScrollListData(const LLPathfindingObjectListPtr pObjectListPtr) const
+LLSD LLFloaterPathfindingCharacters::convertObjectsIntoScrollListData(const LLPathfindingObjectListPtr pObjectListPtr)
{
llassert(pObjectListPtr != NULL);
llassert(!pObjectListPtr->isEmpty());
@@ -105,6 +105,11 @@ LLSD LLFloaterPathfindingCharacters::convertObjectsIntoScrollListData(const LLPa
const LLPathfindingCharacter *characterPtr = dynamic_cast<const LLPathfindingCharacter *>(objectIter->second.get());
LLSD element = buildCharacterScrollListData(characterPtr);
scrollListData.append(element);
+
+ if (characterPtr->hasOwner() && !characterPtr->hasOwnerName())
+ {
+ rebuildScrollListAfterAvatarNameLoads(characterPtr->getUUID());
+ }
}
return scrollListData;
@@ -139,7 +144,9 @@ LLSD LLFloaterPathfindingCharacters::buildCharacterScrollListData(const LLPathfi
columns[1]["font"] = "SANSSERIF";
columns[2]["column"] = "owner";
- columns[2]["value"] = pCharacterPtr->getOwnerName();
+ columns[2]["value"] = (pCharacterPtr->hasOwner() ?
+ (pCharacterPtr->hasOwnerName() ? pCharacterPtr->getOwnerName() : getString("character_owner_loading")) :
+ getString("character_owner_unknown"));
columns[2]["font"] = "SANSSERIF";
S32 cpuTime = llround(pCharacterPtr->getCPUTime());
diff --git a/indra/newview/llfloaterpathfindingcharacters.h b/indra/newview/llfloaterpathfindingcharacters.h
index 397191943a..ced72dadee 100644
--- a/indra/newview/llfloaterpathfindingcharacters.h
+++ b/indra/newview/llfloaterpathfindingcharacters.h
@@ -51,7 +51,7 @@ protected:
virtual void requestGetObjects();
- virtual LLSD convertObjectsIntoScrollListData(const LLPathfindingObjectListPtr pObjectListPtr) const;
+ virtual LLSD convertObjectsIntoScrollListData(const LLPathfindingObjectListPtr pObjectListPtr);
virtual S32 getNameColumnIndex() const;
virtual const LLColor4 &getBeaconColor() const;
diff --git a/indra/newview/llfloaterpathfindinglinksets.cpp b/indra/newview/llfloaterpathfindinglinksets.cpp
index d53f4db5c2..bb1bcd0cb8 100644
--- a/indra/newview/llfloaterpathfindinglinksets.cpp
+++ b/indra/newview/llfloaterpathfindinglinksets.cpp
@@ -213,7 +213,7 @@ void LLFloaterPathfindingLinksets::requestGetObjects()
LLPathfindingManager::getInstance()->requestGetLinksets(getNewRequestId(), boost::bind(&LLFloaterPathfindingLinksets::handleNewObjectList, this, _1, _2, _3));
}
-LLSD LLFloaterPathfindingLinksets::convertObjectsIntoScrollListData(const LLPathfindingObjectListPtr pObjectListPtr) const
+LLSD LLFloaterPathfindingLinksets::convertObjectsIntoScrollListData(const LLPathfindingObjectListPtr pObjectListPtr)
{
llassert(pObjectListPtr != NULL);
llassert(!pObjectListPtr->isEmpty());
@@ -245,6 +245,11 @@ LLSD LLFloaterPathfindingLinksets::convertObjectsIntoScrollListData(const LLPath
{
LLSD element = buildLinksetScrollListData(linksetPtr, avatarPosition);
scrollListData.append(element);
+
+ if (linksetPtr->hasOwner() && !linksetPtr->hasOwnerName())
+ {
+ rebuildScrollListAfterAvatarNameLoads(linksetPtr->getUUID());
+ }
}
}
}
@@ -255,6 +260,11 @@ LLSD LLFloaterPathfindingLinksets::convertObjectsIntoScrollListData(const LLPath
const LLPathfindingLinkset *linksetPtr = dynamic_cast<const LLPathfindingLinkset *>(objectIter->second.get());
LLSD element = buildLinksetScrollListData(linksetPtr, avatarPosition);
scrollListData.append(element);
+
+ if (linksetPtr->hasOwner() && !linksetPtr->hasOwnerName())
+ {
+ rebuildScrollListAfterAvatarNameLoads(linksetPtr->getUUID());
+ }
}
}
@@ -409,7 +419,9 @@ LLSD LLFloaterPathfindingLinksets::buildLinksetScrollListData(const LLPathfindin
columns[1]["font"] = "SANSSERIF";
columns[2]["column"] = "owner";
- columns[2]["value"] = (pLinksetPtr->hasOwnerName() ? pLinksetPtr->getOwnerName() : getString("linkset_owner_unknown"));
+ columns[2]["value"] = (pLinksetPtr->hasOwner() ?
+ (pLinksetPtr->hasOwnerName() ? pLinksetPtr->getOwnerName() : getString("linkset_owner_loading")) :
+ getString("linkset_owner_unknown"));
columns[2]["font"] = "SANSSERIF";
columns[3]["column"] = "land_impact";
diff --git a/indra/newview/llfloaterpathfindinglinksets.h b/indra/newview/llfloaterpathfindinglinksets.h
index 87719e28f0..4b19f09cda 100644
--- a/indra/newview/llfloaterpathfindinglinksets.h
+++ b/indra/newview/llfloaterpathfindinglinksets.h
@@ -62,7 +62,7 @@ protected:
virtual void requestGetObjects();
- virtual LLSD convertObjectsIntoScrollListData(const LLPathfindingObjectListPtr pObjectListPtr) const;
+ virtual LLSD convertObjectsIntoScrollListData(const LLPathfindingObjectListPtr pObjectListPtr);
virtual void updateControls();
diff --git a/indra/newview/llfloaterpathfindingobjects.cpp b/indra/newview/llfloaterpathfindingobjects.cpp
index 8aaeb299f1..7ac0d05bac 100644
--- a/indra/newview/llfloaterpathfindingobjects.cpp
+++ b/indra/newview/llfloaterpathfindingobjects.cpp
@@ -35,6 +35,8 @@
#include <boost/signals2.hpp>
#include "llagent.h"
+#include "llavatarname.h"
+#include "llavatarnamecache.h"
#include "llbutton.h"
#include "llcheckboxctrl.h"
#include "llenvmanager.h"
@@ -162,6 +164,7 @@ LLFloaterPathfindingObjects::LLFloaterPathfindingObjects(const LLSD &pSeed)
mReturnButton(NULL),
mDeleteButton(NULL),
mTeleportButton(NULL),
+ mLoadingAvatarNames(),
mDefaultBeaconColor(),
mDefaultBeaconTextColor(),
mErrorTextColor(),
@@ -346,13 +349,23 @@ void LLFloaterPathfindingObjects::rebuildObjectsScrollList()
updateControls();
}
-LLSD LLFloaterPathfindingObjects::convertObjectsIntoScrollListData(const LLPathfindingObjectListPtr pObjectListPtr) const
+LLSD LLFloaterPathfindingObjects::convertObjectsIntoScrollListData(const LLPathfindingObjectListPtr pObjectListPtr)
{
llassert(0);
LLSD nullObjs = LLSD::emptyArray();
return nullObjs;
}
+void LLFloaterPathfindingObjects::rebuildScrollListAfterAvatarNameLoads(const LLUUID &pAvatarId)
+{
+ std::set<LLUUID>::const_iterator iter = mLoadingAvatarNames.find(pAvatarId);
+ if (iter == mLoadingAvatarNames.end())
+ {
+ mLoadingAvatarNames.insert(pAvatarId);
+ LLAvatarNameCache::get(pAvatarId, boost::bind(&LLFloaterPathfindingObjects::handleAvatarNameLoads, this, _1, _2));
+ }
+}
+
void LLFloaterPathfindingObjects::updateControls()
{
updateMessagingStatus();
@@ -542,6 +555,16 @@ void LLFloaterPathfindingObjects::onGodLevelChange(U8 pGodLevel)
requestGetObjects();
}
+void LLFloaterPathfindingObjects::handleAvatarNameLoads(const LLUUID &pAvatarId, const LLAvatarName &pAvatarName)
+{
+ llassert(mLoadingAvatarNames.find(pAvatarId) != mLoadingAvatarNames.end());
+ mLoadingAvatarNames.erase(pAvatarId);
+ if (mLoadingAvatarNames.empty())
+ {
+ rebuildObjectsScrollList();
+ }
+}
+
void LLFloaterPathfindingObjects::updateMessagingStatus()
{
std::string statusText("");
diff --git a/indra/newview/llfloaterpathfindingobjects.h b/indra/newview/llfloaterpathfindingobjects.h
index 7e7f1b9449..604d026f29 100644
--- a/indra/newview/llfloaterpathfindingobjects.h
+++ b/indra/newview/llfloaterpathfindingobjects.h
@@ -27,6 +27,7 @@
#ifndef LL_LLFLOATERPATHFINDINGOBJECTS_H
#define LL_LLFLOATERPATHFINDINGOBJECTS_H
+#include <set>
#include <boost/signals2.hpp>
#include "llagent.h"
@@ -37,6 +38,7 @@
#include "llselectmgr.h"
#include "v4color.h"
+class LLAvatarName;
class LLButton;
class LLCheckBoxCtrl;
class LLScrollListCtrl;
@@ -77,7 +79,9 @@ protected:
void handleUpdateObjectList(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::ERequestStatus pRequestStatus, LLPathfindingObjectListPtr pObjectList);
void rebuildObjectsScrollList();
- virtual LLSD convertObjectsIntoScrollListData(const LLPathfindingObjectListPtr pObjectListPtr) const;
+ virtual LLSD convertObjectsIntoScrollListData(const LLPathfindingObjectListPtr pObjectListPtr);
+
+ void rebuildScrollListAfterAvatarNameLoads(const LLUUID &pAvatarId);
virtual void updateControls();
@@ -102,24 +106,26 @@ protected:
private:
LLFloaterPathfindingObjects(const LLFloaterPathfindingObjects &pOther);
- void setMessagingState(EMessagingState pMessagingState);
+ void setMessagingState(EMessagingState pMessagingState);
- void onRefreshObjectsClicked();
- void onSelectAllObjectsClicked();
- void onSelectNoneObjectsClicked();
- void onTakeClicked();
- void onTakeCopyClicked();
- void onReturnClicked();
- void onDeleteClicked();
- void onTeleportClicked();
+ void onRefreshObjectsClicked();
+ void onSelectAllObjectsClicked();
+ void onSelectNoneObjectsClicked();
+ void onTakeClicked();
+ void onTakeCopyClicked();
+ void onReturnClicked();
+ void onDeleteClicked();
+ void onTeleportClicked();
- void onScrollListSelectionChanged();
+ void onScrollListSelectionChanged();
void onInWorldSelectionListChanged();
- void onRegionBoundaryCrossed();
+ void onRegionBoundaryCrossed();
void onGodLevelChange(U8 pGodLevel);
- void updateMessagingStatus();
- void updateStateOnListActionControls();
+ void handleAvatarNameLoads(const LLUUID &pAvatarId, const LLAvatarName &pAvatarName);
+
+ void updateMessagingStatus();
+ void updateStateOnListActionControls();
void updateOnScrollListChange();
LLPathfindingObjectPtr findObject(const LLScrollListItem *pListItem) const;
@@ -131,13 +137,15 @@ protected:
LLButton *mSelectAllButton;
LLButton *mSelectNoneButton;
LLCheckBoxCtrl *mShowBeaconCheckBox;
-
+
LLButton *mTakeButton;
LLButton *mTakeCopyButton;
LLButton *mReturnButton;
LLButton *mDeleteButton;
LLButton *mTeleportButton;
+ std::set<LLUUID> mLoadingAvatarNames;
+
LLColor4 mDefaultBeaconColor;
LLColor4 mDefaultBeaconTextColor;
LLColor4 mErrorTextColor;
@@ -153,7 +161,6 @@ protected:
boost::signals2::connection mSelectionUpdateSlot;
boost::signals2::connection mRegionBoundaryCrossingSlot;
LLAgent::god_level_change_slot_t mGodLevelChangeSlot;
-
};
#endif // LL_LLFLOATERPATHFINDINGOBJECTS_H
diff --git a/indra/newview/llpathfindingobject.cpp b/indra/newview/llpathfindingobject.cpp
index cde3777414..65fcedf2f5 100644
--- a/indra/newview/llpathfindingobject.cpp
+++ b/indra/newview/llpathfindingobject.cpp
@@ -52,6 +52,7 @@ LLPathfindingObject::LLPathfindingObject()
mName(),
mDescription(),
mOwnerUUID(),
+ mHasOwnerName(false),
mOwnerName(),
mLocation()
{
@@ -62,6 +63,7 @@ LLPathfindingObject::LLPathfindingObject(const std::string &pUUID, const LLSD &p
mName(),
mDescription(),
mOwnerUUID(),
+ mHasOwnerName(false),
mOwnerName(),
mLocation()
{
@@ -73,9 +75,11 @@ LLPathfindingObject::LLPathfindingObject(const LLPathfindingObject& pOther)
mName(pOther.mName),
mDescription(pOther.mDescription),
mOwnerUUID(pOther.mOwnerUUID),
- mOwnerName(pOther.mOwnerName),
+ mHasOwnerName(false),
+ mOwnerName(),
mLocation(pOther.mLocation)
{
+ fetchOwnerName();
}
LLPathfindingObject::~LLPathfindingObject()
@@ -88,7 +92,7 @@ LLPathfindingObject &LLPathfindingObject::operator =(const LLPathfindingObject&
mName = pOther.mName;
mDescription = pOther.mDescription;
mOwnerUUID = pOther.mOwnerUUID;
- mOwnerName = pOther.mOwnerName;
+ fetchOwnerName();
mLocation = pOther.mLocation;
return *this;
@@ -98,7 +102,7 @@ std::string LLPathfindingObject::getOwnerName() const
{
std::string ownerName;
- if (hasOwnerName())
+ if (hasOwner())
{
ownerName = mOwnerName.getCompleteName();
}
@@ -126,7 +130,7 @@ void LLPathfindingObject::parseObjectData(const LLSD &pObjectData)
{
llassert(pObjectData.get(PATHFINDING_OBJECT_OWNER_FIELD).isUUID());
mOwnerUUID = pObjectData.get(PATHFINDING_OBJECT_OWNER_FIELD).asUUID();
- LLAvatarNameCache::get(mOwnerUUID, &mOwnerName);
+ fetchOwnerName();
}
#endif // SERVER_SIDE_OWNER_ROLLOUT_COMPLETE
@@ -134,3 +138,19 @@ void LLPathfindingObject::parseObjectData(const LLSD &pObjectData)
llassert(pObjectData.get(PATHFINDING_OBJECT_POSITION_FIELD).isArray());
mLocation.setValue(pObjectData.get(PATHFINDING_OBJECT_POSITION_FIELD));
}
+
+void LLPathfindingObject::fetchOwnerName()
+{
+ mHasOwnerName = false;
+ if (hasOwner())
+ {
+ LLAvatarNameCache::get(mOwnerUUID, boost::bind(&LLPathfindingObject::handleAvatarNameFetch, this, _1, _2));
+ }
+}
+
+void LLPathfindingObject::handleAvatarNameFetch(const LLUUID &pOwnerUUID, const LLAvatarName &pAvatarName)
+{
+ llassert(mOwnerUUID == pOwnerUUID);
+ mOwnerName = pAvatarName;
+ mHasOwnerName = true;
+}
diff --git a/indra/newview/llpathfindingobject.h b/indra/newview/llpathfindingobject.h
index 880a3a6864..924ea3f298 100644
--- a/indra/newview/llpathfindingobject.h
+++ b/indra/newview/llpathfindingobject.h
@@ -53,7 +53,8 @@ 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 BOOL hasOwnerName() const {return mOwnerUUID.notNull();};
+ inline BOOL hasOwner() const {return mOwnerUUID.notNull();};
+ inline bool hasOwnerName() const {return mHasOwnerName;};
std::string getOwnerName() const;
inline const LLVector3& getLocation() const {return mLocation;};
@@ -62,10 +63,14 @@ protected:
private:
void parseObjectData(const LLSD &pObjectData);
+ void fetchOwnerName();
+ void handleAvatarNameFetch(const LLUUID &pOwnerUUID, const LLAvatarName &pAvatarName);
+
LLUUID mUUID;
std::string mName;
std::string mDescription;
LLUUID mOwnerUUID;
+ bool mHasOwnerName;
LLAvatarName mOwnerName;
LLVector3 mLocation;
};
diff --git a/indra/newview/skins/default/xui/en/floater_pathfinding_characters.xml b/indra/newview/skins/default/xui/en/floater_pathfinding_characters.xml
index fac6ee05bb..054b2674f2 100644
--- a/indra/newview/skins/default/xui/en/floater_pathfinding_characters.xml
+++ b/indra/newview/skins/default/xui/en/floater_pathfinding_characters.xml
@@ -23,6 +23,8 @@
<floater.string name="messaging_complete_available">[NUM_SELECTED] characters selected out of [NUM_TOTAL].</floater.string>
<floater.string name="messaging_not_enabled">This region is not enabled for pathfinding.</floater.string>
<floater.string name="character_cpu_time">[CPU_TIME] µs</floater.string>
+ <floater.string name="character_owner_loading">[Loading]</floater.string>
+ <floater.string name="character_owner_unknown">Unknown</floater.string>
<panel
border="false"
bevel_style="none"
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 3ae5301cc2..3e718743dc 100644
--- a/indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml
+++ b/indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml
@@ -27,6 +27,7 @@
<floater.string name="linkset_terrain_owner">--</floater.string>
<floater.string name="linkset_terrain_land_impact">--</floater.string>
<floater.string name="linkset_terrain_dist_from_you">--</floater.string>
+ <floater.string name="linkset_owner_loading">[Loading]</floater.string>
<floater.string name="linkset_owner_unknown">Unknown</floater.string>
<floater.string name="linkset_use_walkable">Walkable</floater.string>
<floater.string name="linkset_use_static_obstacle">Static obstacle</floater.string>