From 16299d3a3631e4c42367cf40410ad6995e585384 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Wed, 19 Jun 2024 15:06:46 +0800 Subject: "Teleport to" option in nearby tab of people window https://megapahit.com/show_bug.cgi?id=32 --- indra/newview/llpanelpeoplemenus.cpp | 2 ++ indra/newview/llviewermenu.cpp | 20 ++++++++++++++++++++ indra/newview/llviewermenu.h | 1 + .../skins/default/xui/en/menu_people_nearby.xml | 10 ++++++++++ 4 files changed, 33 insertions(+) (limited to 'indra/newview') 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 @@ -100,6 +100,16 @@ function="Avatar.EnableItem" parameter="can_zoom_in"/> + + + +