Ansariel 2021-05-18 08:56:56 +02:00
commit b3111d2f05
23 changed files with 446 additions and 105 deletions

View File

@ -39,6 +39,29 @@ inline U64 to_region_handle(const U32 x_origin, const U32 y_origin)
return region_handle;
}
// <FS:Beq> 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<U32>( pos_global.mdV[VX] ) };
U32 global_y { static_cast<U32>( pos_global.mdV[VY] ) };
U32 agent_region_origin_x { static_cast<U32>( agent_region_origin.mdV[VX] ) };
U32 agent_region_origin_y { static_cast<U32>( 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 );
}
// </FS:Beq>
inline U64 to_region_handle(const LLVector3d& pos_global)
{
U32 global_x = (U32)pos_global.mdV[VX];

View File

@ -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)
{

View File

@ -50,6 +50,7 @@
#include "llpanelplaceprofile.h"
#include "llpanellandmarkinfo.h"
#include "llparcel.h"
#include "llregionhandle.h" // <FS:Beq/> 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();

View File

@ -469,29 +469,46 @@ LLSLURL::LLSLURL(const std::string& region, const LLVector3& position, bool hype
*this = LLSLURL(LLGridManager::getInstance()->getGrid(), region, position);
}
// <FS:Beq pp Oren> 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)
//{
// <FS:CR> 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));
// </FS:CR>
//}
//
// 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);
}
// </FS:Beq pp Oren>
LLSLURL::LLSLURL(const std::string& command, const LLUUID&id, const std::string& verb)
: mHypergrid(false)

View File

@ -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);
// <FS:Beq> 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);
// </FS:Beq>
LLSLURL(const std::string& command, const LLUUID&id, const std::string& verb);
LLSLURL(const LLSD& path_array, bool from_app);

View File

@ -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);
// <FS:Beq> 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);
}
// </FS:Beq>
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;
}
// <FS:Beq> 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]));
// // <FS:CR> Aurora-sim var region teleports
// //teleportRequest(handle, pos_local);
// teleportRequest(info->getHandle(), pos_local);
// // </FS:CR>
// }
// 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);
// // <FS:Ansariel> 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]));
// <FS:CR> Aurora-sim var region teleports
//teleportRequest(handle, pos_local);
teleportRequest(info->getHandle(), pos_local);
// </FS:CR>
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);
// <FS:Ansariel> 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;
// </FS:Beq>
}
// <FS:TT> 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
// <FS:Beq> 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);
// // <FS:CR> Aurora-sim var region teleports
// LLSimInfo* simInfo = LLWorldMap::instance().simInfoFromHandle(region_handle);
// if (simInfo)
// {
// region_handle = simInfo->getHandle();
// }
// // </FS:CR>
// LLVector3 pos_local = (LLVector3)(pos_global - from_region_handle(region_handle));
// teleportRequest(region_handle, pos_local, look_at);
// // <FS:TT> Client LSL Bridge
// if (FSLSLBridge::instance().canUseBridge())
// {
// if (region_handle == to_region_handle(getPositionGlobal()))
// {
// teleportBridgeLocal(pos_local);
// }
// }
// // </FS:TT>
// }
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);
// <FS:CR> 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());
}
// </FS:CR>
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);
// <FS:TT> 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);
}
}
// </FS:TT>
}
// </FS:Beq>
LLAgent::ETeleportState LLAgent::getTeleportState() const
{
return (mTeleportRequest && (mTeleportRequest->getStatus() == LLTeleportRequest::kFailed)) ?

View File

@ -72,7 +72,10 @@ void LLAgentUI::buildSLURL(LLSLURL& slurl, const bool escaped /*= true*/)
else
#endif
// </FS:CR>
return_slurl = LLSLURL(regionp->getName(), gAgent.getPositionGlobal());
// <FS:Oren> 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());
// </FS:Oren>
}
slurl = return_slurl;
}

View File

@ -679,7 +679,10 @@ void LLFloaterExperienceProfile::onClickLocation()
if(region)
{
LLTextBox* child = getChild<LLTextBox>(EDIT TF_SLURL);
mLocationSLURL = LLSLURL(region->getName(), gAgent.getPositionGlobal()).getSLURLString();
// <FS:Beq> 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();
// </FS:Beq>
child->setText(mLocationSLURL);
onFieldChanged();
}

View File

