diff --git a/indra/llmessage/llregionhandle.h b/indra/llmessage/llregionhandle.h
index 085757dcbc..8154a6358f 100644
--- a/indra/llmessage/llregionhandle.h
+++ b/indra/llmessage/llregionhandle.h
@@ -39,6 +39,29 @@ inline U64 to_region_handle(const U32 x_origin, const U32 y_origin)
return region_handle;
}
+// FIRE-30534 Overload that takes explicit region origin and width to improve Var Region identification.
+inline U64 to_region_handle(const LLVector3d& pos_global, const LLVector3d& agent_region_origin, const F32 width)
+{
+ U32 global_x { static_cast( pos_global.mdV[VX] ) };
+ U32 global_y { static_cast( pos_global.mdV[VY] ) };
+
+ U32 agent_region_origin_x { static_cast( agent_region_origin.mdV[VX] ) };
+ U32 agent_region_origin_y { static_cast( agent_region_origin.mdV[VY] ) };
+
+ if( agent_region_origin_x < global_x && ( agent_region_origin_x + width ) > global_x &&
+ agent_region_origin_y < global_y && ( agent_region_origin_y + width ) > global_y )
+ {
+ // target is local to current region we can make a more informed guess
+ return to_region_handle( agent_region_origin_x, agent_region_origin_y );
+ }
+ // fallback to legacy 256m tile-based guess and let the region server / map work it out.
+ global_x -= global_x % 256;
+ global_y -= global_y % 256;
+
+ return to_region_handle( global_x, global_y );
+}
+//
+
inline U64 to_region_handle(const LLVector3d& pos_global)
{
U32 global_x = (U32)pos_global.mdV[VX];
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/fsslurl.cpp b/indra/newview/fsslurl.cpp
index be5a5b5d43..86e7b9794e 100644
--- a/indra/newview/fsslurl.cpp
+++ b/indra/newview/fsslurl.cpp
@@ -469,29 +469,46 @@ LLSLURL::LLSLURL(const std::string& region, const LLVector3& position, bool hype
*this = LLSLURL(LLGridManager::getInstance()->getGrid(), region, position);
}
+// FIRE-30768: SLURL's don't work in VarRegions
// create a slurl from a global position
-LLSLURL::LLSLURL(const std::string& grid, const std::string& region, const LLVector3d& global_position, bool hypergrid)
-: mHypergrid(hypergrid)
-{
+//LLSLURL::LLSLURL(const std::string& grid, const std::string& region, const LLVector3d& global_position, bool hypergrid)
+//: mHypergrid(hypergrid)
+//{
// Aurora-sim var region teleports
//*this = LLSLURL(grid,
// region, LLVector3(global_position.mdV[VX],
// global_position.mdV[VY],
// global_position.mdV[VZ]));
- S32 x = ll_round( (F32)fmod( (F32)global_position.mdV[VX], (F32)REGION_WIDTH_METERS ) );
- S32 y = ll_round( (F32)fmod( (F32)global_position.mdV[VY], (F32)REGION_WIDTH_METERS ) );
- S32 z = ll_round( (F32)global_position.mdV[VZ] );
+// S32 x = ll_round( (F32)fmod( (F32)global_position.mdV[VX], (F32)REGION_WIDTH_METERS ) );
+// S32 y = ll_round( (F32)fmod( (F32)global_position.mdV[VY], (F32)REGION_WIDTH_METERS ) );
+// S32 z = ll_round( (F32)global_position.mdV[VZ] );
- *this = LLSLURL(grid, region, LLVector3(x, y, z));
+// *this = LLSLURL(grid, region, LLVector3(x, y, z));
//
+//}
+//
+// create a slurl from a global position
+//LLSLURL::LLSLURL(const std::string& region, const LLVector3d& global_position, bool hypergrid)
+//: mHypergrid(hypergrid)
+//{
+// *this = LLSLURL(LLGridManager::getInstance()->getGrid(), region, global_position);
+//}
+
+// create a slurl from a global position
+LLSLURL::LLSLURL(const std::string& grid, const std::string& region, const LLVector3d& region_origin, const LLVector3d& global_position, bool hypergrid)
+ : mHypergrid(hypergrid)
+{
+ LLVector3 local_position = LLVector3(global_position - region_origin);
+ *this = LLSLURL(grid, region, local_position);
}
// create a slurl from a global position
-LLSLURL::LLSLURL(const std::string& region, const LLVector3d& global_position, bool hypergrid)
-: mHypergrid(hypergrid)
+LLSLURL::LLSLURL(const std::string& region, const LLVector3d& region_origin, const LLVector3d& global_position, bool hypergrid)
+ : mHypergrid(hypergrid)
{
- *this = LLSLURL(LLGridManager::getInstance()->getGrid(), region, global_position);
+ *this = LLSLURL(LLGridManager::getInstance()->getGrid(), region, region_origin, global_position);
}
+//
LLSLURL::LLSLURL(const std::string& command, const LLUUID&id, const std::string& verb)
: mHypergrid(false)
diff --git a/indra/newview/fsslurl.h b/indra/newview/fsslurl.h
index 471e2e41ac..d299e3db09 100644
--- a/indra/newview/fsslurl.h
+++ b/indra/newview/fsslurl.h
@@ -68,8 +68,12 @@ public:
LLSLURL(const std::string& grid, const std::string& region, bool hypergrid = false);
LLSLURL(const std::string& region, const LLVector3& position, bool hypergrid = false);
LLSLURL(const std::string& grid, const std::string& region, const LLVector3& position, bool hypergrid = false);
- LLSLURL(const std::string& grid, const std::string& region, const LLVector3d& global_position, bool hypergrid = false);
LLSLURL(const std::string& region, const LLVector3d& global_position, bool hypergrid = false);
+// FIRE-30768: SLURL's don't work in VarRegions (patch from Oren)
+// LLSLURL(const std::string& grid, const std::string& region, const LLVector3d& global_position, bool hypergrid = false);
+ LLSLURL(const std::string& grid, const std::string& region, const LLVector3d& region_origin, const LLVector3d& global_position, bool hypergrid = false);
+ LLSLURL(const std::string& region, const LLVector3d& region_origin, const LLVector3d& global_position, bool hypergrid = false);
+//
LLSLURL(const std::string& command, const LLUUID&id, const std::string& verb);
LLSLURL(const LLSD& path_array, bool from_app);
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index c6cf280a20..4663146c92 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -4586,7 +4586,19 @@ bool LLAgent::teleportBridgeLocal(LLVector3& pos_local)
bool LLAgent::teleportBridgeGlobal(const LLVector3d& pos_global)
{
- U64 region_handle = to_region_handle(pos_global);
+ // FIRE-30534 VarRegion fixes
+ // U64 region_handle = to_region_handle(pos_global);
+ U64 region_handle{};
+ auto regionp = getRegion();
+ if(regionp)
+ {
+ region_handle = to_region_handle(pos_global, regionp->getOriginGlobal(), regionp->getWidth());
+ }
+ else
+ {
+ region_handle = to_region_handle(pos_global);
+ }
+ //
LLVector3 pos_local = (LLVector3)(pos_global - from_region_handle(region_handle));
return teleportBridgeLocal(pos_local);
@@ -5064,23 +5076,83 @@ void LLAgent::doTeleportViaLocation(const LLVector3d& pos_global)
{
return;
}
+ // FIRE-30534 Var Region tp / map locaton fixes
+// U64 handle = to_region_handle(pos_global);
+// bool isLocal = (regionp->getHandle() == to_region_handle_global((F32)pos_global.mdV[VX], (F32)pos_global.mdV[VY]));
+// LLSimInfo* info = LLWorldMap::getInstance()->simInfoFromHandle(handle);
+// if(regionp && info)
+// {
+// LLVector3d region_origin = info->getGlobalOrigin();
+// LLVector3 pos_local(
+// (F32)(pos_global.mdV[VX] - region_origin.mdV[VX]),
+// (F32)(pos_global.mdV[VY] - region_origin.mdV[VY]),
+// (F32)(pos_global.mdV[VZ]));
+// // Aurora-sim var region teleports
+// //teleportRequest(handle, pos_local);
+// teleportRequest(info->getHandle(), pos_local);
+// //
+// }
+// else if(regionp && teleportCore(isLocal))
+// {
+// // send the message
+// LLMessageSystem* msg = gMessageSystem;
+// msg->newMessageFast(_PREHASH_TeleportLocationRequest);
+// msg->nextBlockFast(_PREHASH_AgentData);
+// msg->addUUIDFast(_PREHASH_AgentID, getID());
+// msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
- U64 handle = to_region_handle(pos_global);
- bool isLocal = (regionp->getHandle() == to_region_handle_global((F32)pos_global.mdV[VX], (F32)pos_global.mdV[VY]));
- LLSimInfo* info = LLWorldMap::getInstance()->simInfoFromHandle(handle);
- if(regionp && info)
+// msg->nextBlockFast(_PREHASH_Info);
+// // FIRE-17262: Wrong local teleports on a large opensim region (apparently need to divide by grid unit size)
+// F32 width = REGION_WIDTH_METERS;// regionp->getWidth();
+// LLVector3 pos(fmod((F32)pos_global.mdV[VX], width),
+// fmod((F32)pos_global.mdV[VY], width),
+// (F32)pos_global.mdV[VZ]);
+// F32 region_x = (F32)(pos_global.mdV[VX]);
+// F32 region_y = (F32)(pos_global.mdV[VY]);
+// U64 region_handle = to_region_handle_global(region_x, region_y);
+// msg->addU64Fast(_PREHASH_RegionHandle, region_handle);
+// msg->addVector3Fast(_PREHASH_Position, pos);
+// pos.mV[VX] += 1;
+// msg->addVector3Fast(_PREHASH_LookAt, pos);
+
+// LL_WARNS("Teleport") << "Sending deprecated(?) TeleportLocationRequest."
+// << " pos_global " << pos_global
+// << " region_x " << region_x
+// << " region_y " << region_y
+// << " region_handle " << region_handle
+// << LL_ENDL;
+
+// sendReliableMessage();
+ auto region_origin { regionp->getOriginGlobal() };
+ LLVector3 pos_local{};
+ U64 handle { to_region_handle(pos_global, region_origin, regionp->getWidth()) };
+ bool is_local { regionp->getHandle() == handle };
+ if(is_local)
{
- LLVector3d region_origin = info->getGlobalOrigin();
- LLVector3 pos_local(
+ pos_local.set(
(F32)(pos_global.mdV[VX] - region_origin.mdV[VX]),
(F32)(pos_global.mdV[VY] - region_origin.mdV[VY]),
(F32)(pos_global.mdV[VZ]));
-// Aurora-sim var region teleports
- //teleportRequest(handle, pos_local);
- teleportRequest(info->getHandle(), pos_local);
-//
+ LL_INFOS("Teleport") << "Local in-region TP:"
+ << " pos_global " << pos_global
+ << " region " << region_origin
+ << " local " << pos_local
+ << " region_handle " << handle
+ << LL_ENDL;
}
- else if(regionp && teleportCore(isLocal))
+ else
+ {
+ // determine non-local region location as best we can using global coords
+ // In SL we have uniform region size. This is normal.
+ // In opensim the handle will resolve to a 256m quantised world tile which the server maps back to a region
+ // it "should" also compensate for the local coords. Handle has been "correctly" determined already so we use global % 256
+ static const auto width{LLWorld::getInstance()->getRegionWidthInMeters()};
+ pos_local.set( fmod((F32)pos_global.mdV[VX], width),
+ fmod((F32)pos_global.mdV[VY], width),
+ (F32)pos_global.mdV[VZ] );
+ }
+
+ if(teleportCore(is_local)) // Rather a pointless if as teleportCore currently always returns true
{
// send the message
LLMessageSystem* msg = gMessageSystem;
@@ -5090,30 +5162,23 @@ void LLAgent::doTeleportViaLocation(const LLVector3d& pos_global)
msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
msg->nextBlockFast(_PREHASH_Info);
- // FIRE-17262: Wrong local teleports on a large opensim region (apparently need to divide by grid unit size)
- F32 width = REGION_WIDTH_METERS;// regionp->getWidth();
- LLVector3 pos(fmod((F32)pos_global.mdV[VX], width),
- fmod((F32)pos_global.mdV[VY], width),
- (F32)pos_global.mdV[VZ]);
- F32 region_x = (F32)(pos_global.mdV[VX]);
- F32 region_y = (F32)(pos_global.mdV[VY]);
- U64 region_handle = to_region_handle_global(region_x, region_y);
- msg->addU64Fast(_PREHASH_RegionHandle, region_handle);
- msg->addVector3Fast(_PREHASH_Position, pos);
- pos.mV[VX] += 1;
- msg->addVector3Fast(_PREHASH_LookAt, pos);
-
- LL_WARNS("Teleport") << "Sending deprecated(?) TeleportLocationRequest."
- << " pos_global " << pos_global
- << " region_x " << region_x
- << " region_y " << region_y
- << " region_handle " << region_handle
- << LL_ENDL;
+ msg->addU64Fast(_PREHASH_RegionHandle, handle);
+ msg->addVector3Fast(_PREHASH_Position, pos_local);
+ pos_local.mV[VX] += 1;
+ msg->addVector3Fast(_PREHASH_LookAt, pos_local);
sendReliableMessage();
+ LL_INFOS("Teleport") << "Sending deprecated TeleportLocationRequest."
+ << " pos_global " << pos_global
+ << " region coord (" << (pos_global.mdV[VX] - pos_local.mV[VX])
+ << "," << (pos_global.mdV[VY] - pos_local.mV[VY])
+ << " pos_local " << pos_local
+ << ") region_handle " << handle
+ << LL_ENDL;
+ //
}
// Client LSL Bridge
- if (FSLSLBridge::instance().canUseBridge() && isLocal)
+ if (FSLSLBridge::instance().canUseBridge() && is_local)
{
teleportBridgeGlobal(pos_global);
}
@@ -5154,6 +5219,37 @@ void LLAgent::teleportViaLocationLookAt(const LLVector3d& pos_global, const LLVe
//}
// [RLVa:KB] - Checked: RLVa-2.0.0
+// FIRE-30534 VarRegion TP fixes
+// void LLAgent::doTeleportViaLocationLookAt(const LLVector3d& pos_global, const LLVector3& look_at)
+// {
+// mbTeleportKeepsLookAt = look_at.isExactlyZero();
+
+// if(!gAgentCamera.isfollowCamLocked())
+// {
+// gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); // detach camera form avatar, so it keeps direction
+// }
+
+// U64 region_handle = to_region_handle(pos_global);
+// // Aurora-sim var region teleports
+// LLSimInfo* simInfo = LLWorldMap::instance().simInfoFromHandle(region_handle);
+// if (simInfo)
+// {
+// region_handle = simInfo->getHandle();
+// }
+// //
+// LLVector3 pos_local = (LLVector3)(pos_global - from_region_handle(region_handle));
+// teleportRequest(region_handle, pos_local, look_at);
+
+// // Client LSL Bridge
+// if (FSLSLBridge::instance().canUseBridge())
+// {
+// if (region_handle == to_region_handle(getPositionGlobal()))
+// {
+// teleportBridgeLocal(pos_local);
+// }
+// }
+// //
+// }
void LLAgent::doTeleportViaLocationLookAt(const LLVector3d& pos_global, const LLVector3& look_at)
{
mbTeleportKeepsLookAt = look_at.isExactlyZero();
@@ -5163,28 +5259,34 @@ void LLAgent::doTeleportViaLocationLookAt(const LLVector3d& pos_global, const LL
gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); // detach camera form avatar, so it keeps direction
}
- U64 region_handle = to_region_handle(pos_global);
-// Aurora-sim var region teleports
- LLSimInfo* simInfo = LLWorldMap::instance().simInfoFromHandle(region_handle);
- if (simInfo)
+ U64 region_handle{};
+ auto regionp = getRegion();
+ if(regionp)
{
- region_handle = simInfo->getHandle();
+ region_handle = to_region_handle(pos_global, regionp->getOriginGlobal(), regionp->getWidth());
}
-//
- LLVector3 pos_local = (LLVector3)(pos_global - from_region_handle(region_handle));
- teleportRequest(region_handle, pos_local, look_at);
+ else
+ {
+ region_handle = to_region_handle(pos_global);
+ }
+// Beq Note: if region_handle was obtained to the nearest 256m tile map lookup might give us a better result.
+
+ LLVector3 pos_within_target_region = (LLVector3)(pos_global - from_region_handle(region_handle));
+ teleportRequest(region_handle, pos_within_target_region, look_at);
// Client LSL Bridge
- if (FSLSLBridge::instance().canUseBridge())
+ if ( FSLSLBridge::instance().canUseBridge() )
{
- if (region_handle == to_region_handle(getPositionGlobal()))
+ // refresh regionp
+ regionp = getRegion();
+ if( regionp && ( region_handle == regionp->getHandle() ) )
{
- teleportBridgeLocal(pos_local);
+ teleportBridgeLocal(pos_within_target_region);
}
}
//
}
-
+//
LLAgent::ETeleportState LLAgent::getTeleportState() const
{
return (mTeleportRequest && (mTeleportRequest->getStatus() == LLTeleportRequest::kFailed)) ?
diff --git a/indra/newview/llagentui.cpp b/indra/newview/llagentui.cpp
index 065087cea6..d8541bf9d3 100644
--- a/indra/newview/llagentui.cpp
+++ b/indra/newview/llagentui.cpp
@@ -72,7 +72,10 @@ void LLAgentUI::buildSLURL(LLSLURL& slurl, const bool escaped /*= true*/)
else
#endif
//
- return_slurl = LLSLURL(regionp->getName(), gAgent.getPositionGlobal());
+ // FIRE-30768: SLURL's don't work in VarRegions
+ //return_slurl = LLSLURL(regionp->getName(), gAgent.getPositionGlobal());
+ return_slurl = LLSLURL(regionp->getName(), regionp->getOriginGlobal(), gAgent.getPositionGlobal());
+ //
}
slurl = return_slurl;
}
diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp
index e8be5a402c..8c414ecde9 100644
--- a/indra/newview/llfloaterexperienceprofile.cpp
+++ b/indra/newview/llfloaterexperienceprofile.cpp
@@ -679,7 +679,10 @@ void LLFloaterExperienceProfile::onClickLocation()
if(region)
{
LLTextBox* child = getChild(EDIT TF_SLURL);
- mLocationSLURL = LLSLURL(region->getName(), gAgent.getPositionGlobal()).getSLURLString();
+ // FIRE-30768: SLURL's don't work in VarRegions (Patch from Oren)
+ //mLocationSLURL = LLSLURL(region->getName(), gAgent.getPositionGlobal()).getSLURLString();
+ mLocationSLURL = LLSLURL(region->getName(), region->getOriginGlobal(), gAgent.getPositionGlobal()).getSLURLString();
+ //
child->setText(mLocationSLURL);
onFieldChanged();
}
diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp
index 2a2887c257..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");
@@ -1022,7 +1028,12 @@ void LLFloaterWorldMap::updateLocation()
return; // invalid location
}
std::string sim_name;
- gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal( pos_global, sim_name );
+ // FIRE-30768: SLURL's don't work in VarRegions
+ //gotSimName = LLWorldMap::getInstance()->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))
{
@@ -1055,12 +1066,16 @@ void LLFloaterWorldMap::updateLocation()
childSetValue("location", RlvStrings::getString(RlvStringKeys::Hidden::Region));
}
- else if (gotSimName)
+// FORE-30768 Slurls in Var regions are b0rked
+ // else if (gotSimName)
+ else if (sim_info)
// [/RLVa:KB]
// if ( gotSimName )
{
- mSLURL = LLSLURL(sim_name, pos_global);
+ // mSLURL = LLSLURL(sim_name, pos_global);
+ mSLURL = LLSLURL(sim_info->getName(), sim_info->getGlobalOrigin(), pos_global);
}
+//
else
{ // Empty SLURL will disable the "Copy SLURL to clipboard" button
mSLURL = LLSLURL();
diff --git a/indra/newview/lllandmarkactions.cpp b/indra/newview/lllandmarkactions.cpp
index 4e3f511afc..436b25ffe4 100644
--- a/indra/newview/lllandmarkactions.cpp
+++ b/indra/newview/lllandmarkactions.cpp
@@ -286,22 +286,78 @@ void LLLandmarkActions::createLandmarkHere()
createLandmarkHere(landmark_name, landmark_desc, folder_id);
}
-
-void LLLandmarkActions::getSLURLfromPosGlobal(const LLVector3d& global_pos, slurl_callback_t cb, bool escaped /* = true */)
+// FIRE-30534 - changes related to var regions in opensim
+void LLLandmarkActions::getSLURLfromPosGlobalAndLocal(const LLVector3d& global_pos, const LLVector3& region_pos, slurl_callback_t cb, bool escaped /* = true */)
{
std::string sim_name;
- bool gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal(global_pos, sim_name);
+ LLVector3d tmp_global_pos{global_pos};
+ tmp_global_pos.mdV[VX] -= region_pos.mV[VX];
+ tmp_global_pos.mdV[VY] -= region_pos.mV[VY];
+ tmp_global_pos.mdV[VZ] -= region_pos.mV[VZ];
+
+ bool gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal(tmp_global_pos, sim_name);
if (gotSimName)
{
- std::string slurl = LLSLURL(sim_name, global_pos).getSLURLString();
+ std::string slurl = LLSLURL(sim_name, region_pos).getSLURLString();
+ cb(slurl);
+ return;
+ }
+ else
+ {
+ auto regionp = gAgent.getRegion();
+ U64 new_region_handle{};
+ if(regionp)
+ {
+ new_region_handle = to_region_handle( tmp_global_pos, regionp->getOriginGlobal(), regionp->getWidth() );
+ }
+ else
+ {
+ new_region_handle = to_region_handle( tmp_global_pos );
+ }
+
+ LLWorldMapMessage::url_callback_t url_cb = boost::bind(&LLLandmarkActions::onRegionResponseSLURL,
+ cb,
+ global_pos,
+ escaped,
+ _2);
+
+ LLWorldMapMessage::getInstance()->sendHandleRegionRequest(new_region_handle, url_cb, std::string("unused"), false);
+ }
+}
+//
+void LLLandmarkActions::getSLURLfromPosGlobal(const LLVector3d& global_pos, slurl_callback_t cb, bool escaped /* = true */)
+{
+ // FIRE-30768: SLURL's don't work in VarRegions
+ //std::string sim_name;
+ //bool gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal(global_pos, sim_name);
+ //if (gotSimName)
+ //{
+ // std::string slurl = LLSLURL(sim_name, global_pos).getSLURLString();
+
+ LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromPosGlobal(global_pos);
+ if (sim_info)
+ {
+ std::string slurl = LLSLURL(sim_info->getName(), sim_info->getGlobalOrigin(), global_pos).getSLURLString();
+ //
cb(slurl);
return;
}
else
{
- U64 new_region_handle = to_region_handle(global_pos);
-
+ // FIRE-30534 - changes related to var regions in opensim
+ // U64 new_region_handle = to_region_handle(global_pos);
+ auto regionp = gAgent.getRegion();
+ U64 new_region_handle{};
+ if(regionp)
+ {
+ new_region_handle = to_region_handle( global_pos, regionp->getOriginGlobal(), regionp->getWidth() );
+ }
+ else
+ {
+ new_region_handle = to_region_handle( global_pos );
+ }
+ //
LLWorldMapMessage::url_callback_t url_cb = boost::bind(&LLLandmarkActions::onRegionResponseSLURL,
cb,
global_pos,
@@ -340,19 +396,34 @@ void LLLandmarkActions::onRegionResponseSLURL(slurl_callback_t cb,
bool escaped,
const std::string& url)
{
- std::string sim_name;
+// FIRE-30768: SLURL's don't work in VarRegions
+// std::string sim_name;
+// std::string slurl;
+// bool gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal(global_pos, sim_name);
+// if (gotSimName)
+// {
+// // Debug...
+// if (sim_name.empty())
+// {
+// LL_WARNS() << "Requested sim name is empty!" << LL_ENDL;
+// }
+// //
+// slurl = LLSLURL(sim_name, global_pos).getSLURLString();
+// }
+
std::string slurl;
- bool gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal(global_pos, sim_name);
- if (gotSimName)
+ LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromPosGlobal(global_pos);
+ if (sim_info)
{
// Debug...
- if (sim_name.empty())
+ if (sim_info->getName().empty())
{
LL_WARNS() << "Requested sim name is empty!" << LL_ENDL;
}
//
- slurl = LLSLURL(sim_name, global_pos).getSLURLString();
+ slurl = LLSLURL(sim_info->getName(), sim_info->getGlobalOrigin(), global_pos).getSLURLString();
}
+//
else
{
slurl = "";
@@ -413,7 +484,12 @@ void LLLandmarkActions::copySLURLtoClipboard(const LLUUID& landmarkInventoryItem
{
LLVector3d global_pos;
landmark->getGlobalPos(global_pos);
- LLLandmarkActions::getSLURLfromPosGlobal(global_pos,©_slurl_to_clipboard_callback,true);
+ // FIRE-30534 - changes related to var regions in opensim
+ // LLLandmarkActions::getSLURLfromPosGlobal(global_pos,©_slurl_to_clipboard_callback,true);
+ LLVector3 region_pos;
+ region_pos = landmark->getRegionPos();
+ LLLandmarkActions::getSLURLfromPosGlobalAndLocal(global_pos, region_pos, ©_slurl_to_clipboard_callback,true);
+ //
}
}
diff --git a/indra/newview/lllandmarkactions.h b/indra/newview/lllandmarkactions.h
index 870d92811e..a153ac9403 100644
--- a/indra/newview/lllandmarkactions.h
+++ b/indra/newview/lllandmarkactions.h
@@ -94,6 +94,7 @@ public:
* @brief Creates SLURL for given global position.
*/
static void getSLURLfromPosGlobal(const LLVector3d& global_pos, slurl_callback_t cb, bool escaped = true);
+ static void getSLURLfromPosGlobalAndLocal(const LLVector3d& global_pos, const LLVector3& region_pos, slurl_callback_t cb, bool escaped = true);// FIRE-30534 - changes related to var regions in opensim
static void getRegionNameAndCoordsFromPosGlobal(const LLVector3d& global_pos, region_name_and_coords_callback_t cb);
diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp
index 821ab12537..de802f6275 100644
--- a/indra/newview/lllocationinputctrl.cpp
+++ b/indra/newview/lllocationinputctrl.cpp
@@ -49,6 +49,7 @@
#include "lllandmarkactions.h"
#include "lllandmarklist.h"
#include "llpathfindingmanager.h"
+#include "llworld.h" // FIRE-30768: SLURL's don't work in VarRegions
#include "llpathfindingnavmesh.h"
#include "llpathfindingnavmeshstatus.h"
#include "llteleporthistory.h"
@@ -775,13 +776,24 @@ void LLLocationInputCtrl::onLocationPrearrange(const LLSD& data)
//mFullTitile format - region_name[, parcel_name] (local_x,local_y, local_z)
if (new_item_titles.insert(result->mFullTitle).second)
{
- LLSD value;
- value["item_type"] = TELEPORT_HISTORY;
- value["global_pos"] = result->mGlobalPos.getValue();
- std::string region_name = result->mTitle.substr(0, result->mTitle.find(','));
- //TODO*: add Surl to teleportitem or parse region name from title
- value["tooltip"] = LLSLURL(region_name, result->mGlobalPos).getSLURLString();
- add(result->getTitle(), value);
+ // FIRE-30768: SLURL's don't work in VarRegions
+ LLViewerRegion* regionp = LLWorld::instance().getRegionFromID(result->mRegionID);
+ if (regionp)
+ {
+ LLSD value;
+ value["item_type"] = TELEPORT_HISTORY;
+ value["global_pos"] = result->mGlobalPos.getValue();
+ std::string region_name = result->mTitle.substr(0, result->mTitle.find(','));
+ //TODO*: add Surl to teleportitem or parse region name from title
+ //value["tooltip"] = LLSLURL(region_name, result->mGlobalPos).getSLURLString();
+ value["tooltip"] = LLSLURL(region_name, regionp->getOriginGlobal(), result->mGlobalPos).getSLURLString();
+ add(result->getTitle(), value);
+ }
+ else
+ {
+ LL_WARNS("LocationInputCtrl") << "unable to resolve region " << result->mRegionID << LL_ENDL;
+ }
+ //
}
result = std::find_if(result + 1, th_items.end(), boost::bind(
&LLLocationInputCtrl::findTeleportItemsByTitle, this,
diff --git a/indra/newview/llnavigationbar.cpp b/indra/newview/llnavigationbar.cpp
index edd2d4e91b..34b5853bb9 100644
--- a/indra/newview/llnavigationbar.cpp
+++ b/indra/newview/llnavigationbar.cpp
@@ -672,8 +672,11 @@ void LLNavigationBar::onTeleportFinished(const LLVector3d& global_agent_pos)
*/
LLAgentUI::buildLocationString(location, LLAgentUI::LOCATION_FORMAT_NO_MATURITY,
gAgent.getPosAgentFromGlobal(global_agent_pos));
- std::string tooltip (LLSLURL(gAgent.getRegion()->getName(), global_agent_pos).getSLURLString());
-
+ // FIRE-30768: SLURL's don't work in VarRegions
+ //std::string tooltip (LLSLURL(gAgent.getRegion()->getName(), global_agent_pos).getSLURLString());
+ std::string tooltip (LLSLURL(gAgent.getRegion()->getName(), gAgent.getRegion()->getOriginGlobal(), global_agent_pos).getSLURLString());
+ //
+
LLLocationHistoryItem item (location,
global_agent_pos, tooltip,TYPED_REGION_SLURL);// we can add into history only TYPED location
//Touch it, if it is at list already, add new location otherwise
@@ -760,7 +763,10 @@ void LLNavigationBar::onRegionNameResponse(
LLVector3d region_pos = from_region_handle(region_handle);
LLVector3d global_pos = region_pos + (LLVector3d) local_coords;
- LL_INFOS() << "Teleporting to: " << LLSLURL(region_name, global_pos).getSLURLString() << LL_ENDL;
+ // FIRE-30768: SLURL's don't work in VarRegions
+ //LL_INFOS() << "Teleporting to: " << LLSLURL(region_name, global_pos).getSLURLString() << LL_ENDL;
+ LL_INFOS() << "Teleporting to: " << LLSLURL(region_name, region_pos, global_pos).getSLURLString() << LL_ENDL;
+ //
gAgent.teleportViaLocation(global_pos);
}
else if (gSavedSettings.getBOOL("SearchFromAddressBar"))
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/llpanelplacestab.cpp b/indra/newview/llpanelplacestab.cpp
index 9644b7518e..34a36b186e 100644
--- a/indra/newview/llpanelplacestab.cpp
+++ b/indra/newview/llpanelplacestab.cpp
@@ -60,14 +60,20 @@ 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 );
+ // FIRE-30768: SLURL's don't work in VarRegions
+ //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 ( gotSimName )
+ if (sim_info)
{
- sl_url = LLSLURL(sim_name, landmark_global_pos).getSLURLString();
+ //sl_url = LLSLURL(sim_name, landmark_global_pos).getSLURLString();
+ sl_url = LLSLURL(sim_info->getName(), sim_info->getGlobalOrigin(), landmark_global_pos).getSLURLString();
}
+ //
+
else
{
sl_url = "";
diff --git a/indra/newview/llremoteparcelrequest.cpp b/indra/newview/llremoteparcelrequest.cpp
index 055ccd5818..85540c580f 100644
--- a/indra/newview/llremoteparcelrequest.cpp
+++ b/indra/newview/llremoteparcelrequest.cpp
@@ -189,6 +189,7 @@ void LLRemoteParcelInfoProcessor::regionParcelInfoCoro(std::string url,
LLSD bodyData;
+ LL_DEBUGS("ParcelRequest") << "Remote Parcel Request for " << regionId << "local: " << posRegion << "remote: " << posGlobal << LL_ENDL;// FIRE-30534 - changes related to var regions in opensim
bodyData["location"] = ll_sd_from_vector3(posRegion);
if (!regionId.isNull())
{
@@ -196,6 +197,7 @@ void LLRemoteParcelInfoProcessor::regionParcelInfoCoro(std::string url,
}
if (!posGlobal.isExactlyZero())
{
+ // Note: leave this to_region_handle at 256 grid cell resolution, let OpenSim Server resolve
U64 regionHandle = to_region_handle(posGlobal);
bodyData["region_handle"] = ll_sd_from_U64(regionHandle);
}
diff --git a/indra/newview/llslurl.cpp b/indra/newview/llslurl.cpp
index f9b0dc241d..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),
@@ -363,10 +364,17 @@ LLSLURL::LLSLURL(const std::string& grid,
// create a slurl from a global position
LLSLURL::LLSLURL(const std::string& region,
+ const LLVector3d& region_origin, // FIRE-30768: SLURL's don't work in VarRegions
const LLVector3d& global_position)
{
- *this = LLSLURL(LLGridManager::getInstance()->getGridId(),
- region, global_position);
+ // FIRE-30768: SLURL's don't work in VarRegions
+ // *this = LLSLURL(LLGridManager::getInstance()->getGridId(),
+ // region, global_position);
+ *this = LLSLURL(LLGridManager::getInstance()->getGridId(),
+ 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 d722852ba3..fd0db1837c 100644
--- a/indra/newview/llslurl.h
+++ b/indra/newview/llslurl.h
@@ -71,8 +71,12 @@ public:
LLSLURL(const std::string& grid, const std::string& region);
LLSLURL(const std::string& region, const LLVector3& position);
LLSLURL(const std::string& grid, const std::string& region, const LLVector3& position);
- LLSLURL(const std::string& grid, const std::string& region, const LLVector3d& global_position);
- LLSLURL(const std::string& region, const LLVector3d& global_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& region_origin, const LLVector3d& global_position);
+ LLSLURL(const std::string& region, const LLVector3d& region_origin, const LLVector3d& global_position);
+ //
LLSLURL(const std::string& command, const LLUUID&id, const std::string& verb);
SLURL_TYPE getType() const { return mType; }
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);
diff --git a/indra/newview/llworldmap.cpp b/indra/newview/llworldmap.cpp
index 04e3461513..d5ac9c1f4a 100644
--- a/indra/newview/llworldmap.cpp
+++ b/indra/newview/llworldmap.cpp
@@ -380,6 +380,7 @@ LLSimInfo* LLWorldMap::simInfoFromHandle(const U64 handle)
if(x >= checkRegionX && x < (checkRegionX + info->mSizeX) &&
y >= checkRegionY && y < (checkRegionY + info->mSizeY))
{
+ LL_DEBUGS("WorldMap") << "VarRegion match for map tile (" << x << "," << y << ") in " << info->mSizeX << "x" << info->mSizeY << " region at (" << checkRegionX << "," << checkRegionY << ")" << LL_ENDL;// FIRE-30534 - changes related to var regions in opensim
return info;
}
// Aurora Sim
@@ -466,7 +467,7 @@ bool LLWorldMap::insertRegion(U32 x_world, U32 y_world, U16 x_size, U16 y_size,
else
{
U64 handle = to_region_handle(x_world, y_world);
- //LL_INFOS("WorldMap") << "Map sim : " << name << ", ID : " << image_id.getString() << LL_ENDL;
+ LL_DEBUGS("WorldMap") << "Map sim : " << name << ", ID : " << image_id.getString() << ", HANDLE : " << handle << LL_ENDL;// FIRE-30534 - changes related to var regions in opensim
// Insert the region in the region map of the world map
// Loading the LLSimInfo object with what we got and insert it in the map
LLSimInfo* siminfo = LLWorldMap::getInstance()->simInfoFromHandle(handle);