diff --git a/indra/newview/llfloatertopobjects.cpp b/indra/newview/llfloatertopobjects.cpp index 8c767e64b..ecde6b5b5 100644 --- a/indra/newview/llfloatertopobjects.cpp +++ b/indra/newview/llfloatertopobjects.cpp @@ -93,6 +93,7 @@ LLFloaterTopObjects::LLFloaterTopObjects() mCommitCallbackRegistrar.add("TopObjects.CommitObjectsList",boost::bind(&LLFloaterTopObjects::onCommitObjectsList, this)); mCommitCallbackRegistrar.add("TopObjects.TeleportToObject", boost::bind(&LLFloaterTopObjects::onTeleportToObject, this)); + mCommitCallbackRegistrar.add("TopObjects.CamToObject", boost::bind(&LLFloaterTopObjects::onCamToObject, this)); mCommitCallbackRegistrar.add("TopObjects.Kick", boost::bind(&LLFloaterTopObjects::onKick, this)); mCommitCallbackRegistrar.add("TopObjects.Profile", boost::bind(&LLFloaterTopObjects::onProfile, this)); @@ -522,26 +523,39 @@ void LLFloaterTopObjects::showBeacon() } } -void LLFloaterTopObjects::onTeleportToObject() +LLVector3d LLFloaterTopObjects::getSelectedPosition() const { LLScrollListCtrl* list = getChild("objects_list"); - if (!list) return; + if (!list) return LLVector3d::zero; LLScrollListItem* first_selected = list->getFirstSelected(); - if (!first_selected) return; + if (!first_selected) return LLVector3d::zero; std::string pos_string = first_selected->getColumn(3)->getValue().asString(); F32 x, y, z; S32 matched = sscanf(pos_string.c_str(), "<%g,%g,%g>", &x, &y, &z); - if (matched != 3) return; + if (matched != 3) return LLVector3d::zero; LLVector3 pos_agent(x, y, z); - LLVector3d pos_global = gAgent.getPosGlobalFromAgent(pos_agent); + return gAgent.getPosGlobalFromAgent(pos_agent); +} +void LLFloaterTopObjects::onTeleportToObject() +{ + LLVector3d pos_global = getSelectedPosition(); + if (pos_global.isExactlyZero()) return; gAgent.teleportViaLocation( pos_global ); } +void LLFloaterTopObjects::onCamToObject() +{ + LLVector3d pos_global = getSelectedPosition(); + if (pos_global.isExactlyZero()) return; + const LLUUID& id = getChild("objects_list")->getFirstSelected()->getUUID(); + gAgentCamera.setFocusGlobal(pos_global, id); +} + void LLFloaterTopObjects::onKick() { LLScrollListCtrl* list = getChild("objects_list"); diff --git a/indra/newview/llfloatertopobjects.h b/indra/newview/llfloatertopobjects.h index a69de5fc9..9f1b2794d 100644 --- a/indra/newview/llfloatertopobjects.h +++ b/indra/newview/llfloatertopobjects.h @@ -74,7 +74,9 @@ private: void onDisableAll(); void onDisableSelected(); + LLVector3d getSelectedPosition() const; void onTeleportToObject(); + void onCamToObject(); void onKick(); void onProfile(); diff --git a/indra/newview/skins/default/xui/en-us/floater_top_objects.xml b/indra/newview/skins/default/xui/en-us/floater_top_objects.xml index ec4f7d736..9e50500be 100644 --- a/indra/newview/skins/default/xui/en-us/floater_top_objects.xml +++ b/indra/newview/skins/default/xui/en-us/floater_top_objects.xml @@ -296,4 +296,15 @@ +