summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2024-06-19 15:06:46 +0800
committerErik Kundiman <erik@megapahit.org>2024-06-19 15:06:46 +0800
commit16299d3a3631e4c42367cf40410ad6995e585384 (patch)
tree46a0bf946843d00d724a12fa4adcd2b59904944b
parent26f40db209589d9cdff32887e027f13cf77a8d17 (diff)
"Teleport to" option in nearby tab of people window
https://megapahit.com/show_bug.cgi?id=32
-rw-r--r--indra/newview/llpanelpeoplemenus.cpp2
-rw-r--r--indra/newview/llviewermenu.cpp20
-rw-r--r--indra/newview/llviewermenu.h1
-rw-r--r--indra/newview/skins/default/xui/en/menu_people_nearby.xml10
4 files changed, 33 insertions, 0 deletions
diff --git a/indra/newview/llpanelpeoplemenus.cpp b/indra/newview/llpanelpeoplemenus.cpp
index 172c7d0828..1719f1b4aa 100644
--- a/indra/newview/llpanelpeoplemenus.cpp
+++ b/indra/newview/llpanelpeoplemenus.cpp
@@ -74,6 +74,7 @@ LLContextMenu* PeopleContextMenu::createMenu()
registrar.add("Avatar.Call", boost::bind(&LLAvatarActions::startCall, id));
registrar.add("Avatar.OfferTeleport", boost::bind(&PeopleContextMenu::offerTeleport, this));
registrar.add("Avatar.ZoomIn", boost::bind(&handle_zoom_to_object, id));
+ registrar.add("Avatar.TeleportTo", boost::bind(&handle_teleport_to_object, id));
registrar.add("Avatar.ShowOnMap", boost::bind(&LLAvatarActions::showOnMap, id));
registrar.add("Avatar.Share", boost::bind(&LLAvatarActions::share, id));
registrar.add("Avatar.Pay", boost::bind(&LLAvatarActions::pay, id));
@@ -401,6 +402,7 @@ void NearbyPeopleContextMenu::buildContextMenu(class LLMenuGL& menu, U32 flags)
items.push_back(std::string("invite_to_group"));
items.push_back(std::string("separator_invite_to_group"));
items.push_back(std::string("zoom_in"));
+ items.push_back(std::string("teleport_to"));
items.push_back(std::string("map"));
items.push_back(std::string("share"));
items.push_back(std::string("pay"));
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 4dcfb18b30..2ca27e0e1a 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -6454,6 +6454,26 @@ void handle_zoom_to_object(LLUUID object_id)
}
}
+void handle_teleport_to_object(LLUUID object_id)
+{
+ LLViewerObject* object = gObjectList.findObject(object_id);
+
+ if (object)
+ {
+ gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE);
+
+ LLBBox bbox = object->getBoundingBoxAgent() ;
+
+ LLVector3 obj_to_cam = LLViewerCamera::getInstance()->getOrigin() - bbox.getCenterAgent();
+ obj_to_cam.normVec();
+
+
+ LLVector3d object_center_global = gAgent.getPosGlobalFromAgent(bbox.getCenterAgent());
+
+ gAgent.teleportViaLocation(object_center_global);
+ }
+}
+
class LLAvatarInviteToGroup : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
diff --git a/indra/newview/llviewermenu.h b/indra/newview/llviewermenu.h
index 6683c5f2e6..f4f48d88c0 100644
--- a/indra/newview/llviewermenu.h
+++ b/indra/newview/llviewermenu.h
@@ -107,6 +107,7 @@ void handle_take();
void handle_take_copy();
void handle_look_at_selection(const LLSD& param);
void handle_zoom_to_object(LLUUID object_id);
+void handle_teleport_to_object(LLUUID object_id);
void handle_object_return();
void handle_object_delete();
void handle_object_edit();
diff --git a/indra/newview/skins/default/xui/en/menu_people_nearby.xml b/indra/newview/skins/default/xui/en/menu_people_nearby.xml
index 7bd2c845a6..b7a296bf31 100644
--- a/indra/newview/skins/default/xui/en/menu_people_nearby.xml
+++ b/indra/newview/skins/default/xui/en/menu_people_nearby.xml
@@ -101,6 +101,16 @@
parameter="can_zoom_in"/>
</menu_item_call>
<menu_item_call
+ label="Teleport To"
+ layout="topleft"
+ name="teleport_to">
+ <menu_item_call.on_click
+ function="Avatar.TeleportTo" />
+ <menu_item_call.on_enable
+ function="Avatar.EnableItem"
+ parameter="can_zoom_in"/>
+ </menu_item_call>
+ <menu_item_call
label="Map"
layout="topleft"
name="map">