From ac85669c67be03bfb77f81e9bf51e7f1d4d6ee78 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Tue, 8 Jan 2019 19:54:59 +0200 Subject: SL-10060 EEP Add reset default sky altitudes functionality --- indra/newview/llpanelenvironment.cpp | 23 ++++++++++++++++++++++ indra/newview/llpanelenvironment.h | 2 ++ .../default/xui/en/panel_region_environment.xml | 10 ++++++++++ 3 files changed, 35 insertions(+) (limited to 'indra') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index a324dfb93b..abd1913185 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -68,6 +68,7 @@ namespace const std::string LLPanelEnvironmentInfo::BTN_SELECTINV("btn_select_inventory"); const std::string LLPanelEnvironmentInfo::BTN_EDIT("btn_edit"); const std::string LLPanelEnvironmentInfo::BTN_USEDEFAULT("btn_usedefault"); +const std::string LLPanelEnvironmentInfo::BTN_RST_ALTITUDES("btn_rst_altitudes"); const std::string LLPanelEnvironmentInfo::SLD_DAYLENGTH("sld_day_length"); const std::string LLPanelEnvironmentInfo::SLD_DAYOFFSET("sld_day_offset"); const std::string LLPanelEnvironmentInfo::SLD_ALTITUDES("sld_altitudes"); @@ -105,6 +106,7 @@ const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_MASK( LLPanelEnvironmentInfo::DIRTY_FLAG_ALTITUDES); const U32 ALTITUDE_SLIDER_COUNT = 3; +const F32 ALTITUDE_DEFAULT_HEIGHT_STEP = 1000; const std::string alt_sliders[] = { "sld1", @@ -161,6 +163,7 @@ BOOL LLPanelEnvironmentInfo::postBuild() getChild(BTN_USEDEFAULT)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnDefault(); }); getChild(BTN_SELECTINV)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnSelect(); }); getChild(BTN_EDIT)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnEdit(); }); + getChild(BTN_RST_ALTITUDES)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnRstAltitudes(); }); getChild(SLD_DAYLENGTH)->setCommitCallback([this](LLUICtrl *, const LLSD &value) { onSldDayLengthChanged(value.asReal()); }); getChild(SLD_DAYLENGTH)->setSliderMouseUpCallback([this](LLUICtrl *, const LLSD &) { onDayLenOffsetMouseUp(); }); @@ -428,6 +431,7 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) getChild(PNL_DISABLED)->setVisible(false); getChild(PNL_ENVIRONMENT_ALTITUDES)->setVisible(LLEnvironment::instance().isExtendedEnvironmentEnabled()); + getChild(BTN_RST_ALTITUDES)->setVisible(isRegion()); bool can_enable = enabled && mCurrentEnvironment && (mCurEnvVersion != INVALID_PARCEL_ENVIRONMENT_VERSION); getChild(BTN_SELECTINV)->setEnabled(can_enable && !is_legacy); @@ -437,6 +441,7 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) getChild(SLD_DAYOFFSET)->setEnabled(can_enable && !is_legacy); getChild(SLD_ALTITUDES)->setEnabled(can_enable && isRegion() && !is_legacy); getChild(ICN_GROUND)->setColor((can_enable && isRegion() && !is_legacy) ? LLColor4::white : LLColor4::grey % 0.8f); + getChild(BTN_RST_ALTITUDES)->setEnabled(can_enable && isRegion() && !is_legacy); getChild(PNL_ENVIRONMENT_ALTITUDES)->setEnabled(can_enable && isRegion() && !is_legacy); getChild(CHK_ALLOWOVERRIDE)->setEnabled(can_enable && isRegion() && !is_legacy); @@ -689,6 +694,24 @@ void LLPanelEnvironmentInfo::onBtnSelect() } } +void LLPanelEnvironmentInfo::onBtnRstAltitudes() +{ + if (isRegion()) + { + LLHandle that_h = getHandle(); + LLEnvironment::altitudes_vect_t alts; + + for (S32 idx = 1; idx <= ALTITUDE_SLIDER_COUNT; ++idx) + { + F32 new_height = idx * ALTITUDE_DEFAULT_HEIGHT_STEP; + alts.push_back(new_height); + } + + LLEnvironment::instance().updateParcel(getParcelId(), LLSettingsDay::ptr_t(), + -1, -1, alts, + [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); + } +} void LLPanelEnvironmentInfo::udpateApparentTimeOfDay() { diff --git a/indra/newview/llpanelenvironment.h b/indra/newview/llpanelenvironment.h index dd3a309780..18ab64dc12 100644 --- a/indra/newview/llpanelenvironment.h +++ b/indra/newview/llpanelenvironment.h @@ -66,6 +66,7 @@ protected: static const std::string BTN_SELECTINV; static const std::string BTN_EDIT; static const std::string BTN_USEDEFAULT; + static const std::string BTN_RST_ALTITUDES; static const std::string SLD_DAYLENGTH; static const std::string SLD_DAYOFFSET; static const std::string SLD_ALTITUDES; @@ -117,6 +118,7 @@ protected: void onBtnEdit(); void onBtnSelect(); void onBtnDefault(); + void onBtnRstAltitudes(); void udpateApparentTimeOfDay(); 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 eac444c971..a39973fe3a 100644 --- a/indra/newview/skins/default/xui/en/panel_region_environment.xml +++ b/indra/newview/skins/default/xui/en/panel_region_environment.xml @@ -203,6 +203,16 @@ tool_tip="Drag a setting from Inventory onto this target box to select it as current water." width="155" /> +