Feature Request: "Focus on" button for Top Scripts
This commit is contained in:
@@ -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<LLScrollListCtrl>("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<LLScrollListCtrl>("objects_list")->getFirstSelected()->getUUID();
|
||||
gAgentCamera.setFocusGlobal(pos_global, id);
|
||||
}
|
||||
|
||||
void LLFloaterTopObjects::onKick()
|
||||
{
|
||||
LLScrollListCtrl* list = getChild<LLScrollListCtrl>("objects_list");
|
||||
|
||||
Reference in New Issue
Block a user