From 71eb75382ea7d790b9e70aad879092c37946478e Mon Sep 17 00:00:00 2001 From: Beq Date: Mon, 17 May 2021 20:23:39 +0100 Subject: [PATCH] Further VarRegion slurl updates and fixes --- indra/newview/chatbar_as_cmdline.cpp | 4 ++-- indra/newview/fsfloaterplacedetails.cpp | 11 ++++++++++- indra/newview/llfloaterworldmap.cpp | 14 ++++++++++---- indra/newview/llpanelplaceinfo.cpp | 25 ++++++++++++++++++++++++- indra/newview/llpanelplaceinfo.h | 5 +++++ indra/newview/llpanelplaceprofile.cpp | 11 ++++++++--- indra/newview/llpanelplaces.cpp | 9 +++++++++ indra/newview/llslurl.cpp | 8 +++++--- indra/newview/llslurl.h | 4 ++-- indra/newview/llurldispatcher.cpp | 13 ++++++++++--- 10 files changed, 85 insertions(+), 19 deletions(-) diff --git a/indra/newview/chatbar_as_cmdline.cpp b/indra/newview/chatbar_as_cmdline.cpp index 04098fad54..7181c9dddd 100644 --- a/indra/newview/chatbar_as_cmdline.cpp +++ b/indra/newview/chatbar_as_cmdline.cpp @@ -938,8 +938,8 @@ bool cmd_line_chat(const std::string& revised_text, EChatType type, bool from_ge { region_name = LLWeb::escapeURL(revised_text.substr(command.length() + 1)); LLVector3d agentPos = gAgent.getPositionGlobal(); - agent_x = ll_round((F32)fmod(agentPos.mdV[VX], (F64)REGION_WIDTH_METERS)); - agent_y = ll_round((F32)fmod(agentPos.mdV[VY], (F64)REGION_WIDTH_METERS)); + agent_x = ll_round((F32)agentPos.mdV[VX]); + agent_y = ll_round((F32)agentPos.mdV[VY]); agent_z = ll_round((F32)agentPos.mdV[VZ]); if (!sFSCmdLineMapToKeepPos) { diff --git a/indra/newview/fsfloaterplacedetails.cpp b/indra/newview/fsfloaterplacedetails.cpp index a21eff9f73..ed459a5d81 100644 --- a/indra/newview/fsfloaterplacedetails.cpp +++ b/indra/newview/fsfloaterplacedetails.cpp @@ -50,6 +50,7 @@ #include "llpanelplaceprofile.h" #include "llpanellandmarkinfo.h" #include "llparcel.h" +#include "llregionhandle.h" // Var region support #include "llteleporthistorystorage.h" #include "llviewercontrol.h" #include "llviewermessage.h" @@ -355,7 +356,15 @@ void FSFloaterPlaceDetails::onOpen(const LLSD& key) key["z"].asReal()); mPanelPlaceInfo->setParcelDetailLoadedCallback(boost::bind(&FSFloaterPlaceDetails::processParcelDetails, this, _1)); - mPanelPlaceInfo->displayParcelInfo(LLUUID(), mGlobalPos); + if(key.has("ox")) + { + auto region_handle = to_region_handle(key["ox"].asInteger(), key["oy"].asInteger()); + mPanelPlaceInfo->displayParcelInfo(LLUUID(), region_handle, mGlobalPos); + } + else + { + mPanelPlaceInfo->displayParcelInfo(LLUUID(), mGlobalPos); + } } updateVerbs(); diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index bd0d828acf..b410be19a1 100644 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -713,10 +713,16 @@ void LLFloaterWorldMap::requestParcelInfo(const LLVector3d& pos_global) { return; } - - LLVector3 pos_region((F32)fmod(pos_global.mdV[VX], (F64)REGION_WIDTH_METERS), - (F32)fmod(pos_global.mdV[VY], (F64)REGION_WIDTH_METERS), - (F32)pos_global.mdV[VZ]); + // VarRegion slurl shenanigans + // agent_x = ll_round(region_pos.mV[VX]); + // agent_y = ll_round(region_pos.mV[VY]); + // agent_z = ll_round(region_pos.mV[VZ]); + // LLVector3 pos_region((F32)fmod(pos_global.mdV[VX], (F64)REGION_WIDTH_METERS), + // (F32)fmod(pos_global.mdV[VY], (F64)REGION_WIDTH_METERS), + // (F32)pos_global.mdV[VZ]); + auto region_origin = region->getOriginGlobal(); + auto pos_region = LLVector3(pos_global - region_origin); + // LLSD body; std::string url = region->getCapability("RemoteParcelRequest"); diff --git a/indra/newview/llpanelplaceinfo.cpp b/indra/newview/llpanelplaceinfo.cpp index 452d92a1a3..fb9eca1e7a 100644 --- a/indra/newview/llpanelplaceinfo.cpp +++ b/indra/newview/llpanelplaceinfo.cpp @@ -173,7 +173,7 @@ void LLPanelPlaceInfo::displayParcelInfo(const LLUUID& region_id, mPosRegion.setVec((F32)fmod(pos_global.mdV[VX], (F64)REGION_WIDTH_METERS), (F32)fmod(pos_global.mdV[VY], (F64)REGION_WIDTH_METERS), (F32)pos_global.mdV[VZ]); - + LLSD body; std::string url = region->getCapability("RemoteParcelRequest"); if (!url.empty()) @@ -186,6 +186,29 @@ void LLPanelPlaceInfo::displayParcelInfo(const LLUUID& region_id, mDescEditor->setText(getString("server_update_text")); } } +// FIRE-30768, FIRE-30534 more OS Var region fixups +void LLPanelPlaceInfo::displayParcelInfo(const LLUUID& region_id, + const U64 region_handle, + const LLVector3d& pos_global) +{ + auto region_origin = from_region_handle(region_handle); + mPosRegion.setVec(LLVector3(pos_global - region_origin)); + LLViewerRegion* region = gAgent.getRegion(); + if (!region) + return; + LLSD body; + std::string url = region->getCapability("RemoteParcelRequest"); + if (!url.empty()) + { + LLRemoteParcelInfoProcessor::getInstance()->requestRegionParcelInfo(url, + region_id, mPosRegion, pos_global, getObserverHandle()); + } + else + { + mDescEditor->setText(getString("server_update_text")); + } +} +// // virtual void LLPanelPlaceInfo::setErrorStatus(S32 status, const std::string& reason) diff --git a/indra/newview/llpanelplaceinfo.h b/indra/newview/llpanelplaceinfo.h index 10b6c8a1bc..fe9b26cbb9 100644 --- a/indra/newview/llpanelplaceinfo.h +++ b/indra/newview/llpanelplaceinfo.h @@ -85,6 +85,11 @@ public: // Sends a request to the server. void displayParcelInfo(const LLUUID& region_id, const LLVector3d& pos_global); + // FIRE-30768, FIRE-30534 more OS Var region fixups + void displayParcelInfo(const LLUUID& region_id, + const U64 region_handle, + const LLVector3d& pos_global); + // /*virtual*/ void setErrorStatus(S32 status, const std::string& reason); diff --git a/indra/newview/llpanelplaceprofile.cpp b/indra/newview/llpanelplaceprofile.cpp index 91d51d6594..ae4078f5a3 100644 --- a/indra/newview/llpanelplaceprofile.cpp +++ b/indra/newview/llpanelplaceprofile.cpp @@ -410,9 +410,14 @@ 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), - (F32)pos_global.mdV[VZ]); + // FIRE-30768, FIRE-30534 more OS Var region fixups + // mPosRegion.setVec((F32)fmod(pos_global.mdV[VX], (F64)REGION_WIDTH_METERS), + // (F32)fmod(pos_global.mdV[VY], (F64)REGION_WIDTH_METERS), + // (F32)pos_global.mdV[VZ]); + auto region_origin = region->getOriginGlobal(); + mPosRegion.setVec(LLVector3(pos_global - region_origin)); + LL_DEBUGS("SLURL") << "LM INFO: global " << pos_global << " region_orig " << region_origin << " pos_region " << mPosRegion << LL_ENDL; + // parcel_data.global_x = pos_global.mdV[VX]; parcel_data.global_y = pos_global.mdV[VY]; parcel_data.global_z = pos_global.mdV[VZ]; diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp index 04045d555d..8294158870 100644 --- a/indra/newview/llpanelplaces.cpp +++ b/indra/newview/llpanelplaces.cpp @@ -34,6 +34,7 @@ #include "llinventory.h" #include "lllandmark.h" #include "llparcel.h" +#include "llregionhandle.h" // Var region support #include "llcombobox.h" #include "llfiltereditor.h" @@ -486,6 +487,14 @@ void LLPanelPlaces::onOpen(const LLSD& key) mPosGlobal = LLVector3d(key["x"].asReal(), key["y"].asReal(), key["z"].asReal()); + // Var region support + if(key.has("ox")) + { + auto region_handle = to_region_handle(key["ox"].asInteger(), key["oy"].asInteger()); + mPlaceProfile->displayParcelInfo(LLUUID(), region_handle, mPosGlobal); + } + else + // mPlaceProfile->displayParcelInfo(LLUUID(), mPosGlobal); } diff --git a/indra/newview/llslurl.cpp b/indra/newview/llslurl.cpp index ffa964b117..1d75ecd4eb 100644 --- a/indra/newview/llslurl.cpp +++ b/indra/newview/llslurl.cpp @@ -353,6 +353,7 @@ LLSLURL::LLSLURL(const std::string& region, // create a slurl from a global position LLSLURL::LLSLURL(const std::string& grid, const std::string& region, + const LLVector3d& , // FIRE-30768: SLURL's don't work in VarRegions *unused param in SL builds* const LLVector3d& global_position) { *this = LLSLURL(LLGridManager::getInstance()->getGridId(grid), @@ -366,13 +367,14 @@ LLSLURL::LLSLURL(const std::string& region, const LLVector3d& region_origin, // FIRE-30768: SLURL's don't work in VarRegions const LLVector3d& global_position) { + // FIRE-30768: SLURL's don't work in VarRegions + // *this = LLSLURL(LLGridManager::getInstance()->getGridId(), + // region, global_position); *this = LLSLURL(LLGridManager::getInstance()->getGridId(), - // FIRE-30768: SLURL's don't work in VarRegions - // region, global_position); region, region_origin, global_position); - // + // } LLSLURL::LLSLURL(const std::string& command, const LLUUID&id, const std::string& verb) diff --git a/indra/newview/llslurl.h b/indra/newview/llslurl.h index 86b8d3cd89..fd0db1837c 100644 --- a/indra/newview/llslurl.h +++ b/indra/newview/llslurl.h @@ -72,8 +72,8 @@ public: LLSLURL(const std::string& region, const LLVector3& position); LLSLURL(const std::string& grid, const std::string& region, const LLVector3& position); // FIRE-30768: SLURL's don't work in VarRegions - //LLSLURL(const std::string& grid, const std::string& region, const LLVector3d& global_position); - //LLSLURL(const std::string& region, const LLVector3d& global_position); + // LLSLURL(const std::string& grid, const std::string& region, const LLVector3d& global_position); + // LLSLURL(const std::string& region, const LLVector3d& global_position); LLSLURL(const std::string& grid, const std::string& region, const LLVector3d& region_origin, const LLVector3d& global_position); LLSLURL(const std::string& region, const LLVector3d& region_origin, const LLVector3d& global_position); // diff --git a/indra/newview/llurldispatcher.cpp b/indra/newview/llurldispatcher.cpp index abd6e31d67..2930c46bcc 100644 --- a/indra/newview/llurldispatcher.cpp +++ b/indra/newview/llurldispatcher.cpp @@ -283,9 +283,12 @@ void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const LLSLURL& #endif // OPENSIM // - LLVector3d global_pos = from_region_handle(region_handle); - global_pos += LLVector3d(slurl.getPosition()); - + // make Var Regions work + // LLVector3d global_pos = from_region_handle(region_handle); + // global_pos += LLVector3d(slurl.getPosition()); + LLVector3d origin_pos = from_region_handle(region_handle); + LLVector3d global_pos{origin_pos + LLVector3d(slurl.getPosition())}; + // if (teleport) { gAgent.teleportViaLocation(global_pos); @@ -302,6 +305,10 @@ void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const LLSLURL& key["x"] = global_pos.mdV[VX]; key["y"] = global_pos.mdV[VY]; key["z"] = global_pos.mdV[VZ]; + // support Var regions + key["ox"] = origin_pos.mdV[VX]; + key["oy"] = origin_pos.mdV[VY]; + // // FIRE-817: Separate place details floater //LLFloaterSidePanelContainer::showPanel("places", key);