[OpenSim] Var Region fixups from Oren @ kitely

master
Beq 2021-05-12 16:50:21 +01:00
parent 8880aac517
commit a1f1fb3ff4
11 changed files with 135 additions and 43 deletions

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

@ -73,8 +73,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

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

@ -1022,7 +1022,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 +1060,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

@ -327,11 +327,18 @@ void LLLandmarkActions::getSLURLfromPosGlobalAndLocal(const LLVector3d& global_p
// </FS:Beq>
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)
// <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_name, global_pos).getSLURLString();
std::string slurl = LLSLURL(sim_info->getName(), sim_info->getGlobalOrigin(), global_pos).getSLURLString();
// </FS:Beq pp Oren>
cb(slurl);
return;
@ -389,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 = "";

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

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

@ -363,10 +363,16 @@ 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);
*this = LLSLURL(LLGridManager::getInstance()->getGridId(),
// <FS:Beq pp Oren> FIRE-30768: SLURL's don't work in VarRegions
// region, global_position);
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; }