From 683a96a5f1e9111d62710fe621d52192d34079ed Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 14 Aug 2012 14:54:29 -0700 Subject: PATH-849: Refactoring the behavior after loading the owner name of a pathfinding object into the avatar name cache so that each object can simply update its respective row in the scroll list rather than rebuilding from scratch after all names are loaded. --- indra/newview/llfloaterpathfindingcharacters.cpp | 28 ++++++++---------------- 1 file changed, 9 insertions(+), 19 deletions(-) (limited to 'indra/newview/llfloaterpathfindingcharacters.cpp') diff --git a/indra/newview/llfloaterpathfindingcharacters.cpp b/indra/newview/llfloaterpathfindingcharacters.cpp index 99d262344c..4cf82d162c 100644 --- a/indra/newview/llfloaterpathfindingcharacters.cpp +++ b/indra/newview/llfloaterpathfindingcharacters.cpp @@ -134,26 +134,20 @@ void LLFloaterPathfindingCharacters::requestGetObjects() LLPathfindingManager::getInstance()->requestGetCharacters(getNewRequestId(), boost::bind(&LLFloaterPathfindingCharacters::handleNewObjectList, this, _1, _2, _3)); } -LLSD LLFloaterPathfindingCharacters::convertObjectsIntoScrollListData(const LLPathfindingObjectListPtr pObjectListPtr) +void LLFloaterPathfindingCharacters::buildObjectsScrollList(const LLPathfindingObjectListPtr pObjectListPtr) { llassert(pObjectListPtr != NULL); llassert(!pObjectListPtr->isEmpty()); - LLSD scrollListData = LLSD::emptyArray(); - for (LLPathfindingObjectList::const_iterator objectIter = pObjectListPtr->begin(); objectIter != pObjectListPtr->end(); ++objectIter) { - const LLPathfindingCharacter *characterPtr = dynamic_cast(objectIter->second.get()); - LLSD element = buildCharacterScrollListData(characterPtr); - scrollListData.append(element); + const LLPathfindingObjectPtr objectPtr = objectIter->second; + const LLPathfindingCharacter *characterPtr = dynamic_cast(objectPtr.get()); + llassert(characterPtr != NULL); - if (characterPtr->hasOwner() && !characterPtr->hasOwnerName()) - { - rebuildScrollListAfterAvatarNameLoads(characterPtr->getUUID()); - } + LLSD scrollListItemData = buildCharacterScrollListItemData(characterPtr); + addObjectToScrollList(objectPtr, scrollListItemData); } - - return scrollListData; } void LLFloaterPathfindingCharacters::updateControlsOnScrollListChange() @@ -201,9 +195,9 @@ void LLFloaterPathfindingCharacters::onShowPhysicsCapsuleClicked() } } -LLSD LLFloaterPathfindingCharacters::buildCharacterScrollListData(const LLPathfindingCharacter *pCharacterPtr) const +LLSD LLFloaterPathfindingCharacters::buildCharacterScrollListItemData(const LLPathfindingCharacter *pCharacterPtr) const { - LLSD columns; + LLSD columns = LLSD::emptyArray(); columns[0]["column"] = "name"; columns[0]["value"] = pCharacterPtr->getName(); @@ -231,11 +225,7 @@ LLSD LLFloaterPathfindingCharacters::buildCharacterScrollListData(const LLPathfi columns[4]["column"] = "altitude"; columns[4]["value"] = llformat("%1.0f m", pCharacterPtr->getLocation()[2]); - LLSD element; - element["id"] = pCharacterPtr->getUUID().asString(); - element["column"] = columns; - - return element; + return columns; } void LLFloaterPathfindingCharacters::updateStateOnDisplayControls() -- cgit v1.2.3 From fddaf38f892aa608f9db9c034f6c583d638b6fcf Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 14 Aug 2012 16:04:12 -0700 Subject: PATH-849: Group objects were losing their [group] identifier following the last commit. This should fix that issue. --- indra/newview/llfloaterpathfindingcharacters.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'indra/newview/llfloaterpathfindingcharacters.cpp') diff --git a/indra/newview/llfloaterpathfindingcharacters.cpp b/indra/newview/llfloaterpathfindingcharacters.cpp index 4cf82d162c..69c9d94dfa 100644 --- a/indra/newview/llfloaterpathfindingcharacters.cpp +++ b/indra/newview/llfloaterpathfindingcharacters.cpp @@ -162,6 +162,22 @@ S32 LLFloaterPathfindingCharacters::getNameColumnIndex() const return 0; } +S32 LLFloaterPathfindingCharacters::getOwnerNameColumnIndex() const +{ + return 2; +} + +std::string LLFloaterPathfindingCharacters::getOwnerName(const LLPathfindingObject *pObject) const +{ + return (pObject->hasOwner() + ? (pObject->hasOwnerName() + ? (pObject->isGroupOwned() + ? (pObject->getOwnerName() + " " + getString("character_owner_group")) + : pObject->getOwnerName()) + : getString("character_owner_loading")) + : getString("character_owner_unknown")); +} + const LLColor4 &LLFloaterPathfindingCharacters::getBeaconColor() const { return mBeaconColor; @@ -206,13 +222,7 @@ LLSD LLFloaterPathfindingCharacters::buildCharacterScrollListItemData(const LLPa columns[1]["value"] = pCharacterPtr->getDescription(); columns[2]["column"] = "owner"; - columns[2]["value"] = (pCharacterPtr->hasOwner() - ? (pCharacterPtr->hasOwnerName() - ? (pCharacterPtr->isGroupOwned() - ? (pCharacterPtr->getOwnerName() + " " + getString("character_owner_group")) - : pCharacterPtr->getOwnerName()) - : getString("character_owner_loading")) - : getString("character_owner_unknown")); + columns[2]["value"] = getOwnerName(pCharacterPtr); S32 cpuTime = llround(pCharacterPtr->getCPUTime()); std::string cpuTimeString = llformat("%d", cpuTime); -- cgit v1.2.3