diff options
author | Rider Linden <rider@lindenlab.com> | 2018-09-14 09:52:28 -0700 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2018-09-14 09:52:28 -0700 |
commit | 7c6ac0740dac946275ef3f904614688f4b73f850 (patch) | |
tree | 18446d6a5346400ab2f6ac98fa394446b86156d3 /indra/newview/llfloaterland.cpp | |
parent | 3dd286064e253097af696068940afe009acc0b2e (diff) |
SL-1556: Correctly identify when the selected parcel is in another region and display a message about cross region environments.
Diffstat (limited to 'indra/newview/llfloaterland.cpp')
-rw-r--r-- | indra/newview/llfloaterland.cpp | 72 |
1 files changed, 63 insertions, 9 deletions
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index a2886d5010..38ced18edf 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -155,10 +155,15 @@ public: virtual LLParcel * getParcel() override; virtual bool canEdit() override; + virtual S32 getParcelId() override; + protected: + virtual void refreshFromSource() override; - LLSafeHandle<LLParcelSelection>& mParcel; + bool isSameRegion(); + LLSafeHandle<LLParcelSelection> & mParcel; + S32 mLastParcelId; }; @@ -3248,9 +3253,10 @@ void LLPanelLandExperiences::refresh() //========================================================================= -LLPanelLandEnvironment::LLPanelLandEnvironment(LLSafeHandle<LLParcelSelection>& parcelp): +LLPanelLandEnvironment::LLPanelLandEnvironment(LLParcelSelectionHandle& parcel) : LLPanelEnvironmentInfo(), - mParcel(parcelp) + mParcel(parcel), + mLastParcelId(INVALID_PARCEL_ID) { } @@ -3270,25 +3276,64 @@ void LLPanelLandEnvironment::refresh() if (gDisconnected) return; - LLParcel *parcel = getParcel(); - if (!parcel) + if (!isSameRegion()) { - LL_INFOS("ENVPANEL") << "No parcel selected." << LL_ENDL; + setCrossRegion(true); mCurrentEnvironment.reset(); - mCurrentParcelId = INVALID_PARCEL_ID; + mLastParcelId = INVALID_PARCEL_ID; setControlsEnabled(false); return; } - if (LLEnvironment::instance().isExtendedEnvironmentEnabled() && ((!mCurrentEnvironment) || (mCurrentEnvironment->mParcelId != parcel->getLocalID()))) + if (mLastParcelId != getParcelId()) + { + mCurrentEnvironment.reset(); + } + + if (!mCurrentEnvironment) { - mCurrentParcelId = parcel->getLocalID(); refreshFromSource(); return; } LLPanelEnvironmentInfo::refresh(); + getChild<LLUICtrl>(PNL_ENVIRONMENT_ALTITUDES)->setVisible(FALSE); +} + +void LLPanelLandEnvironment::refreshFromSource() +{ + LLParcel *parcel = getParcel(); + + if (!parcel) + { + setNoSelection(true); + setControlsEnabled(false); + return; + } + setNoSelection(false); + if (isSameRegion()) + { + setCrossRegion(false); + + LLEnvironment::instance().requestParcel(parcel->getLocalID(), + [this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { mLastParcelId = parcel_id; onEnvironmentReceived(parcel_id, envifo); }); + } + else + { + setCrossRegion(true); + mCurrentEnvironment.reset(); + mLastParcelId = INVALID_PARCEL_ID; + setControlsEnabled(false); + } +} + + +bool LLPanelLandEnvironment::isSameRegion() +{ + LLViewerRegion* regionp = LLViewerParcelMgr::instance().getSelectionRegion(); + + return (!regionp || (regionp->getRegionID() == gAgent.getRegion()->getRegionID())); } LLParcel *LLPanelLandEnvironment::getParcel() @@ -3304,3 +3349,12 @@ bool LLPanelLandEnvironment::canEdit() return false; return LLEnvironment::instance().canAgentUpdateParcelEnvironment(parcel); } + +S32 LLPanelLandEnvironment::getParcelId() +{ + LLParcel *parcel = getParcel(); + if (!parcel) + return INVALID_PARCEL_ID; + + return parcel->getLocalID(); +} |