@ -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]);
// <FS:Beq> 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);
// </FS:Beq>
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 );
// <FS:Beq pp Oren> 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();
// </FS:Beq pp Oren>
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)
// <FS:Beq pp Oren> 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);
}
// </FS:Beq pp Oren>
else
{ // Empty SLURL will disable the "Copy SLURL to clipboard" button
mSLURL = LLSLURL();

View File

@ -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 */)
// <FS:Beq> 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);
}
}
// </FS:Beq>
void LLLandmarkActions::getSLURLfromPosGlobal(const LLVector3d& global_pos, slurl_callback_t cb, bool escaped /* = true */)
{
// <FS:Beq pp Oren> 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();
// </FS:Beq pp Oren>
cb(slurl);
return;
}
else
{
U64 new_region_handle = to_region_handle(global_pos);
// <FS:Beq> 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 );
}
// </FS:Beq>
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;
// <FS:Beq pp Oren> 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)
// {
// // <FS:Ansariel> Debug...
// if (sim_name.empty())
// {
// LL_WARNS() << "Requested sim name is empty!" << LL_ENDL;
// }
// // </FS:Ansariel>
// 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)
{
// <FS:Ansariel> Debug...
if (sim_name.empty())
if (sim_info->getName().empty())
{
LL_WARNS() << "Requested sim name is empty!" << LL_ENDL;
}
// </FS:Ansariel>
slurl = LLSLURL(sim_name, global_pos).getSLURLString();
slurl = LLSLURL(sim_info->getName(), sim_info->getGlobalOrigin(), global_pos).getSLURLString();
}
// </FS:Beq pp Oren>
else
{
slurl = "";
@ -413,7 +484,12 @@ void LLLandmarkActions::copySLURLtoClipboard(const LLUUID& landmarkInventoryItem
{
LLVector3d global_pos;
landmark->getGlobalPos(global_pos);
LLLandmarkActions::getSLURLfromPosGlobal(global_pos,&copy_slurl_to_clipboard_callback,true);
// <FS:Beq> FIRE-30534 - changes related to var regions in opensim
// LLLandmarkActions::getSLURLfromPosGlobal(global_pos,&copy_slurl_to_clipboard_callback,true);
LLVector3 region_pos;
region_pos = landmark->getRegionPos();
LLLandmarkActions::getSLURLfromPosGlobalAndLocal(global_pos, region_pos, &copy_slurl_to_clipboard_callback,true);
// </FS:Beq>
}
}

View File

@ -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);// <FS:Beq> FIRE-30534 - changes related to var regions in opensim
static void getRegionNameAndCoordsFromPosGlobal(const LLVector3d& global_pos, region_name_and_coords_callback_t cb);

View File

@ -49,6 +49,7 @@
#include "lllandmarkactions.h"
#include "lllandmarklist.h"
#include "llpathfindingmanager.h"
#include "llworld.h" // <FS:Beq pp Oren/> 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);
// <FS:Beq pp Oren> 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;
}
// </FS:Beq pp Oren>
}
result = std::find_if(result + 1, th_items.end(), boost::bind(
&LLLocationInputCtrl::findTeleportItemsByTitle, this,

View File

@ -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());
// <FS:Beq pp Oren> 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());
// </FS:Beq pp Oren>
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;
// <FS:Beq pp Oren> 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;
// </FS:Beq pp Oren>
gAgent.teleportViaLocation(global_pos);
}
else if (gSavedSettings.getBOOL("SearchFromAddressBar"))

View File

@ -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"));
}
}
// <FS:Beq> 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"));
}
}
// </FS:Beq>
// virtual
void LLPanelPlaceInfo::setErrorStatus(S32 status, const std::string& reason)

View File

@ -85,6 +85,11 @@ public:
// Sends a request to the server.
void displayParcelInfo(const LLUUID& region_id,
const LLVector3d& pos_global);
// <FS:Beq> FIRE-30768, FIRE-30534 more OS Var region fixups
void displayParcelInfo(const LLUUID& region_id,
const U64 region_handle,
const LLVector3d& pos_global);
// </FS:Beq>
/*virtual*/ void setErrorStatus(S32 status, const std::string& reason);

View File

@ -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]);
// <FS:Beq> 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;
// </FS:Beq>
parcel_data.global_x = pos_global.mdV[VX];
parcel_data.global_y = pos_global.mdV[VY];
parcel_data.global_z = pos_global.mdV[VZ];

View File

@ -34,6 +34,7 @@
#include "llinventory.h"
#include "lllandmark.h"
#include "llparcel.h"
#include "llregionhandle.h" // <FS:Beq/> 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());
// <FS:Beq> 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
// </FS:Beq>
mPlaceProfile->displayParcelInfo(LLUUID(), mPosGlobal);
}

View File

@ -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 );
// <FS:Beq pp Oren> 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();
}
// </FS:Beq pp Oren>
else
{
sl_url = "";

View File

@ -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;// <FS:Beq> 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())
{
// <FS:Beq> 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);
}

View File

@ -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& , // <FS:Beq pp Oren> 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, // <FS:Beq pp Oren> FIRE-30768: SLURL's don't work in VarRegions
const LLVector3d& global_position)
{
*this = LLSLURL(LLGridManager::getInstance()->getGridId(),
region, global_position);
// <FS:Beq pp Oren> 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);
// </FS:Beq pp Oren>
}
LLSLURL::LLSLURL(const std::string& command, const LLUUID&id, const std::string& verb)

View File

@ -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);
// <FS:Beq pp Oren> 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);
// </FS:Beq pp Oren>
LLSLURL(const std::string& command, const LLUUID&id, const std::string& verb);
SLURL_TYPE getType() const { return mType; }

View File

@ -283,9 +283,12 @@ void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const LLSLURL&
#endif // OPENSIM
// </FS:AW optional opensim support>
LLVector3d global_pos = from_region_handle(region_handle);
global_pos += LLVector3d(slurl.getPosition());
// <FS:Beq> 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())};
// </FS:Beq>
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];
// <FS:Beq> support Var regions
key["ox"] = origin_pos.mdV[VX];
key["oy"] = origin_pos.mdV[VY];
// </FS:Beq>
// <FS:Ansariel> FIRE-817: Separate place details floater
//LLFloaterSidePanelContainer::showPanel("places", key);

View File

@ -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;// <FS:Beq/> FIRE-30534 - changes related to var regions in opensim
return info;
}
// </FS:CR> 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;// <FS:Beq> 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);