diff options
author | Rider Linden <rider@lindenlab.com> | 2018-08-21 11:37:59 -0700 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2018-08-21 11:37:59 -0700 |
commit | 477c66c890d5d87318705415315aaf9464bec2ff (patch) | |
tree | 48cdffe375ef2de59eb241c58713ab7a335e37a8 /indra | |
parent | 163ae605be8871f37f19d94b71ec4370aadf9a49 (diff) |
Lest couple nullptr checks and disable the controls on legacy regions.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llenvironment.cpp | 28 | ||||
-rw-r--r-- | indra/newview/llfloaterland.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llpanelenvironment.cpp | 30 | ||||
-rw-r--r-- | indra/newview/llpanelenvironment.h | 3 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_region_environment.xml | 24 |
5 files changed, 64 insertions, 23 deletions
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index be0c763e25..8f703d0035 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -1037,22 +1037,26 @@ void LLEnvironment::requestParcel(S32 parcel_id, environment_apply_fn cb) { if (!isExtendedEnvironmentEnabled()) { /*TODO: When EEP is live on the entire grid, this can go away. */ - if (!cb) + if (parcel_id == INVALID_PARCEL_ID) { - cb = [this](S32 pid, EnvironmentInfo::ptr_t envinfo) - { - if (envinfo->mDayCycle) recordEnvironment(pid, envinfo); - else + if (!cb) + { + cb = [this](S32 pid, EnvironmentInfo::ptr_t envinfo) { - clearEnvironment(ENV_PARCEL); - setEnvironment(ENV_REGION, LLSettingsDay::GetDefaultAssetId(), LLSettingsDay::DEFAULT_DAYLENGTH, LLSettingsDay::DEFAULT_DAYOFFSET); - updateEnvironment(); - } - }; - } + if (envinfo->mDayCycle) recordEnvironment(pid, envinfo); + else + { + clearEnvironment(ENV_PARCEL); + setEnvironment(ENV_REGION, LLSettingsDay::GetDefaultAssetId(), LLSettingsDay::DEFAULT_DAYLENGTH, LLSettingsDay::DEFAULT_DAYOFFSET); + updateEnvironment(); + } + }; + } - if (parcel_id == INVALID_PARCEL_ID) LLEnvironmentRequest::initiate(cb); + } + else if (cb) + cb(parcel_id, EnvironmentInfo::ptr_t()); return; } diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 91f755e71b..3e50700377 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -3279,7 +3279,7 @@ void LLPanelLandEnvironment::refresh() return; } - if ((!mCurrentEnvironment) || (mCurrentEnvironment->mParcelId != parcel->getLocalID())) + if (LLEnvironment::instance().isExtendedEnvironmentEnabled() && ((!mCurrentEnvironment) || (mCurrentEnvironment->mParcelId != parcel->getLocalID()))) { mCurrentParcelId = parcel->getLocalID(); refreshFromSource(); diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 6de17cbee9..4425483989 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -66,6 +66,9 @@ const std::string LLPanelEnvironmentInfo::CHK_ALLOWOVERRIDE("chk_allow_override" const std::string LLPanelEnvironmentInfo::BTN_APPLY("btn_apply"); const std::string LLPanelEnvironmentInfo::BTN_CANCEL("btn_cancel"); const std::string LLPanelEnvironmentInfo::LBL_TIMEOFDAY("lbl_apparent_time"); +const std::string LLPanelEnvironmentInfo::PNL_SETTINGS("pnl_environment_config"); +const std::string LLPanelEnvironmentInfo::PNL_BUTTONS("pnl_environment_buttons"); +const std::string LLPanelEnvironmentInfo::PNL_DISABLED("pnl_environment_disabled"); const std::string LLPanelEnvironmentInfo::STR_LABEL_USEDEFAULT("str_label_use_default"); const std::string LLPanelEnvironmentInfo::STR_LABEL_USEREGION("str_label_use_region"); @@ -125,6 +128,12 @@ void LLPanelEnvironmentInfo::refresh() if (gDisconnected) return; + setControlsEnabled(canEdit()); + if (!mCurrentEnvironment) + { + return; + } + if ((!mCurrentEnvironment->mDayCycle) || ((mCurrentEnvironment->mParcelId == INVALID_PARCEL_ID) && (mCurrentEnvironment->mDayCycle->getAssetId() == LLSettingsDay::GetDefaultAssetId() ))) { @@ -161,7 +170,6 @@ void LLPanelEnvironmentInfo::refresh() udpateApparentTimeOfDay(); - setControlsEnabled(canEdit()); } void LLPanelEnvironmentInfo::refreshFromSource() @@ -229,19 +237,27 @@ LLFloaterEditExtDayCycle * LLPanelEnvironmentInfo::getEditFloater() void LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) { S32 rdo_selection = getChild<LLRadioGroup>(RDG_ENVIRONMENT_SELECT)->getSelectedIndex(); + bool is_legacy = (mCurrentEnvironment) ? mCurrentEnvironment->mIsLegacy : true; + + bool is_unavailable = (is_legacy && (!mCurrentEnvironment || (mCurrentEnvironment->mParcelId != INVALID_PARCEL_ID))); getChild<LLUICtrl>(RDG_ENVIRONMENT_SELECT)->setEnabled(enabled); - getChild<LLUICtrl>(RDO_USEDEFAULT)->setEnabled(enabled); - getChild<LLUICtrl>(RDO_USEINV)->setEnabled(enabled); + getChild<LLUICtrl>(RDO_USEDEFAULT)->setEnabled(enabled && !is_legacy); + getChild<LLUICtrl>(RDO_USEINV)->setEnabled(enabled && !is_legacy); getChild<LLUICtrl>(RDO_USECUSTOM)->setEnabled(enabled); getChild<LLUICtrl>(EDT_INVNAME)->setEnabled(FALSE); - getChild<LLUICtrl>(BTN_SELECTINV)->setEnabled(enabled); + getChild<LLUICtrl>(BTN_SELECTINV)->setEnabled(enabled && !is_legacy); getChild<LLUICtrl>(BTN_EDIT)->setEnabled(enabled); - getChild<LLUICtrl>(SLD_DAYLENGTH)->setEnabled(enabled && (rdo_selection != 0)); - getChild<LLUICtrl>(SLD_DAYOFFSET)->setEnabled(enabled && (rdo_selection != 0)); - getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setEnabled(enabled && (mCurrentParcelId == INVALID_PARCEL_ID)); + 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>(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); + } void LLPanelEnvironmentInfo::setApplyProgress(bool started) diff --git a/indra/newview/llpanelenvironment.h b/indra/newview/llpanelenvironment.h index 44e3c11a82..971f12c7e7 100644 --- a/indra/newview/llpanelenvironment.h +++ b/indra/newview/llpanelenvironment.h @@ -76,6 +76,9 @@ protected: static const std::string BTN_APPLY; static const std::string BTN_CANCEL; static const std::string LBL_TIMEOFDAY; + static const std::string PNL_SETTINGS; + static const std::string PNL_BUTTONS; + static const std::string PNL_DISABLED; static const std::string STR_LABEL_USEDEFAULT; 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 bb10e0c69e..3a1a8c432a 100644 --- a/indra/newview/skins/default/xui/en/panel_region_environment.xml +++ b/indra/newview/skins/default/xui/en/panel_region_environment.xml @@ -18,9 +18,26 @@ height="450" follows="left|right|top|bottom" orientation="vertical"> + <layout_panel + auto_resize="true" + user_resize="false" + name="pnl_environment_disabled" + visible="false"> + <text follows="top|left|bottom|right" + font="SansSerif" + halign="center" + valign="top" + top_pad="20" + text_color="white"> +Parcel environmental settings are +disabled on legacy regions. + </text> + </layout_panel> <layout_panel auto_resize="true" - user_resize="false"> + user_resize="false" + name="pnl_environment_config" + visible="true"> <layout_stack left="5" top="5" @@ -165,7 +182,7 @@ left_delta="0" top_pad="20" width="200"> - Apparent Time of Day Would Be: + Apparent Time of Day: </text> <text name="lbl_apparent_time" @@ -187,7 +204,8 @@ auto_resize="true" user_resize="false" height="21" - min_height="0"> + min_height="0" + name="pnl_environment_buttons"> <check_box height="20" label="Parcel Owners May Override Environment" |