diff options
Diffstat (limited to 'indra/newview/llfloaterpathfindingobjects.cpp')
-rw-r--r-- | indra/newview/llfloaterpathfindingobjects.cpp | 61 |
1 files changed, 48 insertions, 13 deletions
diff --git a/indra/newview/llfloaterpathfindingobjects.cpp b/indra/newview/llfloaterpathfindingobjects.cpp index 9bfbc582bd..e246265be9 100644 --- a/indra/newview/llfloaterpathfindingobjects.cpp +++ b/indra/newview/llfloaterpathfindingobjects.cpp @@ -1,6 +1,6 @@ /** * @file llfloaterpathfindingobjects.cpp -* @brief Implementation of llfloaterpathfindingobjects +* @brief Base class for both the pathfinding linksets and characters floater. * @author Stinson@lindenlab.com * * $LicenseInfo:firstyear=2012&license=viewerlgpl$ @@ -41,10 +41,12 @@ #include "llcheckboxctrl.h" #include "llenvmanager.h" #include "llfloater.h" +#include "llfontgl.h" #include "llnotifications.h" #include "llnotificationsutil.h" #include "llpathfindingmanager.h" #include "llresmgr.h" +#include "llscrolllistcell.h" #include "llscrolllistctrl.h" #include "llscrolllistitem.h" #include "llselectmgr.h" @@ -57,9 +59,9 @@ #include "llviewerobject.h" #include "llviewerobjectlist.h" #include "llviewerregion.h" +#include "v3dmath.h" +#include "v3math.h" #include "v4color.h" -#include "pipeline.h" -#include "llfloaterreg.h" #define DEFAULT_BEACON_WIDTH 6 @@ -346,10 +348,38 @@ void LLFloaterPathfindingObjects::rebuildObjectsScrollList() { LLSD scrollListData = convertObjectsIntoScrollListData(mObjectList); llassert(scrollListData.isArray()); - for (LLSD::array_const_iterator elementIter = scrollListData.beginArray(); elementIter != scrollListData.endArray(); ++elementIter) + + LLScrollListCell::Params cellParams; + cellParams.font = LLFontGL::getFontSansSerif(); + + for (LLSD::array_const_iterator rowElementIter = scrollListData.beginArray(); rowElementIter != scrollListData.endArray(); ++rowElementIter) { - const LLSD &element = *elementIter; - mObjectsScrollList->addElement(element); + const LLSD &rowElement = *rowElementIter; + + LLScrollListItem::Params rowParams; + llassert(rowElement.has("id")); + llassert(rowElement.get("id").isString()); + rowParams.value = rowElement.get("id"); + + llassert(rowElement.has("column")); + llassert(rowElement.get("column").isArray()); + const LLSD &columnElement = rowElement.get("column"); + for (LLSD::array_const_iterator cellIter = columnElement.beginArray(); cellIter != columnElement.endArray(); ++cellIter) + { + const LLSD &cellElement = *cellIter; + + llassert(cellElement.has("column")); + llassert(cellElement.get("column").isString()); + cellParams.column = cellElement.get("column").asString(); + + llassert(cellElement.has("value")); + llassert(cellElement.get("value").isString()); + cellParams.value = cellElement.get("value").asString(); + + rowParams.columns.add(cellParams); + } + + mObjectsScrollList->addRow(rowParams); } } @@ -488,14 +518,20 @@ void LLFloaterPathfindingObjects::teleportToSelectedObject() std::vector<LLScrollListItem*>::const_reference selectedItemRef = selectedItems.front(); const LLScrollListItem *selectedItem = selectedItemRef; llassert(mObjectList != NULL); - const LLPathfindingObjectPtr objectPtr = mObjectList->find(selectedItem->getUUID().asString()); - const LLVector3 &objectLocation = objectPtr->getLocation(); - - LLViewerRegion* region = gAgent.getRegion(); - if (region != NULL) + LLVector3d teleportLocation; + LLViewerObject *viewerObject = gObjectList.findObject(selectedItem->getUUID()); + if (viewerObject == NULL) { - gAgent.teleportRequest(region->getHandle(), objectLocation, true); + // If we cannot find the object in the viewer list, teleport to the last reported position + const LLPathfindingObjectPtr objectPtr = mObjectList->find(selectedItem->getUUID().asString()); + teleportLocation = gAgent.getPosGlobalFromAgent(objectPtr->getLocation()); } + else + { + // If we can find the object in the viewer list, teleport to the known current position + teleportLocation = viewerObject->getPositionGlobal(); + } + gAgent.teleportViaLocationLookAt(teleportLocation); } } @@ -828,4 +864,3 @@ LLPathfindingObjectPtr LLFloaterPathfindingObjects::findObject(const LLScrollLis return objectPtr; } - |