diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llpanelpeoplemenus.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llviewermenu.cpp | 20 | ||||
-rw-r--r-- | indra/newview/llviewermenu.h | 1 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_people_nearby.xml | 10 |
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"> |