Add TP and Look options to area search (happy now?)

This commit is contained in:
Inusaito Sayori
2015-05-14 11:22:36 -04:00
parent 67836ecf67
commit 8e05524027
3 changed files with 34 additions and 16 deletions

View File

@@ -41,6 +41,7 @@
#include "lluictrlfactory.h"
#include "llagent.h"
#include "llagentcamera.h"
#include "lltracker.h"
#include "llviewerobjectlist.h"
@@ -84,6 +85,8 @@ BOOL JCFloaterAreaSearch::postBuild()
getChild<LLButton>("Refresh")->setClickedCallback(boost::bind(&JCFloaterAreaSearch::onRefresh,this));
getChild<LLButton>("Stop")->setClickedCallback(boost::bind(&JCFloaterAreaSearch::onStop,this));
getChild<LLButton>("TP")->setClickedCallback(boost::bind(&JCFloaterAreaSearch::teleportToSelected, this));
getChild<LLButton>("Look")->setClickedCallback(boost::bind(&JCFloaterAreaSearch::lookAtSelected, this));
getChild<LLFilterEditor>("Name query chunk")->setCommitCallback(boost::bind(&JCFloaterAreaSearch::onCommitLine,this,_1,_2,LIST_OBJECT_NAME));
getChild<LLFilterEditor>("Description query chunk")->setCommitCallback(boost::bind(&JCFloaterAreaSearch::onCommitLine,this,_1,_2,LIST_OBJECT_DESC));
@@ -113,22 +116,32 @@ void JCFloaterAreaSearch::checkRegion(bool force_clear)
}
}
LLViewerObject* JCFloaterAreaSearch::getSelectedObject()
{
if (LLScrollListItem* item = mResultList->getFirstSelected())
return gObjectList.findObject(item->getUUID());
return NULL;
}
void JCFloaterAreaSearch::onDoubleClick()
{
LLScrollListItem *item = mResultList->getFirstSelected();
if (!item) return;
LLUUID object_id = item->getUUID();
std::map<LLUUID,ObjectData>::iterator it = mCachedObjects.find(object_id);
if(it != mCachedObjects.end())
{
LLViewerObject* objectp = gObjectList.findObject(object_id);
if (objectp)
{
LLTracker::trackLocation(objectp->getPositionGlobal(), it->second.name, "", LLTracker::LOCATION_ITEM);
}
}
if (LLViewerObject* objectp = getSelectedObject())
LLTracker::trackLocation(objectp->getPositionGlobal(), mCachedObjects[objectp->getID()].name, "", LLTracker::LOCATION_ITEM);
}
void JCFloaterAreaSearch::teleportToSelected()
{
if (LLViewerObject* objectp = getSelectedObject())
gAgent.teleportViaLocation(objectp->getPositionGlobal());
}
void JCFloaterAreaSearch::lookAtSelected()
{
if (LLScrollListItem* item = mResultList->getFirstSelected())
gAgentCamera.lookAtObject(item->getUUID(), false);
}
void JCFloaterAreaSearch::onStop()
{
mStopped = true;

View File

@@ -72,7 +72,10 @@ private:
void onRefresh();
void onCommitLine(LLUICtrl* caller, const LLSD& value, OBJECT_COLUMN_ORDER type);
bool requestIfNeeded(LLUUID object_id);
class LLViewerObject* getSelectedObject();
void onDoubleClick();
void teleportToSelected();
void lookAtSelected();
LLTextBox* mCounterText;
LLScrollListCtrl* mResultList;
@@ -94,4 +97,4 @@ private:
std::string mFilterStrings[LIST_OBJECT_COUNT];
};
#endif
#endif

View File

@@ -39,12 +39,14 @@
<column name="Owner" label="Owner" dynamicwidth="true" tool_tip="Double click on any entry to get a position beacon"/>
<column name="Group" label="Group" dynamicwidth="true" tool_tip="Double click on any entry to get a position beacon"/>
</scroll_list>
<button name="TP" label="TP" height="20" width="40" left="10" bottom="6" follows="left|bottom"/>
<button name="Look" label="Look" height="20" width="60" left_delta="40" bottom="6" follows="left|bottom"/>
<button name="Refresh" label="Refresh" font="SansSerif" mouse_opaque="true"
height="20" width="80" left="10" bottom="6" follows="left|bottom"/>
height="20" width="80" left_delta="65" bottom="6" follows="left|bottom"/>
<button name="Stop" label="Stop" font="SansSerif" mouse_opaque="true"
height="20" width="80" left_delta="85" bottom="6" follows="left|bottom"/>
height="20" width="70" left_delta="80" bottom="6" follows="left|bottom"/>
<text name="counter"
height="15" width="220" left_delta="85" bottom="9" follows="left|bottom">
height="15" width="220" left_delta="75" bottom="9" follows="left|bottom">
Listed/Pending/Total
</text>
</floater>