summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llenvironment.cpp22
-rw-r--r--indra/newview/llfloaterland.cpp72
-rw-r--r--indra/newview/llfloaterregioninfo.cpp22
-rw-r--r--indra/newview/llpanelenvironment.cpp77
-rw-r--r--indra/newview/llpanelenvironment.h28
-rw-r--r--indra/newview/skins/default/xui/en/panel_region_environment.xml7
6 files changed, 171 insertions, 57 deletions
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp
index 6981203e75..3b1990c850 100644
--- a/indra/newview/llenvironment.cpp
+++ b/indra/newview/llenvironment.cpp
@@ -1166,18 +1166,18 @@ void LLEnvironment::coroRequestEnvironment(S32 parcel_id, LLEnvironment::environ
LLSD result = httpAdapter->getAndSuspend(httpRequest, url);
// results that come back may contain the new settings
- LLSD notify;
+// LLSD notify;
LLSD httpResults = result["http_result"];
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
if (!status)
{
- LL_WARNS("WindlightCaps") << "Couldn't retrieve Windlight settings for " << ((parcel_id == INVALID_PARCEL_ID) ? ("region!") : ("parcel!")) << LL_ENDL;
+ LL_WARNS("WindlightCaps") << "Couldn't retrieve environment settings for " << ((parcel_id == INVALID_PARCEL_ID) ? ("region!") : ("parcel!")) << LL_ENDL;
- std::stringstream msg;
- msg << status.toString() << " (Code " << status.toTerseString() << ")";
- notify = LLSD::emptyMap();
- notify["FAIL_REASON"] = msg.str();
+// std::stringstream msg;
+// msg << status.toString() << " (Code " << status.toTerseString() << ")";
+// notify = LLSD::emptyMap();
+// notify["FAIL_REASON"] = msg.str();
}
else
@@ -1190,11 +1190,11 @@ void LLEnvironment::coroRequestEnvironment(S32 parcel_id, LLEnvironment::environ
}
}
- if (!notify.isUndefined())
- {
- LLNotificationsUtil::add("WLRegionApplyFail", notify);
- //LLEnvManagerNew::instance().onRegionSettingsApplyResponse(false);
- }
+// if (!notify.isUndefined())
+// {
+// LLNotificationsUtil::add("WLRegionApplyFail", notify);
+// //LLEnvManagerNew::instance().onRegionSettingsApplyResponse(false);
+// }
}
void LLEnvironment::coroUpdateEnvironment(S32 parcel_id, S32 track_no, LLSettingsDay::ptr_t pday, LLUUID settings_asset, S32 day_length, S32 day_offset, LLEnvironment::environment_apply_fn apply)
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();
+}
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index d13190254f..6aa35b40b6 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -192,11 +192,14 @@ public:
virtual BOOL postBuild() override;
+ virtual S32 getParcelId() override { return INVALID_PARCEL_ID; }
+
protected:
static const U32 DIRTY_FLAG_OVERRIDE;
virtual void doApply() override;
+ virtual void refreshFromSource() override;
bool doUpdateEstate(const LLSD& notification, const LLSD& response);
@@ -3418,6 +3421,19 @@ void LLPanelRegionEnvironment::refresh()
bool LLPanelRegionEnvironment::refreshFromRegion(LLViewerRegion* region)
{
+ if (!region)
+ {
+ setNoSelection(true);
+ setControlsEnabled(false);
+ }
+ setNoSelection(false);
+
+ if (gAgent.getRegion()->getRegionID() != region->getRegionID())
+ {
+ setCrossRegion(true);
+ }
+ setCrossRegion(false);
+
refreshFromSource();
return true;
}
@@ -3429,6 +3445,12 @@ void LLPanelRegionEnvironment::refreshFromEstate()
mAllowOverride = estate_info.getAllowEnvironmentOverride();
}
+void LLPanelRegionEnvironment::refreshFromSource()
+{
+ LLEnvironment::instance().requestRegion(
+ [this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {onEnvironmentReceived(parcel_id, envifo); });
+}
+
void LLPanelRegionEnvironment::doApply()
{
LLPanelEnvironmentInfo::doApply();
diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp
index 5f4bb7ccb8..8d7ec48d63 100644
--- a/indra/newview/llpanelenvironment.cpp
+++ b/indra/newview/llpanelenvironment.cpp
@@ -46,6 +46,7 @@
#include "llappviewer.h"
#include "llcallbacklist.h"
+#include "llviewerparcelmgr.h"
//=========================================================================
namespace
@@ -72,11 +73,15 @@ const std::string LLPanelEnvironmentInfo::PNL_SETTINGS("pnl_environment_config")
const std::string LLPanelEnvironmentInfo::PNL_ENVIRONMENT_ALTITUDES("pnl_environment_altitudes");
const std::string LLPanelEnvironmentInfo::PNL_BUTTONS("pnl_environment_buttons");
const std::string LLPanelEnvironmentInfo::PNL_DISABLED("pnl_environment_disabled");
+const std::string LLPanelEnvironmentInfo::TXT_DISABLED("txt_environment_disabled");
const std::string LLPanelEnvironmentInfo::STR_LABEL_USEDEFAULT("str_label_use_default");
const std::string LLPanelEnvironmentInfo::STR_LABEL_USEREGION("str_label_use_region");
const std::string LLPanelEnvironmentInfo::STR_LABEL_UNKNOWNINV("str_unknow_inventory");
const std::string LLPanelEnvironmentInfo::STR_ALTITUDE_DESCRIPTION("str_altitude_desription");
+const std::string LLPanelEnvironmentInfo::STR_NO_PARCEL("str_no_parcel");
+const std::string LLPanelEnvironmentInfo::STR_CROSS_REGION("str_cross_region");
+const std::string LLPanelEnvironmentInfo::STR_LEGACY("str_legacy");
const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_DAYCYCLE(0x01 << 0);
const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_DAYLENGTH(0x01 << 1);
@@ -111,8 +116,9 @@ const std::string alt_labels[] = {
//=========================================================================
LLPanelEnvironmentInfo::LLPanelEnvironmentInfo():
mCurrentEnvironment(),
- mCurrentParcelId(INVALID_PARCEL_ID),
mDirtyFlag(0),
+ mCrossRegion(false),
+ mNoSelection(false),
mSettingsFloater(),
mEditFloater()
{
@@ -173,7 +179,8 @@ void LLPanelEnvironmentInfo::refresh()
if (gDisconnected)
return;
- setControlsEnabled(canEdit());
+ if (!setControlsEnabled(canEdit()))
+ return;
if (!mCurrentEnvironment)
{
@@ -235,12 +242,6 @@ void LLPanelEnvironmentInfo::refresh()
}
-void LLPanelEnvironmentInfo::refreshFromSource()
-{
- LLEnvironment::instance().requestParcel(mCurrentParcelId,
- [this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {onEnvironmentReceived(parcel_id, envifo); });
-}
-
std::string LLPanelEnvironmentInfo::getInventoryNameForAssetId(LLUUID asset_id)
{
LLFloaterSettingsPicker *picker = getSettingsPicker();
@@ -284,7 +285,7 @@ LLFloaterEditExtDayCycle * LLPanelEnvironmentInfo::getEditFloater(bool create)
// Show the dialog
if (!editor && create)
{
- LLSD params(LLSDMap(LLFloaterEditExtDayCycle::KEY_EDIT_CONTEXT, (mCurrentParcelId == INVALID_PARCEL_ID) ? LLFloaterEditExtDayCycle::CONTEXT_REGION : LLFloaterEditExtDayCycle::CONTEXT_PARCEL)
+ LLSD params(LLSDMap(LLFloaterEditExtDayCycle::KEY_EDIT_CONTEXT, isRegion() ? LLFloaterEditExtDayCycle::CONTEXT_REGION : LLFloaterEditExtDayCycle::CONTEXT_PARCEL)
(LLFloaterEditExtDayCycle::KEY_DAY_LENGTH, mCurrentEnvironment ? (S32)(mCurrentEnvironment->mDayLength.value()) : FOURHOURS));
editor = (LLFloaterEditExtDayCycle *)LLFloaterReg::getInstance(FLOATER_DAY_CYCLE_EDIT, params);
@@ -324,12 +325,42 @@ void LLPanelEnvironmentInfo::updateEditFloater(const LLEnvironment::EnvironmentI
}
}
-void LLPanelEnvironmentInfo::setControlsEnabled(bool enabled)
+bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled)
{
- S32 rdo_selection = getChild<LLRadioGroup>(RDG_ENVIRONMENT_SELECT)->getSelectedIndex();
+ bool is_unavailable(false);
bool is_legacy = (mCurrentEnvironment) ? mCurrentEnvironment->mIsLegacy : true;
- bool is_unavailable = (is_legacy && (!mCurrentEnvironment || (mCurrentEnvironment->mParcelId != INVALID_PARCEL_ID)));
+ if (!LLEnvironment::instance().isExtendedEnvironmentEnabled() && !isRegion())
+ {
+ is_unavailable = true;
+ getChild<LLTextBox>(TXT_DISABLED)->setText(getString(STR_LEGACY));
+ }
+ else if (mNoSelection)
+ {
+ is_unavailable = true;
+ getChild<LLTextBox>(TXT_DISABLED)->setText(getString(STR_NO_PARCEL));
+ }
+ else if (mCrossRegion)
+ {
+ is_unavailable = true;
+ getChild<LLTextBox>(TXT_DISABLED)->setText(getString(STR_CROSS_REGION));
+ }
+
+ if (is_unavailable)
+ {
+ getChild<LLUICtrl>(PNL_SETTINGS)->setVisible(false);
+ getChild<LLUICtrl>(PNL_BUTTONS)->setVisible(false);
+ getChild<LLUICtrl>(PNL_DISABLED)->setVisible(true);
+
+ updateEditFloater(mCurrentEnvironment);
+
+ return false;
+ }
+ getChild<LLUICtrl>(PNL_SETTINGS)->setVisible(true);
+ getChild<LLUICtrl>(PNL_BUTTONS)->setVisible(true);
+ getChild<LLUICtrl>(PNL_DISABLED)->setVisible(false);
+
+ S32 rdo_selection = getChild<LLRadioGroup>(RDG_ENVIRONMENT_SELECT)->getSelectedIndex();
getChild<LLUICtrl>(RDG_ENVIRONMENT_SELECT)->setEnabled(enabled);
getChild<LLUICtrl>(RDO_USEDEFAULT)->setEnabled(enabled && !is_legacy);
@@ -340,15 +371,11 @@ void LLPanelEnvironmentInfo::setControlsEnabled(bool enabled)
getChild<LLUICtrl>(BTN_EDIT)->setEnabled(enabled);
getChild<LLUICtrl>(SLD_DAYLENGTH)->setEnabled(enabled && (rdo_selection != 0) && !is_legacy);
getChild<LLUICtrl>(SLD_DAYOFFSET)->setEnabled(enabled && (rdo_selection != 0) && !is_legacy);
- getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setEnabled(enabled && (mCurrentParcelId == INVALID_PARCEL_ID) && !is_legacy);
+ getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setEnabled(enabled && isRegion() && !is_legacy);
getChild<LLUICtrl>(BTN_APPLY)->setEnabled(enabled && (mDirtyFlag != 0));
getChild<LLUICtrl>(BTN_CANCEL)->setEnabled(enabled && (mDirtyFlag != 0));
- getChild<LLUICtrl>(PNL_SETTINGS)->setVisible(!is_unavailable);
- getChild<LLUICtrl>(PNL_BUTTONS)->setVisible(!is_unavailable);
- getChild<LLUICtrl>(PNL_DISABLED)->setVisible(is_unavailable);
-
- updateEditFloater(mCurrentEnvironment);
+ return true;
}
void LLPanelEnvironmentInfo::setApplyProgress(bool started)
@@ -517,7 +544,7 @@ void LLPanelEnvironmentInfo::onBtnEdit()
LLFloaterEditExtDayCycle *dayeditor = getEditFloater();
- LLSD params(LLSDMap(LLFloaterEditExtDayCycle::KEY_EDIT_CONTEXT, (mCurrentParcelId == INVALID_PARCEL_ID) ? LLFloaterEditExtDayCycle::VALUE_CONTEXT_REGION : LLFloaterEditExtDayCycle::VALUE_CONTEXT_REGION)
+ LLSD params(LLSDMap(LLFloaterEditExtDayCycle::KEY_EDIT_CONTEXT, isRegion() ? LLFloaterEditExtDayCycle::VALUE_CONTEXT_REGION : LLFloaterEditExtDayCycle::VALUE_CONTEXT_REGION)
(LLFloaterEditExtDayCycle::KEY_DAY_LENGTH, mCurrentEnvironment ? (S32)(mCurrentEnvironment->mDayLength.value()) : FOURHOURS)
(LLFloaterEditExtDayCycle::KEY_CANMOD, LLSD::Boolean(true)));
@@ -543,24 +570,26 @@ void LLPanelEnvironmentInfo::onBtnSelect()
void LLPanelEnvironmentInfo::doApply()
{
+ S32 parcel_id = getParcelId();
+
if (getIsDirtyFlag(DIRTY_FLAG_MASK))
{
S32 rdo_selection = getChild<LLRadioGroup>(RDG_ENVIRONMENT_SELECT)->getSelectedIndex();
if (rdo_selection == 0)
{
- LLEnvironment::instance().resetParcel(mCurrentParcelId,
+ LLEnvironment::instance().resetParcel(parcel_id,
[this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {onEnvironmentReceived(parcel_id, envifo); });
}
else if (rdo_selection == 1)
{
- LLEnvironment::instance().updateParcel(mCurrentParcelId,
+ LLEnvironment::instance().updateParcel(parcel_id,
mCurrentEnvironment->mDayCycle->getAssetId(), mCurrentEnvironment->mDayLength.value(), mCurrentEnvironment->mDayOffset.value(),
[this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {onEnvironmentReceived(parcel_id, envifo); });
}
else
{
- LLEnvironment::instance().updateParcel(mCurrentParcelId,
+ LLEnvironment::instance().updateParcel(parcel_id,
mCurrentEnvironment->mDayCycle, mCurrentEnvironment->mDayLength.value(), mCurrentEnvironment->mDayOffset.value(),
[this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {onEnvironmentReceived(parcel_id, envifo); });
}
@@ -657,9 +686,9 @@ void LLPanelEnvironmentInfo::onPickerAssetDownloaded(LLSettingsBase::ptr_t setti
void LLPanelEnvironmentInfo::onEnvironmentReceived(S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo)
{
- if (parcel_id != mCurrentParcelId)
+ if (parcel_id != getParcelId())
{
- LL_WARNS("ENVPANEL") << "Have environment for parcel " << parcel_id << " expecting " << mCurrentParcelId << ". Discarding." << LL_ENDL;
+ LL_WARNS("ENVPANEL") << "Have environment for parcel " << parcel_id << " expecting " << getParcelId() << ". Discarding." << LL_ENDL;
return;
}
mCurrentEnvironment = envifo;
diff --git a/indra/newview/llpanelenvironment.h b/indra/newview/llpanelenvironment.h
index c18092e2e5..fdf0fe46a7 100644
--- a/indra/newview/llpanelenvironment.h
+++ b/indra/newview/llpanelenvironment.h
@@ -52,12 +52,10 @@ public:
virtual void refresh() override;
- S32 getCurrentParcelId() const { return mCurrentParcelId; }
- void setCurrentParcelId(S32 parcel_id) { mCurrentParcelId = parcel_id; }
-
virtual bool isRegion() const = 0;
virtual LLParcel * getParcel() = 0;
virtual bool canEdit() = 0;
+ virtual S32 getParcelId() = 0;
protected:
LOG_CLASS(LLPanelEnvironmentInfo);
@@ -80,12 +78,15 @@ protected:
static const std::string PNL_ENVIRONMENT_ALTITUDES;
static const std::string PNL_BUTTONS;
static const std::string PNL_DISABLED;
-
+ static const std::string TXT_DISABLED;
static const std::string STR_LABEL_USEDEFAULT;
static const std::string STR_LABEL_USEREGION;
static const std::string STR_LABEL_UNKNOWNINV;
static const std::string STR_ALTITUDE_DESCRIPTION;
+ static const std::string STR_NO_PARCEL;
+ static const std::string STR_CROSS_REGION;
+ static const std::string STR_LEGACY;
static const U32 DIRTY_FLAG_DAYCYCLE;
static const U32 DIRTY_FLAG_DAYLENGTH;
@@ -94,7 +95,7 @@ protected:
static const U32 DIRTY_FLAG_MASK;
- void setControlsEnabled(bool enabled);
+ bool setControlsEnabled(bool enabled);
void setApplyProgress(bool started);
void setDirtyFlag(U32 flag);
void clearDirtyFlag(U32 flag);
@@ -121,7 +122,7 @@ protected:
void onPickerAssetDownloaded(LLSettingsBase::ptr_t settings);
void onEnvironmentReceived(S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo);
- void refreshFromSource();
+ virtual void refreshFromSource() = 0;
std::string getInventoryNameForAssetId(LLUUID asset_id);
@@ -129,8 +130,10 @@ protected:
LLFloaterEditExtDayCycle * getEditFloater(bool create = true);
void updateEditFloater(const LLEnvironment::EnvironmentInfo::ptr_t &nextenv);
+ void setCrossRegion(bool val) { mCrossRegion = val; }
+ void setNoSelection(bool val) { mNoSelection = val; }
+
LLEnvironment::EnvironmentInfo::ptr_t mCurrentEnvironment;
- S32 mCurrentParcelId;
class AltitudeData
{
@@ -156,9 +159,12 @@ private:
typedef boost::signals2::connection connection_t;
- connection_t mCommitConnection;
- LLHandle<LLFloater> mSettingsFloater;
- LLHandle<LLFloater> mEditFloater;
- S32 mDirtyFlag;
+ connection_t mCommitConnection;
+ LLHandle<LLFloater> mSettingsFloater;
+ LLHandle<LLFloater> mEditFloater;
+ S32 mDirtyFlag;
+ bool mCrossRegion;
+ bool mNoSelection;
+
};
#endif // LL_LLPANELEXPERIENCES_H
diff --git a/indra/newview/skins/default/xui/en/panel_region_environment.xml b/indra/newview/skins/default/xui/en/panel_region_environment.xml
index 3b77744f1b..3ce0d7a2ef 100644
--- a/indra/newview/skins/default/xui/en/panel_region_environment.xml
+++ b/indra/newview/skins/default/xui/en/panel_region_environment.xml
@@ -13,7 +13,9 @@
<string name="str_label_use_region">Use Region Settings</string>
<string name="str_unknow_inventory">Unknown</string>
<string name="str_altitude_desription">Sky [INDEX]([ALTITUDE]m)</string>
-
+ <string name="str_no_parcel">No parcel is selected. Environmental settings are disabled.</string>
+ <string name="str_cross_region">Environmental settings are not available across region boundries.</string>
+ <string name="str_legacy">Environmental settings are not available on this region.</string>
<layout_stack
width="530"
height="367"
@@ -29,8 +31,9 @@
halign="center"
valign="top"
top_pad="40"
+ name="txt_environment_disabled"
text_color="white">
-No parcel is selected. Environmental settings are disabled.
+ ...
</text>
</layout_panel>
<layout_panel