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/llfloaterpathfindinglinksets.cpp | 42 ++++++++++---------------- 1 file changed, 16 insertions(+), 26 deletions(-) (limited to 'indra/newview/llfloaterpathfindinglinksets.cpp') diff --git a/indra/newview/llfloaterpathfindinglinksets.cpp b/indra/newview/llfloaterpathfindinglinksets.cpp index 877bd0822d..dd28f82db1 100644 --- a/indra/newview/llfloaterpathfindinglinksets.cpp +++ b/indra/newview/llfloaterpathfindinglinksets.cpp @@ -215,7 +215,7 @@ void LLFloaterPathfindingLinksets::requestGetObjects() LLPathfindingManager::getInstance()->requestGetLinksets(getNewRequestId(), boost::bind(&LLFloaterPathfindingLinksets::handleNewObjectList, this, _1, _2, _3)); } -LLSD LLFloaterPathfindingLinksets::convertObjectsIntoScrollListData(const LLPathfindingObjectListPtr pObjectListPtr) +void LLFloaterPathfindingLinksets::buildObjectsScrollList(const LLPathfindingObjectListPtr pObjectListPtr) { llassert(pObjectListPtr != NULL); llassert(!pObjectListPtr->isEmpty()); @@ -227,7 +227,6 @@ LLSD LLFloaterPathfindingLinksets::convertObjectsIntoScrollListData(const LLPath bool isFilteringDescription = !descriptionFilter.empty(); bool isFilteringLinksetUse = (linksetUseFilter != LLPathfindingLinkset::kUnknown); - LLSD scrollListData = LLSD::emptyArray(); const LLVector3& avatarPosition = gAgent.getPositionAgent(); if (isFilteringName || isFilteringDescription || isFilteringLinksetUse) @@ -236,22 +235,21 @@ LLSD LLFloaterPathfindingLinksets::convertObjectsIntoScrollListData(const LLPath LLStringUtil::toUpper(descriptionFilter); for (LLPathfindingObjectList::const_iterator objectIter = pObjectListPtr->begin(); objectIter != pObjectListPtr->end(); ++objectIter) { - const LLPathfindingLinkset *linksetPtr = dynamic_cast(objectIter->second.get()); + const LLPathfindingObjectPtr objectPtr = objectIter->second; + const LLPathfindingLinkset *linksetPtr = dynamic_cast(objectPtr.get()); + llassert(linksetPtr != NULL); + std::string linksetName = (linksetPtr->isTerrain() ? getString("linkset_terrain_name") : linksetPtr->getName()); std::string linksetDescription = linksetPtr->getDescription(); LLStringUtil::toUpper(linksetName); LLStringUtil::toUpper(linksetDescription); + if ((!isFilteringName || (linksetName.find(nameFilter) != std::string::npos)) && (!isFilteringDescription || (linksetDescription.find(descriptionFilter) != std::string::npos)) && (!isFilteringLinksetUse || (linksetPtr->getLinksetUse() == linksetUseFilter))) { - LLSD element = buildLinksetScrollListData(linksetPtr, avatarPosition); - scrollListData.append(element); - - if (linksetPtr->hasOwner() && !linksetPtr->hasOwnerName()) - { - rebuildScrollListAfterAvatarNameLoads(linksetPtr->getUUID()); - } + LLSD scrollListItemData = buildLinksetScrollListItemData(linksetPtr, avatarPosition); + addObjectToScrollList(objectPtr, scrollListItemData); } } } @@ -259,18 +257,14 @@ LLSD LLFloaterPathfindingLinksets::convertObjectsIntoScrollListData(const LLPath { for (LLPathfindingObjectList::const_iterator objectIter = pObjectListPtr->begin(); objectIter != pObjectListPtr->end(); ++objectIter) { - const LLPathfindingLinkset *linksetPtr = dynamic_cast(objectIter->second.get()); - LLSD element = buildLinksetScrollListData(linksetPtr, avatarPosition); - scrollListData.append(element); + const LLPathfindingObjectPtr objectPtr = objectIter->second; + const LLPathfindingLinkset *linksetPtr = dynamic_cast(objectPtr.get()); + llassert(linksetPtr != NULL); - if (linksetPtr->hasOwner() && !linksetPtr->hasOwnerName()) - { - rebuildScrollListAfterAvatarNameLoads(linksetPtr->getUUID()); - } + LLSD scrollListItemData = buildLinksetScrollListItemData(linksetPtr, avatarPosition); + addObjectToScrollList(objectPtr, scrollListItemData); } } - - return scrollListData; } void LLFloaterPathfindingLinksets::updateControlsOnScrollListChange() @@ -373,10 +367,10 @@ void LLFloaterPathfindingLinksets::updateEditFieldValues() } } -LLSD LLFloaterPathfindingLinksets::buildLinksetScrollListData(const LLPathfindingLinkset *pLinksetPtr, const LLVector3 &pAvatarPosition) const +LLSD LLFloaterPathfindingLinksets::buildLinksetScrollListItemData(const LLPathfindingLinkset *pLinksetPtr, const LLVector3 &pAvatarPosition) const { llassert(pLinksetPtr != NULL); - LLSD columns; + LLSD columns = LLSD::emptyArray(); if (pLinksetPtr->isTerrain()) { @@ -451,11 +445,7 @@ LLSD LLFloaterPathfindingLinksets::buildLinksetScrollListData(const LLPathfindin columns[9]["column"] = "d_percent"; columns[9]["value"] = llformat("%3d", pLinksetPtr->getWalkabilityCoefficientD()); - LLSD element; - element["id"] = pLinksetPtr->getUUID().asString(); - element["column"] = columns; - - return element; + return columns; } LLSD LLFloaterPathfindingLinksets::buildLinksetUseScrollListData(const std::string &pLabel, S32 pValue) const -- 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/llfloaterpathfindinglinksets.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'indra/newview/llfloaterpathfindinglinksets.cpp') diff --git a/indra/newview/llfloaterpathfindinglinksets.cpp b/indra/newview/llfloaterpathfindinglinksets.cpp index dd28f82db1..4d3b7fca91 100644 --- a/indra/newview/llfloaterpathfindinglinksets.cpp +++ b/indra/newview/llfloaterpathfindinglinksets.cpp @@ -280,6 +280,22 @@ S32 LLFloaterPathfindingLinksets::getNameColumnIndex() const return 0; } +S32 LLFloaterPathfindingLinksets::getOwnerNameColumnIndex() const +{ + return 2; +} + +std::string LLFloaterPathfindingLinksets::getOwnerName(const LLPathfindingObject *pObject) const +{ + return (pObject->hasOwner() + ? (pObject->hasOwnerName() + ? (pObject->isGroupOwned() + ? (pObject->getOwnerName() + " " + getString("linkset_owner_group")) + : pObject->getOwnerName()) + : getString("linkset_owner_loading")) + : getString("linkset_owner_unknown")); +} + const LLColor4 &LLFloaterPathfindingLinksets::getBeaconColor() const { return mBeaconColor; @@ -398,13 +414,7 @@ LLSD LLFloaterPathfindingLinksets::buildLinksetScrollListItemData(const LLPathfi columns[1]["value"] = pLinksetPtr->getDescription(); columns[2]["column"] = "owner"; - columns[2]["value"] = (pLinksetPtr->hasOwner() - ? (pLinksetPtr->hasOwnerName() - ? (pLinksetPtr->isGroupOwned() - ? (pLinksetPtr->getOwnerName() + " " + getString("linkset_owner_group")) - : pLinksetPtr->getOwnerName()) - : getString("linkset_owner_loading")) - : getString("linkset_owner_unknown")); + columns[2]["value"] = getOwnerName(pLinksetPtr); columns[3]["column"] = "land_impact"; columns[3]["value"] = llformat("%1d", pLinksetPtr->getLandImpact()); -- cgit v1.2.3 From 0517f5f487550f0616bc2ca062f94c3ccf63374e Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 14 Aug 2012 16:39:43 -0700 Subject: PATH-854: Adding support to display whether linksets are scripted or not in the pathfinding linksets floater. --- indra/newview/llfloaterpathfindinglinksets.cpp | 46 ++++++++++++++++---------- 1 file changed, 28 insertions(+), 18 deletions(-) (limited to 'indra/newview/llfloaterpathfindinglinksets.cpp') diff --git a/indra/newview/llfloaterpathfindinglinksets.cpp b/indra/newview/llfloaterpathfindinglinksets.cpp index 4d3b7fca91..651be274d9 100644 --- a/indra/newview/llfloaterpathfindinglinksets.cpp +++ b/indra/newview/llfloaterpathfindinglinksets.cpp @@ -399,11 +399,14 @@ LLSD LLFloaterPathfindingLinksets::buildLinksetScrollListItemData(const LLPathfi columns[2]["column"] = "owner"; columns[2]["value"] = getString("linkset_terrain_owner"); - columns[3]["column"] = "land_impact"; - columns[3]["value"] = getString("linkset_terrain_land_impact"); + columns[3]["column"] = "scripted"; + columns[3]["value"] = getString("linkset_terrain_scripted"); - columns[4]["column"] = "dist_from_you"; - columns[4]["value"] = getString("linkset_terrain_dist_from_you"); + columns[4]["column"] = "land_impact"; + columns[4]["value"] = getString("linkset_terrain_land_impact"); + + columns[5]["column"] = "dist_from_you"; + columns[5]["value"] = getString("linkset_terrain_dist_from_you"); } else { @@ -416,14 +419,21 @@ LLSD LLFloaterPathfindingLinksets::buildLinksetScrollListItemData(const LLPathfi columns[2]["column"] = "owner"; columns[2]["value"] = getOwnerName(pLinksetPtr); - columns[3]["column"] = "land_impact"; - columns[3]["value"] = llformat("%1d", pLinksetPtr->getLandImpact()); + columns[3]["column"] = "scripted"; + columns[3]["value"] = (pLinksetPtr->hasIsScripted() + ? (pLinksetPtr->isScripted() + ? getString("linkset_is_scripted") + : getString("linkset_is_not_scripted")) + : getString("linkset_is_unknown_scripted")); + + columns[4]["column"] = "land_impact"; + columns[4]["value"] = llformat("%1d", pLinksetPtr->getLandImpact()); - columns[4]["column"] = "dist_from_you"; - columns[4]["value"] = llformat("%1.0f m", dist_vec(pAvatarPosition, pLinksetPtr->getLocation())); + columns[5]["column"] = "dist_from_you"; + columns[5]["value"] = llformat("%1.0f m", dist_vec(pAvatarPosition, pLinksetPtr->getLocation())); } - columns[5]["column"] = "linkset_use"; + columns[6]["column"] = "linkset_use"; std::string linksetUse = getLinksetUseString(pLinksetPtr->getLinksetUse()); if (pLinksetPtr->isTerrain()) { @@ -441,19 +451,19 @@ LLSD LLFloaterPathfindingLinksets::buildLinksetScrollListItemData(const LLPathfi { linksetUse += (" " + getString("linkset_is_restricted_non_volume_state")); } - columns[5]["value"] = linksetUse; + columns[6]["value"] = linksetUse; - columns[6]["column"] = "a_percent"; - columns[6]["value"] = llformat("%3d", pLinksetPtr->getWalkabilityCoefficientA()); + columns[7]["column"] = "a_percent"; + columns[7]["value"] = llformat("%3d", pLinksetPtr->getWalkabilityCoefficientA()); - columns[7]["column"] = "b_percent"; - columns[7]["value"] = llformat("%3d", pLinksetPtr->getWalkabilityCoefficientB()); + columns[8]["column"] = "b_percent"; + columns[8]["value"] = llformat("%3d", pLinksetPtr->getWalkabilityCoefficientB()); - columns[8]["column"] = "c_percent"; - columns[8]["value"] = llformat("%3d", pLinksetPtr->getWalkabilityCoefficientC()); + columns[9]["column"] = "c_percent"; + columns[9]["value"] = llformat("%3d", pLinksetPtr->getWalkabilityCoefficientC()); - columns[9]["column"] = "d_percent"; - columns[9]["value"] = llformat("%3d", pLinksetPtr->getWalkabilityCoefficientD()); + columns[10]["column"] = "d_percent"; + columns[10]["value"] = llformat("%3d", pLinksetPtr->getWalkabilityCoefficientD()); return columns; } -- cgit v1.2.3 From 2e338ef2efcfa2f1812506201d1ff5d61a13310f Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 14 Aug 2012 17:58:26 -0700 Subject: PATH-856: Adding a new notification to indicate when the user will be toggling the phantom flag of a linkset through the Pathfinding Linksets floater. --- indra/newview/llfloaterpathfindinglinksets.cpp | 45 +++++++++++++++++++++----- 1 file changed, 37 insertions(+), 8 deletions(-) (limited to 'indra/newview/llfloaterpathfindinglinksets.cpp') diff --git a/indra/newview/llfloaterpathfindinglinksets.cpp b/indra/newview/llfloaterpathfindinglinksets.cpp index 651be274d9..0fe0e151fb 100644 --- a/indra/newview/llfloaterpathfindinglinksets.cpp +++ b/indra/newview/llfloaterpathfindinglinksets.cpp @@ -500,6 +500,23 @@ bool LLFloaterPathfindingLinksets::isShowUnmodifiablePhantomWarning(LLPathfindin return isShowWarning; } +bool LLFloaterPathfindingLinksets::isShowPhantomToggleWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const +{ + bool isShowWarning = false; + + if (pLinksetUse != LLPathfindingLinkset::kUnknown) + { + LLPathfindingObjectListPtr selectedObjects = getSelectedObjects(); + if ((selectedObjects != NULL) && !selectedObjects->isEmpty()) + { + const LLPathfindingLinksetList *linksetList = dynamic_cast(selectedObjects.get()); + isShowWarning = linksetList->isShowPhantomToggleWarning(pLinksetUse); + } + } + + return isShowWarning; +} + bool LLFloaterPathfindingLinksets::isShowCannotBeVolumeWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const { bool isShowWarning = false; @@ -569,29 +586,41 @@ void LLFloaterPathfindingLinksets::applyEdit() { LLPathfindingLinkset::ELinksetUse linksetUse = getEditLinksetUse(); + bool showPhantomToggleWarning = isShowPhantomToggleWarning(linksetUse); bool showUnmodifiablePhantomWarning = isShowUnmodifiablePhantomWarning(linksetUse); bool showCannotBeVolumeWarning = isShowCannotBeVolumeWarning(linksetUse); - if (showUnmodifiablePhantomWarning || showCannotBeVolumeWarning) + if (showPhantomToggleWarning || showUnmodifiablePhantomWarning || showCannotBeVolumeWarning) { LLPathfindingLinkset::ELinksetUse restrictedLinksetUse = LLPathfindingLinkset::getLinksetUseWithToggledPhantom(linksetUse); LLSD substitutions; substitutions["REQUESTED_TYPE"] = getLinksetUseString(linksetUse); substitutions["RESTRICTED_TYPE"] = getLinksetUseString(restrictedLinksetUse); - std::string notificationName; - if (showUnmodifiablePhantomWarning && showCannotBeVolumeWarning) + // Build one of the following notifications names + // - PathfindingLinksets_WarnOnPhantom + // - PathfindingLinksets_WarnOnPhantom_MismatchOnRestricted + // - PathfindingLinksets_WarnOnPhantom_MismatchOnVolume + // - PathfindingLinksets_WarnOnPhantom_MismatchOnRestricted_MismatchOnVolume + // - PathfindingLinksets_MismatchOnRestricted + // - PathfindingLinksets_MismatchOnVolume + // - PathfindingLinksets_MismatchOnRestricted_MismatchOnVolume + + std::string notificationName = "PathfindingLinksets"; + + if (showPhantomToggleWarning) { - notificationName = "PathfindingLinksets_SetLinksetUseMismatchOnRestrictedAndVolume"; + notificationName += "_WarnOnPhantom"; } - else if (showUnmodifiablePhantomWarning) + if (showUnmodifiablePhantomWarning) { - notificationName = "PathfindingLinksets_SetLinksetUseMismatchOnRestricted"; + notificationName += "_MismatchOnRestricted"; } - else + if (showCannotBeVolumeWarning) { - notificationName = "PathfindingLinksets_SetLinksetUseMismatchOnVolume"; + notificationName += "_MismatchOnVolume"; } + LLNotificationsUtil::add(notificationName, substitutions, LLSD(), boost::bind(&LLFloaterPathfindingLinksets::handleApplyEdit, this, _1, _2)); } else -- cgit v1.2.3