Add Move To to avatar right click menus

This commit is contained in:
Liru Færs
2020-01-05 16:25:55 -05:00
parent dd3944161d
commit 734621be82
4 changed files with 34 additions and 1 deletions

View File

@@ -322,6 +322,17 @@ bool is_nearby(const LLUUID& id)
return std::find(avatars.begin(), avatars.end(), id) != avatars.end();
}
const LLVector3d& get_av_pos(const LLUUID& id)
{
if (const auto inst = LLFloaterAvatarList::getIfExists())
if (const auto av = inst->getAvatarEntry(id))
return av->getPosition();
LLWorld::pos_map_t avatars;
LLWorld::instance().getAvatars(&avatars);
return avatars[id];
}
void track_av(const LLUUID& id)
{
if (auto inst = LLFloaterAvatarList::getIfExists())

View File

@@ -2873,7 +2873,8 @@ class LLGoToObject : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
return handle_go_to(LLToolPie::instance().getPick().mPosGlobal);
handle_go_to(LLToolPie::instance().getPick().mPosGlobal);
return true;
}
};
@@ -9388,6 +9389,17 @@ class ListIsNearby : public view_listener_t
}
};
const LLVector3d& get_av_pos(const LLUUID& id);
class ListGoTo : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
auto id = LFIDBearer::getActiveSelectedID();
handle_go_to(LFIDBearer::getActiveType() == LFIDBearer::AVATAR ? get_av_pos(id) : gObjectList.findObject(id)->getPositionGlobal());
return true;
}
};
void track_av(const LLUUID& id);
class ListTrack : public view_listener_t
{
@@ -9921,6 +9933,7 @@ void initialize_menus()
addMenu(new ListStartIM(), "List.StartIM");
addMenu(new ListAbuseReport(), "List.AbuseReport");
addMenu(new ListIsNearby, "List.IsNearby");
addMenu(new ListGoTo, "List.GoTo");
addMenu(new ListTrack, "List.Track");
addMenu(new ListEject(), "List.ParcelEject");
addMenu(new ListFreeze(), "List.Freeze");

View File

@@ -45,6 +45,11 @@
<on_click function="List.InviteToGroup"/>
<on_visible function="List.EnableAnySelected"/>
</menu_item_call>
<menu_item_call label="Move To" name="Move To">
<on_click function="List.GoTo"/>
<on_enable function="List.EnableSingleSelected"/>
<on_visible function="List.IsNearby"/>
</menu_item_call>
<menu_item_call label="Offer Teleport" name="Offer Teleport">
<on_click function="List.OfferTeleport"/>
<on_enable function="List.EnableAnySelected"/>

View File

@@ -45,6 +45,10 @@
<on_click function="List.InviteToGroup"/>
<on_visible function="List.EnableAnySelected"/>
</menu_item_call>
<menu_item_call label="Move To" name="Move To">
<on_click function="List.GoTo"/>
<on_enable function="List.EnableSingleSelected"/>
</menu_item_call>
<menu_item_call label="Offer Teleport" name="Offer Teleport">
<on_click function="List.OfferTeleport"/>
<on_enable function="List.EnableAnySelected"/>