From b00126366c7b8315af3e7383cc3fd2ee421076f3 Mon Sep 17 00:00:00 2001 From: Rye Mutt <rye@alchemyviewer.org> Date: Sat, 19 Mar 2022 15:31:57 -0400 Subject: [PATCH] Prep for opensim slurl support --- indra/newview/llfloaterexperienceprofile.cpp | 2 +- indra/newview/llfloaterworldmap.cpp | 10 ++++++---- indra/newview/lllandmarkactions.cpp | 16 ++++++---------- indra/newview/llnamebox.cpp | 5 +++-- indra/newview/llpanelplaceprofile.cpp | 5 +++-- indra/newview/llpanelplacestab.cpp | 7 +++---- 6 files changed, 22 insertions(+), 23 deletions(-) diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp index a99a096ea7b..044acb7d338 100644 --- a/indra/newview/llfloaterexperienceprofile.cpp +++ b/indra/newview/llfloaterexperienceprofile.cpp @@ -690,7 +690,7 @@ void LLFloaterExperienceProfile::onClickLocation() if(region) { LLTextBox* child = getChild<LLTextBox>(EDIT TF_SLURL); - mLocationSLURL = LLSLURL(region->getName(), gAgent.getPositionGlobal()).getSLURLString(); + mLocationSLURL = LLSLURL(region->getName(), gAgent.getPositionAgent()).getSLURLString(); child->setText(mLocationSLURL); onFieldChanged(); } diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index 0398c142a9c..b8e0e504127 100644 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -798,14 +798,16 @@ void LLFloaterWorldMap::updateLocation() // Figure out where user is // Set the current SLURL - mSLURL = LLSLURL(agent_sim_name, gAgent.getPositionGlobal()); + mSLURL = LLSLURL(agent_sim_name, gAgent.getPositionAgent()); } } return; // invalid location } std::string sim_name; - gotSimName = LLWorldMap::getInstanceFast()->simNameFromPosGlobal( pos_global, sim_name ); + LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromPosGlobal(pos_global); + if (sim_info) + sim_name = sim_info->getName(); if ((status != LLTracker::TRACKING_NOTHING) && (status != mTrackedStatus || pos_global != mTrackedLocation || sim_name != mTrackedSimName)) { @@ -838,11 +840,11 @@ void LLFloaterWorldMap::updateLocation() childSetValue("location", RlvStrings::getString(RlvStringKeys::Hidden::Region)); } - else if (gotSimName) + else if (sim_info) // [/RLVa:KB] // if ( gotSimName ) { - mSLURL = LLSLURL(sim_name, pos_global); + mSLURL = LLSLURL(sim_name, sim_info->getLocalPos(pos_global)); } else { // Empty SLURL will disable the "Copy SLURL to clipboard" button diff --git a/indra/newview/lllandmarkactions.cpp b/indra/newview/lllandmarkactions.cpp index a17dc674acb..60e279b0004 100644 --- a/indra/newview/lllandmarkactions.cpp +++ b/indra/newview/lllandmarkactions.cpp @@ -267,14 +267,11 @@ void LLLandmarkActions::createLandmarkHere() void LLLandmarkActions::getSLURLfromPosGlobal(const LLVector3d& global_pos, slurl_callback_t cb, bool escaped /* = true */) { - std::string sim_name; - bool gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal(global_pos, sim_name); - if (gotSimName) + const LLSimInfo* siminfo = LLWorldMap::getInstance()->simInfoFromPosGlobal(global_pos); + if (siminfo) { - std::string slurl = LLSLURL(sim_name, global_pos).getSLURLString(); + std::string slurl = LLSLURL(siminfo->getName(), siminfo->getLocalPos(global_pos)).getSLURLString(); cb(slurl); - - return; } else { @@ -318,12 +315,11 @@ void LLLandmarkActions::onRegionResponseSLURL(slurl_callback_t cb, bool escaped, const std::string& url) { - std::string sim_name; std::string slurl; - bool gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal(global_pos, sim_name); - if (gotSimName) + LLSimInfo* info = LLWorldMap::getInstance()->simInfoFromPosGlobal(global_pos); + if (info) { - slurl = LLSLURL(sim_name, global_pos).getSLURLString(); + slurl = LLSLURL(info->getName(), info->getLocalPos(global_pos)).getSLURLString(); } else { diff --git a/indra/newview/llnamebox.cpp b/indra/newview/llnamebox.cpp index 8d32fb1d5cc..8eb5316b541 100644 --- a/indra/newview/llnamebox.cpp +++ b/indra/newview/llnamebox.cpp @@ -33,6 +33,7 @@ #include "llui.h" #include "llviewercontrol.h" #include "lluuid.h" +#include "llslurl.h" #include "llcachename.h" #include "llavatarnamecache.h" @@ -112,9 +113,9 @@ void LLNameBox::setName(const std::string& name, BOOL is_group) std::string url; if (is_group) - url = "[secondlife:///app/group/" + mNameID.asString() + "/about " + name + "]"; + url = "[" + LLSLURL("group", mNameID, "about").getSLURLString() + "]"; else - url = "[secondlife:///app/agent/" + mNameID.asString() + "/about " + name + "]"; + url = "[" + LLSLURL("agent", mNameID, "about").getSLURLString() + "]"; setText(url); } diff --git a/indra/newview/llpanelplaceprofile.cpp b/indra/newview/llpanelplaceprofile.cpp index b51e89f3f1d..2c8c83bf6e3 100644 --- a/indra/newview/llpanelplaceprofile.cpp +++ b/indra/newview/llpanelplaceprofile.cpp @@ -395,8 +395,9 @@ void LLPanelPlaceProfile::displaySelectedParcelInfo(LLParcel* parcel, parcel_data.name = parcel->getName(); parcel_data.sim_name = region->getName(); parcel_data.snapshot_id = parcel->getSnapshotID(); - mPosRegion.setVec((F32)fmod(pos_global.mdV[VX], (F64)REGION_WIDTH_METERS), - (F32)fmod(pos_global.mdV[VY], (F64)REGION_WIDTH_METERS), + const auto& global_origin = region->getOriginGlobal(); + mPosRegion.setVec((F32)(pos_global.mdV[VX] - global_origin.mdV[VX]), + (F32)(pos_global.mdV[VY] - global_origin.mdV[VY]), (F32)pos_global.mdV[VZ]); parcel_data.global_x = pos_global.mdV[VX]; parcel_data.global_y = pos_global.mdV[VY]; diff --git a/indra/newview/llpanelplacestab.cpp b/indra/newview/llpanelplacestab.cpp index 748a9171475..e837c283fb0 100644 --- a/indra/newview/llpanelplacestab.cpp +++ b/indra/newview/llpanelplacestab.cpp @@ -54,13 +54,12 @@ void LLPanelPlacesTab::onRegionResponse(const LLVector3d& landmark_global_pos, const LLUUID& snapshot_id, bool teleport) { - std::string sim_name; - bool gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal( landmark_global_pos, sim_name ); + LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromPosGlobal(landmark_global_pos); std::string sl_url; - if ( gotSimName ) + if (sim_info) { - sl_url = LLSLURL(sim_name, landmark_global_pos).getSLURLString(); + sl_url = LLSLURL(sim_info->getName(), sim_info->getLocalPos(landmark_global_pos)).getSLURLString(); } else { -- GitLab