summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterpathfindingobjects.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloaterpathfindingobjects.cpp')
-rw-r--r--indra/newview/llfloaterpathfindingobjects.cpp424
1 files changed, 271 insertions, 153 deletions
diff --git a/indra/newview/llfloaterpathfindingobjects.cpp b/indra/newview/llfloaterpathfindingobjects.cpp
index 572f2f707e..20c1215bcb 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$
@@ -29,18 +29,26 @@
#include "llfloaterpathfindingobjects.h"
+#include <string>
+#include <map>
#include <vector>
#include <boost/bind.hpp>
#include <boost/signals2.hpp>
#include "llagent.h"
+#include "llavatarname.h"
+#include "llavatarnamecache.h"
#include "llbutton.h"
#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"
@@ -53,14 +61,12 @@
#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
-LLHandle<LLFloaterPathfindingObjects> LLFloaterPathfindingObjects::sInstanceHandle;
-
//---------------------------------------------------------------------------
// LLFloaterPathfindingObjects
//---------------------------------------------------------------------------
@@ -74,7 +80,7 @@ void LLFloaterPathfindingObjects::onOpen(const LLSD &pKey)
if (!mSelectionUpdateSlot.connected())
{
- mSelectionUpdateSlot = LLSelectMgr::getInstance()->mUpdateSignal.connect(boost::bind(&LLFloaterPathfindingObjects::onSelectionListChanged, this));
+ mSelectionUpdateSlot = LLSelectMgr::getInstance()->mUpdateSignal.connect(boost::bind(&LLFloaterPathfindingObjects::onInWorldSelectionListChanged, this));
}
if (!mRegionBoundaryCrossingSlot.connected())
@@ -82,11 +88,21 @@ void LLFloaterPathfindingObjects::onOpen(const LLSD &pKey)
mRegionBoundaryCrossingSlot = LLEnvManagerNew::getInstance()->setRegionChangeCallback(boost::bind(&LLFloaterPathfindingObjects::onRegionBoundaryCrossed, this));
}
+ if (!mGodLevelChangeSlot.connected())
+ {
+ mGodLevelChangeSlot = gAgent.registerGodLevelChanageListener(boost::bind(&LLFloaterPathfindingObjects::onGodLevelChange, this, _1));
+ }
+
requestGetObjects();
}
void LLFloaterPathfindingObjects::onClose(bool pIsAppQuitting)
{
+ if (mGodLevelChangeSlot.connected())
+ {
+ mGodLevelChangeSlot.disconnect();
+ }
+
if (mRegionBoundaryCrossingSlot.connected())
{
mRegionBoundaryCrossingSlot.disconnect();
@@ -104,6 +120,11 @@ void LLFloaterPathfindingObjects::onClose(bool pIsAppQuitting)
{
mObjectsSelection.clear();
}
+
+ if (pIsAppQuitting)
+ {
+ clearAllObjects();
+ }
}
void LLFloaterPathfindingObjects::draw()
@@ -148,7 +169,6 @@ LLFloaterPathfindingObjects::LLFloaterPathfindingObjects(const LLSD &pSeed)
mSelectAllButton(NULL),
mSelectNoneButton(NULL),
mShowBeaconCheckBox(NULL),
- mShowPhysicsCapsuleCheckBox(NULL),
mTakeButton(NULL),
mTakeCopyButton(NULL),
mReturnButton(NULL),
@@ -160,17 +180,19 @@ LLFloaterPathfindingObjects::LLFloaterPathfindingObjects(const LLSD &pSeed)
mWarningTextColor(),
mMessagingState(kMessagingUnknown),
mMessagingRequestId(0U),
+ mMissingNameObjectsScrollListItems(),
mObjectList(),
mObjectsSelection(),
+ mHasObjectsToBeSelected(false),
+ mObjectsToBeSelected(),
mSelectionUpdateSlot(),
- mRegionBoundaryCrossingSlot(),
- mSelfHandle()
+ mRegionBoundaryCrossingSlot()
{
- mSelfHandle.bind(this);
}
LLFloaterPathfindingObjects::~LLFloaterPathfindingObjects()
{
+ clearAllObjects();
}
BOOL LLFloaterPathfindingObjects::postBuild()
@@ -203,10 +225,6 @@ BOOL LLFloaterPathfindingObjects::postBuild()
mShowBeaconCheckBox = findChild<LLCheckBoxCtrl>("show_beacon");
llassert(mShowBeaconCheckBox != NULL);
- mShowPhysicsCapsuleCheckBox = findChild<LLCheckBoxCtrl>("show_physics_capsule");
- llassert(mShowPhysicsCapsuleCheckBox != NULL);
- mShowPhysicsCapsuleCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingObjects::onShowPhysicsCapsuleClicked, this));
-
mTakeButton = findChild<LLButton>("take_objects");
llassert(mTakeButton != NULL);
mTakeButton->setCommitCallback(boost::bind(&LLFloaterPathfindingObjects::onTakeClicked, this));
@@ -232,6 +250,7 @@ BOOL LLFloaterPathfindingObjects::postBuild()
void LLFloaterPathfindingObjects::requestGetObjects()
{
+ llassert(0);
}
LLPathfindingManager::request_id_t LLFloaterPathfindingObjects::getNewRequestId()
@@ -273,13 +292,14 @@ void LLFloaterPathfindingObjects::handleNewObjectList(LLPathfindingManager::requ
void LLFloaterPathfindingObjects::handleUpdateObjectList(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::ERequestStatus pRequestStatus, LLPathfindingObjectListPtr pObjectList)
{
+ // We current assume that handleUpdateObjectList is called only when objects are being SET
llassert(pRequestId <= mMessagingRequestId);
if (pRequestId == mMessagingRequestId)
{
switch (pRequestStatus)
{
case LLPathfindingManager::kRequestStarted :
- setMessagingState(kMessagingGetRequestSent);
+ setMessagingState(kMessagingSetRequestSent);
break;
case LLPathfindingManager::kRequestCompleted :
if (mObjectList == NULL)
@@ -298,10 +318,12 @@ void LLFloaterPathfindingObjects::handleUpdateObjectList(LLPathfindingManager::r
setMessagingState(kMessagingNotEnabled);
break;
case LLPathfindingManager::kRequestError :
- setMessagingState(kMessagingGetError);
+ clearAllObjects();
+ setMessagingState(kMessagingSetError);
break;
default :
- setMessagingState(kMessagingGetError);
+ clearAllObjects();
+ setMessagingState(kMessagingSetError);
llassert(0);
break;
}
@@ -310,85 +332,97 @@ void LLFloaterPathfindingObjects::handleUpdateObjectList(LLPathfindingManager::r
void LLFloaterPathfindingObjects::rebuildObjectsScrollList()
{
- std::vector<LLScrollListItem*> selectedItems = mObjectsScrollList->getAllSelected();
- int numSelectedItems = selectedItems.size();
- uuid_vec_t selectedUUIDs;
- if (numSelectedItems > 0)
+ if (!mHasObjectsToBeSelected)
{
- selectedUUIDs.reserve(selectedItems.size());
- for (std::vector<LLScrollListItem*>::const_iterator itemIter = selectedItems.begin();
- itemIter != selectedItems.end(); ++itemIter)
+ std::vector<LLScrollListItem*> selectedItems = mObjectsScrollList->getAllSelected();
+ int numSelectedItems = selectedItems.size();
+ if (numSelectedItems > 0)
{
- const LLScrollListItem *listItem = *itemIter;
- selectedUUIDs.push_back(listItem->getUUID());
+ mObjectsToBeSelected.reserve(selectedItems.size());
+ for (std::vector<LLScrollListItem*>::const_iterator itemIter = selectedItems.begin();
+ itemIter != selectedItems.end(); ++itemIter)
+ {
+ const LLScrollListItem *listItem = *itemIter;
+ mObjectsToBeSelected.push_back(listItem->getUUID());
+ }
}
}
S32 origScrollPosition = mObjectsScrollList->getScrollPos();
mObjectsScrollList->deleteAllItems();
+ mMissingNameObjectsScrollListItems.clear();
if ((mObjectList != NULL) && !mObjectList->isEmpty())
{
- LLSD scrollListData = convertObjectsIntoScrollListData(mObjectList);
- llassert(scrollListData.isArray());
- for (LLSD::array_const_iterator elementIter = scrollListData.beginArray(); elementIter != scrollListData.endArray(); ++elementIter)
+ buildObjectsScrollList(mObjectList);
+
+ mObjectsScrollList->selectMultiple(mObjectsToBeSelected);
+ if (mHasObjectsToBeSelected)
+ {
+ mObjectsScrollList->scrollToShowSelected();
+ }
+ else
{
- const LLSD &element = *elementIter;
- mObjectsScrollList->addElement(element);
+ mObjectsScrollList->setScrollPos(origScrollPosition);
}
}
- mObjectsScrollList->selectMultiple(selectedUUIDs);
- mObjectsScrollList->setScrollPos(origScrollPosition);
- updateControls();
+ mObjectsToBeSelected.clear();
+ mHasObjectsToBeSelected = false;
+
+ updateControlsOnScrollListChange();
}
-LLSD LLFloaterPathfindingObjects::convertObjectsIntoScrollListData(const LLPathfindingObjectListPtr pObjectListPtr) const
+void LLFloaterPathfindingObjects::buildObjectsScrollList(const LLPathfindingObjectListPtr pObjectListPtr)
{
llassert(0);
- LLSD nullObjs = LLSD::emptyArray();
- return nullObjs;
}
-void LLFloaterPathfindingObjects::updateControls()
+void LLFloaterPathfindingObjects::addObjectToScrollList(const LLPathfindingObjectPtr pObjectPtr, const LLSD &pScrollListItemData)
{
- updateMessagingStatus();
- updateStateOnListActionControls();
- updateStateOnEditFields();
-}
+ LLScrollListCell::Params cellParams;
+ cellParams.font = LLFontGL::getFontSansSerif();
-void LLFloaterPathfindingObjects::updateSelection()
-{
- mObjectsSelection.clear();
- LLSelectMgr::getInstance()->deselectAll();
+ LLScrollListItem::Params rowParams;
+ rowParams.value = pObjectPtr->getUUID().asString();
- std::vector<LLScrollListItem *> selectedItems = mObjectsScrollList->getAllSelected();
- if (!selectedItems.empty())
+ llassert(pScrollListItemData.isArray());
+ for (LLSD::array_const_iterator cellIter = pScrollListItemData.beginArray();
+ cellIter != pScrollListItemData.endArray(); ++cellIter)
{
- int numSelectedItems = selectedItems.size();
+ const LLSD &cellElement = *cellIter;
- std::vector<LLViewerObject *>viewerObjects;
- viewerObjects.reserve(numSelectedItems);
+ llassert(cellElement.has("column"));
+ llassert(cellElement.get("column").isString());
+ cellParams.column = cellElement.get("column").asString();
- for (std::vector<LLScrollListItem *>::const_iterator selectedItemIter = selectedItems.begin();
- selectedItemIter != selectedItems.end(); ++selectedItemIter)
- {
- const LLScrollListItem *selectedItem = *selectedItemIter;
+ llassert(cellElement.has("value"));
+ llassert(cellElement.get("value").isString());
+ cellParams.value = cellElement.get("value").asString();
- LLViewerObject *viewerObject = gObjectList.findObject(selectedItem->getUUID());
- if (viewerObject != NULL)
- {
- viewerObjects.push_back(viewerObject);
- }
- }
+ rowParams.columns.add(cellParams);
+ }
- if (!viewerObjects.empty())
- {
- mObjectsSelection = LLSelectMgr::getInstance()->selectObjectAndFamily(viewerObjects);
- }
+ LLScrollListItem *scrollListItem = mObjectsScrollList->addRow(rowParams);
+
+ if (pObjectPtr->hasOwner() && !pObjectPtr->hasOwnerName())
+ {
+ mMissingNameObjectsScrollListItems.insert(std::make_pair<std::string, LLScrollListItem *>(pObjectPtr->getUUID().asString(), scrollListItem));
+ pObjectPtr->registerOwnerNameListener(boost::bind(&LLFloaterPathfindingObjects::handleObjectNameResponse, this, _1));
}
+}
+
+void LLFloaterPathfindingObjects::updateControlsOnScrollListChange()
+{
+ updateMessagingStatus();
+ updateStateOnListControls();
+ selectScrollListItemsInWorld();
+ updateStateOnActionControls();
+}
- updateControls();
+void LLFloaterPathfindingObjects::updateControlsOnInWorldSelectionChange()
+{
+ updateStateOnActionControls();
}
S32 LLFloaterPathfindingObjects::getNameColumnIndex() const
@@ -396,6 +430,18 @@ S32 LLFloaterPathfindingObjects::getNameColumnIndex() const
return 0;
}
+S32 LLFloaterPathfindingObjects::getOwnerNameColumnIndex() const
+{
+ return 2;
+}
+
+std::string LLFloaterPathfindingObjects::getOwnerName(const LLPathfindingObject *pObject) const
+{
+ llassert(0);
+ std::string returnVal;
+ return returnVal;
+}
+
const LLColor4 &LLFloaterPathfindingObjects::getBeaconColor() const
{
return mDefaultBeaconColor;
@@ -411,6 +457,44 @@ S32 LLFloaterPathfindingObjects::getBeaconWidth() const
return DEFAULT_BEACON_WIDTH;
}
+void LLFloaterPathfindingObjects::showFloaterWithSelectionObjects()
+{
+ mObjectsToBeSelected.clear();
+
+ LLObjectSelectionHandle selectedObjectsHandle = LLSelectMgr::getInstance()->getSelection();
+ if (selectedObjectsHandle.notNull())
+ {
+ LLObjectSelection *selectedObjects = selectedObjectsHandle.get();
+ if (!selectedObjects->isEmpty())
+ {
+ for (LLObjectSelection::valid_iterator objectIter = selectedObjects->valid_begin();
+ objectIter != selectedObjects->valid_end(); ++objectIter)
+ {
+ LLSelectNode *object = *objectIter;
+ LLViewerObject *viewerObject = object->getObject();
+ mObjectsToBeSelected.push_back(viewerObject->getID());
+ }
+ }
+ }
+ mHasObjectsToBeSelected = true;
+
+ if (!isShown())
+ {
+ openFloater();
+ setVisibleAndFrontmost();
+ }
+ else
+ {
+ rebuildObjectsScrollList();
+ if (isMinimized())
+ {
+ setMinimized(FALSE);
+ }
+ setVisibleAndFrontmost();
+ }
+ setFocus(TRUE);
+}
+
BOOL LLFloaterPathfindingObjects::isShowBeacons() const
{
return mShowBeaconCheckBox->get();
@@ -419,7 +503,8 @@ BOOL LLFloaterPathfindingObjects::isShowBeacons() const
void LLFloaterPathfindingObjects::clearAllObjects()
{
selectNoneObjects();
- mObjectsScrollList->clear();
+ mObjectsScrollList->deleteAllItems();
+ mMissingNameObjectsScrollListItems.clear();
mObjectList.reset();
}
@@ -442,14 +527,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)
+ {
+ // 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
{
- gAgent.teleportRequest(region->getHandle(), objectLocation, true);
+ // If we can find the object in the viewer list, teleport to the known current position
+ teleportLocation = viewerObject->getPositionGlobal();
}
+ gAgent.teleportViaLocationLookAt(teleportLocation);
}
}
@@ -507,7 +598,7 @@ LLFloaterPathfindingObjects::EMessagingState LLFloaterPathfindingObjects::getMes
void LLFloaterPathfindingObjects::setMessagingState(EMessagingState pMessagingState)
{
mMessagingState = pMessagingState;
- updateControls();
+ updateControlsOnScrollListChange();
}
void LLFloaterPathfindingObjects::onRefreshObjectsClicked()
@@ -528,6 +619,7 @@ void LLFloaterPathfindingObjects::onSelectNoneObjectsClicked()
void LLFloaterPathfindingObjects::onTakeClicked()
{
handle_take();
+ requestGetObjects();
}
void LLFloaterPathfindingObjects::onTakeCopyClicked()
@@ -537,12 +629,42 @@ void LLFloaterPathfindingObjects::onTakeCopyClicked()
void LLFloaterPathfindingObjects::onReturnClicked()
{
- handle_object_return();
+ LLNotification::Params params("PathfindingReturnMultipleItems");
+ params.functor.function(boost::bind(&LLFloaterPathfindingObjects::handleReturnItemsResponse, this, _1, _2));
+
+ LLSD substitutions;
+ int numItems = getNumSelectedObjects();
+ substitutions["NUM_ITEMS"] = static_cast<LLSD::Integer>(numItems);
+ params.substitutions = substitutions;
+
+ if (numItems == 1)
+ {
+ LLNotifications::getInstance()->forceResponse(params, 0);
+ }
+ else if (numItems > 1)
+ {
+ LLNotifications::getInstance()->add(params);
+ }
}
void LLFloaterPathfindingObjects::onDeleteClicked()
{
- handle_object_delete();
+ LLNotification::Params params("PathfindingDeleteMultipleItems");
+ params.functor.function(boost::bind(&LLFloaterPathfindingObjects::handleDeleteItemsResponse, this, _1, _2));
+
+ LLSD substitutions;
+ int numItems = getNumSelectedObjects();
+ substitutions["NUM_ITEMS"] = static_cast<LLSD::Integer>(numItems);
+ params.substitutions = substitutions;
+
+ if (numItems == 1)
+ {
+ LLNotifications::getInstance()->forceResponse(params, 0);
+ }
+ else if (numItems > 1)
+ {
+ LLNotifications::getInstance()->add(params);
+ }
}
void LLFloaterPathfindingObjects::onTeleportClicked()
@@ -552,12 +674,12 @@ void LLFloaterPathfindingObjects::onTeleportClicked()
void LLFloaterPathfindingObjects::onScrollListSelectionChanged()
{
- updateSelection();
+ updateControlsOnScrollListChange();
}
-void LLFloaterPathfindingObjects::onSelectionListChanged()
+void LLFloaterPathfindingObjects::onInWorldSelectionListChanged()
{
- updateControls();
+ updateControlsOnInWorldSelectionChange();
}
void LLFloaterPathfindingObjects::onRegionBoundaryCrossed()
@@ -565,6 +687,30 @@ void LLFloaterPathfindingObjects::onRegionBoundaryCrossed()
requestGetObjects();
}
+void LLFloaterPathfindingObjects::onGodLevelChange(U8 pGodLevel)
+{
+ requestGetObjects();
+}
+
+void LLFloaterPathfindingObjects::handleObjectNameResponse(const LLPathfindingObject *pObject)
+{
+ llassert(pObject != NULL);
+ const std::string uuid = pObject->getUUID().asString();
+ scroll_list_item_map::iterator scrollListItemIter = mMissingNameObjectsScrollListItems.find(uuid);
+ if (scrollListItemIter != mMissingNameObjectsScrollListItems.end())
+ {
+ LLScrollListItem *scrollListItem = scrollListItemIter->second;
+ llassert(scrollListItem != NULL);
+
+ LLScrollListCell *scrollListCell = scrollListItem->getColumn(getOwnerNameColumnIndex());
+ LLSD ownerName = getOwnerName(pObject);
+
+ scrollListCell->setValue(ownerName);
+
+ mMissingNameObjectsScrollListItems.erase(scrollListItemIter);
+ }
+}
+
void LLFloaterPathfindingObjects::updateMessagingStatus()
{
std::string statusText("");
@@ -629,7 +775,7 @@ void LLFloaterPathfindingObjects::updateMessagingStatus()
mMessagingStatus->setText((LLStringExplicit)statusText, styleParams);
}
-void LLFloaterPathfindingObjects::updateStateOnListActionControls()
+void LLFloaterPathfindingObjects::updateStateOnListControls()
{
switch (getMessagingState())
{
@@ -662,13 +808,12 @@ void LLFloaterPathfindingObjects::updateStateOnListActionControls()
}
}
-void LLFloaterPathfindingObjects::updateStateOnEditFields()
+void LLFloaterPathfindingObjects::updateStateOnActionControls()
{
int numSelectedItems = mObjectsScrollList->getNumSelected();
bool isEditEnabled = (numSelectedItems > 0);
mShowBeaconCheckBox->setEnabled(isEditEnabled);
- //prep#mShowPhysicsCapsuleCheckBox->setEnabled( false );
mTakeButton->setEnabled(isEditEnabled && visible_take_object());
mTakeCopyButton->setEnabled(isEditEnabled && enable_object_take_copy());
mReturnButton->setEnabled(isEditEnabled && enable_object_return());
@@ -676,91 +821,64 @@ void LLFloaterPathfindingObjects::updateStateOnEditFields()
mTeleportButton->setEnabled(numSelectedItems == 1);
}
-LLPathfindingObjectPtr LLFloaterPathfindingObjects::findObject(const LLScrollListItem *pListItem) const
+void LLFloaterPathfindingObjects::selectScrollListItemsInWorld()
{
- LLPathfindingObjectPtr objectPtr;
+ mObjectsSelection.clear();
+ LLSelectMgr::getInstance()->deselectAll();
- LLUUID uuid = pListItem->getUUID();
- const std::string &uuidString = uuid.asString();
- llassert(mObjectList != NULL);
- objectPtr = mObjectList->find(uuidString);
+ std::vector<LLScrollListItem *> selectedItems = mObjectsScrollList->getAllSelected();
+ if (!selectedItems.empty())
+ {
+ int numSelectedItems = selectedItems.size();
- return objectPtr;
-}
+ std::vector<LLViewerObject *>viewerObjects;
+ viewerObjects.reserve(numSelectedItems);
-void LLFloaterPathfindingObjects::onShowPhysicsCapsuleClicked()
-{
- if ( mShowPhysicsCapsuleCheckBox->get() )
- {
- //We want to hide the VO and display the the objects physics capsule
- LLVector3 pos;
- LLUUID id = getUUIDFromSelection( pos );
- if ( id.notNull() )
+ for (std::vector<LLScrollListItem *>::const_iterator selectedItemIter = selectedItems.begin();
+ selectedItemIter != selectedItems.end(); ++selectedItemIter)
{
- gPipeline.hideObject( id );
- }
- }
- else
- {
- //We want to restore the selected objects vo and disable the physics capsule rendering
- LLVector3 pos;
- LLUUID id = getUUIDFromSelection( pos );
- if ( id.notNull() )
- {
- gPipeline.restoreHiddenObject( id );
- }
- }
-}
-
-BOOL LLFloaterPathfindingObjects::isPhysicsCapsuleEnabled( LLUUID& id, LLVector3& pos )
-{
- BOOL result = false;
- if ( mShowPhysicsCapsuleCheckBox->get() )
- {
- id = getUUIDFromSelection( pos );
- result = true;
- }
- else
- {
- id.setNull();
- }
- return result;
-}
+ const LLScrollListItem *selectedItem = *selectedItemIter;
-LLUUID LLFloaterPathfindingObjects::getUUIDFromSelection( LLVector3& pos )
-{
- std::vector<LLScrollListItem*> selectedItems = mObjectsScrollList->getAllSelected();
- if ( selectedItems.size() > 1 )
- {
- return LLUUID::null;
- }
- if (selectedItems.size() == 1)
- {
- std::vector<LLScrollListItem*>::const_reference selectedItemRef = selectedItems.front();
- const LLScrollListItem *selectedItem = selectedItemRef;
- llassert(mObjectList != NULL);
- LLViewerObject *viewerObject = gObjectList.findObject( selectedItem->getUUID() );
- if ( viewerObject != NULL )
+ LLViewerObject *viewerObject = gObjectList.findObject(selectedItem->getUUID());
+ if (viewerObject != NULL)
+ {
+ viewerObjects.push_back(viewerObject);
+ }
+ }
+
+ if (!viewerObjects.empty())
{
- pos = viewerObject->getRenderPosition();
+ mObjectsSelection = LLSelectMgr::getInstance()->selectObjectAndFamily(viewerObjects);
}
- //prep#llinfos<<"id : "<<selectedItem->getUUID()<<llendl;
- return selectedItem->getUUID();
}
+}
- return LLUUID::null;
+void LLFloaterPathfindingObjects::handleReturnItemsResponse(const LLSD &pNotification, const LLSD &pResponse)
+{
+ if (LLNotificationsUtil::getSelectedOption(pNotification, pResponse) == 0)
+ {
+ handle_object_return();
+ requestGetObjects();
+ }
}
-LLHandle<LLFloaterPathfindingObjects> LLFloaterPathfindingObjects::getInstanceHandle()
+void LLFloaterPathfindingObjects::handleDeleteItemsResponse(const LLSD &pNotification, const LLSD &pResponse)
{
- if ( sInstanceHandle.isDead() )
+ if (LLNotificationsUtil::getSelectedOption(pNotification, pResponse) == 0)
{
- LLFloaterPathfindingObjects *floaterInstance = LLFloaterReg::getTypedInstance<LLFloaterPathfindingObjects>("pathfinding_characters");
- if (floaterInstance != NULL)
- {
- sInstanceHandle = floaterInstance->mSelfHandle;
- }
+ handle_object_delete();
+ requestGetObjects();
}
+}
- return sInstanceHandle;
+LLPathfindingObjectPtr LLFloaterPathfindingObjects::findObject(const LLScrollListItem *pListItem) const
+{
+ LLPathfindingObjectPtr objectPtr;
+
+ LLUUID uuid = pListItem->getUUID();
+ const std::string &uuidString = uuid.asString();
+ llassert(mObjectList != NULL);
+ objectPtr = mObjectList->find(uuidString);
+
+ return objectPtr;
}