Add Follow to pie and right click UI menus for objects and avatars

This commit is contained in:
Liru Færs
2020-01-07 17:44:08 -05:00
parent 33feeb0a01
commit dfe8e364be
8 changed files with 54 additions and 9 deletions

View File

@@ -2505,15 +2505,22 @@ BOOL enable_has_attachments(void*)
//---------------------------------------------------------------------------
// Avatar pie menu
//---------------------------------------------------------------------------
//void handle_follow(void *userdata)
//{
// // follow a given avatar by ID
// LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
// if (objectp)
// {
// gAgent.startFollowPilot(objectp->getID());
// }
//}
class LLObjectFollow : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
// follow a given avatar by ID
LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
if (objectp)
{
if (auto av = objectp->getAvatarAncestor()) // Follow the avatar, not a control avatar or an attachment, if possible
objectp = av;
gAgent.startFollowPilot(objectp->getID(), true, 1.0f);
}
return true;
}
};
bool enable_object_mute()
{
@@ -9401,6 +9408,15 @@ class ListIsNearby : public view_listener_t
}
};
class ListFollow : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
gAgent.startFollowPilot(LFIDBearer::getActiveSelectedID(), true, 1.0f);
return true;
}
};
class ListGoTo : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
@@ -9813,6 +9829,7 @@ void initialize_menus()
addMenu(new LLOHGOD(), "Object.EnableExplode");
add_wave_listeners();
add_dae_listeners();
addMenu(new LLObjectFollow(), "Object.Follow");
// </edit>
addMenu(new LLObjectMute(), "Object.Mute");
addMenu(new LLObjectBuy(), "Object.Buy");
@@ -9945,6 +9962,7 @@ void initialize_menus()
addMenu(new ListTeleportTo, "List.TeleportTo");
addMenu(new ListAbuseReport(), "List.AbuseReport");
addMenu(new ListIsNearby, "List.IsNearby");
addMenu(new ListFollow, "List.Follow");
addMenu(new ListGoTo, "List.GoTo");
addMenu(new ListTrack, "List.Track");
addMenu(new ListEject(), "List.ParcelEject");

View File

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

View File

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

View File

@@ -67,6 +67,9 @@
<on_click function="ShowFloater" userdata="show inspect" />
<on_enable function="Object.EnableInspect" />
</menu_item_call>
<menu_item_call label="Follow" name="Follow">
<on_click function="Object.Follow"/>
</menu_item_call>
</pie_menu>
<menu_item_call enabled="false" label="Send IM..." mouse_opaque="true" name="Send IM...">
<on_click function="Avatar.SendIM" />

View File

@@ -79,6 +79,9 @@
<menu_item_separator />
<menu_item_call enabled="true" label="Reload" mouse_opaque="true" name="Reload Textures">
<on_click function="Object.ReloadTextures" />
</menu_item_call>
<menu_item_call label="Follow" name="Follow">
<on_click function="Object.Follow"/>
</menu_item_call>
</pie_menu>
<menu_item_call enabled="false" label="Mute" mouse_opaque="true" name="Object Mute">

View File

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

View File

@@ -33,6 +33,10 @@
<menu_item_call label="Invite To Group" name="Invite To Group">
<on_click function="List.InviteToGroup"/>
</menu_item_call>
<menu_item_call label="Follow" name="Follow">
<on_click function="List.Follow"/>
<on_visible function="List.IsNearby"/>
</menu_item_call>
<menu_item_call label="Move To" name="Move To">
<on_click function="List.GoTo"/>
<on_enable function="List.EnableSingleSelected"/>

View File

@@ -40,6 +40,10 @@
<menu_item_call.on_click
function="Text.Url" userdata="Teleport" />
</menu_item_call>
<menu_item_call label="Follow" name="Follow">
<on_click function="List.Follow"/>
<on_visible function="List.IsNearby"/>
</menu_item_call>
<menu_item_call label="Move To" name="Move To">
<on_click function="List.GoTo"/>
<on_visible function="List.IsNearby"/>