From 5e544ee35d70fa9e27774ba30ccae06aa6d4d5f9 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 23 Jan 2018 12:03:03 -0800 Subject: Adding a couple files that got skipped. --- indra/newview/llpanelenvironment.cpp | 396 +++++++++++++++++++++++++++++++++++ 1 file changed, 396 insertions(+) create mode 100644 indra/newview/llpanelenvironment.cpp (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp new file mode 100644 index 0000000000..b606e1de08 --- /dev/null +++ b/indra/newview/llpanelenvironment.cpp @@ -0,0 +1,396 @@ +/** + * @file llpanelenvironment.cpp + * @brief LLPanelExperiences class implementation + * + * $LicenseInfo:firstyear=2013&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2013, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + + +#include "llpanelprofile.h" +#include "lluictrlfactory.h" +#include "llexperiencecache.h" +#include "llagent.h" + +#include "llviewerregion.h" +#include "llpanelenvironment.h" +#include "llslurl.h" +#include "lllayoutstack.h" + +static LLPanelInjector register_environment_panel("environment_panel"); + +LLPanelEnvironmentInfo::LLPanelEnvironmentInfo(): + mEnableEditing(false), + mRegionSettingsRadioGroup(NULL), + mDayLengthSlider(NULL), + mDayOffsetSlider(NULL), + mAllowOverRide(NULL) +{ +} + +// virtual +BOOL LLPanelEnvironmentInfo::postBuild() +{ + mRegionSettingsRadioGroup = getChild("environment_select_radio_group"); + mRegionSettingsRadioGroup->setCommitCallback(boost::bind(&LLPanelEnvironmentInfo::onSwitchDefaultSelection, this)); + + mDayLengthSlider = getChild("day_length_sld"); + mDayOffsetSlider = getChild("day_offset_sld"); + mAllowOverRide = getChild("allow_override_chk"); + + childSetCommitCallback("edit_btn", boost::bind(&LLPanelEnvironmentInfo::onBtnEdit, this), NULL); + childSetCommitCallback("apply_btn", boost::bind(&LLPanelEnvironmentInfo::onBtnApply, this), NULL); + childSetCommitCallback("cancel_btn", boost::bind(&LLPanelEnvironmentInfo::onBtnCancel, this), NULL); + + return TRUE; +} + +// virtual +void LLPanelEnvironmentInfo::onOpen(const LLSD& key) +{ + LL_DEBUGS("Windlight") << "Panel opened, refreshing" << LL_ENDL; + refresh(); +} + +// virtual +void LLPanelEnvironmentInfo::onVisibilityChange(BOOL new_visibility) +{ + // If hiding (user switched to another tab or closed the floater), + // display user's preferred environment. + // switching back and forth between agent's environment and the one being edited. + // +} + +void LLPanelEnvironmentInfo::refresh() +{ +#if 0 + if (gDisconnected) + { + return; + } + + populateWaterPresetsList(); + populateSkyPresetsList(); + populateDayCyclesList(); + + // Init radio groups. + const LLEnvironmentSettings& settings = LLEnvManagerNew::instance().getRegionSettings(); + const LLSD& dc = settings.getWLDayCycle(); + LLSD::Real first_frame_time = dc.size() > 0 ? dc[0][0].asReal() : 0.0f; + const bool use_fixed_sky = dc.size() == 1 && first_frame_time < 0; + mRegionSettingsRadioGroup->setSelectedIndex(settings.getSkyMap().size() == 0 ? 0 : 1); + mDayCycleSettingsRadioGroup->setSelectedIndex(use_fixed_sky ? 0 : 1); + + setControlsEnabled(mEnableEditing); + + setDirty(false); +#endif +} + +void LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) +{ + mRegionSettingsRadioGroup->setEnabled(enabled); + + mDayLengthSlider->setEnabled(false); + mDayOffsetSlider->setEnabled(false); + mAllowOverRide->setEnabled(enabled); + + getChildView("edit_btn")->setEnabled(false); + + getChildView("apply_btn")->setEnabled(enabled); + getChildView("cancel_btn")->setEnabled(enabled); + + if (enabled) + { + // Enable/disable some controls based on currently selected radio buttons. + bool use_defaults = mRegionSettingsRadioGroup->getSelectedIndex() == 0; + getChild("edit_btn")->setEnabled(!use_defaults); + + mDayLengthSlider->setEnabled(!use_defaults); + mDayOffsetSlider->setEnabled(!use_defaults); + + } +} + +void LLPanelEnvironmentInfo::setApplyProgress(bool started) +{ +// LLLoadingIndicator* indicator = getChild("progress_indicator"); +// +// indicator->setVisible(started); +// +// if (started) +// { +// indicator->start(); +// } +// else +// { +// indicator->stop(); +// } +} + +void LLPanelEnvironmentInfo::setDirty(bool dirty) +{ + getChildView("apply_btn")->setEnabled(dirty); + getChildView("cancel_btn")->setEnabled(dirty); +} + +// void LLPanelEnvironmentInfo::sendRegionSunUpdate() +// { +// #if 0 +// LLRegionInfoModel& region_info = LLRegionInfoModel::instance(); +// +// // If the region is being switched to fixed sky, +// // change the region's sun hour according to the (fixed) sun position. +// // This is needed for llGetSunDirection() LSL function to work properly (STORM-1330). +// const LLSD& sky_map = mNewRegionSettings.getSkyMap(); +// bool region_use_fixed_sky = sky_map.size() == 1; +// if (region_use_fixed_sky) +// { +// LLWLParamSet param_set; +// llassert(sky_map.isMap()); +// param_set.setAll(sky_map.beginMap()->second); +// F32 sun_angle = param_set.getSunAngle(); +// +// LL_DEBUGS("Windlight Sync") << "Old sun hour: " << region_info.mSunHour << LL_ENDL; +// // convert value range from 0..2pi to 6..30 +// region_info.mSunHour = fmodf((sun_angle / F_TWO_PI) * 24.f, 24.f) + 6.f; +// } +// +// region_info.setUseFixedSun(region_use_fixed_sky); +// region_info.mUseEstateSun = !region_use_fixed_sky; +// LL_DEBUGS("Windlight Sync") << "Sun hour: " << region_info.mSunHour << LL_ENDL; +// +// region_info.sendRegionTerrain(LLFloaterRegionInfo::getLastInvoice()); +// #endif +// } + +// void LLPanelEnvironmentInfo::fixEstateSun() +// { +// // We don't support fixed sun estates anymore and need to fix +// // such estates for region day cycle to take effect. +// // *NOTE: Assuming that current estate settings have arrived already. +// LLEstateInfoModel& estate_info = LLEstateInfoModel::instance(); +// if (estate_info.getUseFixedSun()) +// { +// LL_INFOS() << "Switching estate to global sun" << LL_ENDL; +// estate_info.setUseFixedSun(false); +// estate_info.sendEstateInfo(); +// } +// } + +// void LLPanelEnvironmentInfo::populateWaterPresetsList() +// { +// #if 0 +// mWaterPresetCombo->removeall(); +// +// // If the region already has water params, add them to the list. +// const LLEnvironmentSettings& region_settings = LLEnvManagerNew::instance().getRegionSettings(); +// if (region_settings.getWaterParams().size() != 0) +// { +// const std::string& region_name = gAgent.getRegion()->getName(); +// mWaterPresetCombo->add(region_name, LLWLParamKey(region_name, LLEnvKey::SCOPE_REGION).toLLSD()); +// mWaterPresetCombo->addSeparator(); +// } +// +// std::list user_presets, system_presets; +// LLWaterParamManager::instance().getPresetNames(user_presets, system_presets); +// +// // Add local user presets first. +// for (std::list::const_iterator it = user_presets.begin(); it != user_presets.end(); ++it) +// { +// mWaterPresetCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toLLSD()); +// } +// +// if (user_presets.size() > 0) +// { +// mWaterPresetCombo->addSeparator(); +// } +// +// // Add local system presets. +// for (std::list::const_iterator it = system_presets.begin(); it != system_presets.end(); ++it) +// { +// mWaterPresetCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toLLSD()); +// } +// +// // There's no way to select current preset because its name is not stored on server. +// #endif +// } +// +// void LLPanelEnvironmentInfo::populateSkyPresetsList() +// { +// #if 0 +// mSkyPresetCombo->removeall(); +// +// LLWLParamManager::preset_name_list_t region_presets; +// LLWLParamManager::preset_name_list_t user_presets, sys_presets; +// LLWLParamManager::instance().getPresetNames(region_presets, user_presets, sys_presets); +// +// // Add region presets. +// std::string region_name = gAgent.getRegion() ? gAgent.getRegion()->getName() : LLTrans::getString("Unknown"); +// for (LLWLParamManager::preset_name_list_t::const_iterator it = region_presets.begin(); it != region_presets.end(); ++it) +// { +// std::string preset_name = *it; +// std::string item_title = preset_name + " (" + region_name + ")"; +// mSkyPresetCombo->add(item_title, LLWLParamKey(preset_name, LLEnvKey::SCOPE_REGION).toStringVal()); +// } +// +// if (!region_presets.empty()) +// { +// mSkyPresetCombo->addSeparator(); +// } +// +// // Add user presets. +// for (LLWLParamManager::preset_name_list_t::const_iterator it = user_presets.begin(); it != user_presets.end(); ++it) +// { +// mSkyPresetCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toStringVal()); +// } +// +// if (!user_presets.empty()) +// { +// mSkyPresetCombo->addSeparator(); +// } +// +// // Add system presets. +// for (LLWLParamManager::preset_name_list_t::const_iterator it = sys_presets.begin(); it != sys_presets.end(); ++it) +// { +// mSkyPresetCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toStringVal()); +// } +// +// // Select current preset. +// LLSD sky_map = LLEnvManagerNew::instance().getRegionSettings().getSkyMap(); +// if (sky_map.size() == 1) // if the region is set to fixed sky +// { +// std::string preset_name = sky_map.beginMap()->first; +// mSkyPresetCombo->selectByValue(LLWLParamKey(preset_name, LLEnvKey::SCOPE_REGION).toStringVal()); +// } +// #endif +// } +// +// void LLPanelEnvironmentInfo::populateDayCyclesList() +// { +// #if 0 +// mDayCyclePresetCombo->removeall(); +// +// // If the region already has env. settings, add its day cycle to the list. +// const LLSD& cur_region_dc = LLEnvManagerNew::instance().getRegionSettings().getWLDayCycle(); +// if (cur_region_dc.size() != 0) +// { +// LLViewerRegion* region = gAgent.getRegion(); +// llassert(region != NULL); +// +// LLWLParamKey key(region->getName(), LLEnvKey::SCOPE_REGION); +// mDayCyclePresetCombo->add(region->getName(), key.toStringVal()); +// mDayCyclePresetCombo->addSeparator(); +// } +// +// // Add local user day cycles. +// LLDayCycleManager::preset_name_list_t user_days, sys_days; +// LLDayCycleManager::instance().getPresetNames(user_days, sys_days); +// for (LLDayCycleManager::preset_name_list_t::const_iterator it = user_days.begin(); it != user_days.end(); ++it) +// { +// mDayCyclePresetCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toStringVal()); +// } +// +// if (user_days.size() > 0) +// { +// mDayCyclePresetCombo->addSeparator(); +// } +// +// // Add local system day cycles. +// for (LLDayCycleManager::preset_name_list_t::const_iterator it = sys_days.begin(); it != sys_days.end(); ++it) +// { +// mDayCyclePresetCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toStringVal()); +// } +// +// // Current day cycle is already selected. +// #endif +// } + +void LLPanelEnvironmentInfo::onSwitchDefaultSelection() +{ + bool use_defaults = mRegionSettingsRadioGroup->getSelectedIndex() == 0; + getChild("user_environment_settings")->setEnabled(!use_defaults); + + setDirty(true); +} + + +void LLPanelEnvironmentInfo::onBtnApply() +{ + doApply(); +} + +void LLPanelEnvironmentInfo::doApply() +{ +} + +void LLPanelEnvironmentInfo::onBtnCancel() +{ + // Reload last saved region settings. + refresh(); +} + +void LLPanelEnvironmentInfo::onBtnEdit() +{ +} + + +// void LLPanelEnvironmentInfo::onRegionSettingschange() +// { +// LL_DEBUGS("Windlight") << "Region settings changed, refreshing" << LL_ENDL; +// refresh(); +// +// // Stop applying progress indicator (it may be running if it's us who initiated settings update). +// setApplyProgress(false); +// } +// +// void LLPanelEnvironmentInfo::onRegionSettingsApplied(bool ok) +// { +// // If applying new settings has failed, stop the indicator right away. +// // Otherwise it will be stopped when we receive the updated settings from server. +// if (ok) +// { +// // Set the region sun phase/flags according to the chosen new preferences. +// // +// // If we do this earlier we may get jerky transition from fixed sky to a day cycle (STORM-1481). +// // That is caused by the simulator re-sending the region info, which in turn makes us +// // re-request and display old region environment settings while the new ones haven't been applied yet. +// sendRegionSunUpdate(); +// +// // Switch estate to not using fixed sun for the region day cycle to work properly (STORM-1506). +// fixEstateSun(); +// } +// else +// { +// setApplyProgress(false); +// +// // We need to re-request environment setting here, +// // otherwise our subsequent attempts to change region settings will fail with the following error: +// // "Unable to update environment settings because the last update your viewer saw was not the same +// // as the last update sent from the simulator. Try sending your update again, and if this +// // does not work, try leaving and returning to the region." +// // LLEnvManagerNew::instance().requestRegionSettings(); +// } +// } + + -- cgit v1.2.3 From 536aeb54a6130f3d1e20405c8f6cbd29201de26d Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 23 Jan 2018 17:34:25 -0800 Subject: MAINT-8052: One more step towards parcel environments. --- indra/newview/llpanelenvironment.cpp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index b606e1de08..c9e29e3e79 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -37,6 +37,10 @@ #include "llslurl.h" #include "lllayoutstack.h" +#include "llfloater.h" +#include "llfloaterreg.h" +#include "llfloatereditextdaycycle.h" + static LLPanelInjector register_environment_panel("environment_panel"); LLPanelEnvironmentInfo::LLPanelEnvironmentInfo(): @@ -329,7 +333,11 @@ void LLPanelEnvironmentInfo::setDirty(bool dirty) void LLPanelEnvironmentInfo::onSwitchDefaultSelection() { bool use_defaults = mRegionSettingsRadioGroup->getSelectedIndex() == 0; - getChild("user_environment_settings")->setEnabled(!use_defaults); + + getChild("edit_btn")->setEnabled(!use_defaults); + + mDayLengthSlider->setEnabled(!use_defaults); + mDayOffsetSlider->setEnabled(!use_defaults); setDirty(true); } @@ -352,8 +360,25 @@ void LLPanelEnvironmentInfo::onBtnCancel() void LLPanelEnvironmentInfo::onBtnEdit() { + LLFloaterEditExtDayCycle *dayeditor = (LLFloaterEditExtDayCycle *)LLFloaterReg::getInstance("env_edit_extdaycycle"); + + if (dayeditor) + { + dayeditor->setEditCommitSignal(boost::bind(&LLPanelEnvironmentInfo::onEditiCommited, this, _1)); + dayeditor->openFloater(); + } +} + +void LLPanelEnvironmentInfo::onEditiCommited(LLSettingsDay::ptr_t newday) +{ + doEditCommited(newday); } +void LLPanelEnvironmentInfo::doEditCommited(LLSettingsDay::ptr_t &newday) +{ + mEditingDayCycle = newday; + /*TODO pure virtual*/ +} // void LLPanelEnvironmentInfo::onRegionSettingschange() // { -- cgit v1.2.3 From 2d41de9007ce485e2c7e96c487d609cfe1690c29 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 24 Jan 2018 13:36:59 -0800 Subject: MAINT-8052: Parcel environments. Set, clear and get. --- indra/newview/llpanelenvironment.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index c9e29e3e79..ab1c7502bb 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -41,7 +41,7 @@ #include "llfloaterreg.h" #include "llfloatereditextdaycycle.h" -static LLPanelInjector register_environment_panel("environment_panel"); +//static LLPanelInjector register_environment_panel("environment_panel"); LLPanelEnvironmentInfo::LLPanelEnvironmentInfo(): mEnableEditing(false), @@ -348,10 +348,6 @@ void LLPanelEnvironmentInfo::onBtnApply() doApply(); } -void LLPanelEnvironmentInfo::doApply() -{ -} - void LLPanelEnvironmentInfo::onBtnCancel() { // Reload last saved region settings. -- cgit v1.2.3 From e4973e0f92b524e7f9c2d10745f4c5e3a8557284 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 18 May 2018 21:09:42 +0300 Subject: MAINT-8344 Day Cycle Editor (part 3) --- indra/newview/llpanelenvironment.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index ab1c7502bb..afbbbd424e 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -360,8 +360,8 @@ void LLPanelEnvironmentInfo::onBtnEdit() if (dayeditor) { - dayeditor->setEditCommitSignal(boost::bind(&LLPanelEnvironmentInfo::onEditiCommited, this, _1)); - dayeditor->openFloater(); + dayeditor->setEditCommitSignal(boost::bind(&LLPanelEnvironmentInfo::onEditiCommited, this, _1)); //Not needed? + dayeditor->openFloater(mEditingDayCycle, F32Hours(mDayLengthSlider->getValue().asReal()), F32Hours(mDayOffsetSlider->getValue().asReal())); } } -- cgit v1.2.3 From 044b80e4e1a7b55f46e6f3b52c9cae6d9c6df3eb Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 22 May 2018 10:49:55 -0700 Subject: Manual blender for use in day editing dialog. --- indra/newview/llpanelenvironment.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index afbbbd424e..ebe3da79f2 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -359,9 +359,13 @@ void LLPanelEnvironmentInfo::onBtnEdit() LLFloaterEditExtDayCycle *dayeditor = (LLFloaterEditExtDayCycle *)LLFloaterReg::getInstance("env_edit_extdaycycle"); if (dayeditor) - { - dayeditor->setEditCommitSignal(boost::bind(&LLPanelEnvironmentInfo::onEditiCommited, this, _1)); //Not needed? - dayeditor->openFloater(mEditingDayCycle, F32Hours(mDayLengthSlider->getValue().asReal()), F32Hours(mDayOffsetSlider->getValue().asReal())); + { //*TODO Determine if region or parcel. + LLSD params(LLSDMap(LLFloaterEditExtDayCycle::KEY_LIVE_ENVIRONMENT, "parcel") + (LLFloaterEditExtDayCycle::KEY_DAY_LENGTH, mDayLengthSlider->getValueF32() * (60.0 * 60.0))); + + LLFloaterReg::showInstance("env_edit_extdaycycle", params, TAKE_FOCUS_YES); + +// dayeditor->openFloater(mEditingDayCycle, F32Hours(mDayLengthSlider->getValue().asReal()), F32Hours(mDayOffsetSlider->getValue().asReal())); } } -- cgit v1.2.3 From eadf0b910174274e7c83fe37e417f576a7350edb Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 15 Aug 2018 13:35:53 -0700 Subject: MAINT-8990, MAINT-9002: First pass rework on environment panels, region/parcel --- indra/newview/llpanelenvironment.cpp | 506 ++++++++++++++++------------------- 1 file changed, 227 insertions(+), 279 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index ebe3da79f2..a2788124e7 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -31,6 +31,7 @@ #include "lluictrlfactory.h" #include "llexperiencecache.h" #include "llagent.h" +#include "llparcel.h" #include "llviewerregion.h" #include "llpanelenvironment.h" @@ -40,31 +41,63 @@ #include "llfloater.h" #include "llfloaterreg.h" #include "llfloatereditextdaycycle.h" +#include "llsettingsvo.h" -//static LLPanelInjector register_environment_panel("environment_panel"); +#include "llappviewer.h" +//========================================================================= +namespace +{ + const std::string FLOATER_DAY_CYCLE_EDIT("env_edit_extdaycycle"); +} + +//========================================================================= +const std::string LLPanelEnvironmentInfo::RDG_ENVIRONMENT_SELECT("rdg_environment_select"); +const std::string LLPanelEnvironmentInfo::RDO_USEDEFAULT("rdo_use_xxx_setting"); +const std::string LLPanelEnvironmentInfo::RDO_USEINV("rdo_use_inv_setting"); +const std::string LLPanelEnvironmentInfo::RDO_USECUSTOM("rdo_use_custom_setting"); +const std::string LLPanelEnvironmentInfo::EDT_INVNAME("edt_inventory_name"); +const std::string LLPanelEnvironmentInfo::BTN_SELECTINV("btn_select_inventory"); +const std::string LLPanelEnvironmentInfo::BTN_EDIT("btn_edit"); +const std::string LLPanelEnvironmentInfo::SLD_DAYLENGTH("sld_day_length"); +const std::string LLPanelEnvironmentInfo::SLD_DAYOFFSET("sld_day_offset"); +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::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 S32 LLPanelEnvironmentInfo::DIRTY_FLAG_DAYCYCLE(0x01 << 0); +const S32 LLPanelEnvironmentInfo::DIRTY_FLAG_DAYLENGTH(0x01 << 1); +const S32 LLPanelEnvironmentInfo::DIRTY_FLAG_DAYOFFSET(0x01 << 2); + +const S32 LLPanelEnvironmentInfo::DIRTY_FLAG_MASK( + LLPanelEnvironmentInfo::DIRTY_FLAG_DAYCYCLE | + LLPanelEnvironmentInfo::DIRTY_FLAG_DAYLENGTH | + LLPanelEnvironmentInfo::DIRTY_FLAG_DAYOFFSET ); + +//========================================================================= LLPanelEnvironmentInfo::LLPanelEnvironmentInfo(): - mEnableEditing(false), - mRegionSettingsRadioGroup(NULL), - mDayLengthSlider(NULL), - mDayOffsetSlider(NULL), - mAllowOverRide(NULL) + mCurrentEnvironment(), + mCurrentParcelId(INVALID_PARCEL_ID), + mDirtyFlag(0), + mSettingsFloater(), + mEditFloater() { } -// virtual BOOL LLPanelEnvironmentInfo::postBuild() { - mRegionSettingsRadioGroup = getChild("environment_select_radio_group"); - mRegionSettingsRadioGroup->setCommitCallback(boost::bind(&LLPanelEnvironmentInfo::onSwitchDefaultSelection, this)); - - mDayLengthSlider = getChild("day_length_sld"); - mDayOffsetSlider = getChild("day_offset_sld"); - mAllowOverRide = getChild("allow_override_chk"); + getChild(RDG_ENVIRONMENT_SELECT)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onSwitchDefaultSelection(); }); + getChild(BTN_SELECTINV)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnSelect(); }); + getChild(BTN_EDIT)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnEdit(); }); + getChild(BTN_APPLY)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnApply(); }); + getChild(BTN_CANCEL)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnReset(); }); - childSetCommitCallback("edit_btn", boost::bind(&LLPanelEnvironmentInfo::onBtnEdit, this), NULL); - childSetCommitCallback("apply_btn", boost::bind(&LLPanelEnvironmentInfo::onBtnApply, this), NULL); - childSetCommitCallback("cancel_btn", boost::bind(&LLPanelEnvironmentInfo::onBtnCancel, this), NULL); + getChild(SLD_DAYLENGTH)->setCommitCallback([this](LLUICtrl *, const LLSD &value) { onSldDayLengthChanged(value.asReal()); }); + getChild(SLD_DAYOFFSET)->setCommitCallback([this](LLUICtrl *, const LLSD &value) { onSldDayOffsetChanged(value.asReal()); }); return TRUE; } @@ -72,8 +105,7 @@ BOOL LLPanelEnvironmentInfo::postBuild() // virtual void LLPanelEnvironmentInfo::onOpen(const LLSD& key) { - LL_DEBUGS("Windlight") << "Panel opened, refreshing" << LL_ENDL; - refresh(); + refreshFromSource(); } // virtual @@ -87,53 +119,120 @@ void LLPanelEnvironmentInfo::onVisibilityChange(BOOL new_visibility) void LLPanelEnvironmentInfo::refresh() { -#if 0 if (gDisconnected) - { return; + + if (((mCurrentEnvironment->mParcelId != INVALID_PARCEL_ID) && (!mCurrentEnvironment->mDayCycle)) || + ((mCurrentEnvironment->mParcelId == INVALID_PARCEL_ID) && (mCurrentEnvironment->mDayCycle->getAssetId() == LLSettingsDay::GetDefaultAssetId() ))) + { + getChild(RDG_ENVIRONMENT_SELECT)->setSelectedIndex(0); + getChild(EDT_INVNAME)->setValue(""); } + else if (!mCurrentEnvironment->mDayCycle->getAssetId().isNull()) + { + getChild(RDG_ENVIRONMENT_SELECT)->setSelectedIndex(1); + + LLUUID asset_id = mCurrentEnvironment->mDayCycle->getAssetId(); + + std::string inventoryname = getInventoryNameForAssetId(asset_id); + + if (inventoryname.empty()) + inventoryname = "(" + mCurrentEnvironment->mDayCycle->getName() + ")"; - populateWaterPresetsList(); - populateSkyPresetsList(); - populateDayCyclesList(); + getChild(EDT_INVNAME)->setValue(inventoryname); + } + else + { // asset id is null so this is a custom environment + getChild(RDG_ENVIRONMENT_SELECT)->setSelectedIndex(2); + getChild(EDT_INVNAME)->setValue(""); + } - // Init radio groups. - const LLEnvironmentSettings& settings = LLEnvManagerNew::instance().getRegionSettings(); - const LLSD& dc = settings.getWLDayCycle(); - LLSD::Real first_frame_time = dc.size() > 0 ? dc[0][0].asReal() : 0.0f; - const bool use_fixed_sky = dc.size() == 1 && first_frame_time < 0; - mRegionSettingsRadioGroup->setSelectedIndex(settings.getSkyMap().size() == 0 ? 0 : 1); - mDayCycleSettingsRadioGroup->setSelectedIndex(use_fixed_sky ? 0 : 1); + F32Hours daylength(mCurrentEnvironment->mDayLength); + F32Hours dayoffset(mCurrentEnvironment->mDayOffset); - setControlsEnabled(mEnableEditing); + if (dayoffset.value() > 8.0f) + dayoffset -= F32Hours(24.0); - setDirty(false); -#endif + getChild(SLD_DAYLENGTH)->setValue(daylength.value()); + getChild(SLD_DAYOFFSET)->setValue(dayoffset.value()); + + setControlsEnabled(canEdit()); } -void LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) +void LLPanelEnvironmentInfo::refreshFromSource() { - mRegionSettingsRadioGroup->setEnabled(enabled); + LLEnvironment::instance().requestParcel(mCurrentParcelId, + [this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {handleEnvironmentReceived(parcel_id, envifo); }); +} - mDayLengthSlider->setEnabled(false); - mDayOffsetSlider->setEnabled(false); - mAllowOverRide->setEnabled(enabled); +std::string LLPanelEnvironmentInfo::getInventoryNameForAssetId(LLUUID asset_id) +{ + LLFloaterSettingsPicker *picker = getSettingsPicker(); + + if (!picker) + { + LL_WARNS("ENVPANEL") << "Couldn't instantiate picker." << LL_ENDL; + return std::string(); + } + + std::string name(picker->findItemName(asset_id, false, false)); + + if (name.empty()) + return getString(STR_LABEL_UNKNOWNINV); + return name; +} + +LLFloaterSettingsPicker *LLPanelEnvironmentInfo::getSettingsPicker() +{ + LLFloaterSettingsPicker *picker = static_cast(mSettingsFloater.get()); - getChildView("edit_btn")->setEnabled(false); + // Show the dialog + if (!picker) + { + picker = new LLFloaterSettingsPicker(this, + LLUUID::null, "SELECT SETTINGS"); + + mSettingsFloater = picker->getHandle(); + + picker->setCommitCallback([this](LLUICtrl *, const LLSD &data){ onPickerCommited(data.asUUID()); }); + } - getChildView("apply_btn")->setEnabled(enabled); - getChildView("cancel_btn")->setEnabled(enabled); + return picker; +} + +LLFloaterEditExtDayCycle * LLPanelEnvironmentInfo::getEditFloater() +{ + LLFloaterEditExtDayCycle *editor = static_cast(mEditFloater.get()); - if (enabled) + // Show the dialog + if (!editor) { - // Enable/disable some controls based on currently selected radio buttons. - bool use_defaults = mRegionSettingsRadioGroup->getSelectedIndex() == 0; - getChild("edit_btn")->setEnabled(!use_defaults); + LLSD params(LLSDMap(LLFloaterEditExtDayCycle::KEY_EDIT_CONTEXT, "parcel") + (LLFloaterEditExtDayCycle::KEY_DAY_LENGTH, static_cast(mCurrentEnvironment->mDayLength.value()))); - mDayLengthSlider->setEnabled(!use_defaults); - mDayOffsetSlider->setEnabled(!use_defaults); + editor = (LLFloaterEditExtDayCycle *)LLFloaterReg::getInstance(FLOATER_DAY_CYCLE_EDIT, params); + if (!editor) + return nullptr; } + + return editor; +} + +void LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) +{ + getChild(RDG_ENVIRONMENT_SELECT)->setEnabled(enabled); + getChild(RDO_USEDEFAULT)->setEnabled(enabled); + getChild(RDO_USEINV)->setEnabled(enabled); + getChild(RDO_USECUSTOM)->setEnabled(enabled); + getChild(EDT_INVNAME)->setEnabled(FALSE); + getChild(BTN_SELECTINV)->setEnabled(enabled); + getChild(BTN_EDIT)->setEnabled(enabled); + getChild(SLD_DAYLENGTH)->setEnabled(enabled); + getChild(SLD_DAYOFFSET)->setEnabled(enabled); + getChild(CHK_ALLOWOVERRIDE)->setEnabled(enabled && (mCurrentParcelId == INVALID_PARCEL_ID)); + getChild(BTN_APPLY)->setEnabled(enabled && (mDirtyFlag != 0)); + getChild(BTN_CANCEL)->setEnabled(enabled && (mDirtyFlag != 0)); } void LLPanelEnvironmentInfo::setApplyProgress(bool started) @@ -152,270 +251,119 @@ void LLPanelEnvironmentInfo::setApplyProgress(bool started) // } } -void LLPanelEnvironmentInfo::setDirty(bool dirty) +void LLPanelEnvironmentInfo::setDirtyFlag(S32 flag) { - getChildView("apply_btn")->setEnabled(dirty); - getChildView("cancel_btn")->setEnabled(dirty); + bool can_edit = canEdit(); + mDirtyFlag |= flag; + getChildView(BTN_APPLY)->setEnabled((mDirtyFlag != 0) && can_edit); + getChildView(BTN_CANCEL)->setEnabled((mDirtyFlag != 0) && can_edit); } -// void LLPanelEnvironmentInfo::sendRegionSunUpdate() -// { -// #if 0 -// LLRegionInfoModel& region_info = LLRegionInfoModel::instance(); -// -// // If the region is being switched to fixed sky, -// // change the region's sun hour according to the (fixed) sun position. -// // This is needed for llGetSunDirection() LSL function to work properly (STORM-1330). -// const LLSD& sky_map = mNewRegionSettings.getSkyMap(); -// bool region_use_fixed_sky = sky_map.size() == 1; -// if (region_use_fixed_sky) -// { -// LLWLParamSet param_set; -// llassert(sky_map.isMap()); -// param_set.setAll(sky_map.beginMap()->second); -// F32 sun_angle = param_set.getSunAngle(); -// -// LL_DEBUGS("Windlight Sync") << "Old sun hour: " << region_info.mSunHour << LL_ENDL; -// // convert value range from 0..2pi to 6..30 -// region_info.mSunHour = fmodf((sun_angle / F_TWO_PI) * 24.f, 24.f) + 6.f; -// } +void LLPanelEnvironmentInfo::onSwitchDefaultSelection() +{ + setDirtyFlag(DIRTY_FLAG_DAYCYCLE); +// bool use_defaults = mRegionSettingsRadioGroup->getSelectedIndex() == 0; +// +// getChild("edit_btn")->setEnabled(!use_defaults); // -// region_info.setUseFixedSun(region_use_fixed_sky); -// region_info.mUseEstateSun = !region_use_fixed_sky; -// LL_DEBUGS("Windlight Sync") << "Sun hour: " << region_info.mSunHour << LL_ENDL; +// mDayLengthSlider->setEnabled(!use_defaults); +// mDayOffsetSlider->setEnabled(!use_defaults); // -// region_info.sendRegionTerrain(LLFloaterRegionInfo::getLastInvoice()); -// #endif -// } - -// void LLPanelEnvironmentInfo::fixEstateSun() -// { -// // We don't support fixed sun estates anymore and need to fix -// // such estates for region day cycle to take effect. -// // *NOTE: Assuming that current estate settings have arrived already. -// LLEstateInfoModel& estate_info = LLEstateInfoModel::instance(); -// if (estate_info.getUseFixedSun()) -// { -// LL_INFOS() << "Switching estate to global sun" << LL_ENDL; -// estate_info.setUseFixedSun(false); -// estate_info.sendEstateInfo(); -// } -// } +// setDirty(true); +} -// void LLPanelEnvironmentInfo::populateWaterPresetsList() -// { -// #if 0 -// mWaterPresetCombo->removeall(); -// -// // If the region already has water params, add them to the list. -// const LLEnvironmentSettings& region_settings = LLEnvManagerNew::instance().getRegionSettings(); -// if (region_settings.getWaterParams().size() != 0) -// { -// const std::string& region_name = gAgent.getRegion()->getName(); -// mWaterPresetCombo->add(region_name, LLWLParamKey(region_name, LLEnvKey::SCOPE_REGION).toLLSD()); -// mWaterPresetCombo->addSeparator(); -// } -// -// std::list user_presets, system_presets; -// LLWaterParamManager::instance().getPresetNames(user_presets, system_presets); -// -// // Add local user presets first. -// for (std::list::const_iterator it = user_presets.begin(); it != user_presets.end(); ++it) -// { -// mWaterPresetCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toLLSD()); -// } -// -// if (user_presets.size() > 0) -// { -// mWaterPresetCombo->addSeparator(); -// } -// -// // Add local system presets. -// for (std::list::const_iterator it = system_presets.begin(); it != system_presets.end(); ++it) -// { -// mWaterPresetCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toLLSD()); -// } -// -// // There's no way to select current preset because its name is not stored on server. -// #endif -// } -// -// void LLPanelEnvironmentInfo::populateSkyPresetsList() -// { -// #if 0 -// mSkyPresetCombo->removeall(); -// -// LLWLParamManager::preset_name_list_t region_presets; -// LLWLParamManager::preset_name_list_t user_presets, sys_presets; -// LLWLParamManager::instance().getPresetNames(region_presets, user_presets, sys_presets); -// -// // Add region presets. -// std::string region_name = gAgent.getRegion() ? gAgent.getRegion()->getName() : LLTrans::getString("Unknown"); -// for (LLWLParamManager::preset_name_list_t::const_iterator it = region_presets.begin(); it != region_presets.end(); ++it) -// { -// std::string preset_name = *it; -// std::string item_title = preset_name + " (" + region_name + ")"; -// mSkyPresetCombo->add(item_title, LLWLParamKey(preset_name, LLEnvKey::SCOPE_REGION).toStringVal()); -// } -// -// if (!region_presets.empty()) -// { -// mSkyPresetCombo->addSeparator(); -// } -// -// // Add user presets. -// for (LLWLParamManager::preset_name_list_t::const_iterator it = user_presets.begin(); it != user_presets.end(); ++it) -// { -// mSkyPresetCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toStringVal()); -// } -// -// if (!user_presets.empty()) -// { -// mSkyPresetCombo->addSeparator(); -// } -// -// // Add system presets. -// for (LLWLParamManager::preset_name_list_t::const_iterator it = sys_presets.begin(); it != sys_presets.end(); ++it) -// { -// mSkyPresetCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toStringVal()); -// } -// -// // Select current preset. -// LLSD sky_map = LLEnvManagerNew::instance().getRegionSettings().getSkyMap(); -// if (sky_map.size() == 1) // if the region is set to fixed sky -// { -// std::string preset_name = sky_map.beginMap()->first; -// mSkyPresetCombo->selectByValue(LLWLParamKey(preset_name, LLEnvKey::SCOPE_REGION).toStringVal()); -// } -// #endif -// } -// -// void LLPanelEnvironmentInfo::populateDayCyclesList() -// { -// #if 0 -// mDayCyclePresetCombo->removeall(); -// -// // If the region already has env. settings, add its day cycle to the list. -// const LLSD& cur_region_dc = LLEnvManagerNew::instance().getRegionSettings().getWLDayCycle(); -// if (cur_region_dc.size() != 0) -// { -// LLViewerRegion* region = gAgent.getRegion(); -// llassert(region != NULL); -// -// LLWLParamKey key(region->getName(), LLEnvKey::SCOPE_REGION); -// mDayCyclePresetCombo->add(region->getName(), key.toStringVal()); -// mDayCyclePresetCombo->addSeparator(); -// } -// -// // Add local user day cycles. -// LLDayCycleManager::preset_name_list_t user_days, sys_days; -// LLDayCycleManager::instance().getPresetNames(user_days, sys_days); -// for (LLDayCycleManager::preset_name_list_t::const_iterator it = user_days.begin(); it != user_days.end(); ++it) -// { -// mDayCyclePresetCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toStringVal()); -// } -// -// if (user_days.size() > 0) -// { -// mDayCyclePresetCombo->addSeparator(); -// } -// -// // Add local system day cycles. -// for (LLDayCycleManager::preset_name_list_t::const_iterator it = sys_days.begin(); it != sys_days.end(); ++it) -// { -// mDayCyclePresetCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toStringVal()); -// } -// -// // Current day cycle is already selected. -// #endif -// } -void LLPanelEnvironmentInfo::onSwitchDefaultSelection() +void LLPanelEnvironmentInfo::onSldDayLengthChanged(F32 value) { - bool use_defaults = mRegionSettingsRadioGroup->getSelectedIndex() == 0; - - getChild("edit_btn")->setEnabled(!use_defaults); - - mDayLengthSlider->setEnabled(!use_defaults); - mDayOffsetSlider->setEnabled(!use_defaults); + F32Hours daylength(value); - setDirty(true); + mCurrentEnvironment->mDayLength = daylength; + setDirtyFlag(DIRTY_FLAG_DAYLENGTH); } +void LLPanelEnvironmentInfo::onSldDayOffsetChanged(F32 value) +{ + F32Hours dayoffset(value); + + if (dayoffset.value() < 0.0f) + dayoffset += F32Hours(24.0); + + mCurrentEnvironment->mDayLength = dayoffset; + setDirtyFlag(DIRTY_FLAG_DAYOFFSET); +} + void LLPanelEnvironmentInfo::onBtnApply() { - doApply(); +// doApply(); } -void LLPanelEnvironmentInfo::onBtnCancel() +void LLPanelEnvironmentInfo::onBtnReset() { - // Reload last saved region settings. - refresh(); + mCurrentEnvironment.reset(); + refreshFromSource(); } void LLPanelEnvironmentInfo::onBtnEdit() { - LLFloaterEditExtDayCycle *dayeditor = (LLFloaterEditExtDayCycle *)LLFloaterReg::getInstance("env_edit_extdaycycle"); + LLFloaterEditExtDayCycle *dayeditor = getEditFloater(); - if (dayeditor) - { //*TODO Determine if region or parcel. - LLSD params(LLSDMap(LLFloaterEditExtDayCycle::KEY_LIVE_ENVIRONMENT, "parcel") - (LLFloaterEditExtDayCycle::KEY_DAY_LENGTH, mDayLengthSlider->getValueF32() * (60.0 * 60.0))); - - LLFloaterReg::showInstance("env_edit_extdaycycle", params, TAKE_FOCUS_YES); + dayeditor->openFloater(dayeditor->getKey()); +} -// dayeditor->openFloater(mEditingDayCycle, F32Hours(mDayLengthSlider->getValue().asReal()), F32Hours(mDayOffsetSlider->getValue().asReal())); +void LLPanelEnvironmentInfo::onBtnSelect() +{ + LLFloaterSettingsPicker *picker = getSettingsPicker(); + if (picker) + { + picker->setSettingsFilter(LLSettingsType::ST_NONE); + picker->setSettingsAssetId((mCurrentEnvironment->mDayCycle) ? mCurrentEnvironment->mDayCycle->getAssetId() : LLUUID::null); + picker->openFloater(); + picker->setFocus(TRUE); } } +void LLPanelEnvironmentInfo::onPickerCommited(LLUUID asset_id) +{ + LLSettingsVOBase::getSettingsAsset(asset_id, [this](LLUUID, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { + if (status) + return; + onPickerAssetDownloaded(settings); + }); +} + void LLPanelEnvironmentInfo::onEditiCommited(LLSettingsDay::ptr_t newday) { doEditCommited(newday); } -void LLPanelEnvironmentInfo::doEditCommited(LLSettingsDay::ptr_t &newday) +void LLPanelEnvironmentInfo::onPickerAssetDownloaded(LLSettingsBase::ptr_t settings) { - mEditingDayCycle = newday; - /*TODO pure virtual*/ + LLSettingsVODay::buildFromOtherSetting(settings, [this](LLSettingsDay::ptr_t pday) + { + if (pday) + { + mCurrentEnvironment->mDayCycle = pday; + setDirtyFlag(DIRTY_FLAG_DAYCYCLE); + } + refresh(); + }); } -// void LLPanelEnvironmentInfo::onRegionSettingschange() -// { -// LL_DEBUGS("Windlight") << "Region settings changed, refreshing" << LL_ENDL; -// refresh(); -// -// // Stop applying progress indicator (it may be running if it's us who initiated settings update). -// setApplyProgress(false); -// } -// -// void LLPanelEnvironmentInfo::onRegionSettingsApplied(bool ok) -// { -// // If applying new settings has failed, stop the indicator right away. -// // Otherwise it will be stopped when we receive the updated settings from server. -// if (ok) -// { -// // Set the region sun phase/flags according to the chosen new preferences. -// // -// // If we do this earlier we may get jerky transition from fixed sky to a day cycle (STORM-1481). -// // That is caused by the simulator re-sending the region info, which in turn makes us -// // re-request and display old region environment settings while the new ones haven't been applied yet. -// sendRegionSunUpdate(); -// -// // Switch estate to not using fixed sun for the region day cycle to work properly (STORM-1506). -// fixEstateSun(); -// } -// else -// { -// setApplyProgress(false); -// -// // We need to re-request environment setting here, -// // otherwise our subsequent attempts to change region settings will fail with the following error: -// // "Unable to update environment settings because the last update your viewer saw was not the same -// // as the last update sent from the simulator. Try sending your update again, and if this -// // does not work, try leaving and returning to the region." -// // LLEnvManagerNew::instance().requestRegionSettings(); -// } -// } - +void LLPanelEnvironmentInfo::handleEnvironmentReceived(S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) +{ + if (parcel_id != mCurrentParcelId) + { + LL_WARNS("ENVPANEL") << "Have environment for parcel " << parcel_id << " expecting " << mCurrentParcelId << ". Discarding." << LL_ENDL; + return; + } + mCurrentEnvironment = envifo; + setDirtyFlag(DIRTY_FLAG_DAYCYCLE); + refresh(); +} +void LLPanelEnvironmentInfo::doEditCommited(LLSettingsDay::ptr_t &newday) +{ +// mEditingDayCycle = newday; + /*TODO pure virtual*/ +} -- cgit v1.2.3 From 68158f0340729d9f7e5a4b3e64bfc154a105ab6c Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Thu, 16 Aug 2018 09:43:54 -0700 Subject: Pass call backs into parcel and region change methods. --- indra/newview/llpanelenvironment.cpp | 62 ++++++++++++++++++++++++++++-------- 1 file changed, 48 insertions(+), 14 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index a2788124e7..d323e5f43b 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -221,6 +221,8 @@ LLFloaterEditExtDayCycle * LLPanelEnvironmentInfo::getEditFloater() void LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) { + S32 rdo_selection = getChild(RDG_ENVIRONMENT_SELECT)->getSelectedIndex(); + getChild(RDG_ENVIRONMENT_SELECT)->setEnabled(enabled); getChild(RDO_USEDEFAULT)->setEnabled(enabled); getChild(RDO_USEINV)->setEnabled(enabled); @@ -228,8 +230,8 @@ void LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) getChild(EDT_INVNAME)->setEnabled(FALSE); getChild(BTN_SELECTINV)->setEnabled(enabled); getChild(BTN_EDIT)->setEnabled(enabled); - getChild(SLD_DAYLENGTH)->setEnabled(enabled); - getChild(SLD_DAYOFFSET)->setEnabled(enabled); + getChild(SLD_DAYLENGTH)->setEnabled(enabled && (rdo_selection != 0)); + getChild(SLD_DAYOFFSET)->setEnabled(enabled && (rdo_selection != 0)); getChild(CHK_ALLOWOVERRIDE)->setEnabled(enabled && (mCurrentParcelId == INVALID_PARCEL_ID)); getChild(BTN_APPLY)->setEnabled(enabled && (mDirtyFlag != 0)); getChild(BTN_CANCEL)->setEnabled(enabled && (mDirtyFlag != 0)); @@ -259,19 +261,23 @@ void LLPanelEnvironmentInfo::setDirtyFlag(S32 flag) getChildView(BTN_CANCEL)->setEnabled((mDirtyFlag != 0) && can_edit); } +void LLPanelEnvironmentInfo::clearDirtyFlag(S32 flag) +{ + bool can_edit = canEdit(); + mDirtyFlag &= ~flag; + getChildView(BTN_APPLY)->setEnabled((mDirtyFlag != 0) && can_edit); + getChildView(BTN_CANCEL)->setEnabled((mDirtyFlag != 0) && can_edit); +} + void LLPanelEnvironmentInfo::onSwitchDefaultSelection() { + bool can_edit = canEdit(); setDirtyFlag(DIRTY_FLAG_DAYCYCLE); -// bool use_defaults = mRegionSettingsRadioGroup->getSelectedIndex() == 0; -// -// getChild("edit_btn")->setEnabled(!use_defaults); -// -// mDayLengthSlider->setEnabled(!use_defaults); -// mDayOffsetSlider->setEnabled(!use_defaults); -// -// setDirty(true); -} + S32 rdo_selection = getChild(RDG_ENVIRONMENT_SELECT)->getSelectedIndex(); + getChild(SLD_DAYLENGTH)->setEnabled(can_edit && (rdo_selection != 0)); + getChild(SLD_DAYOFFSET)->setEnabled(can_edit && (rdo_selection != 0)); +} void LLPanelEnvironmentInfo::onSldDayLengthChanged(F32 value) { @@ -281,7 +287,6 @@ void LLPanelEnvironmentInfo::onSldDayLengthChanged(F32 value) setDirtyFlag(DIRTY_FLAG_DAYLENGTH); } - void LLPanelEnvironmentInfo::onSldDayOffsetChanged(F32 value) { F32Hours dayoffset(value); @@ -295,7 +300,7 @@ void LLPanelEnvironmentInfo::onSldDayOffsetChanged(F32 value) void LLPanelEnvironmentInfo::onBtnApply() { -// doApply(); + doApply(); } void LLPanelEnvironmentInfo::onBtnReset() @@ -323,6 +328,35 @@ void LLPanelEnvironmentInfo::onBtnSelect() } } + +void LLPanelEnvironmentInfo::doApply() +{ + if (getIsDirtyFlag(DIRTY_FLAG_MASK)) + { + S32 rdo_selection = getChild(RDG_ENVIRONMENT_SELECT)->getSelectedIndex(); + + if (rdo_selection == 0) + { + LLEnvironment::instance().resetParcel(mCurrentParcelId, + [this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {handleEnvironmentReceived(parcel_id, envifo); }); + } + else if (rdo_selection == 1) + { + LLEnvironment::instance().updateParcel(mCurrentParcelId, + mCurrentEnvironment->mDayCycle->getAssetId(), mCurrentEnvironment->mDayLength.value(), mCurrentEnvironment->mDayOffset.value(), + [this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {handleEnvironmentReceived(parcel_id, envifo); }); + } + else + { + LLEnvironment::instance().updateParcel(mCurrentParcelId, + mCurrentEnvironment->mDayCycle, mCurrentEnvironment->mDayLength.value(), mCurrentEnvironment->mDayOffset.value(), + [this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {handleEnvironmentReceived(parcel_id, envifo); }); + } + + } + setControlsEnabled(false); +} + void LLPanelEnvironmentInfo::onPickerCommited(LLUUID asset_id) { LLSettingsVOBase::getSettingsAsset(asset_id, [this](LLUUID, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { @@ -358,7 +392,7 @@ void LLPanelEnvironmentInfo::handleEnvironmentReceived(S32 parcel_id, LLEnvironm return; } mCurrentEnvironment = envifo; - setDirtyFlag(DIRTY_FLAG_DAYCYCLE); + clearDirtyFlag(DIRTY_FLAG_MASK); refresh(); } -- cgit v1.2.3 From 7f25bef9c4bd5bf277331040711f13eb69b9c6d1 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Thu, 16 Aug 2018 16:27:53 -0700 Subject: MAINT-7703: Estate level switch turns of parcel environments. --- indra/newview/llpanelenvironment.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index d323e5f43b..7d11f7c6e2 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -69,11 +69,11 @@ const std::string LLPanelEnvironmentInfo::STR_LABEL_USEDEFAULT("str_label_use_de const std::string LLPanelEnvironmentInfo::STR_LABEL_USEREGION("str_label_use_region"); const std::string LLPanelEnvironmentInfo::STR_LABEL_UNKNOWNINV("str_unknow_inventory"); -const S32 LLPanelEnvironmentInfo::DIRTY_FLAG_DAYCYCLE(0x01 << 0); -const S32 LLPanelEnvironmentInfo::DIRTY_FLAG_DAYLENGTH(0x01 << 1); -const S32 LLPanelEnvironmentInfo::DIRTY_FLAG_DAYOFFSET(0x01 << 2); +const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_DAYCYCLE(0x01 << 0); +const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_DAYLENGTH(0x01 << 1); +const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_DAYOFFSET(0x01 << 2); -const S32 LLPanelEnvironmentInfo::DIRTY_FLAG_MASK( +const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_MASK( LLPanelEnvironmentInfo::DIRTY_FLAG_DAYCYCLE | LLPanelEnvironmentInfo::DIRTY_FLAG_DAYLENGTH | LLPanelEnvironmentInfo::DIRTY_FLAG_DAYOFFSET ); @@ -253,7 +253,7 @@ void LLPanelEnvironmentInfo::setApplyProgress(bool started) // } } -void LLPanelEnvironmentInfo::setDirtyFlag(S32 flag) +void LLPanelEnvironmentInfo::setDirtyFlag(U32 flag) { bool can_edit = canEdit(); mDirtyFlag |= flag; @@ -261,7 +261,7 @@ void LLPanelEnvironmentInfo::setDirtyFlag(S32 flag) getChildView(BTN_CANCEL)->setEnabled((mDirtyFlag != 0) && can_edit); } -void LLPanelEnvironmentInfo::clearDirtyFlag(S32 flag) +void LLPanelEnvironmentInfo::clearDirtyFlag(U32 flag) { bool can_edit = canEdit(); mDirtyFlag &= ~flag; @@ -294,7 +294,7 @@ void LLPanelEnvironmentInfo::onSldDayOffsetChanged(F32 value) if (dayoffset.value() < 0.0f) dayoffset += F32Hours(24.0); - mCurrentEnvironment->mDayLength = dayoffset; + mCurrentEnvironment->mDayOffset = dayoffset; setDirtyFlag(DIRTY_FLAG_DAYOFFSET); } @@ -353,8 +353,8 @@ void LLPanelEnvironmentInfo::doApply() [this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {handleEnvironmentReceived(parcel_id, envifo); }); } + setControlsEnabled(false); } - setControlsEnabled(false); } void LLPanelEnvironmentInfo::onPickerCommited(LLUUID asset_id) -- cgit v1.2.3 From 1716129fd23ff35e030808406af1a8f796dc4b01 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 17 Aug 2018 12:35:42 -0700 Subject: MAINT-8826, MAINT-8990, MAINT-9002, MAINT-7703: Rework for environment pannels in Region/Estate and Parcel. Enable/disable by permission. Edit the correct environment. Dirty flags for changes. Estate owner disallow switch. --- indra/newview/llpanelenvironment.cpp | 40 ++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 15 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 7d11f7c6e2..907118aa44 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -162,7 +162,7 @@ void LLPanelEnvironmentInfo::refresh() void LLPanelEnvironmentInfo::refreshFromSource() { LLEnvironment::instance().requestParcel(mCurrentParcelId, - [this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {handleEnvironmentReceived(parcel_id, envifo); }); + [this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {onEnvironmentReceived(parcel_id, envifo); }); } std::string LLPanelEnvironmentInfo::getInventoryNameForAssetId(LLUUID asset_id) @@ -207,13 +207,14 @@ LLFloaterEditExtDayCycle * LLPanelEnvironmentInfo::getEditFloater() // Show the dialog if (!editor) { - LLSD params(LLSDMap(LLFloaterEditExtDayCycle::KEY_EDIT_CONTEXT, "parcel") + LLSD params(LLSDMap(LLFloaterEditExtDayCycle::KEY_EDIT_CONTEXT, (mCurrentParcelId == INVALID_PARCEL_ID) ? LLFloaterEditExtDayCycle::CONTEXT_REGION : LLFloaterEditExtDayCycle::CONTEXT_PARCEL) (LLFloaterEditExtDayCycle::KEY_DAY_LENGTH, static_cast(mCurrentEnvironment->mDayLength.value()))); editor = (LLFloaterEditExtDayCycle *)LLFloaterReg::getInstance(FLOATER_DAY_CYCLE_EDIT, params); if (!editor) return nullptr; + editor->setEditCommitSignal([this](LLSettingsDay::ptr_t pday) { onEditCommited(pday); }); } return editor; @@ -313,7 +314,14 @@ void LLPanelEnvironmentInfo::onBtnEdit() { LLFloaterEditExtDayCycle *dayeditor = getEditFloater(); - dayeditor->openFloater(dayeditor->getKey()); + LLSD params(LLSDMap(LLFloaterEditExtDayCycle::KEY_EDIT_CONTEXT, (mCurrentParcelId == INVALID_PARCEL_ID) ? LLFloaterEditExtDayCycle::VALUE_CONTEXT_REGION: LLFloaterEditExtDayCycle::VALUE_CONTEXT_PARCEL) + (LLFloaterEditExtDayCycle::KEY_DAY_LENGTH, static_cast(mCurrentEnvironment->mDayLength.value()))); + + dayeditor->openFloater(params); + if (mCurrentEnvironment->mDayCycle) + dayeditor->setEditDayCycle(mCurrentEnvironment->mDayCycle); + else + dayeditor->setEditDefaultDayCycle(); } void LLPanelEnvironmentInfo::onBtnSelect() @@ -338,19 +346,19 @@ void LLPanelEnvironmentInfo::doApply() if (rdo_selection == 0) { LLEnvironment::instance().resetParcel(mCurrentParcelId, - [this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {handleEnvironmentReceived(parcel_id, envifo); }); + [this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {onEnvironmentReceived(parcel_id, envifo); }); } else if (rdo_selection == 1) { LLEnvironment::instance().updateParcel(mCurrentParcelId, mCurrentEnvironment->mDayCycle->getAssetId(), mCurrentEnvironment->mDayLength.value(), mCurrentEnvironment->mDayOffset.value(), - [this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {handleEnvironmentReceived(parcel_id, envifo); }); + [this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {onEnvironmentReceived(parcel_id, envifo); }); } else { LLEnvironment::instance().updateParcel(mCurrentParcelId, mCurrentEnvironment->mDayCycle, mCurrentEnvironment->mDayLength.value(), mCurrentEnvironment->mDayOffset.value(), - [this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {handleEnvironmentReceived(parcel_id, envifo); }); + [this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {onEnvironmentReceived(parcel_id, envifo); }); } setControlsEnabled(false); @@ -366,9 +374,17 @@ void LLPanelEnvironmentInfo::onPickerCommited(LLUUID asset_id) }); } -void LLPanelEnvironmentInfo::onEditiCommited(LLSettingsDay::ptr_t newday) +void LLPanelEnvironmentInfo::onEditCommited(LLSettingsDay::ptr_t newday) { - doEditCommited(newday); + size_t newhash(newday->getHash()); + size_t oldhash((mCurrentEnvironment->mDayCycle) ? mCurrentEnvironment->mDayCycle->getHash() : 0); + + if (newhash != oldhash) + { + mCurrentEnvironment->mDayCycle = newday; + setDirtyFlag(DIRTY_FLAG_DAYCYCLE); + refresh(); + } } void LLPanelEnvironmentInfo::onPickerAssetDownloaded(LLSettingsBase::ptr_t settings) @@ -384,7 +400,7 @@ void LLPanelEnvironmentInfo::onPickerAssetDownloaded(LLSettingsBase::ptr_t setti }); } -void LLPanelEnvironmentInfo::handleEnvironmentReceived(S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) +void LLPanelEnvironmentInfo::onEnvironmentReceived(S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { if (parcel_id != mCurrentParcelId) { @@ -395,9 +411,3 @@ void LLPanelEnvironmentInfo::handleEnvironmentReceived(S32 parcel_id, LLEnvironm clearDirtyFlag(DIRTY_FLAG_MASK); refresh(); } - -void LLPanelEnvironmentInfo::doEditCommited(LLSettingsDay::ptr_t &newday) -{ -// mEditingDayCycle = newday; - /*TODO pure virtual*/ -} -- cgit v1.2.3 From 1e3ee272ae811b862a529b6f3bbebb50a0c22580 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 17 Aug 2018 15:37:10 -0700 Subject: Add an apparent time of day. More OSX complaints. --- indra/newview/llpanelenvironment.cpp | 57 +++++++++++++++++++++++++++++++++--- 1 file changed, 53 insertions(+), 4 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 907118aa44..1f29e4c054 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -44,6 +44,7 @@ #include "llsettingsvo.h" #include "llappviewer.h" +#include "llcallbacklist.h" //========================================================================= namespace @@ -64,6 +65,7 @@ const std::string LLPanelEnvironmentInfo::SLD_DAYOFFSET("sld_day_offset"); 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::STR_LABEL_USEDEFAULT("str_label_use_default"); const std::string LLPanelEnvironmentInfo::STR_LABEL_USEREGION("str_label_use_region"); @@ -111,10 +113,11 @@ void LLPanelEnvironmentInfo::onOpen(const LLSD& key) // virtual void LLPanelEnvironmentInfo::onVisibilityChange(BOOL new_visibility) { - // If hiding (user switched to another tab or closed the floater), - // display user's preferred environment. - // switching back and forth between agent's environment and the one being edited. - // + if (new_visibility) + gIdleCallbacks.addFunction(onIdlePlay, this); + else + gIdleCallbacks.deleteFunction(onIdlePlay, this); + } void LLPanelEnvironmentInfo::refresh() @@ -156,6 +159,8 @@ void LLPanelEnvironmentInfo::refresh() getChild(SLD_DAYLENGTH)->setValue(daylength.value()); getChild(SLD_DAYOFFSET)->setValue(dayoffset.value()); + udpateApparentTimeOfDay(); + setControlsEnabled(canEdit()); } @@ -286,6 +291,8 @@ void LLPanelEnvironmentInfo::onSldDayLengthChanged(F32 value) mCurrentEnvironment->mDayLength = daylength; setDirtyFlag(DIRTY_FLAG_DAYLENGTH); + + udpateApparentTimeOfDay(); } void LLPanelEnvironmentInfo::onSldDayOffsetChanged(F32 value) @@ -297,6 +304,8 @@ void LLPanelEnvironmentInfo::onSldDayOffsetChanged(F32 value) mCurrentEnvironment->mDayOffset = dayoffset; setDirtyFlag(DIRTY_FLAG_DAYOFFSET); + + udpateApparentTimeOfDay(); } void LLPanelEnvironmentInfo::onBtnApply() @@ -365,6 +374,46 @@ void LLPanelEnvironmentInfo::doApply() } } + +void LLPanelEnvironmentInfo::udpateApparentTimeOfDay() +{ + static const F32 SECONDSINDAY(24.0 * 60.0 * 60.0); + + if (!mCurrentEnvironment) + return; + + S32Seconds now(LLDate::now().secondsSinceEpoch()); + + now += mCurrentEnvironment->mDayOffset; + + F32 perc = (F32)(now.value() % mCurrentEnvironment->mDayLength.value()) / (F32)(mCurrentEnvironment->mDayLength.value()); + + S32Seconds secondofday((S32)(perc * SECONDSINDAY)); + S32Hours hourofday(secondofday); + S32Seconds secondofhour(secondofday - hourofday); + S32Minutes minutesofhour(secondofhour); + bool am_pm(hourofday.value() >= 12); + + if (hourofday.value() < 1) + hourofday = S32Hours(12); + if (hourofday.value() > 12) + hourofday -= S32Hours(12); + + std::string lblminute(((minutesofhour.value() < 10) ? "0" : "") + LLSD(minutesofhour.value()).asString()); + + + getChild(LBL_TIMEOFDAY)->setTextArg("[HH]", LLSD(hourofday.value()).asString()); + getChild(LBL_TIMEOFDAY)->setTextArg("[MM]", lblminute); + getChild(LBL_TIMEOFDAY)->setTextArg("[AP]", std::string(am_pm ? "PM" : "AM")); + getChild(LBL_TIMEOFDAY)->setTextArg("[PRC]", LLSD((S32)(100 * perc)).asString()); + +} + +void LLPanelEnvironmentInfo::onIdlePlay(void *data) +{ + ((LLPanelEnvironmentInfo *)data)->udpateApparentTimeOfDay(); +} + void LLPanelEnvironmentInfo::onPickerCommited(LLUUID asset_id) { LLSettingsVOBase::getSettingsAsset(asset_id, [this](LLUUID, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { -- cgit v1.2.3 From 8fc3956a5eeaa2dffabdcda60800d9c4d4e49c43 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 20 Aug 2018 14:59:02 -0700 Subject: Use the EnvironmentInfo structure to pass information back from legacy environment requests. --- indra/newview/llpanelenvironment.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 1f29e4c054..5bdd2ecff8 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -207,13 +207,14 @@ LLFloaterSettingsPicker *LLPanelEnvironmentInfo::getSettingsPicker() LLFloaterEditExtDayCycle * LLPanelEnvironmentInfo::getEditFloater() { + static const S32 FOURHOURS(4 * 60 * 60); LLFloaterEditExtDayCycle *editor = static_cast(mEditFloater.get()); // Show the dialog if (!editor) { LLSD params(LLSDMap(LLFloaterEditExtDayCycle::KEY_EDIT_CONTEXT, (mCurrentParcelId == INVALID_PARCEL_ID) ? LLFloaterEditExtDayCycle::CONTEXT_REGION : LLFloaterEditExtDayCycle::CONTEXT_PARCEL) - (LLFloaterEditExtDayCycle::KEY_DAY_LENGTH, static_cast(mCurrentEnvironment->mDayLength.value()))); + (LLFloaterEditExtDayCycle::KEY_DAY_LENGTH, mCurrentEnvironment ? (S32)(mCurrentEnvironment->mDayLength.value()) : FOURHOURS)); editor = (LLFloaterEditExtDayCycle *)LLFloaterReg::getInstance(FLOATER_DAY_CYCLE_EDIT, params); @@ -321,10 +322,12 @@ void LLPanelEnvironmentInfo::onBtnReset() void LLPanelEnvironmentInfo::onBtnEdit() { + static const S32 FOURHOURS(4 * 60 * 60); + LLFloaterEditExtDayCycle *dayeditor = getEditFloater(); - LLSD params(LLSDMap(LLFloaterEditExtDayCycle::KEY_EDIT_CONTEXT, (mCurrentParcelId == INVALID_PARCEL_ID) ? LLFloaterEditExtDayCycle::VALUE_CONTEXT_REGION: LLFloaterEditExtDayCycle::VALUE_CONTEXT_PARCEL) - (LLFloaterEditExtDayCycle::KEY_DAY_LENGTH, static_cast(mCurrentEnvironment->mDayLength.value()))); + LLSD params(LLSDMap(LLFloaterEditExtDayCycle::KEY_EDIT_CONTEXT, (mCurrentParcelId == INVALID_PARCEL_ID) ? LLFloaterEditExtDayCycle::CONTEXT_REGION : LLFloaterEditExtDayCycle::CONTEXT_PARCEL) + (LLFloaterEditExtDayCycle::KEY_DAY_LENGTH, mCurrentEnvironment ? (S32)(mCurrentEnvironment->mDayLength.value()) : FOURHOURS)); dayeditor->openFloater(params); if (mCurrentEnvironment->mDayCycle) -- cgit v1.2.3 From b2b3c36bda988be4b433e9f97f13bc1c67722eb7 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 20 Aug 2018 16:26:54 -0700 Subject: Didn't get a fix from last week, and divide by zeros are bad. --- indra/newview/llpanelenvironment.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 5bdd2ecff8..e52863c6ef 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -326,7 +326,7 @@ void LLPanelEnvironmentInfo::onBtnEdit() LLFloaterEditExtDayCycle *dayeditor = getEditFloater(); - LLSD params(LLSDMap(LLFloaterEditExtDayCycle::KEY_EDIT_CONTEXT, (mCurrentParcelId == INVALID_PARCEL_ID) ? LLFloaterEditExtDayCycle::CONTEXT_REGION : LLFloaterEditExtDayCycle::CONTEXT_PARCEL) + LLSD params(LLSDMap(LLFloaterEditExtDayCycle::KEY_EDIT_CONTEXT, (mCurrentParcelId == INVALID_PARCEL_ID) ? LLFloaterEditExtDayCycle::VALUE_CONTEXT_REGION : LLFloaterEditExtDayCycle::VALUE_CONTEXT_REGION) (LLFloaterEditExtDayCycle::KEY_DAY_LENGTH, mCurrentEnvironment ? (S32)(mCurrentEnvironment->mDayLength.value()) : FOURHOURS)); dayeditor->openFloater(params); @@ -382,8 +382,12 @@ void LLPanelEnvironmentInfo::udpateApparentTimeOfDay() { static const F32 SECONDSINDAY(24.0 * 60.0 * 60.0); - if (!mCurrentEnvironment) + if ((!mCurrentEnvironment) || (mCurrentEnvironment->mDayLength.value() < 1.0) || (mCurrentEnvironment->mDayOffset.value() < 1.0)) + { + getChild(LBL_TIMEOFDAY)->setVisible(false); return; + } + getChild(LBL_TIMEOFDAY)->setVisible(true); S32Seconds now(LLDate::now().secondsSinceEpoch()); -- cgit v1.2.3 From 163ae605be8871f37f19d94b71ec4370aadf9a49 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 20 Aug 2018 16:54:39 -0700 Subject: MAINT-9019: One last potential null ptr reference. --- indra/newview/llpanelenvironment.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index e52863c6ef..6de17cbee9 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -125,7 +125,7 @@ void LLPanelEnvironmentInfo::refresh() if (gDisconnected) return; - if (((mCurrentEnvironment->mParcelId != INVALID_PARCEL_ID) && (!mCurrentEnvironment->mDayCycle)) || + if ((!mCurrentEnvironment->mDayCycle) || ((mCurrentEnvironment->mParcelId == INVALID_PARCEL_ID) && (mCurrentEnvironment->mDayCycle->getAssetId() == LLSettingsDay::GetDefaultAssetId() ))) { getChild(RDG_ENVIRONMENT_SELECT)->setSelectedIndex(0); -- cgit v1.2.3 From 477c66c890d5d87318705415315aaf9464bec2ff Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 21 Aug 2018 11:37:59 -0700 Subject: Lest couple nullptr checks and disable the controls on legacy regions. --- indra/newview/llpanelenvironment.cpp | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') 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(RDG_ENVIRONMENT_SELECT)->getSelectedIndex(); + bool is_legacy = (mCurrentEnvironment) ? mCurrentEnvironment->mIsLegacy : true; + + bool is_unavailable = (is_legacy && (!mCurrentEnvironment || (mCurrentEnvironment->mParcelId != INVALID_PARCEL_ID))); getChild(RDG_ENVIRONMENT_SELECT)->setEnabled(enabled); - getChild(RDO_USEDEFAULT)->setEnabled(enabled); - getChild(RDO_USEINV)->setEnabled(enabled); + getChild(RDO_USEDEFAULT)->setEnabled(enabled && !is_legacy); + getChild(RDO_USEINV)->setEnabled(enabled && !is_legacy); getChild(RDO_USECUSTOM)->setEnabled(enabled); getChild(EDT_INVNAME)->setEnabled(FALSE); - getChild(BTN_SELECTINV)->setEnabled(enabled); + getChild(BTN_SELECTINV)->setEnabled(enabled && !is_legacy); getChild(BTN_EDIT)->setEnabled(enabled); - getChild(SLD_DAYLENGTH)->setEnabled(enabled && (rdo_selection != 0)); - getChild(SLD_DAYOFFSET)->setEnabled(enabled && (rdo_selection != 0)); - getChild(CHK_ALLOWOVERRIDE)->setEnabled(enabled && (mCurrentParcelId == INVALID_PARCEL_ID)); + getChild(SLD_DAYLENGTH)->setEnabled(enabled && (rdo_selection != 0) && !is_legacy); + getChild(SLD_DAYOFFSET)->setEnabled(enabled && (rdo_selection != 0) && !is_legacy); + getChild(CHK_ALLOWOVERRIDE)->setEnabled(enabled && (mCurrentParcelId == INVALID_PARCEL_ID) && !is_legacy); getChild(BTN_APPLY)->setEnabled(enabled && (mDirtyFlag != 0)); getChild(BTN_CANCEL)->setEnabled(enabled && (mDirtyFlag != 0)); + + getChild(PNL_SETTINGS)->setVisible(!is_unavailable); + getChild(PNL_BUTTONS)->setVisible(!is_unavailable); + getChild(PNL_DISABLED)->setVisible(is_unavailable); + } void LLPanelEnvironmentInfo::setApplyProgress(bool started) -- cgit v1.2.3 From 4859db1adabcf84b959ff0603f1bb8401232164c Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 21 Aug 2018 15:59:18 -0700 Subject: MAINT-9026: Adding scale for sun and moon. Also don't allow the user to directly set the radio buttons for inventory and custom. --- indra/newview/llpanelenvironment.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 4425483989..d91f9110e0 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -243,8 +243,8 @@ void LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) getChild(RDG_ENVIRONMENT_SELECT)->setEnabled(enabled); getChild(RDO_USEDEFAULT)->setEnabled(enabled && !is_legacy); - getChild(RDO_USEINV)->setEnabled(enabled && !is_legacy); - getChild(RDO_USECUSTOM)->setEnabled(enabled); + getChild(RDO_USEINV)->setEnabled(false); // these two are selected automatically based on + getChild(RDO_USECUSTOM)->setEnabled(false); getChild(EDT_INVNAME)->setEnabled(FALSE); getChild(BTN_SELECTINV)->setEnabled(enabled && !is_legacy); getChild(BTN_EDIT)->setEnabled(enabled); -- cgit v1.2.3 From 06a77dd5fe228a3bbf4c57ae3b0c51937871d6a2 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 24 Aug 2018 16:46:07 -0700 Subject: is dirty code in day cycle editor. When environment panel closes disconnect commit hook for crash. --- indra/newview/llpanelenvironment.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index d91f9110e0..51b2fa380f 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -119,7 +119,19 @@ void LLPanelEnvironmentInfo::onVisibilityChange(BOOL new_visibility) if (new_visibility) gIdleCallbacks.addFunction(onIdlePlay, this); else + { gIdleCallbacks.deleteFunction(onIdlePlay, this); + LLFloaterEditExtDayCycle *dayeditor = getEditFloater(); + if (mCommitConnection.connected()) + mCommitConnection.disconnect(); + if (dayeditor) + { + if (dayeditor->isDirty()) + dayeditor->refresh(); + else + dayeditor->closeFloater(); + } + } } @@ -213,13 +225,13 @@ LLFloaterSettingsPicker *LLPanelEnvironmentInfo::getSettingsPicker() return picker; } -LLFloaterEditExtDayCycle * LLPanelEnvironmentInfo::getEditFloater() +LLFloaterEditExtDayCycle * LLPanelEnvironmentInfo::getEditFloater(bool create) { static const S32 FOURHOURS(4 * 60 * 60); LLFloaterEditExtDayCycle *editor = static_cast(mEditFloater.get()); // Show the dialog - if (!editor) + if (!editor && create) { LLSD params(LLSDMap(LLFloaterEditExtDayCycle::KEY_EDIT_CONTEXT, (mCurrentParcelId == INVALID_PARCEL_ID) ? LLFloaterEditExtDayCycle::CONTEXT_REGION : LLFloaterEditExtDayCycle::CONTEXT_PARCEL) (LLFloaterEditExtDayCycle::KEY_DAY_LENGTH, mCurrentEnvironment ? (S32)(mCurrentEnvironment->mDayLength.value()) : FOURHOURS)); @@ -228,9 +240,11 @@ LLFloaterEditExtDayCycle * LLPanelEnvironmentInfo::getEditFloater() if (!editor) return nullptr; - editor->setEditCommitSignal([this](LLSettingsDay::ptr_t pday) { onEditCommited(pday); }); } + if (editor && !mCommitConnection.connected()) + mCommitConnection = editor->setEditCommitSignal([this](LLSettingsDay::ptr_t pday) { onEditCommited(pday); }); + return editor; } -- cgit v1.2.3 From 2fd4ce55af8c68b8ae5eea72566cdb6d87d3a842 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 10 Sep 2018 11:22:36 -0700 Subject: MAINT-9115: When selecting no parcel or a parcel without a day cycle, close the day cycle editor if it is not dirty, if dirty just disable commit. --- indra/newview/llpanelenvironment.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 51b2fa380f..e1676fbb13 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -141,6 +141,7 @@ void LLPanelEnvironmentInfo::refresh() return; setControlsEnabled(canEdit()); + if (!mCurrentEnvironment) { return; @@ -240,6 +241,7 @@ LLFloaterEditExtDayCycle * LLPanelEnvironmentInfo::getEditFloater(bool create) if (!editor) return nullptr; + mEditFloater = editor->getHandle(); } if (editor && !mCommitConnection.connected()) @@ -248,6 +250,30 @@ LLFloaterEditExtDayCycle * LLPanelEnvironmentInfo::getEditFloater(bool create) return editor; } + +void LLPanelEnvironmentInfo::updateEditFloater(const LLEnvironment::EnvironmentInfo::ptr_t &nextenv) +{ + LLFloaterEditExtDayCycle *dayeditor(getEditFloater(false)); + + if (!dayeditor) + return; + + if (!nextenv || !nextenv->mDayCycle) + { + if (mCommitConnection.connected()) + mCommitConnection.disconnect(); + + if (dayeditor->isDirty()) + dayeditor->refresh(); + else + dayeditor->closeFloater(); + } + else + { + /*TODO: Swap in new day to edit?*/ + } +} + void LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) { S32 rdo_selection = getChild(RDG_ENVIRONMENT_SELECT)->getSelectedIndex(); @@ -272,6 +298,7 @@ void LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) getChild(PNL_BUTTONS)->setVisible(!is_unavailable); getChild(PNL_DISABLED)->setVisible(is_unavailable); + updateEditFloater(mCurrentEnvironment); } void LLPanelEnvironmentInfo::setApplyProgress(bool started) -- cgit v1.2.3 From 6246c8077e5ee81321cff52250d3b99eab81cd57 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 10 Sep 2018 14:49:14 -0700 Subject: MAINT-9118: Allow the environment panel to indicated that the environment may be modified. --- indra/newview/llpanelenvironment.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index e1676fbb13..3edfd4156c 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -384,7 +384,8 @@ 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) - (LLFloaterEditExtDayCycle::KEY_DAY_LENGTH, mCurrentEnvironment ? (S32)(mCurrentEnvironment->mDayLength.value()) : FOURHOURS)); + (LLFloaterEditExtDayCycle::KEY_DAY_LENGTH, mCurrentEnvironment ? (S32)(mCurrentEnvironment->mDayLength.value()) : FOURHOURS) + (LLFloaterEditExtDayCycle::KEY_CANMOD, LLSD::Boolean(true))); dayeditor->openFloater(params); if (mCurrentEnvironment->mDayCycle) -- cgit v1.2.3 From 43c8f5959f8afaf2f67fbbf49e78965802859b55 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 10 Sep 2018 16:44:56 +0300 Subject: MAINT-9099 Adjustable region altitudes. --- indra/newview/llpanelenvironment.cpp | 122 ++++++++++++++++++++++++++++++++++- 1 file changed, 121 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 3edfd4156c..825a38e8b2 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -41,6 +41,7 @@ #include "llfloater.h" #include "llfloaterreg.h" #include "llfloatereditextdaycycle.h" +#include "llmultisliderctrl.h" #include "llsettingsvo.h" #include "llappviewer.h" @@ -62,26 +63,45 @@ const std::string LLPanelEnvironmentInfo::BTN_SELECTINV("btn_select_inventory"); const std::string LLPanelEnvironmentInfo::BTN_EDIT("btn_edit"); 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"); 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_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::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 U32 LLPanelEnvironmentInfo::DIRTY_FLAG_DAYCYCLE(0x01 << 0); const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_DAYLENGTH(0x01 << 1); const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_DAYOFFSET(0x01 << 2); +const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_ALTITUDES(0x01 << 3); const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_MASK( LLPanelEnvironmentInfo::DIRTY_FLAG_DAYCYCLE | LLPanelEnvironmentInfo::DIRTY_FLAG_DAYLENGTH | - LLPanelEnvironmentInfo::DIRTY_FLAG_DAYOFFSET ); + LLPanelEnvironmentInfo::DIRTY_FLAG_DAYOFFSET | + LLPanelEnvironmentInfo::DIRTY_FLAG_ALTITUDES); + +const U32 ALTITUDE_SLIDER_COUNT = 3; +const std::string alt_sliders[] = { + "sld1", + "sld2", + "sld3", +}; + +const std::string alt_labels[] = { + "alt1", + "alt2", + "alt3", + "ground", +}; //========================================================================= LLPanelEnvironmentInfo::LLPanelEnvironmentInfo(): @@ -104,6 +124,8 @@ BOOL LLPanelEnvironmentInfo::postBuild() getChild(SLD_DAYLENGTH)->setCommitCallback([this](LLUICtrl *, const LLSD &value) { onSldDayLengthChanged(value.asReal()); }); getChild(SLD_DAYOFFSET)->setCommitCallback([this](LLUICtrl *, const LLSD &value) { onSldDayOffsetChanged(value.asReal()); }); + getChild(SLD_ALTITUDES)->setCommitCallback([this](LLUICtrl *cntrl, const LLSD &value) { onAltSliderCallback(cntrl, value); }); + return TRUE; } @@ -183,6 +205,18 @@ void LLPanelEnvironmentInfo::refresh() udpateApparentTimeOfDay(); + LLEnvironment::altitude_list_t altitudes = LLEnvironment::instance().getRegionAltitudes(); + if (altitudes.size() > 0) + { + for (S32 idx = 0; idx < ALTITUDE_SLIDER_COUNT; ++idx) + { + LLMultiSliderCtrl *sld = getChild(SLD_ALTITUDES); + sld->setSliderValue(alt_sliders[idx], altitudes[idx+1], FALSE); + updateAltLabel(alt_labels[idx], idx + 2, altitudes[idx+1]); + mAltitudes[alt_sliders[idx]] = AltitudeData(idx+1, idx, altitudes[idx+1]); + } + } + } void LLPanelEnvironmentInfo::refreshFromSource() @@ -333,6 +367,37 @@ void LLPanelEnvironmentInfo::clearDirtyFlag(U32 flag) getChildView(BTN_CANCEL)->setEnabled((mDirtyFlag != 0) && can_edit); } +void LLPanelEnvironmentInfo::updateAltLabel(const std::string &alt_name, U32 sky_index, F32 alt_value) +{ + LLMultiSliderCtrl *sld = getChild(SLD_ALTITUDES); + LLRect sld_rect = sld->getRect(); + U32 sld_range = sld_rect.getHeight(); + U32 sld_bottom = sld_rect.mBottom; + U32 sld_offset = 8 + 1; // Default slider-thumb width plus stretch. Placeholder until images are implemented. + U32 pos = (sld_range - sld_offset) * ((alt_value - 100) / (4000 - 100)); + + // get related text box + LLTextBox* text = getChild(alt_name); + if (text) + { + // move related text box + LLRect rect = text->getRect(); + U32 height = rect.getHeight(); + rect.mBottom = sld_bottom + sld_offset + pos - (height / 2); + rect.mTop = rect.mBottom + height; + text->setRect(rect); + + // update text + std::ostringstream convert; + convert << alt_value; + text->setTextArg("[ALTITUDE]", convert.str()); + convert.str(""); + convert.clear(); + convert << sky_index; + text->setTextArg("[INDEX]", convert.str()); + } +} + void LLPanelEnvironmentInfo::onSwitchDefaultSelection() { bool can_edit = canEdit(); @@ -366,6 +431,59 @@ void LLPanelEnvironmentInfo::onSldDayOffsetChanged(F32 value) udpateApparentTimeOfDay(); } +void LLPanelEnvironmentInfo::onAltSliderCallback(LLUICtrl *cntrl, const LLSD &data) +{ + LLMultiSliderCtrl *sld = (LLMultiSliderCtrl *)cntrl; + std::string sld_name = sld->getCurSlider(); + F32 sld_value = sld->getCurSliderValue(); + U32 alt_index = 1; + + mAltitudes[sld_name].mAltitude = sld_value; + + // find index of sky layer/altitude + altitudes_data_t::iterator iter = mAltitudes.begin(); + altitudes_data_t::iterator end = mAltitudes.end(); + while (iter!=end) + { + if (sld_value > iter->second.mAltitude) + { + alt_index++; + } + iter++; + } + + if (mAltitudes[sld_name].mAltitudeIndex != alt_index) + { + // update all labels since we could have jumped multiple + // (or sort by altitude, too little elements, so I didn't bother with efficiency) + altitudes_data_t::iterator iter = mAltitudes.begin(); + altitudes_data_t::iterator iter2; + U32 new_index; + while (iter != end) + { + iter2 = mAltitudes.begin(); + new_index = 1; + while (iter2 != end) + { + if (iter->second.mAltitude > iter2->second.mAltitude) + { + new_index++; + } + iter2++; + } + iter->second.mAltitudeIndex = new_index; + updateAltLabel(alt_labels[iter->second.mLabelIndex], iter->second.mAltitudeIndex + 1, iter->second.mAltitude); + iter++; + } + } + else + { + updateAltLabel(alt_labels[mAltitudes[sld_name].mLabelIndex], alt_index + 1, sld_value); + } + + setDirtyFlag(DIRTY_FLAG_ALTITUDES); +} + void LLPanelEnvironmentInfo::onBtnApply() { doApply(); @@ -431,6 +549,8 @@ void LLPanelEnvironmentInfo::doApply() [this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {onEnvironmentReceived(parcel_id, envifo); }); } + // Todo: save altitudes once LLEnvironment::setRegionAltitudes() gets implemented + setControlsEnabled(false); } } -- cgit v1.2.3 From a0b9c262185c00d15fb54d06ab2fdb1c6d6b95d9 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 11 Sep 2018 14:04:43 -0700 Subject: SL-9620: Double check that commit actually passes back a day cycle from the editor. Also hide the altitude setting interface for the moment. --- indra/newview/llpanelenvironment.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 825a38e8b2..d3325796fb 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -205,6 +205,10 @@ void LLPanelEnvironmentInfo::refresh() udpateApparentTimeOfDay(); +#if 1 + // hiding the controls until Rider can get the simulator code to adjust altitudes done. + getChild(PNL_ENVIRONMENT_ALTITUDES)->setVisible(FALSE); +#else LLEnvironment::altitude_list_t altitudes = LLEnvironment::instance().getRegionAltitudes(); if (altitudes.size() > 0) { @@ -216,6 +220,7 @@ void LLPanelEnvironmentInfo::refresh() mAltitudes[alt_sliders[idx]] = AltitudeData(idx+1, idx, altitudes[idx+1]); } } +#endif } @@ -610,6 +615,11 @@ void LLPanelEnvironmentInfo::onPickerCommited(LLUUID asset_id) void LLPanelEnvironmentInfo::onEditCommited(LLSettingsDay::ptr_t newday) { + if (!newday) + { + LL_WARNS("ENVPANEL") << "Editor committed an empty day. Do nothing." << LL_ENDL; + return; + } size_t newhash(newday->getHash()); size_t oldhash((mCurrentEnvironment->mDayCycle) ? mCurrentEnvironment->mDayCycle->getHash() : 0); -- cgit v1.2.3 From be979a0cac6aaa11293f123d1f4ef794bf23dba9 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 11 Sep 2018 14:48:10 -0700 Subject: OSX gets anoyingly cranky if I don't use a variable. --- indra/newview/llpanelenvironment.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index d3325796fb..94fa198085 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -89,7 +89,10 @@ const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_MASK( LLPanelEnvironmentInfo::DIRTY_FLAG_DAYOFFSET | LLPanelEnvironmentInfo::DIRTY_FLAG_ALTITUDES); +#if 0 +// Because the OSX is Very cranky when I don't use a variable. const U32 ALTITUDE_SLIDER_COUNT = 3; + const std::string alt_sliders[] = { "sld1", "sld2", @@ -102,6 +105,7 @@ const std::string alt_labels[] = { "alt3", "ground", }; +#endif //========================================================================= LLPanelEnvironmentInfo::LLPanelEnvironmentInfo(): -- cgit v1.2.3 From 3558377d540de31bdb615f9c0e0df8163b33ccf8 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 11 Sep 2018 15:23:31 -0700 Subject: Good grief OSX --- indra/newview/llpanelenvironment.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 94fa198085..74cc7660f3 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -93,6 +93,8 @@ const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_MASK( // Because the OSX is Very cranky when I don't use a variable. const U32 ALTITUDE_SLIDER_COUNT = 3; +#endif + const std::string alt_sliders[] = { "sld1", "sld2", @@ -105,7 +107,6 @@ const std::string alt_labels[] = { "alt3", "ground", }; -#endif //========================================================================= LLPanelEnvironmentInfo::LLPanelEnvironmentInfo(): -- cgit v1.2.3 From 4fe44b9033ee793134b7c080c71931c62c33ddf9 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 11 Sep 2018 17:10:32 -0700 Subject: SL-9626: When the panel loses visibility the picker is now automatically closed. Also picker checks handle to parent rather than pointer to parent. --- indra/newview/llpanelenvironment.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 74cc7660f3..41d7d8b54f 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -147,6 +147,12 @@ void LLPanelEnvironmentInfo::onVisibilityChange(BOOL new_visibility) gIdleCallbacks.addFunction(onIdlePlay, this); else { + LLFloaterSettingsPicker *picker = getSettingsPicker(false); + if (picker) + { + picker->closeFloater(); + } + gIdleCallbacks.deleteFunction(onIdlePlay, this); LLFloaterEditExtDayCycle *dayeditor = getEditFloater(); if (mCommitConnection.connected()) @@ -252,12 +258,12 @@ std::string LLPanelEnvironmentInfo::getInventoryNameForAssetId(LLUUID asset_id) return name; } -LLFloaterSettingsPicker *LLPanelEnvironmentInfo::getSettingsPicker() +LLFloaterSettingsPicker * LLPanelEnvironmentInfo::getSettingsPicker(bool create) { LLFloaterSettingsPicker *picker = static_cast(mSettingsFloater.get()); // Show the dialog - if (!picker) + if (!picker && create) { picker = new LLFloaterSettingsPicker(this, LLUUID::null, "SELECT SETTINGS"); -- cgit v1.2.3 From 27a76a7e731bd13fb5d0862a932f40ea5c9c7119 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 12 Sep 2018 17:05:27 -0700 Subject: SL-1402, SL-1193, SL-976: Corrected strings and layout for named bugs ("Use Shared Environment", no selection format in panel, Missing String in give object) Also Rider learned how to spell Committed --- indra/newview/llpanelenvironment.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 41d7d8b54f..258b6714b1 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -270,7 +270,7 @@ LLFloaterSettingsPicker * LLPanelEnvironmentInfo::getSettingsPicker(bool create) mSettingsFloater = picker->getHandle(); - picker->setCommitCallback([this](LLUICtrl *, const LLSD &data){ onPickerCommited(data.asUUID()); }); + picker->setCommitCallback([this](LLUICtrl *, const LLSD &data){ onPickerCommitted(data.asUUID()); }); } return picker; @@ -295,7 +295,7 @@ LLFloaterEditExtDayCycle * LLPanelEnvironmentInfo::getEditFloater(bool create) } if (editor && !mCommitConnection.connected()) - mCommitConnection = editor->setEditCommitSignal([this](LLSettingsDay::ptr_t pday) { onEditCommited(pday); }); + mCommitConnection = editor->setEditCommitSignal([this](LLSettingsDay::ptr_t pday) { onEditCommitted(pday); }); return editor; } @@ -615,7 +615,7 @@ void LLPanelEnvironmentInfo::onIdlePlay(void *data) ((LLPanelEnvironmentInfo *)data)->udpateApparentTimeOfDay(); } -void LLPanelEnvironmentInfo::onPickerCommited(LLUUID asset_id) +void LLPanelEnvironmentInfo::onPickerCommitted(LLUUID asset_id) { LLSettingsVOBase::getSettingsAsset(asset_id, [this](LLUUID, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { if (status) @@ -624,7 +624,7 @@ void LLPanelEnvironmentInfo::onPickerCommited(LLUUID asset_id) }); } -void LLPanelEnvironmentInfo::onEditCommited(LLSettingsDay::ptr_t newday) +void LLPanelEnvironmentInfo::onEditCommitted(LLSettingsDay::ptr_t newday) { if (!newday) { -- cgit v1.2.3 From c5936bbba031272b1deb78ce8ea52663d033695b Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 12 Sep 2018 21:02:58 +0300 Subject: SL-1961 Icon support for multislider and icons on altitudes slider --- indra/newview/llpanelenvironment.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 258b6714b1..5f4bb7ccb8 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -389,7 +389,7 @@ void LLPanelEnvironmentInfo::updateAltLabel(const std::string &alt_name, U32 sky LLRect sld_rect = sld->getRect(); U32 sld_range = sld_rect.getHeight(); U32 sld_bottom = sld_rect.mBottom; - U32 sld_offset = 8 + 1; // Default slider-thumb width plus stretch. Placeholder until images are implemented. + U32 sld_offset = sld_rect.getWidth(); // Roughly identical to thumb's width in slider. U32 pos = (sld_range - sld_offset) * ((alt_value - 100) / (4000 - 100)); // get related text box @@ -399,7 +399,7 @@ void LLPanelEnvironmentInfo::updateAltLabel(const std::string &alt_name, U32 sky // move related text box LLRect rect = text->getRect(); U32 height = rect.getHeight(); - rect.mBottom = sld_bottom + sld_offset + pos - (height / 2); + rect.mBottom = sld_bottom + (sld_offset / 2 + 1) + pos - (height / 2); rect.mTop = rect.mBottom + height; text->setRect(rect); -- cgit v1.2.3 From 7c6ac0740dac946275ef3f904614688f4b73f850 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 14 Sep 2018 09:52:28 -0700 Subject: SL-1556: Correctly identify when the selected parcel is in another region and display a message about cross region environments. --- indra/newview/llpanelenvironment.cpp | 77 +++++++++++++++++++++++++----------- 1 file changed, 53 insertions(+), 24 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') 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(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(TXT_DISABLED)->setText(getString(STR_LEGACY)); + } + else if (mNoSelection) + { + is_unavailable = true; + getChild(TXT_DISABLED)->setText(getString(STR_NO_PARCEL)); + } + else if (mCrossRegion) + { + is_unavailable = true; + getChild(TXT_DISABLED)->setText(getString(STR_CROSS_REGION)); + } + + if (is_unavailable) + { + getChild(PNL_SETTINGS)->setVisible(false); + getChild(PNL_BUTTONS)->setVisible(false); + getChild(PNL_DISABLED)->setVisible(true); + + updateEditFloater(mCurrentEnvironment); + + return false; + } + getChild(PNL_SETTINGS)->setVisible(true); + getChild(PNL_BUTTONS)->setVisible(true); + getChild(PNL_DISABLED)->setVisible(false); + + S32 rdo_selection = getChild(RDG_ENVIRONMENT_SELECT)->getSelectedIndex(); getChild(RDG_ENVIRONMENT_SELECT)->setEnabled(enabled); getChild(RDO_USEDEFAULT)->setEnabled(enabled && !is_legacy); @@ -340,15 +371,11 @@ void LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) getChild(BTN_EDIT)->setEnabled(enabled); getChild(SLD_DAYLENGTH)->setEnabled(enabled && (rdo_selection != 0) && !is_legacy); getChild(SLD_DAYOFFSET)->setEnabled(enabled && (rdo_selection != 0) && !is_legacy); - getChild(CHK_ALLOWOVERRIDE)->setEnabled(enabled && (mCurrentParcelId == INVALID_PARCEL_ID) && !is_legacy); + getChild(CHK_ALLOWOVERRIDE)->setEnabled(enabled && isRegion() && !is_legacy); getChild(BTN_APPLY)->setEnabled(enabled && (mDirtyFlag != 0)); getChild(BTN_CANCEL)->setEnabled(enabled && (mDirtyFlag != 0)); - getChild(PNL_SETTINGS)->setVisible(!is_unavailable); - getChild(PNL_BUTTONS)->setVisible(!is_unavailable); - getChild(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(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; -- cgit v1.2.3 From 17fb7d0bf4cc4db1c3f30dbbbdee7610d168336c Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 17 Sep 2018 14:21:38 -0700 Subject: SL-9667, SL-9669: Do not attempt to request environment for non-eep parcels, use handle to panel passed to static for callbacks. --- indra/newview/llpanelenvironment.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 8d7ec48d63..ecffa34ab9 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -119,6 +119,7 @@ LLPanelEnvironmentInfo::LLPanelEnvironmentInfo(): mDirtyFlag(0), mCrossRegion(false), mNoSelection(false), + mNoEnvironment(false), mSettingsFloater(), mEditFloater() { @@ -330,7 +331,7 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) bool is_unavailable(false); bool is_legacy = (mCurrentEnvironment) ? mCurrentEnvironment->mIsLegacy : true; - if (!LLEnvironment::instance().isExtendedEnvironmentEnabled() && !isRegion()) + if (mNoEnvironment || (!LLEnvironment::instance().isExtendedEnvironmentEnabled() && !isRegion())) { is_unavailable = true; getChild(TXT_DISABLED)->setText(getString(STR_LEGACY)); @@ -574,24 +575,26 @@ void LLPanelEnvironmentInfo::doApply() if (getIsDirtyFlag(DIRTY_FLAG_MASK)) { + LLHandle that_h = getHandle(); + S32 rdo_selection = getChild(RDG_ENVIRONMENT_SELECT)->getSelectedIndex(); if (rdo_selection == 0) { LLEnvironment::instance().resetParcel(parcel_id, - [this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {onEnvironmentReceived(parcel_id, envifo); }); + [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); } else if (rdo_selection == 1) { 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); }); + [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); } else { 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); }); + [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); } // Todo: save altitudes once LLEnvironment::setRegionAltitudes() gets implemented @@ -695,3 +698,11 @@ void LLPanelEnvironmentInfo::onEnvironmentReceived(S32 parcel_id, LLEnvironment: clearDirtyFlag(DIRTY_FLAG_MASK); refresh(); } + +void LLPanelEnvironmentInfo::_onEnvironmentReceived(LLHandle that_h, S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) +{ + LLPanelEnvironmentInfo *that = (LLPanelEnvironmentInfo *)that_h.get(); + if (!that) + return; + that->onEnvironmentReceived(parcel_id, envifo); +} -- cgit v1.2.3 From ff8f5f52a49d7984909a1d2dcb89ad81a3cb7588 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 19 Sep 2018 17:48:41 +0300 Subject: SL-9679 EEP - disable panel elements until data update, null cycle crash fix --- indra/newview/llpanelenvironment.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index ecffa34ab9..bc06bde138 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -550,7 +550,7 @@ void LLPanelEnvironmentInfo::onBtnEdit() (LLFloaterEditExtDayCycle::KEY_CANMOD, LLSD::Boolean(true))); dayeditor->openFloater(params); - if (mCurrentEnvironment->mDayCycle) + if (mCurrentEnvironment && mCurrentEnvironment->mDayCycle) dayeditor->setEditDayCycle(mCurrentEnvironment->mDayCycle); else dayeditor->setEditDefaultDayCycle(); @@ -562,7 +562,7 @@ void LLPanelEnvironmentInfo::onBtnSelect() if (picker) { picker->setSettingsFilter(LLSettingsType::ST_NONE); - picker->setSettingsAssetId((mCurrentEnvironment->mDayCycle) ? mCurrentEnvironment->mDayCycle->getAssetId() : LLUUID::null); + picker->setSettingsAssetId((mCurrentEnvironment && mCurrentEnvironment->mDayCycle) ? mCurrentEnvironment->mDayCycle->getAssetId() : LLUUID::null); picker->openFloater(); picker->setFocus(TRUE); } -- cgit v1.2.3 From cae08e0096f75827851a8c9447e163ddb0132f2d Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 19 Sep 2018 15:31:23 -0700 Subject: SL-9661: Trigger an event when the settings on a parcel or region are changed. Environment panel montiors this event and updates itself when it occurs. --- indra/newview/llpanelenvironment.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index bc06bde138..1beba9db0c 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -125,6 +125,12 @@ LLPanelEnvironmentInfo::LLPanelEnvironmentInfo(): { } +LLPanelEnvironmentInfo::~LLPanelEnvironmentInfo() +{ + if (mChangeMonitor.connected()) + mChangeMonitor.disconnect(); +} + BOOL LLPanelEnvironmentInfo::postBuild() { getChild(RDG_ENVIRONMENT_SELECT)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onSwitchDefaultSelection(); }); @@ -138,6 +144,8 @@ BOOL LLPanelEnvironmentInfo::postBuild() getChild(SLD_ALTITUDES)->setCommitCallback([this](LLUICtrl *cntrl, const LLSD &value) { onAltSliderCallback(cntrl, value); }); + mChangeMonitor = LLEnvironment::instance().setEnvironmentChanged([this](LLEnvironment::EnvSelection_t env) { onEnvironmentChanged(env); }); + return TRUE; } @@ -151,7 +159,9 @@ void LLPanelEnvironmentInfo::onOpen(const LLSD& key) void LLPanelEnvironmentInfo::onVisibilityChange(BOOL new_visibility) { if (new_visibility) + { gIdleCallbacks.addFunction(onIdlePlay, this); + } else { LLFloaterSettingsPicker *picker = getSettingsPicker(false); @@ -164,6 +174,7 @@ void LLPanelEnvironmentInfo::onVisibilityChange(BOOL new_visibility) LLFloaterEditExtDayCycle *dayeditor = getEditFloater(); if (mCommitConnection.connected()) mCommitConnection.disconnect(); + if (dayeditor) { if (dayeditor->isDirty()) @@ -674,6 +685,17 @@ void LLPanelEnvironmentInfo::onEditCommitted(LLSettingsDay::ptr_t newday) } } +void LLPanelEnvironmentInfo::onEnvironmentChanged(LLEnvironment::EnvSelection_t env) +{ + if ((isRegion() && (env == LLEnvironment::ENV_REGION)) || + ((env == LLEnvironment::ENV_PARCEL) && (getParcelId() == LLViewerParcelMgr::instance().getAgentParcelId()))) + { + mCurrentEnvironment.reset(); + refreshFromSource(); + } +} + + void LLPanelEnvironmentInfo::onPickerAssetDownloaded(LLSettingsBase::ptr_t settings) { LLSettingsVODay::buildFromOtherSetting(settings, [this](LLSettingsDay::ptr_t pday) -- cgit v1.2.3 From 18dd6f076e3d3936e6b5a426d8c5476fac4c4e58 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Tue, 25 Sep 2018 20:27:59 +0300 Subject: SL-1961 EEP Altitude labels auto-adjustment --- indra/newview/llpanelenvironment.cpp | 128 +++++++++++++++++++++++------------ 1 file changed, 85 insertions(+), 43 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 1beba9db0c..aa8c6cf724 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -65,6 +65,7 @@ const std::string LLPanelEnvironmentInfo::BTN_EDIT("btn_edit"); 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"); +const std::string LLPanelEnvironmentInfo::ICN_GROUND("icon_ground"); 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"); @@ -94,12 +95,8 @@ const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_MASK( LLPanelEnvironmentInfo::DIRTY_FLAG_DAYOFFSET | LLPanelEnvironmentInfo::DIRTY_FLAG_ALTITUDES); -#if 0 -// Because the OSX is Very cranky when I don't use a variable. const U32 ALTITUDE_SLIDER_COUNT = 3; -#endif - const std::string alt_sliders[] = { "sld1", "sld2", @@ -249,6 +246,7 @@ void LLPanelEnvironmentInfo::refresh() updateAltLabel(alt_labels[idx], idx + 2, altitudes[idx+1]); mAltitudes[alt_sliders[idx]] = AltitudeData(idx+1, idx, altitudes[idx+1]); } + readjustAltLabels(); } #endif @@ -363,6 +361,7 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) getChild(PNL_SETTINGS)->setVisible(false); getChild(PNL_BUTTONS)->setVisible(false); getChild(PNL_DISABLED)->setVisible(true); + getChild(PNL_ENVIRONMENT_ALTITUDES)->setVisible(FALSE); updateEditFloater(mCurrentEnvironment); @@ -372,6 +371,13 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) getChild(PNL_BUTTONS)->setVisible(true); getChild(PNL_DISABLED)->setVisible(false); +#if 1 + // hiding the controls until Rider can get the simulator code to adjust altitudes done. + getChild(PNL_ENVIRONMENT_ALTITUDES)->setVisible(FALSE); +#else + getChild(PNL_ENVIRONMENT_ALTITUDES)->setVisible(isRegion()); +#endif + S32 rdo_selection = getChild(RDG_ENVIRONMENT_SELECT)->getSelectedIndex(); getChild(RDG_ENVIRONMENT_SELECT)->setEnabled(enabled); @@ -383,6 +389,7 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) getChild(BTN_EDIT)->setEnabled(enabled); getChild(SLD_DAYLENGTH)->setEnabled(enabled && (rdo_selection != 0) && !is_legacy); getChild(SLD_DAYOFFSET)->setEnabled(enabled && (rdo_selection != 0) && !is_legacy); + getChild(PNL_ENVIRONMENT_ALTITUDES)->setEnabled(enabled && isRegion() && !is_legacy); getChild(CHK_ALLOWOVERRIDE)->setEnabled(enabled && isRegion() && !is_legacy); getChild(BTN_APPLY)->setEnabled(enabled && (mDirtyFlag != 0)); getChild(BTN_CANCEL)->setEnabled(enabled && (mDirtyFlag != 0)); @@ -426,10 +433,10 @@ void LLPanelEnvironmentInfo::updateAltLabel(const std::string &alt_name, U32 sky { LLMultiSliderCtrl *sld = getChild(SLD_ALTITUDES); LLRect sld_rect = sld->getRect(); - U32 sld_range = sld_rect.getHeight(); - U32 sld_bottom = sld_rect.mBottom; - U32 sld_offset = sld_rect.getWidth(); // Roughly identical to thumb's width in slider. - U32 pos = (sld_range - sld_offset) * ((alt_value - 100) / (4000 - 100)); + S32 sld_range = sld_rect.getHeight(); + S32 sld_bottom = sld_rect.mBottom; + S32 sld_offset = sld_rect.getWidth(); // Roughly identical to thumb's width in slider. + S32 pos = (sld_range - sld_offset) * ((alt_value - 100) / (4000 - 100)); // get related text box LLTextBox* text = getChild(alt_name); @@ -437,7 +444,7 @@ void LLPanelEnvironmentInfo::updateAltLabel(const std::string &alt_name, U32 sky { // move related text box LLRect rect = text->getRect(); - U32 height = rect.getHeight(); + S32 height = rect.getHeight(); rect.mBottom = sld_bottom + (sld_offset / 2 + 1) + pos - (height / 2); rect.mTop = rect.mBottom + height; text->setRect(rect); @@ -453,6 +460,59 @@ void LLPanelEnvironmentInfo::updateAltLabel(const std::string &alt_name, U32 sky } } +void LLPanelEnvironmentInfo::readjustAltLabels() +{ + // Restore ground label position + LLView* icon = getChild(ICN_GROUND); + LLTextBox* text = getChild(alt_labels[ALTITUDE_SLIDER_COUNT]); // one more field then sliders + LLRect ground_text_rect = text->getRect(); + LLRect icon_rect = icon->getRect(); + S32 height = ground_text_rect.getHeight(); + ground_text_rect.mBottom = icon_rect.mBottom + (icon_rect.getHeight()/2) - (height/2); + ground_text_rect.mTop = ground_text_rect.mBottom + height; + text->setRect(ground_text_rect); + + // Re-adjust all labels + // Very simple "adjust after the fact" method + // Note: labels are unordered, labels are 1 above sliders due to 'ground' + + for (U32 i = 0; i < ALTITUDE_SLIDER_COUNT; i++) + { + LLTextBox* text_cmp = getChild(alt_labels[i]); + + for (U32 j = i + 1; j <= ALTITUDE_SLIDER_COUNT; j++) + { + LLTextBox* text_intr = getChild(alt_labels[j]); + if (text_cmp && text_intr) + { + LLRect cmp_rect = text_cmp->getRect(); + LLRect intr_rect = text_intr->getRect(); + S32 shift = 0; + if (cmp_rect.mBottom <= intr_rect.mTop && cmp_rect.mBottom >= intr_rect.mBottom) + { + // Aproximate shift + // We probably will need more cycle runs over all labels to get accurate one + // At the moment single cycle should do since we have too little elements to do something complicated + shift = (cmp_rect.mBottom - intr_rect.mTop) / 2; + } + else if (cmp_rect.mTop >= intr_rect.mBottom && cmp_rect.mTop <= intr_rect.mTop) + { + // Aproximate shift + shift = (cmp_rect.mTop - intr_rect.mBottom) / 2; + } + if (shift != 0) + { + cmp_rect.translate(0, -shift); + text_cmp->setRect(cmp_rect); + + intr_rect.translate(0, shift); + text_intr->setRect(intr_rect); + } + } + } + } +} + void LLPanelEnvironmentInfo::onSwitchDefaultSelection() { bool can_edit = canEdit(); @@ -491,51 +551,33 @@ void LLPanelEnvironmentInfo::onAltSliderCallback(LLUICtrl *cntrl, const LLSD &da LLMultiSliderCtrl *sld = (LLMultiSliderCtrl *)cntrl; std::string sld_name = sld->getCurSlider(); F32 sld_value = sld->getCurSliderValue(); - U32 alt_index = 1; mAltitudes[sld_name].mAltitude = sld_value; - // find index of sky layer/altitude - altitudes_data_t::iterator iter = mAltitudes.begin(); + // update all labels since we could have jumped multiple and we will need to readjust + // (or sort by altitude, too little elements, so I didn't bother with efficiency) altitudes_data_t::iterator end = mAltitudes.end(); - while (iter!=end) - { - if (sld_value > iter->second.mAltitude) - { - alt_index++; - } - iter++; - } - - if (mAltitudes[sld_name].mAltitudeIndex != alt_index) + altitudes_data_t::iterator iter = mAltitudes.begin(); + altitudes_data_t::iterator iter2; + U32 new_index; + while (iter != end) { - // update all labels since we could have jumped multiple - // (or sort by altitude, too little elements, so I didn't bother with efficiency) - altitudes_data_t::iterator iter = mAltitudes.begin(); - altitudes_data_t::iterator iter2; - U32 new_index; - while (iter != end) + iter2 = mAltitudes.begin(); + new_index = 1; + while (iter2 != end) { - iter2 = mAltitudes.begin(); - new_index = 1; - while (iter2 != end) + if (iter->second.mAltitude > iter2->second.mAltitude) { - if (iter->second.mAltitude > iter2->second.mAltitude) - { - new_index++; - } - iter2++; + new_index++; } - iter->second.mAltitudeIndex = new_index; - updateAltLabel(alt_labels[iter->second.mLabelIndex], iter->second.mAltitudeIndex + 1, iter->second.mAltitude); - iter++; + iter2++; } - } - else - { - updateAltLabel(alt_labels[mAltitudes[sld_name].mLabelIndex], alt_index + 1, sld_value); + iter->second.mAltitudeIndex = new_index; + updateAltLabel(alt_labels[iter->second.mLabelIndex], iter->second.mAltitudeIndex + 1, iter->second.mAltitude); + iter++; } + readjustAltLabels(); setDirtyFlag(DIRTY_FLAG_ALTITUDES); } -- cgit v1.2.3 From 41a6504c5e121f4ee35f06adc297485d21f4d14d Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 26 Sep 2018 18:14:44 +0300 Subject: SL-983 EEP - When selecting a new parcel with the day editor open follow in editor --- indra/newview/llpanelenvironment.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index aa8c6cf724..20aaf258f8 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -232,6 +232,8 @@ void LLPanelEnvironmentInfo::refresh() udpateApparentTimeOfDay(); + updateEditFloater(mCurrentEnvironment, canEdit()); + #if 1 // hiding the controls until Rider can get the simulator code to adjust altitudes done. getChild(PNL_ENVIRONMENT_ALTITUDES)->setVisible(FALSE); @@ -312,14 +314,14 @@ LLFloaterEditExtDayCycle * LLPanelEnvironmentInfo::getEditFloater(bool create) } -void LLPanelEnvironmentInfo::updateEditFloater(const LLEnvironment::EnvironmentInfo::ptr_t &nextenv) +void LLPanelEnvironmentInfo::updateEditFloater(const LLEnvironment::EnvironmentInfo::ptr_t &nextenv, bool enable) { LLFloaterEditExtDayCycle *dayeditor(getEditFloater(false)); if (!dayeditor) return; - if (!nextenv || !nextenv->mDayCycle) + if (!nextenv || !nextenv->mDayCycle || !enable) { if (mCommitConnection.connected()) mCommitConnection.disconnect(); @@ -331,7 +333,10 @@ void LLPanelEnvironmentInfo::updateEditFloater(const LLEnvironment::EnvironmentI } else { - /*TODO: Swap in new day to edit?*/ + // Ignore dirty + // If parcel selection changed whatever we do except saving to inventory with + // old settings will be invalid. + dayeditor->setEditDayCycle(nextenv->mDayCycle); } } @@ -363,7 +368,7 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) getChild(PNL_DISABLED)->setVisible(true); getChild(PNL_ENVIRONMENT_ALTITUDES)->setVisible(FALSE); - updateEditFloater(mCurrentEnvironment); + updateEditFloater(mCurrentEnvironment, false); return false; } -- cgit v1.2.3 From 337beb56f962c4574b500af20538d37d099c8cf3 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Thu, 27 Sep 2018 10:13:42 -0700 Subject: Flipped the wrong return value. Fixed the conditional. --- indra/newview/llpanelenvironment.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 20aaf258f8..6e2f3450fb 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -603,7 +603,7 @@ void LLPanelEnvironmentInfo::onBtnEdit() LLFloaterEditExtDayCycle *dayeditor = getEditFloater(); - LLSD params(LLSDMap(LLFloaterEditExtDayCycle::KEY_EDIT_CONTEXT, isRegion() ? LLFloaterEditExtDayCycle::VALUE_CONTEXT_REGION : LLFloaterEditExtDayCycle::VALUE_CONTEXT_REGION) + LLSD params(LLSDMap(LLFloaterEditExtDayCycle::KEY_EDIT_CONTEXT, isRegion() ? LLFloaterEditExtDayCycle::VALUE_CONTEXT_REGION : LLFloaterEditExtDayCycle::VALUE_CONTEXT_PARCEL) (LLFloaterEditExtDayCycle::KEY_DAY_LENGTH, mCurrentEnvironment ? (S32)(mCurrentEnvironment->mDayLength.value()) : FOURHOURS) (LLFloaterEditExtDayCycle::KEY_CANMOD, LLSD::Boolean(true))); -- cgit v1.2.3 From 6401ed2298f46df6c72526b811a88c5e3b3eee46 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Fri, 28 Sep 2018 15:56:48 +0300 Subject: SL-9620 FIXED Viewer crashes after clicking "Commit" button while editing Day Cycle preset --- indra/newview/llpanelenvironment.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 6e2f3450fb..21b9c4edbd 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -126,6 +126,8 @@ LLPanelEnvironmentInfo::~LLPanelEnvironmentInfo() { if (mChangeMonitor.connected()) mChangeMonitor.disconnect(); + if (mCommitConnection.connected()) + mCommitConnection.disconnect(); } BOOL LLPanelEnvironmentInfo::postBuild() -- cgit v1.2.3 From 6e7d794b01673c138a50859c0e513732cb89fc8b Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 1 Oct 2018 16:10:19 -0700 Subject: MAINT-9738: Wire the altitude slider to the protocol and send new altitudes to simulator. --- indra/newview/llpanelenvironment.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 21b9c4edbd..ee27d28140 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -236,10 +236,6 @@ void LLPanelEnvironmentInfo::refresh() updateEditFloater(mCurrentEnvironment, canEdit()); -#if 1 - // hiding the controls until Rider can get the simulator code to adjust altitudes done. - getChild(PNL_ENVIRONMENT_ALTITUDES)->setVisible(FALSE); -#else LLEnvironment::altitude_list_t altitudes = LLEnvironment::instance().getRegionAltitudes(); if (altitudes.size() > 0) { @@ -252,7 +248,6 @@ void LLPanelEnvironmentInfo::refresh() } readjustAltLabels(); } -#endif } @@ -378,12 +373,7 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) getChild(PNL_BUTTONS)->setVisible(true); getChild(PNL_DISABLED)->setVisible(false); -#if 1 - // hiding the controls until Rider can get the simulator code to adjust altitudes done. - getChild(PNL_ENVIRONMENT_ALTITUDES)->setVisible(FALSE); -#else getChild(PNL_ENVIRONMENT_ALTITUDES)->setVisible(isRegion()); -#endif S32 rdo_selection = getChild(RDG_ENVIRONMENT_SELECT)->getSelectedIndex(); @@ -636,9 +626,19 @@ void LLPanelEnvironmentInfo::doApply() if (getIsDirtyFlag(DIRTY_FLAG_MASK)) { LLHandle that_h = getHandle(); + LLEnvironment::altitudes_vect_t alts; S32 rdo_selection = getChild(RDG_ENVIRONMENT_SELECT)->getSelectedIndex(); + if (isRegion() && getIsDirtyFlag(DIRTY_FLAG_ALTITUDES)) + { + altitudes_data_t::iterator it; + for (auto alt : mAltitudes) + { + alts.push_back(alt.second.mAltitude); + } + } + if (rdo_selection == 0) { LLEnvironment::instance().resetParcel(parcel_id, @@ -647,13 +647,13 @@ void LLPanelEnvironmentInfo::doApply() else if (rdo_selection == 1) { LLEnvironment::instance().updateParcel(parcel_id, - mCurrentEnvironment->mDayCycle->getAssetId(), mCurrentEnvironment->mDayLength.value(), mCurrentEnvironment->mDayOffset.value(), + mCurrentEnvironment->mDayCycle->getAssetId(), mCurrentEnvironment->mDayLength.value(), mCurrentEnvironment->mDayOffset.value(), alts, [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); } else { LLEnvironment::instance().updateParcel(parcel_id, - mCurrentEnvironment->mDayCycle, mCurrentEnvironment->mDayLength.value(), mCurrentEnvironment->mDayOffset.value(), + mCurrentEnvironment->mDayCycle, mCurrentEnvironment->mDayLength.value(), mCurrentEnvironment->mDayOffset.value(), alts, [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); } -- cgit v1.2.3 From 83c2692ffcde2409ed983cb82a1b4d3fc759f72b Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 1 Oct 2018 16:49:44 -0700 Subject: Hide altitudes on legacy regions --- indra/newview/llpanelenvironment.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index ee27d28140..ecd67ff8af 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -373,7 +373,7 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) getChild(PNL_BUTTONS)->setVisible(true); getChild(PNL_DISABLED)->setVisible(false); - getChild(PNL_ENVIRONMENT_ALTITUDES)->setVisible(isRegion()); + getChild(PNL_ENVIRONMENT_ALTITUDES)->setVisible(isRegion() && LLEnvironment::instance().isExtendedEnvironmentEnabled()); S32 rdo_selection = getChild(RDG_ENVIRONMENT_SELECT)->getSelectedIndex(); -- cgit v1.2.3 From 20e78bb88ebe0a5416f3fb272afe9455aa756869 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Wed, 3 Oct 2018 13:33:19 +0300 Subject: SL-9780 FIXED [EEP] Environment gets stuck on region environment after closing Region/Estate floater --- indra/newview/llpanelenvironment.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index ecd67ff8af..4ab09e7118 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -170,7 +170,7 @@ void LLPanelEnvironmentInfo::onVisibilityChange(BOOL new_visibility) } gIdleCallbacks.deleteFunction(onIdlePlay, this); - LLFloaterEditExtDayCycle *dayeditor = getEditFloater(); + LLFloaterEditExtDayCycle *dayeditor = getEditFloater(false); if (mCommitConnection.connected()) mCommitConnection.disconnect(); @@ -179,7 +179,10 @@ void LLPanelEnvironmentInfo::onVisibilityChange(BOOL new_visibility) if (dayeditor->isDirty()) dayeditor->refresh(); else + { dayeditor->closeFloater(); + mEditFloater.markDead(); + } } } -- cgit v1.2.3 From 57ff71c915727abe09e794da4aa1615eb43f0abf Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 4 Oct 2018 22:12:17 +0300 Subject: SL-9654 [EEP] Settings Picker reliability --- indra/newview/llpanelenvironment.cpp | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 4ab09e7118..1c12677355 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -48,6 +48,8 @@ #include "llcallbacklist.h" #include "llviewerparcelmgr.h" +#include "llinventorymodel.h" + //========================================================================= namespace { @@ -256,15 +258,7 @@ void LLPanelEnvironmentInfo::refresh() std::string LLPanelEnvironmentInfo::getInventoryNameForAssetId(LLUUID asset_id) { - LLFloaterSettingsPicker *picker = getSettingsPicker(); - - if (!picker) - { - LL_WARNS("ENVPANEL") << "Couldn't instantiate picker." << LL_ENDL; - return std::string(); - } - - std::string name(picker->findItemName(asset_id, false, false)); + std::string name(LLFloaterSettingsPicker::findItemName(asset_id, false, false)); if (name.empty()) return getString(STR_LABEL_UNKNOWNINV); @@ -614,8 +608,13 @@ void LLPanelEnvironmentInfo::onBtnSelect() LLFloaterSettingsPicker *picker = getSettingsPicker(); if (picker) { + LLUUID item_id; + if (mCurrentEnvironment && mCurrentEnvironment->mDayCycle) + { + item_id = LLFloaterSettingsPicker::findItemID(mCurrentEnvironment->mDayCycle->getAssetId(), false, false); + } picker->setSettingsFilter(LLSettingsType::ST_NONE); - picker->setSettingsAssetId((mCurrentEnvironment && mCurrentEnvironment->mDayCycle) ? mCurrentEnvironment->mDayCycle->getAssetId() : LLUUID::null); + picker->setSettingsItemId(item_id); picker->openFloater(); picker->setFocus(TRUE); } @@ -710,13 +709,17 @@ void LLPanelEnvironmentInfo::onIdlePlay(void *data) ((LLPanelEnvironmentInfo *)data)->udpateApparentTimeOfDay(); } -void LLPanelEnvironmentInfo::onPickerCommitted(LLUUID asset_id) +void LLPanelEnvironmentInfo::onPickerCommitted(LLUUID item_id) { - LLSettingsVOBase::getSettingsAsset(asset_id, [this](LLUUID, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { - if (status) - return; - onPickerAssetDownloaded(settings); - }); + LLInventoryItem *itemp = gInventory.getItem(item_id); + if (itemp) + { + LLSettingsVOBase::getSettingsAsset(itemp->getAssetUUID(), [this](LLUUID, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { + if (status) + return; + onPickerAssetDownloaded(settings); + }); + } } void LLPanelEnvironmentInfo::onEditCommitted(LLSettingsDay::ptr_t newday) -- cgit v1.2.3 From d60588ec4fe6adc67de7938bc8ed9570f6cb187c Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 5 Oct 2018 17:12:58 +0300 Subject: SL-9822 Minimizing viewer resets day editor's values --- indra/newview/llpanelenvironment.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 1c12677355..ee66c5c15b 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -116,6 +116,7 @@ const std::string alt_labels[] = { LLPanelEnvironmentInfo::LLPanelEnvironmentInfo(): mCurrentEnvironment(), mDirtyFlag(0), + mEditorLastParcelId(INVALID_PARCEL_ID), mCrossRegion(false), mNoSelection(false), mNoEnvironment(false), @@ -325,11 +326,15 @@ void LLPanelEnvironmentInfo::updateEditFloater(const LLEnvironment::EnvironmentI else dayeditor->closeFloater(); } - else + else if (dayeditor->getEditingAssetId() != nextenv->mDayCycle->getAssetId() + || mEditorLastParcelId != nextenv->mParcelId + || mEditorLastRegionId != nextenv->mRegionId) { // Ignore dirty // If parcel selection changed whatever we do except saving to inventory with // old settings will be invalid. + mEditorLastParcelId = nextenv->mParcelId; + mEditorLastRegionId = nextenv->mRegionId; dayeditor->setEditDayCycle(nextenv->mDayCycle); } } -- cgit v1.2.3 From b030d7036f87d30babb4a8df8d256113f46182e9 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 5 Oct 2018 19:31:35 +0300 Subject: SL-1961 EEP correct disabling of altitude multislider and cleanup --- indra/newview/llpanelenvironment.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index ee66c5c15b..5abef949e1 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -388,6 +388,8 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) getChild(BTN_EDIT)->setEnabled(enabled); getChild(SLD_DAYLENGTH)->setEnabled(enabled && (rdo_selection != 0) && !is_legacy); getChild(SLD_DAYOFFSET)->setEnabled(enabled && (rdo_selection != 0) && !is_legacy); + getChild(SLD_ALTITUDES)->setEnabled(enabled && isRegion() && !is_legacy); + getChild(ICN_GROUND)->setColor((enabled && isRegion() && !is_legacy) ? LLColor4::white : LLColor4::grey % 0.8f); getChild(PNL_ENVIRONMENT_ALTITUDES)->setEnabled(enabled && isRegion() && !is_legacy); getChild(CHK_ALLOWOVERRIDE)->setEnabled(enabled && isRegion() && !is_legacy); getChild(BTN_APPLY)->setEnabled(enabled && (mDirtyFlag != 0)); -- cgit v1.2.3 From efb45915a13af81266a266d8d662b529941dc40c Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 12 Oct 2018 15:14:46 +0300 Subject: SL-9873 EEP setting Day Offset > 8.0 causes it to go to -12.0 --- indra/newview/llpanelenvironment.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 5abef949e1..a260f98181 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -232,7 +232,7 @@ void LLPanelEnvironmentInfo::refresh() F32Hours daylength(mCurrentEnvironment->mDayLength); F32Hours dayoffset(mCurrentEnvironment->mDayOffset); - if (dayoffset.value() > 8.0f) + if (dayoffset.value() > 12.0f) dayoffset -= F32Hours(24.0); getChild(SLD_DAYLENGTH)->setValue(daylength.value()); -- cgit v1.2.3 From d2428d53b5816ce33adf10423ae7bb8229d4b915 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Mon, 22 Oct 2018 15:36:22 +0300 Subject: SL-9911 FIXED [EEP] Day Settings are modifiable in About Land floater for parcel that uses Region Settings --- indra/newview/llpanelenvironment.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index a260f98181..35a998edf6 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -204,15 +204,15 @@ void LLPanelEnvironmentInfo::refresh() return; } + S32 rdo_selection = 0; if ((!mCurrentEnvironment->mDayCycle) || ((mCurrentEnvironment->mParcelId == INVALID_PARCEL_ID) && (mCurrentEnvironment->mDayCycle->getAssetId() == LLSettingsDay::GetDefaultAssetId() ))) { - getChild(RDG_ENVIRONMENT_SELECT)->setSelectedIndex(0); getChild(EDT_INVNAME)->setValue(""); } else if (!mCurrentEnvironment->mDayCycle->getAssetId().isNull()) { - getChild(RDG_ENVIRONMENT_SELECT)->setSelectedIndex(1); + rdo_selection = 1; LLUUID asset_id = mCurrentEnvironment->mDayCycle->getAssetId(); @@ -225,9 +225,10 @@ void LLPanelEnvironmentInfo::refresh() } else { // asset id is null so this is a custom environment - getChild(RDG_ENVIRONMENT_SELECT)->setSelectedIndex(2); + rdo_selection = 2; getChild(EDT_INVNAME)->setValue(""); } + getChild(RDG_ENVIRONMENT_SELECT)->setSelectedIndex(rdo_selection); F32Hours daylength(mCurrentEnvironment->mDayLength); F32Hours dayoffset(mCurrentEnvironment->mDayOffset); @@ -237,6 +238,8 @@ void LLPanelEnvironmentInfo::refresh() getChild(SLD_DAYLENGTH)->setValue(daylength.value()); getChild(SLD_DAYOFFSET)->setValue(dayoffset.value()); + getChild(SLD_DAYLENGTH)->setEnabled(canEdit() && (rdo_selection != 0) && !mCurrentEnvironment->mIsLegacy); + getChild(SLD_DAYOFFSET)->setEnabled(canEdit() && (rdo_selection != 0) && !mCurrentEnvironment->mIsLegacy); udpateApparentTimeOfDay(); -- cgit v1.2.3 From e9faa3cce8897af2a4303538672e2262ed39520a Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Thu, 25 Oct 2018 18:16:34 +0300 Subject: SL-9960 [EEP] Allow drag and drop inventory setting to the "Settings from Inventory" field --- indra/newview/llpanelenvironment.cpp | 55 ++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 35a998edf6..e049fa7842 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -77,6 +77,7 @@ const std::string LLPanelEnvironmentInfo::PNL_ENVIRONMENT_ALTITUDES("pnl_environ 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::SDT_DROP_TARGET("sdt_drop_target"); const std::string LLPanelEnvironmentInfo::STR_LABEL_USEDEFAULT("str_label_use_default"); const std::string LLPanelEnvironmentInfo::STR_LABEL_USEREGION("str_label_use_region"); @@ -112,6 +113,9 @@ const std::string alt_labels[] = { "ground", }; + +static LLDefaultChildRegistry::Register r("settings_drop_target"); + //========================================================================= LLPanelEnvironmentInfo::LLPanelEnvironmentInfo(): mCurrentEnvironment(), @@ -148,6 +152,8 @@ BOOL LLPanelEnvironmentInfo::postBuild() mChangeMonitor = LLEnvironment::instance().setEnvironmentChanged([this](LLEnvironment::EnvSelection_t env) { onEnvironmentChanged(env); }); + getChild(SDT_DROP_TARGET)->setPanel(this); + return TRUE; } @@ -398,6 +404,8 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) getChild(BTN_APPLY)->setEnabled(enabled && (mDirtyFlag != 0)); getChild(BTN_CANCEL)->setEnabled(enabled && (mDirtyFlag != 0)); + getChild(SDT_DROP_TARGET)->setDndEnabled(enabled && !is_legacy); + return true; } @@ -793,3 +801,50 @@ void LLPanelEnvironmentInfo::_onEnvironmentReceived(LLHandle that_h, S3 return; that->onEnvironmentReceived(parcel_id, envifo); } + +LLSettingsDropTarget::LLSettingsDropTarget(const LLSettingsDropTarget::Params& p) + : LLView(p), mEnvironmentInfoPanel(NULL), mDndEnabled(false) +{} + +BOOL LLSettingsDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg) +{ + BOOL handled = FALSE; + + if (getParent() && mDndEnabled) + { + handled = TRUE; + + switch (cargo_type) + { + case DAD_SETTINGS: + { + LLViewerInventoryItem* inv_item = (LLViewerInventoryItem*)cargo_data; + if (inv_item && mEnvironmentInfoPanel) + { + LLUUID item_id = inv_item->getUUID(); + if (gInventory.getItem(item_id)) + { + *accept = ACCEPT_YES_COPY_SINGLE; + if (drop) + { + mEnvironmentInfoPanel->onPickerCommitted(item_id); + } + } + } + else + { + *accept = ACCEPT_NO; + } + break; + } + default: + *accept = ACCEPT_NO; + break; + } + } + return handled; +} -- cgit v1.2.3 From 51772e6083d8af786704cee18f5eb3c9b3dfefda Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 2 Nov 2018 09:17:19 -0700 Subject: SL-9886: Viewer send and receive new day_name(s) information in the environment protocol for viewer specified names on individual tracks. --- indra/newview/llpanelenvironment.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index e049fa7842..e848c6eaf1 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -667,7 +667,8 @@ void LLPanelEnvironmentInfo::doApply() else if (rdo_selection == 1) { LLEnvironment::instance().updateParcel(parcel_id, - mCurrentEnvironment->mDayCycle->getAssetId(), mCurrentEnvironment->mDayLength.value(), mCurrentEnvironment->mDayOffset.value(), alts, + mCurrentEnvironment->mDayCycle->getAssetId(), std::string(), mCurrentEnvironment->mDayLength.value(), + mCurrentEnvironment->mDayOffset.value(), alts, [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); } else -- cgit v1.2.3 From 77b278b7f5615a6ba93b47c2a0d8a2338dc27dc2 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 12 Nov 2018 16:41:40 +0200 Subject: SL-9620 Viewer crashes after clicking "Commit" button while editing Day Cycle preset --- indra/newview/llpanelenvironment.cpp | 97 ++++++++++++++++++++++++++++-------- 1 file changed, 77 insertions(+), 20 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index e848c6eaf1..df595632f8 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -124,6 +124,7 @@ LLPanelEnvironmentInfo::LLPanelEnvironmentInfo(): mCrossRegion(false), mNoSelection(false), mNoEnvironment(false), + mCurEnvVersion(INVALID_PARCEL_ENVIRONMENT_VERSION), mSettingsFloater(), mEditFloater() { @@ -388,20 +389,21 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) S32 rdo_selection = getChild(RDG_ENVIRONMENT_SELECT)->getSelectedIndex(); - getChild(RDG_ENVIRONMENT_SELECT)->setEnabled(enabled); - getChild(RDO_USEDEFAULT)->setEnabled(enabled && !is_legacy); + bool can_enable = enabled && mCurEnvVersion != INVALID_PARCEL_ENVIRONMENT_VERSION; + getChild(RDG_ENVIRONMENT_SELECT)->setEnabled(can_enable); + getChild(RDO_USEDEFAULT)->setEnabled(can_enable && !is_legacy); getChild(RDO_USEINV)->setEnabled(false); // these two are selected automatically based on getChild(RDO_USECUSTOM)->setEnabled(false); getChild(EDT_INVNAME)->setEnabled(FALSE); - getChild(BTN_SELECTINV)->setEnabled(enabled && !is_legacy); - getChild(BTN_EDIT)->setEnabled(enabled); - getChild(SLD_DAYLENGTH)->setEnabled(enabled && (rdo_selection != 0) && !is_legacy); - getChild(SLD_DAYOFFSET)->setEnabled(enabled && (rdo_selection != 0) && !is_legacy); - getChild(SLD_ALTITUDES)->setEnabled(enabled && isRegion() && !is_legacy); - getChild(ICN_GROUND)->setColor((enabled && isRegion() && !is_legacy) ? LLColor4::white : LLColor4::grey % 0.8f); - getChild(PNL_ENVIRONMENT_ALTITUDES)->setEnabled(enabled && isRegion() && !is_legacy); - getChild(CHK_ALLOWOVERRIDE)->setEnabled(enabled && isRegion() && !is_legacy); - getChild(BTN_APPLY)->setEnabled(enabled && (mDirtyFlag != 0)); + getChild(BTN_SELECTINV)->setEnabled(can_enable && !is_legacy); + getChild(BTN_EDIT)->setEnabled(can_enable); + getChild(SLD_DAYLENGTH)->setEnabled(can_enable && (rdo_selection != 0) && !is_legacy); + getChild(SLD_DAYOFFSET)->setEnabled(can_enable && (rdo_selection != 0) && !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(PNL_ENVIRONMENT_ALTITUDES)->setEnabled(can_enable && isRegion() && !is_legacy); + getChild(CHK_ALLOWOVERRIDE)->setEnabled(can_enable && isRegion() && !is_legacy); + getChild(BTN_APPLY)->setEnabled(can_enable && (mDirtyFlag != 0)); getChild(BTN_CANCEL)->setEnabled(enabled && (mDirtyFlag != 0)); getChild(SDT_DROP_TARGET)->setDndEnabled(enabled && !is_legacy); @@ -429,7 +431,7 @@ void LLPanelEnvironmentInfo::setDirtyFlag(U32 flag) { bool can_edit = canEdit(); mDirtyFlag |= flag; - getChildView(BTN_APPLY)->setEnabled((mDirtyFlag != 0) && can_edit); + getChildView(BTN_APPLY)->setEnabled((mDirtyFlag != 0) && mCurEnvVersion != INVALID_PARCEL_ENVIRONMENT_VERSION && can_edit); getChildView(BTN_CANCEL)->setEnabled((mDirtyFlag != 0) && can_edit); } @@ -437,7 +439,7 @@ void LLPanelEnvironmentInfo::clearDirtyFlag(U32 flag) { bool can_edit = canEdit(); mDirtyFlag &= ~flag; - getChildView(BTN_APPLY)->setEnabled((mDirtyFlag != 0) && can_edit); + getChildView(BTN_APPLY)->setEnabled((mDirtyFlag != 0) && mCurEnvVersion != INVALID_PARCEL_ENVIRONMENT_VERSION && can_edit); getChildView(BTN_CANCEL)->setEnabled((mDirtyFlag != 0) && can_edit); } @@ -661,11 +663,19 @@ void LLPanelEnvironmentInfo::doApply() if (rdo_selection == 0) { + mCurEnvVersion = INVALID_PARCEL_ENVIRONMENT_VERSION; LLEnvironment::instance().resetParcel(parcel_id, [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); } else if (rdo_selection == 1) { + if (!mCurrentEnvironment) + { + // Attempting to save mid update? + LL_WARNS("ENVPANEL") << "Failed to apply changes from editor! Dirty state: " << mDirtyFlag << " update state: " << mCurEnvVersion << LL_ENDL; + return; + } + mCurEnvVersion = INVALID_PARCEL_ENVIRONMENT_VERSION; LLEnvironment::instance().updateParcel(parcel_id, mCurrentEnvironment->mDayCycle->getAssetId(), std::string(), mCurrentEnvironment->mDayLength.value(), mCurrentEnvironment->mDayOffset.value(), alts, @@ -673,13 +683,18 @@ void LLPanelEnvironmentInfo::doApply() } else { + if (!mCurrentEnvironment) + { + // Attempting to save mid update? + LL_WARNS("ENVPANEL") << "Failed to apply changes from editor! Dirty state: " << mDirtyFlag << " update state: " << mCurEnvVersion << LL_ENDL; + return; + } + mCurEnvVersion = INVALID_PARCEL_ENVIRONMENT_VERSION; LLEnvironment::instance().updateParcel(parcel_id, mCurrentEnvironment->mDayCycle, mCurrentEnvironment->mDayLength.value(), mCurrentEnvironment->mDayOffset.value(), alts, [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); } - // Todo: save altitudes once LLEnvironment::setRegionAltitudes() gets implemented - setControlsEnabled(false); } } @@ -748,6 +763,12 @@ void LLPanelEnvironmentInfo::onEditCommitted(LLSettingsDay::ptr_t newday) LL_WARNS("ENVPANEL") << "Editor committed an empty day. Do nothing." << LL_ENDL; return; } + if (!mCurrentEnvironment) + { + // Attempting to save mid update? + LL_WARNS("ENVPANEL") << "Failed to apply changes from editor! Dirty state: " << mDirtyFlag << " env version: " << mCurEnvVersion << LL_ENDL; + return; + } size_t newhash(newday->getHash()); size_t oldhash((mCurrentEnvironment->mDayCycle) ? mCurrentEnvironment->mDayCycle->getHash() : 0); @@ -761,11 +782,32 @@ void LLPanelEnvironmentInfo::onEditCommitted(LLSettingsDay::ptr_t newday) void LLPanelEnvironmentInfo::onEnvironmentChanged(LLEnvironment::EnvSelection_t env) { - if ((isRegion() && (env == LLEnvironment::ENV_REGION)) || - ((env == LLEnvironment::ENV_PARCEL) && (getParcelId() == LLViewerParcelMgr::instance().getAgentParcelId()))) + if (isRegion()) { - mCurrentEnvironment.reset(); - refreshFromSource(); + // Note: at the moment mCurEnvVersion is only applyable to parcels, we might need separate version control for regions + // but mCurEnvVersion still acts like indicator that update is pending + if (env == LLEnvironment::ENV_REGION) + { + mCurrentEnvironment.reset(); + refreshFromSource(); + } + } + else if ((env == LLEnvironment::ENV_PARCEL) && (getParcelId() == LLViewerParcelMgr::instance().getAgentParcelId())) + { + // Panel receives environment from different sources, from environment update callbacks, + // from hovers (causes callbacks on version change) and from personal requests + // filter out dupplicates and out of order packets by checking parcel environment version. + LL_DEBUGS("ENVPANEL") << "Received environment update " << mCurEnvVersion << " " << (getParcel() ? getParcel()->getParcelEnvironmentVersion() : (S32)-1) << LL_ENDL; + LLParcel *parcel = getParcel(); + if (parcel && mCurEnvVersion < parcel->getParcelEnvironmentVersion()) + { + mCurrentEnvironment.reset(); + refreshFromSource(); + } + else + { + refresh(); + } } } @@ -784,7 +826,7 @@ void LLPanelEnvironmentInfo::onPickerAssetDownloaded(LLSettingsBase::ptr_t setti } void LLPanelEnvironmentInfo::onEnvironmentReceived(S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) -{ +{ if (parcel_id != getParcelId()) { LL_WARNS("ENVPANEL") << "Have environment for parcel " << parcel_id << " expecting " << getParcelId() << ". Discarding." << LL_ENDL; @@ -792,6 +834,21 @@ void LLPanelEnvironmentInfo::onEnvironmentReceived(S32 parcel_id, LLEnvironment: } mCurrentEnvironment = envifo; clearDirtyFlag(DIRTY_FLAG_MASK); + if (parcel_id == INVALID_PARCEL_ID) + { + // region, no version + mCurEnvVersion = 1; + } + else + { + LLParcel* parcel = getParcel(); + if (parcel) + { + // not always up to date, we will get onEnvironmentChanged() update in such case. + mCurEnvVersion = parcel->getParcelEnvironmentVersion(); + } + LL_DEBUGS("ENVPANEL") << " Setting environment version: " << mCurEnvVersion << LL_ENDL; + } refresh(); } -- cgit v1.2.3 From 62720cf5dd5c11eaf08e90ce281d6d084ae017f0 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 21 Nov 2018 19:04:28 +0200 Subject: SL-9661 Settings applied from inventory don't update about land floater. --- indra/newview/llpanelenvironment.cpp | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index df595632f8..8c86e3e8e4 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -797,16 +797,21 @@ void LLPanelEnvironmentInfo::onEnvironmentChanged(LLEnvironment::EnvSelection_t // Panel receives environment from different sources, from environment update callbacks, // from hovers (causes callbacks on version change) and from personal requests // filter out dupplicates and out of order packets by checking parcel environment version. - LL_DEBUGS("ENVPANEL") << "Received environment update " << mCurEnvVersion << " " << (getParcel() ? getParcel()->getParcelEnvironmentVersion() : (S32)-1) << LL_ENDL; LLParcel *parcel = getParcel(); - if (parcel && mCurEnvVersion < parcel->getParcelEnvironmentVersion()) - { - mCurrentEnvironment.reset(); - refreshFromSource(); - } - else + if (parcel) { - refresh(); + S32 new_version = parcel->getParcelEnvironmentVersion(); + LL_DEBUGS("ENVPANEL") << "Received environment update " << mCurEnvVersion << " " << new_version << LL_ENDL; + if (mCurEnvVersion < new_version + || (mCurEnvVersion != new_version && new_version == UNSET_PARCEL_ENVIRONMENT_VERSION)) + { + mCurrentEnvironment.reset(); + refreshFromSource(); + } + else + { + refresh(); + } } } } @@ -837,16 +842,24 @@ void LLPanelEnvironmentInfo::onEnvironmentReceived(S32 parcel_id, LLEnvironment: if (parcel_id == INVALID_PARCEL_ID) { // region, no version - mCurEnvVersion = 1; + // -2 for invalid version viewer -1 for invalid version from server + mCurEnvVersion = UNSET_PARCEL_ENVIRONMENT_VERSION; } else { LLParcel* parcel = getParcel(); - if (parcel) + if (parcel + && mCurrentEnvironment->mDayCycle + && mCurrentEnvironment->mDayCycle->getAssetId() != LLSettingsDay::GetDefaultAssetId()) { // not always up to date, we will get onEnvironmentChanged() update in such case. mCurEnvVersion = parcel->getParcelEnvironmentVersion(); } + else + { + // When using 'region' as parcel environment + mCurEnvVersion = UNSET_PARCEL_ENVIRONMENT_VERSION; + } LL_DEBUGS("ENVPANEL") << " Setting environment version: " << mCurEnvVersion << LL_ENDL; } refresh(); -- cgit v1.2.3 From 76071d4fe8f2b88e33d0393fe00dc2ce88f71935 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 5 Dec 2018 22:13:49 +0200 Subject: SL-10091 EEP Filter out dupplicate refreshes and callbacks --- indra/newview/llpanelenvironment.cpp | 83 +++++++++++++++++++----------------- 1 file changed, 45 insertions(+), 38 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 8c86e3e8e4..04f281a40c 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -151,7 +151,7 @@ BOOL LLPanelEnvironmentInfo::postBuild() getChild(SLD_ALTITUDES)->setCommitCallback([this](LLUICtrl *cntrl, const LLSD &value) { onAltSliderCallback(cntrl, value); }); - mChangeMonitor = LLEnvironment::instance().setEnvironmentChanged([this](LLEnvironment::EnvSelection_t env) { onEnvironmentChanged(env); }); + mChangeMonitor = LLEnvironment::instance().setEnvironmentChanged([this](LLEnvironment::EnvSelection_t env, S32 version) { onEnvironmentChanged(env, version); }); getChild(SDT_DROP_TARGET)->setPanel(this); @@ -389,7 +389,7 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) S32 rdo_selection = getChild(RDG_ENVIRONMENT_SELECT)->getSelectedIndex(); - bool can_enable = enabled && mCurEnvVersion != INVALID_PARCEL_ENVIRONMENT_VERSION; + bool can_enable = enabled && mCurrentEnvironment && mCurEnvVersion != INVALID_PARCEL_ENVIRONMENT_VERSION; getChild(RDG_ENVIRONMENT_SELECT)->setEnabled(can_enable); getChild(RDO_USEDEFAULT)->setEnabled(can_enable && !is_legacy); getChild(RDO_USEINV)->setEnabled(false); // these two are selected automatically based on @@ -431,16 +431,16 @@ void LLPanelEnvironmentInfo::setDirtyFlag(U32 flag) { bool can_edit = canEdit(); mDirtyFlag |= flag; - getChildView(BTN_APPLY)->setEnabled((mDirtyFlag != 0) && mCurEnvVersion != INVALID_PARCEL_ENVIRONMENT_VERSION && can_edit); - getChildView(BTN_CANCEL)->setEnabled((mDirtyFlag != 0) && can_edit); + getChildView(BTN_APPLY)->setEnabled((mDirtyFlag != 0) && mCurrentEnvironment && mCurEnvVersion != INVALID_PARCEL_ENVIRONMENT_VERSION && can_edit); + getChildView(BTN_CANCEL)->setEnabled((mDirtyFlag != 0) && mCurrentEnvironment && can_edit); } void LLPanelEnvironmentInfo::clearDirtyFlag(U32 flag) { bool can_edit = canEdit(); mDirtyFlag &= ~flag; - getChildView(BTN_APPLY)->setEnabled((mDirtyFlag != 0) && mCurEnvVersion != INVALID_PARCEL_ENVIRONMENT_VERSION && can_edit); - getChildView(BTN_CANCEL)->setEnabled((mDirtyFlag != 0) && can_edit); + getChildView(BTN_APPLY)->setEnabled((mDirtyFlag != 0) && mCurrentEnvironment && mCurEnvVersion != INVALID_PARCEL_ENVIRONMENT_VERSION && can_edit); + getChildView(BTN_CANCEL)->setEnabled((mDirtyFlag != 0) && mCurrentEnvironment && can_edit); } void LLPanelEnvironmentInfo::updateAltLabel(const std::string &alt_name, U32 sky_index, F32 alt_value) @@ -663,7 +663,6 @@ void LLPanelEnvironmentInfo::doApply() if (rdo_selection == 0) { - mCurEnvVersion = INVALID_PARCEL_ENVIRONMENT_VERSION; LLEnvironment::instance().resetParcel(parcel_id, [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); } @@ -675,7 +674,6 @@ void LLPanelEnvironmentInfo::doApply() LL_WARNS("ENVPANEL") << "Failed to apply changes from editor! Dirty state: " << mDirtyFlag << " update state: " << mCurEnvVersion << LL_ENDL; return; } - mCurEnvVersion = INVALID_PARCEL_ENVIRONMENT_VERSION; LLEnvironment::instance().updateParcel(parcel_id, mCurrentEnvironment->mDayCycle->getAssetId(), std::string(), mCurrentEnvironment->mDayLength.value(), mCurrentEnvironment->mDayOffset.value(), alts, @@ -689,7 +687,6 @@ void LLPanelEnvironmentInfo::doApply() LL_WARNS("ENVPANEL") << "Failed to apply changes from editor! Dirty state: " << mDirtyFlag << " update state: " << mCurEnvVersion << LL_ENDL; return; } - mCurEnvVersion = INVALID_PARCEL_ENVIRONMENT_VERSION; LLEnvironment::instance().updateParcel(parcel_id, mCurrentEnvironment->mDayCycle, mCurrentEnvironment->mDayLength.value(), mCurrentEnvironment->mDayOffset.value(), alts, [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); @@ -780,36 +777,55 @@ void LLPanelEnvironmentInfo::onEditCommitted(LLSettingsDay::ptr_t newday) } } -void LLPanelEnvironmentInfo::onEnvironmentChanged(LLEnvironment::EnvSelection_t env) +void LLPanelEnvironmentInfo::onEnvironmentChanged(LLEnvironment::EnvSelection_t env, S32 new_version) { + if (new_version < INVALID_PARCEL_ENVIRONMENT_VERSION) + { + // cleanups and local changes, we are only interested in changes sent by server + return; + } + + LL_DEBUGS("ENVPANEL") << "Received environment update " << mCurEnvVersion << " " << new_version << LL_ENDL; + + // Environment comes from different sources, from environment update callbacks, + // from hovers (causes callbacks on version change) and from personal requests + // filter out duplicates and out of order packets by checking parcel environment version. + if (isRegion()) { - // Note: at the moment mCurEnvVersion is only applyable to parcels, we might need separate version control for regions - // but mCurEnvVersion still acts like indicator that update is pending - if (env == LLEnvironment::ENV_REGION) + // Note: region uses same init versions as parcel + if (env == LLEnvironment::ENV_REGION + // version should be always growing, UNSET_PARCEL_ENVIRONMENT_VERSION is backup case + && (mCurEnvVersion < new_version || mCurEnvVersion <= UNSET_PARCEL_ENVIRONMENT_VERSION)) { + if (new_version >= UNSET_PARCEL_ENVIRONMENT_VERSION) + { + // 'pending state' to prevent re-request on following onEnvironmentChanged if there will be any + mCurEnvVersion = new_version; + } mCurrentEnvironment.reset(); refreshFromSource(); } } - else if ((env == LLEnvironment::ENV_PARCEL) && (getParcelId() == LLViewerParcelMgr::instance().getAgentParcelId())) + else if ((env == LLEnvironment::ENV_PARCEL) + && (getParcelId() == LLViewerParcelMgr::instance().getAgentParcelId())) { - // Panel receives environment from different sources, from environment update callbacks, - // from hovers (causes callbacks on version change) and from personal requests - // filter out dupplicates and out of order packets by checking parcel environment version. LLParcel *parcel = getParcel(); if (parcel) { - S32 new_version = parcel->getParcelEnvironmentVersion(); - LL_DEBUGS("ENVPANEL") << "Received environment update " << mCurEnvVersion << " " << new_version << LL_ENDL; + // first for parcel own settings, second is for case when parcel uses region settings if (mCurEnvVersion < new_version || (mCurEnvVersion != new_version && new_version == UNSET_PARCEL_ENVIRONMENT_VERSION)) { + // 'pending state' to prevent re-request on following onEnvironmentChanged if there will be any + mCurEnvVersion = new_version; mCurrentEnvironment.reset(); + refreshFromSource(); } - else + else if (mCurrentEnvironment) { + // update controls refresh(); } } @@ -839,30 +855,21 @@ void LLPanelEnvironmentInfo::onEnvironmentReceived(S32 parcel_id, LLEnvironment: } mCurrentEnvironment = envifo; clearDirtyFlag(DIRTY_FLAG_MASK); - if (parcel_id == INVALID_PARCEL_ID) + if (mCurrentEnvironment->mEnvVersion > INVALID_PARCEL_ENVIRONMENT_VERSION) { - // region, no version - // -2 for invalid version viewer -1 for invalid version from server - mCurEnvVersion = UNSET_PARCEL_ENVIRONMENT_VERSION; + // Server provided version, use it + mCurEnvVersion = mCurrentEnvironment->mEnvVersion; + LL_DEBUGS("ENVPANEL") << " Setting environment version: " << mCurEnvVersion << " for parcel id: " << parcel_id << LL_ENDL; } + // Backup: Version was not provided for some reason else { - LLParcel* parcel = getParcel(); - if (parcel - && mCurrentEnvironment->mDayCycle - && mCurrentEnvironment->mDayCycle->getAssetId() != LLSettingsDay::GetDefaultAssetId()) - { - // not always up to date, we will get onEnvironmentChanged() update in such case. - mCurEnvVersion = parcel->getParcelEnvironmentVersion(); - } - else - { - // When using 'region' as parcel environment - mCurEnvVersion = UNSET_PARCEL_ENVIRONMENT_VERSION; - } - LL_DEBUGS("ENVPANEL") << " Setting environment version: " << mCurEnvVersion << LL_ENDL; + LL_WARNS("ENVPANEL") << " Environment version was not provided for " << parcel_id << ", old env version: " << mCurEnvVersion << LL_ENDL; } + refresh(); + + // todo: we have envifo and parcel env version, should we just setEnvironment() and parcel's property to prevent dupplicate requests? } void LLPanelEnvironmentInfo::_onEnvironmentReceived(LLHandle that_h, S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) -- cgit v1.2.3 From 6762c4515a9b0f98164d6efd191abec5ca4dd211 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 7 Dec 2018 17:10:05 +0200 Subject: SL-1894 When crossing regions altitude slider could misbehave --- indra/newview/llpanelenvironment.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 04f281a40c..7abb05b6fb 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -255,13 +255,19 @@ void LLPanelEnvironmentInfo::refresh() LLEnvironment::altitude_list_t altitudes = LLEnvironment::instance().getRegionAltitudes(); if (altitudes.size() > 0) { + LLMultiSliderCtrl *sld = getChild(SLD_ALTITUDES); + sld->clear(); + for (S32 idx = 0; idx < ALTITUDE_SLIDER_COUNT; ++idx) { - LLMultiSliderCtrl *sld = getChild(SLD_ALTITUDES); - sld->setSliderValue(alt_sliders[idx], altitudes[idx+1], FALSE); + sld->addSlider(altitudes[idx + 1], alt_sliders[idx]); updateAltLabel(alt_labels[idx], idx + 2, altitudes[idx+1]); mAltitudes[alt_sliders[idx]] = AltitudeData(idx+1, idx, altitudes[idx+1]); } + if (sld->getCurNumSliders() != ALTITUDE_SLIDER_COUNT) + { + LL_WARNS("ENVPANEL") << "Failed to add altitude sliders!" << LL_ENDL; + } readjustAltLabels(); } -- cgit v1.2.3 From dbcd1c273571a5d496b0d89db6bc224c2a0d672a Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Tue, 11 Dec 2018 13:24:48 +0200 Subject: SL-10186 FIXED When attempting to apply Day Offset of 0.0 the slider jumps to the last set Offset value --- indra/newview/llpanelenvironment.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 7abb05b6fb..e3be46f1af 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -557,7 +557,7 @@ void LLPanelEnvironmentInfo::onSldDayOffsetChanged(F32 value) { F32Hours dayoffset(value); - if (dayoffset.value() < 0.0f) + if (dayoffset.value() <= 0.0f) dayoffset += F32Hours(24.0); mCurrentEnvironment->mDayOffset = dayoffset; -- cgit v1.2.3 From 8227a0b270f6e7cc521adeb7b97ad2d5fb646973 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 21 Dec 2018 15:30:57 -0800 Subject: SL-10279: Rework the environment pannel. Still in progress. --- indra/newview/llpanelenvironment.cpp | 337 +++++++++++++++++++++++------------ 1 file changed, 227 insertions(+), 110 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index e3be46f1af..6465c25716 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -54,16 +54,20 @@ namespace { const std::string FLOATER_DAY_CYCLE_EDIT("env_edit_extdaycycle"); + + inline bool ends_with(std::string const & value, std::string const & ending) + { + if (ending.size() > value.size()) + return false; + return std::equal(ending.rbegin(), ending.rend(), value.rbegin()); + } + } //========================================================================= -const std::string LLPanelEnvironmentInfo::RDG_ENVIRONMENT_SELECT("rdg_environment_select"); -const std::string LLPanelEnvironmentInfo::RDO_USEDEFAULT("rdo_use_xxx_setting"); -const std::string LLPanelEnvironmentInfo::RDO_USEINV("rdo_use_inv_setting"); -const std::string LLPanelEnvironmentInfo::RDO_USECUSTOM("rdo_use_custom_setting"); -const std::string LLPanelEnvironmentInfo::EDT_INVNAME("edt_inventory_name"); 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::SLD_DAYLENGTH("sld_day_length"); const std::string LLPanelEnvironmentInfo::SLD_DAYOFFSET("sld_day_offset"); const std::string LLPanelEnvironmentInfo::SLD_ALTITUDES("sld_altitudes"); @@ -111,9 +115,9 @@ const std::string alt_labels[] = { "alt2", "alt3", "ground", + "water", }; - static LLDefaultChildRegistry::Register r("settings_drop_target"); //========================================================================= @@ -140,16 +144,19 @@ LLPanelEnvironmentInfo::~LLPanelEnvironmentInfo() BOOL LLPanelEnvironmentInfo::postBuild() { - getChild(RDG_ENVIRONMENT_SELECT)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onSwitchDefaultSelection(); }); + 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_APPLY)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnApply(); }); getChild(BTN_CANCEL)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnReset(); }); getChild(SLD_DAYLENGTH)->setCommitCallback([this](LLUICtrl *, const LLSD &value) { onSldDayLengthChanged(value.asReal()); }); + getChild(SLD_DAYLENGTH)->setSliderMouseUpCallback([this](LLUICtrl *, const LLSD &) { onDayLenOffsetMouseUp(); }); getChild(SLD_DAYOFFSET)->setCommitCallback([this](LLUICtrl *, const LLSD &value) { onSldDayOffsetChanged(value.asReal()); }); + getChild(SLD_DAYOFFSET)->setSliderMouseUpCallback([this](LLUICtrl *, const LLSD &) { onDayLenOffsetMouseUp(); }); getChild(SLD_ALTITUDES)->setCommitCallback([this](LLUICtrl *cntrl, const LLSD &value) { onAltSliderCallback(cntrl, value); }); + getChild(SLD_ALTITUDES)->setSliderMouseUpCallback([this](LLUICtrl *, const LLSD &) { onAltSliderMouseUp(); }); mChangeMonitor = LLEnvironment::instance().setEnvironmentChanged([this](LLEnvironment::EnvSelection_t env, S32 version) { onEnvironmentChanged(env, version); }); @@ -211,31 +218,31 @@ void LLPanelEnvironmentInfo::refresh() return; } - S32 rdo_selection = 0; - if ((!mCurrentEnvironment->mDayCycle) || - ((mCurrentEnvironment->mParcelId == INVALID_PARCEL_ID) && (mCurrentEnvironment->mDayCycle->getAssetId() == LLSettingsDay::GetDefaultAssetId() ))) - { - getChild(EDT_INVNAME)->setValue(""); - } - else if (!mCurrentEnvironment->mDayCycle->getAssetId().isNull()) - { - rdo_selection = 1; - - LLUUID asset_id = mCurrentEnvironment->mDayCycle->getAssetId(); - - std::string inventoryname = getInventoryNameForAssetId(asset_id); - - if (inventoryname.empty()) - inventoryname = "(" + mCurrentEnvironment->mDayCycle->getName() + ")"; - - getChild(EDT_INVNAME)->setValue(inventoryname); - } - else - { // asset id is null so this is a custom environment - rdo_selection = 2; - getChild(EDT_INVNAME)->setValue(""); - } - getChild(RDG_ENVIRONMENT_SELECT)->setSelectedIndex(rdo_selection); +// S32 rdo_selection = 0; +// if ((!mCurrentEnvironment->mDayCycle) || +// ((mCurrentEnvironment->mParcelId == INVALID_PARCEL_ID) && (mCurrentEnvironment->mDayCycle->getAssetId() == LLSettingsDay::GetDefaultAssetId() ))) +// { +// getChild(EDT_INVNAME)->setValue(""); +// } +// else if (!mCurrentEnvironment->mDayCycle->getAssetId().isNull()) +// { +// rdo_selection = 1; +// +// LLUUID asset_id = mCurrentEnvironment->mDayCycle->getAssetId(); +// +// std::string inventoryname = getInventoryNameForAssetId(asset_id); +// +// if (inventoryname.empty()) +// inventoryname = "(" + mCurrentEnvironment->mDayCycle->getName() + ")"; +// +// getChild(EDT_INVNAME)->setValue(inventoryname); +// } +// else +// { // asset id is null so this is a custom environment +// rdo_selection = 2; +// getChild(EDT_INVNAME)->setValue(""); +// } +// getChild(RDG_ENVIRONMENT_SELECT)->setSelectedIndex(rdo_selection); F32Hours daylength(mCurrentEnvironment->mDayLength); F32Hours dayoffset(mCurrentEnvironment->mDayOffset); @@ -245,8 +252,8 @@ void LLPanelEnvironmentInfo::refresh() getChild(SLD_DAYLENGTH)->setValue(daylength.value()); getChild(SLD_DAYOFFSET)->setValue(dayoffset.value()); - getChild(SLD_DAYLENGTH)->setEnabled(canEdit() && (rdo_selection != 0) && !mCurrentEnvironment->mIsLegacy); - getChild(SLD_DAYOFFSET)->setEnabled(canEdit() && (rdo_selection != 0) && !mCurrentEnvironment->mIsLegacy); +// getChild(SLD_DAYLENGTH)->setEnabled(canEdit() && (rdo_selection != 0) && !mCurrentEnvironment->mIsLegacy); +// getChild(SLD_DAYOFFSET)->setEnabled(canEdit() && (rdo_selection != 0) && !mCurrentEnvironment->mIsLegacy); udpateApparentTimeOfDay(); @@ -271,6 +278,9 @@ void LLPanelEnvironmentInfo::refresh() readjustAltLabels(); } + updateAltLabel(alt_labels[3], 1, 0); // ground + updateAltLabel(alt_labels[4], 0, 0); // water + } std::string LLPanelEnvironmentInfo::getInventoryNameForAssetId(LLUUID asset_id) @@ -282,6 +292,27 @@ std::string LLPanelEnvironmentInfo::getInventoryNameForAssetId(LLUUID asset_id) return name; } + +std::string LLPanelEnvironmentInfo::getNameForTrackIndex(S32 index) +{ + std::string invname; + + LL_WARNS("LAPRAS") << "mDayCycleName='" << mCurrentEnvironment->mDayCycleName << "'" << LL_ENDL; + if (mCurrentEnvironment->mDayCycleName.empty()) + { + invname = mCurrentEnvironment->mNameList[index]; + } + else if (!mCurrentEnvironment->mDayCycle->isTrackEmpty(index)) + { + invname = mCurrentEnvironment->mDayCycleName; + } + + if (invname.empty()) + invname = getString("str_empty"); + + return invname; +} + LLFloaterSettingsPicker * LLPanelEnvironmentInfo::getSettingsPicker(bool create) { LLFloaterSettingsPicker *picker = static_cast(mSettingsFloater.get()); @@ -391,20 +422,13 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) getChild(PNL_BUTTONS)->setVisible(true); getChild(PNL_DISABLED)->setVisible(false); - getChild(PNL_ENVIRONMENT_ALTITUDES)->setVisible(isRegion() && LLEnvironment::instance().isExtendedEnvironmentEnabled()); - - S32 rdo_selection = getChild(RDG_ENVIRONMENT_SELECT)->getSelectedIndex(); + getChild(PNL_ENVIRONMENT_ALTITUDES)->setVisible(LLEnvironment::instance().isExtendedEnvironmentEnabled()); - bool can_enable = enabled && mCurrentEnvironment && mCurEnvVersion != INVALID_PARCEL_ENVIRONMENT_VERSION; - getChild(RDG_ENVIRONMENT_SELECT)->setEnabled(can_enable); - getChild(RDO_USEDEFAULT)->setEnabled(can_enable && !is_legacy); - getChild(RDO_USEINV)->setEnabled(false); // these two are selected automatically based on - getChild(RDO_USECUSTOM)->setEnabled(false); - getChild(EDT_INVNAME)->setEnabled(FALSE); + bool can_enable = enabled && mCurrentEnvironment && (mCurEnvVersion != INVALID_PARCEL_ENVIRONMENT_VERSION); getChild(BTN_SELECTINV)->setEnabled(can_enable && !is_legacy); getChild(BTN_EDIT)->setEnabled(can_enable); - getChild(SLD_DAYLENGTH)->setEnabled(can_enable && (rdo_selection != 0) && !is_legacy); - getChild(SLD_DAYOFFSET)->setEnabled(can_enable && (rdo_selection != 0) && !is_legacy); + getChild(SLD_DAYLENGTH)->setEnabled(can_enable && !is_legacy); + 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(PNL_ENVIRONMENT_ALTITUDES)->setEnabled(can_enable && isRegion() && !is_legacy); @@ -460,7 +484,10 @@ void LLPanelEnvironmentInfo::updateAltLabel(const std::string &alt_name, U32 sky // get related text box LLTextBox* text = getChild(alt_name); - if (text) + LLLineEditor *field = getChild("edt_invname_" + alt_name); + LLSettingsDropTarget *dt = getChild("sdt_" + alt_name); + + if (text && (sky_index > 1)) { // move related text box LLRect rect = text->getRect(); @@ -468,7 +495,6 @@ void LLPanelEnvironmentInfo::updateAltLabel(const std::string &alt_name, U32 sky rect.mBottom = sld_bottom + (sld_offset / 2 + 1) + pos - (height / 2); rect.mTop = rect.mBottom + height; text->setRect(rect); - // update text std::ostringstream convert; convert << alt_value; @@ -477,7 +503,26 @@ void LLPanelEnvironmentInfo::updateAltLabel(const std::string &alt_name, U32 sky convert.clear(); convert << sky_index; text->setTextArg("[INDEX]", convert.str()); + + if (field) + { + LLRect rect_name = field->getRect(); + S32 name_height = rect_name.getHeight(); + S32 center = rect.mBottom + (height / 2); + rect_name.mBottom = center - (name_height / 2); + rect_name.mTop = rect_name.mBottom + name_height; + + field->setRect(rect_name); + if (dt) + dt->setRect(rect_name); + } } + + if (field) + { + field->setText(getNameForTrackIndex(sky_index)); + } + } void LLPanelEnvironmentInfo::readjustAltLabels() @@ -492,10 +537,22 @@ void LLPanelEnvironmentInfo::readjustAltLabels() ground_text_rect.mTop = ground_text_rect.mBottom + height; text->setRect(ground_text_rect); +// LLMultiSliderCtrl *sld = getChild(SLD_ALTITUDES); +// for (U32 idx = 0; idx < ALTITUDE_SLIDER_COUNT; ++idx) +// { +// LLRect rect_sld = sld->getSliderThumbRect(alt_sliders[idx]); +// LLTextBox* text_cmp = getChild(alt_labels[i]); +// +// LLRect rect_text = text_cmp->getRect(); +// +// LL_WARNS("LAPRAS") << "slider[" << alt_sliders[idx] << "] -> " << rect_sld << " value=" << sld->getSliderValue(alt_sliders[idx]) LL_ENDL; +// } + + +#if 0 // Re-adjust all labels // Very simple "adjust after the fact" method // Note: labels are unordered, labels are 1 above sliders due to 'ground' - for (U32 i = 0; i < ALTITUDE_SLIDER_COUNT; i++) { LLTextBox* text_cmp = getChild(alt_labels[i]); @@ -531,17 +588,20 @@ void LLPanelEnvironmentInfo::readjustAltLabels() } } } +#endif } +#if 0 void LLPanelEnvironmentInfo::onSwitchDefaultSelection() { - bool can_edit = canEdit(); +// bool can_edit = canEdit(); setDirtyFlag(DIRTY_FLAG_DAYCYCLE); - S32 rdo_selection = getChild(RDG_ENVIRONMENT_SELECT)->getSelectedIndex(); - getChild(SLD_DAYLENGTH)->setEnabled(can_edit && (rdo_selection != 0)); - getChild(SLD_DAYOFFSET)->setEnabled(can_edit && (rdo_selection != 0)); +// S32 rdo_selection = getChild(RDG_ENVIRONMENT_SELECT)->getSelectedIndex(); +// getChild(SLD_DAYLENGTH)->setEnabled(can_edit && (rdo_selection != 0)); +// getChild(SLD_DAYOFFSET)->setEnabled(can_edit && (rdo_selection != 0)); } +#endif void LLPanelEnvironmentInfo::onSldDayLengthChanged(F32 value) { @@ -566,6 +626,22 @@ void LLPanelEnvironmentInfo::onSldDayOffsetChanged(F32 value) udpateApparentTimeOfDay(); } +void LLPanelEnvironmentInfo::onDayLenOffsetMouseUp() +{ + if (getDirtyFlag() & (DIRTY_FLAG_DAYLENGTH | DIRTY_FLAG_DAYOFFSET)) + { + clearDirtyFlag(DIRTY_FLAG_DAYOFFSET); + clearDirtyFlag(DIRTY_FLAG_DAYLENGTH); + + LLHandle that_h = getHandle(); + + LLEnvironment::instance().updateParcel(getParcelId(), LLSettingsDay::ptr_t(), + mCurrentEnvironment->mDayLength.value(), mCurrentEnvironment->mDayOffset.value(), LLEnvironment::altitudes_vect_t(), + [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); + + } +} + void LLPanelEnvironmentInfo::onAltSliderCallback(LLUICtrl *cntrl, const LLSD &data) { LLMultiSliderCtrl *sld = (LLMultiSliderCtrl *)cntrl; @@ -593,6 +669,7 @@ void LLPanelEnvironmentInfo::onAltSliderCallback(LLUICtrl *cntrl, const LLSD &da iter2++; } iter->second.mAltitudeIndex = new_index; + updateAltLabel(alt_labels[iter->second.mLabelIndex], iter->second.mAltitudeIndex + 1, iter->second.mAltitude); iter++; } @@ -601,6 +678,27 @@ void LLPanelEnvironmentInfo::onAltSliderCallback(LLUICtrl *cntrl, const LLSD &da setDirtyFlag(DIRTY_FLAG_ALTITUDES); } +void LLPanelEnvironmentInfo::onAltSliderMouseUp() +{ + if (isRegion() && (getDirtyFlag() & DIRTY_FLAG_ALTITUDES)) + { + clearDirtyFlag(DIRTY_FLAG_ALTITUDES); + + LLHandle that_h = getHandle(); + LLEnvironment::altitudes_vect_t alts; + + for (auto alt : mAltitudes) + { + alts.push_back(alt.second.mAltitude); + } + + 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::onBtnApply() { doApply(); @@ -612,6 +710,14 @@ void LLPanelEnvironmentInfo::onBtnReset() refreshFromSource(); } +void LLPanelEnvironmentInfo::onBtnDefault() +{ + LLHandle that_h = getHandle(); + + LLEnvironment::instance().resetParcel(getParcelId(), + [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); +} + void LLPanelEnvironmentInfo::onBtnEdit() { static const S32 FOURHOURS(4 * 60 * 60); @@ -624,7 +730,13 @@ void LLPanelEnvironmentInfo::onBtnEdit() dayeditor->openFloater(params); if (mCurrentEnvironment && mCurrentEnvironment->mDayCycle) + { dayeditor->setEditDayCycle(mCurrentEnvironment->mDayCycle); + if (!ends_with(mCurrentEnvironment->mDayCycle->getName(), "(customized)")) + { + dayeditor->setEditName(mCurrentEnvironment->mDayCycle->getName() + "(customized)"); + } + } else dayeditor->setEditDefaultDayCycle(); } @@ -649,57 +761,57 @@ void LLPanelEnvironmentInfo::onBtnSelect() void LLPanelEnvironmentInfo::doApply() { - S32 parcel_id = getParcelId(); - - if (getIsDirtyFlag(DIRTY_FLAG_MASK)) - { - LLHandle that_h = getHandle(); - LLEnvironment::altitudes_vect_t alts; - - S32 rdo_selection = getChild(RDG_ENVIRONMENT_SELECT)->getSelectedIndex(); - - if (isRegion() && getIsDirtyFlag(DIRTY_FLAG_ALTITUDES)) - { - altitudes_data_t::iterator it; - for (auto alt : mAltitudes) - { - alts.push_back(alt.second.mAltitude); - } - } +// S32 parcel_id = getParcelId(); - if (rdo_selection == 0) - { - LLEnvironment::instance().resetParcel(parcel_id, - [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); - } - else if (rdo_selection == 1) - { - if (!mCurrentEnvironment) - { - // Attempting to save mid update? - LL_WARNS("ENVPANEL") << "Failed to apply changes from editor! Dirty state: " << mDirtyFlag << " update state: " << mCurEnvVersion << LL_ENDL; - return; - } - LLEnvironment::instance().updateParcel(parcel_id, - mCurrentEnvironment->mDayCycle->getAssetId(), std::string(), mCurrentEnvironment->mDayLength.value(), - mCurrentEnvironment->mDayOffset.value(), alts, - [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); - } - else - { - if (!mCurrentEnvironment) - { - // Attempting to save mid update? - LL_WARNS("ENVPANEL") << "Failed to apply changes from editor! Dirty state: " << mDirtyFlag << " update state: " << mCurEnvVersion << LL_ENDL; - return; - } - LLEnvironment::instance().updateParcel(parcel_id, - mCurrentEnvironment->mDayCycle, mCurrentEnvironment->mDayLength.value(), mCurrentEnvironment->mDayOffset.value(), alts, - [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); - } - - setControlsEnabled(false); - } +// if (getIsDirtyFlag(DIRTY_FLAG_MASK)) +// { +// LLHandle that_h = getHandle(); +// LLEnvironment::altitudes_vect_t alts; +// +// // S32 rdo_selection = getChild(RDG_ENVIRONMENT_SELECT)->getSelectedIndex(); +// +// if (isRegion() && getIsDirtyFlag(DIRTY_FLAG_ALTITUDES)) +// { +// altitudes_data_t::iterator it; +// for (auto alt : mAltitudes) +// { +// alts.push_back(alt.second.mAltitude); +// } +// } + +// if (rdo_selection == 0) +// { +// LLEnvironment::instance().resetParcel(parcel_id, +// [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); +// } +// else if (rdo_selection == 1) +// { +// if (!mCurrentEnvironment) +// { +// // Attempting to save mid update? +// LL_WARNS("ENVPANEL") << "Failed to apply changes from editor! Dirty state: " << mDirtyFlag << " update state: " << mCurEnvVersion << LL_ENDL; +// return; +// } +// LLEnvironment::instance().updateParcel(parcel_id, +// mCurrentEnvironment->mDayCycle->getAssetId(), std::string(), mCurrentEnvironment->mDayLength.value(), +// mCurrentEnvironment->mDayOffset.value(), alts, +// [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); +// } +// else +// { +// if (!mCurrentEnvironment) +// { +// // Attempting to save mid update? +// LL_WARNS("ENVPANEL") << "Failed to apply changes from editor! Dirty state: " << mDirtyFlag << " update state: " << mCurEnvVersion << LL_ENDL; +// return; +// } +// LLEnvironment::instance().updateParcel(parcel_id, +// mCurrentEnvironment->mDayCycle, mCurrentEnvironment->mDayLength.value(), mCurrentEnvironment->mDayOffset.value(), alts, +// [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); +// } + +// setControlsEnabled(false); +// } } @@ -751,16 +863,19 @@ void LLPanelEnvironmentInfo::onPickerCommitted(LLUUID item_id) LLInventoryItem *itemp = gInventory.getItem(item_id); if (itemp) { - LLSettingsVOBase::getSettingsAsset(itemp->getAssetUUID(), [this](LLUUID, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { - if (status) - return; - onPickerAssetDownloaded(settings); - }); + LLHandle that_h = getHandle(); + + LLEnvironment::instance().updateParcel(getParcelId(), itemp->getAssetUUID(), + itemp->getName(), + -1, -1, LLEnvironment::altitudes_vect_t(), + [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); } } void LLPanelEnvironmentInfo::onEditCommitted(LLSettingsDay::ptr_t newday) { + LLEnvironment::instance().clearEnvironment(LLEnvironment::ENV_EDIT); + LLEnvironment::instance().updateEnvironment(); if (!newday) { LL_WARNS("ENVPANEL") << "Editor committed an empty day. Do nothing." << LL_ENDL; @@ -777,9 +892,11 @@ void LLPanelEnvironmentInfo::onEditCommitted(LLSettingsDay::ptr_t newday) if (newhash != oldhash) { - mCurrentEnvironment->mDayCycle = newday; - setDirtyFlag(DIRTY_FLAG_DAYCYCLE); - refresh(); + LLHandle that_h = getHandle(); + + LLEnvironment::instance().updateParcel(getParcelId(), newday, + -1, -1, LLEnvironment::altitudes_vect_t(), + [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); } } -- cgit v1.2.3 From 5fe626afabd2857980e8011ceb6081f9e9f108c7 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 2 Jan 2019 15:13:47 -0800 Subject: SL-10279: Most functionality now present. Still needs some cleanup on the bump code. --- indra/newview/llpanelenvironment.cpp | 109 ++++++----------------------------- 1 file changed, 17 insertions(+), 92 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 6465c25716..79e3d61014 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -73,8 +73,6 @@ const std::string LLPanelEnvironmentInfo::SLD_DAYOFFSET("sld_day_offset"); const std::string LLPanelEnvironmentInfo::SLD_ALTITUDES("sld_altitudes"); const std::string LLPanelEnvironmentInfo::ICN_GROUND("icon_ground"); 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_ENVIRONMENT_ALTITUDES("pnl_environment_altitudes"); @@ -90,6 +88,7 @@ const std::string LLPanelEnvironmentInfo::STR_ALTITUDE_DESCRIPTION("str_altitude 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 std::string LLPanelEnvironmentInfo::STR_DISALLOWED("str_disallowed"); const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_DAYCYCLE(0x01 << 0); const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_DAYLENGTH(0x01 << 1); @@ -130,7 +129,8 @@ LLPanelEnvironmentInfo::LLPanelEnvironmentInfo(): mNoEnvironment(false), mCurEnvVersion(INVALID_PARCEL_ENVIRONMENT_VERSION), mSettingsFloater(), - mEditFloater() + mEditFloater(), + mAllowOverride(false) { } @@ -147,8 +147,6 @@ 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_APPLY)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnApply(); }); - getChild(BTN_CANCEL)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnReset(); }); getChild(SLD_DAYLENGTH)->setCommitCallback([this](LLUICtrl *, const LLSD &value) { onSldDayLengthChanged(value.asReal()); }); getChild(SLD_DAYLENGTH)->setSliderMouseUpCallback([this](LLUICtrl *, const LLSD &) { onDayLenOffsetMouseUp(); }); @@ -283,6 +281,13 @@ void LLPanelEnvironmentInfo::refresh() } +void LLPanelEnvironmentInfo::refreshFromEstate() +{ + const LLEstateInfoModel& estate_info = LLEstateInfoModel::instance(); + + mAllowOverride = estate_info.getAllowEnvironmentOverride(); +} + std::string LLPanelEnvironmentInfo::getInventoryNameForAssetId(LLUUID asset_id) { std::string name(LLFloaterSettingsPicker::findItemName(asset_id, false, false)); @@ -406,6 +411,11 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) is_unavailable = true; getChild(TXT_DISABLED)->setText(getString(STR_CROSS_REGION)); } + else if (!isRegion() && !mAllowOverride) + { + is_unavailable = true; + getChild(TXT_DISABLED)->setText(getString(STR_DISALLOWED)); + } if (is_unavailable) { @@ -426,6 +436,7 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) bool can_enable = enabled && mCurrentEnvironment && (mCurEnvVersion != INVALID_PARCEL_ENVIRONMENT_VERSION); getChild(BTN_SELECTINV)->setEnabled(can_enable && !is_legacy); + getChild(BTN_USEDEFAULT)->setEnabled(can_enable && !is_legacy); getChild(BTN_EDIT)->setEnabled(can_enable); getChild(SLD_DAYLENGTH)->setEnabled(can_enable && !is_legacy); getChild(SLD_DAYOFFSET)->setEnabled(can_enable && !is_legacy); @@ -433,8 +444,6 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) getChild(ICN_GROUND)->setColor((can_enable && isRegion() && !is_legacy) ? LLColor4::white : LLColor4::grey % 0.8f); getChild(PNL_ENVIRONMENT_ALTITUDES)->setEnabled(can_enable && isRegion() && !is_legacy); getChild(CHK_ALLOWOVERRIDE)->setEnabled(can_enable && isRegion() && !is_legacy); - getChild(BTN_APPLY)->setEnabled(can_enable && (mDirtyFlag != 0)); - getChild(BTN_CANCEL)->setEnabled(enabled && (mDirtyFlag != 0)); getChild(SDT_DROP_TARGET)->setDndEnabled(enabled && !is_legacy); @@ -459,18 +468,12 @@ void LLPanelEnvironmentInfo::setApplyProgress(bool started) void LLPanelEnvironmentInfo::setDirtyFlag(U32 flag) { - bool can_edit = canEdit(); mDirtyFlag |= flag; - getChildView(BTN_APPLY)->setEnabled((mDirtyFlag != 0) && mCurrentEnvironment && mCurEnvVersion != INVALID_PARCEL_ENVIRONMENT_VERSION && can_edit); - getChildView(BTN_CANCEL)->setEnabled((mDirtyFlag != 0) && mCurrentEnvironment && can_edit); } void LLPanelEnvironmentInfo::clearDirtyFlag(U32 flag) { - bool can_edit = canEdit(); mDirtyFlag &= ~flag; - getChildView(BTN_APPLY)->setEnabled((mDirtyFlag != 0) && mCurrentEnvironment && mCurEnvVersion != INVALID_PARCEL_ENVIRONMENT_VERSION && can_edit); - getChildView(BTN_CANCEL)->setEnabled((mDirtyFlag != 0) && mCurrentEnvironment && can_edit); } void LLPanelEnvironmentInfo::updateAltLabel(const std::string &alt_name, U32 sky_index, F32 alt_value) @@ -591,18 +594,6 @@ void LLPanelEnvironmentInfo::readjustAltLabels() #endif } -#if 0 -void LLPanelEnvironmentInfo::onSwitchDefaultSelection() -{ -// bool can_edit = canEdit(); - setDirtyFlag(DIRTY_FLAG_DAYCYCLE); - -// S32 rdo_selection = getChild(RDG_ENVIRONMENT_SELECT)->getSelectedIndex(); -// getChild(SLD_DAYLENGTH)->setEnabled(can_edit && (rdo_selection != 0)); -// getChild(SLD_DAYOFFSET)->setEnabled(can_edit && (rdo_selection != 0)); -} -#endif - void LLPanelEnvironmentInfo::onSldDayLengthChanged(F32 value) { F32Hours daylength(value); @@ -699,17 +690,6 @@ void LLPanelEnvironmentInfo::onAltSliderMouseUp() } } -void LLPanelEnvironmentInfo::onBtnApply() -{ - doApply(); -} - -void LLPanelEnvironmentInfo::onBtnReset() -{ - mCurrentEnvironment.reset(); - refreshFromSource(); -} - void LLPanelEnvironmentInfo::onBtnDefault() { LLHandle that_h = getHandle(); @@ -759,62 +739,6 @@ void LLPanelEnvironmentInfo::onBtnSelect() } -void LLPanelEnvironmentInfo::doApply() -{ -// S32 parcel_id = getParcelId(); - -// if (getIsDirtyFlag(DIRTY_FLAG_MASK)) -// { -// LLHandle that_h = getHandle(); -// LLEnvironment::altitudes_vect_t alts; -// -// // S32 rdo_selection = getChild(RDG_ENVIRONMENT_SELECT)->getSelectedIndex(); -// -// if (isRegion() && getIsDirtyFlag(DIRTY_FLAG_ALTITUDES)) -// { -// altitudes_data_t::iterator it; -// for (auto alt : mAltitudes) -// { -// alts.push_back(alt.second.mAltitude); -// } -// } - -// if (rdo_selection == 0) -// { -// LLEnvironment::instance().resetParcel(parcel_id, -// [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); -// } -// else if (rdo_selection == 1) -// { -// if (!mCurrentEnvironment) -// { -// // Attempting to save mid update? -// LL_WARNS("ENVPANEL") << "Failed to apply changes from editor! Dirty state: " << mDirtyFlag << " update state: " << mCurEnvVersion << LL_ENDL; -// return; -// } -// LLEnvironment::instance().updateParcel(parcel_id, -// mCurrentEnvironment->mDayCycle->getAssetId(), std::string(), mCurrentEnvironment->mDayLength.value(), -// mCurrentEnvironment->mDayOffset.value(), alts, -// [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); -// } -// else -// { -// if (!mCurrentEnvironment) -// { -// // Attempting to save mid update? -// LL_WARNS("ENVPANEL") << "Failed to apply changes from editor! Dirty state: " << mDirtyFlag << " update state: " << mCurEnvVersion << LL_ENDL; -// return; -// } -// LLEnvironment::instance().updateParcel(parcel_id, -// mCurrentEnvironment->mDayCycle, mCurrentEnvironment->mDayLength.value(), mCurrentEnvironment->mDayOffset.value(), alts, -// [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); -// } - -// setControlsEnabled(false); -// } -} - - void LLPanelEnvironmentInfo::udpateApparentTimeOfDay() { static const F32 SECONDSINDAY(24.0 * 60.0 * 60.0); @@ -990,6 +914,7 @@ void LLPanelEnvironmentInfo::onEnvironmentReceived(S32 parcel_id, LLEnvironment: LL_WARNS("ENVPANEL") << " Environment version was not provided for " << parcel_id << ", old env version: " << mCurEnvVersion << LL_ENDL; } + refreshFromEstate(); refresh(); // todo: we have envifo and parcel env version, should we just setEnvironment() and parcel's property to prevent dupplicate requests? -- cgit v1.2.3 From d607d81dba25dfe7dd1ecdf123af656ca939924f Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 2 Jan 2019 17:10:15 -0800 Subject: SL-10279: Temp fix for stale estate info when editing parcel environment. --- indra/newview/llpanelenvironment.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 79e3d61014..b4007cfdf0 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -130,7 +130,7 @@ LLPanelEnvironmentInfo::LLPanelEnvironmentInfo(): mCurEnvVersion(INVALID_PARCEL_ENVIRONMENT_VERSION), mSettingsFloater(), mEditFloater(), - mAllowOverride(false) + mAllowOverride(true) { } @@ -283,9 +283,21 @@ void LLPanelEnvironmentInfo::refresh() void LLPanelEnvironmentInfo::refreshFromEstate() { + /*TODO: Bug!! estate_info seems stale if regain floater has not been opened.*/ const LLEstateInfoModel& estate_info = LLEstateInfoModel::instance(); - mAllowOverride = estate_info.getAllowEnvironmentOverride(); + if (isRegion()) + { // this should always work... but estate_info gives back false when it shouldn't for parcels + bool oldAO = mAllowOverride; + mAllowOverride = estate_info.getAllowEnvironmentOverride(); + if (oldAO != mAllowOverride) + refresh(); + } + else + { + // Get rid of this when I solve the above. + mAllowOverride = true; + } } std::string LLPanelEnvironmentInfo::getInventoryNameForAssetId(LLUUID asset_id) -- cgit v1.2.3 From 69a84d81728203868923bbf27f8bce0d8b0c8e86 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 4 Jan 2019 17:09:09 +0200 Subject: SL-10279 Fix altitude description repositioning code --- indra/newview/llpanelenvironment.cpp | 112 ++++++++++++++--------------------- 1 file changed, 46 insertions(+), 66 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index b4007cfdf0..04153b8aa7 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -109,7 +109,7 @@ const std::string alt_sliders[] = { "sld3", }; -const std::string alt_labels[] = { +const std::string alt_prefixes[] = { "alt1", "alt2", "alt3", @@ -117,6 +117,14 @@ const std::string alt_labels[] = { "water", }; +const std::string alt_panels[] = { + "pnl_alt1", + "pnl_alt2", + "pnl_alt3", + "pnl_ground", + "pnl_water", +}; + static LLDefaultChildRegistry::Register r("settings_drop_target"); //========================================================================= @@ -266,7 +274,7 @@ void LLPanelEnvironmentInfo::refresh() for (S32 idx = 0; idx < ALTITUDE_SLIDER_COUNT; ++idx) { sld->addSlider(altitudes[idx + 1], alt_sliders[idx]); - updateAltLabel(alt_labels[idx], idx + 2, altitudes[idx+1]); + updateAltLabel(alt_prefixes[idx], idx + 2, altitudes[idx + 1]); mAltitudes[alt_sliders[idx]] = AltitudeData(idx+1, idx, altitudes[idx+1]); } if (sld->getCurNumSliders() != ALTITUDE_SLIDER_COUNT) @@ -276,8 +284,8 @@ void LLPanelEnvironmentInfo::refresh() readjustAltLabels(); } - updateAltLabel(alt_labels[3], 1, 0); // ground - updateAltLabel(alt_labels[4], 0, 0); // water + updateAltLabel(alt_prefixes[3], 1, 0); // ground + updateAltLabel(alt_prefixes[4], 0, 0); // water } @@ -488,28 +496,27 @@ void LLPanelEnvironmentInfo::clearDirtyFlag(U32 flag) mDirtyFlag &= ~flag; } -void LLPanelEnvironmentInfo::updateAltLabel(const std::string &alt_name, U32 sky_index, F32 alt_value) +void LLPanelEnvironmentInfo::updateAltLabel(const std::string &alt_prefix, U32 sky_index, F32 alt_value) { - LLMultiSliderCtrl *sld = getChild(SLD_ALTITUDES); + LLMultiSliderCtrl *sld = findChild(SLD_ALTITUDES); + if (!sld) + { + LL_WARNS() << "Failed to find slider " << SLD_ALTITUDES << LL_ENDL; + return; + } LLRect sld_rect = sld->getRect(); S32 sld_range = sld_rect.getHeight(); S32 sld_bottom = sld_rect.mBottom; S32 sld_offset = sld_rect.getWidth(); // Roughly identical to thumb's width in slider. S32 pos = (sld_range - sld_offset) * ((alt_value - 100) / (4000 - 100)); - // get related text box - LLTextBox* text = getChild(alt_name); - LLLineEditor *field = getChild("edt_invname_" + alt_name); - LLSettingsDropTarget *dt = getChild("sdt_" + alt_name); + // get related views + LLTextBox* text = findChild("txt_" + alt_prefix); + LLLineEditor *field = findChild("edt_invname_" + alt_prefix); + LLView *alt_panel = findChild("pnl_" + alt_prefix); if (text && (sky_index > 1)) { - // move related text box - LLRect rect = text->getRect(); - S32 height = rect.getHeight(); - rect.mBottom = sld_bottom + (sld_offset / 2 + 1) + pos - (height / 2); - rect.mTop = rect.mBottom + height; - text->setRect(rect); // update text std::ostringstream convert; convert << alt_value; @@ -518,19 +525,6 @@ void LLPanelEnvironmentInfo::updateAltLabel(const std::string &alt_name, U32 sky convert.clear(); convert << sky_index; text->setTextArg("[INDEX]", convert.str()); - - if (field) - { - LLRect rect_name = field->getRect(); - S32 name_height = rect_name.getHeight(); - S32 center = rect.mBottom + (height / 2); - rect_name.mBottom = center - (name_height / 2); - rect_name.mTop = rect_name.mBottom + name_height; - - field->setRect(rect_name); - if (dt) - dt->setRect(rect_name); - } } if (field) @@ -538,72 +532,58 @@ void LLPanelEnvironmentInfo::updateAltLabel(const std::string &alt_name, U32 sky field->setText(getNameForTrackIndex(sky_index)); } + if (alt_panel && (sky_index > 1)) + { + // move containing panel + LLRect rect = alt_panel->getRect(); + S32 height = rect.getHeight(); + rect.mBottom = sld_bottom + (sld_offset / 2 + 1) + pos - (height / 2); + rect.mTop = rect.mBottom + height; + alt_panel->setRect(rect); + } + } void LLPanelEnvironmentInfo::readjustAltLabels() { - // Restore ground label position - LLView* icon = getChild(ICN_GROUND); - LLTextBox* text = getChild(alt_labels[ALTITUDE_SLIDER_COUNT]); // one more field then sliders - LLRect ground_text_rect = text->getRect(); - LLRect icon_rect = icon->getRect(); - S32 height = ground_text_rect.getHeight(); - ground_text_rect.mBottom = icon_rect.mBottom + (icon_rect.getHeight()/2) - (height/2); - ground_text_rect.mTop = ground_text_rect.mBottom + height; - text->setRect(ground_text_rect); - -// LLMultiSliderCtrl *sld = getChild(SLD_ALTITUDES); -// for (U32 idx = 0; idx < ALTITUDE_SLIDER_COUNT; ++idx) -// { -// LLRect rect_sld = sld->getSliderThumbRect(alt_sliders[idx]); -// LLTextBox* text_cmp = getChild(alt_labels[i]); -// -// LLRect rect_text = text_cmp->getRect(); -// -// LL_WARNS("LAPRAS") << "slider[" << alt_sliders[idx] << "] -> " << rect_sld << " value=" << sld->getSliderValue(alt_sliders[idx]) LL_ENDL; -// } - - -#if 0 // Re-adjust all labels // Very simple "adjust after the fact" method - // Note: labels are unordered, labels are 1 above sliders due to 'ground' - for (U32 i = 0; i < ALTITUDE_SLIDER_COUNT; i++) + // Note: labels can be in any ordered + for (U32 i = 0; i < ALTITUDE_SLIDER_COUNT - 1; i++) { - LLTextBox* text_cmp = getChild(alt_labels[i]); + LLView* view_cmp = findChild(alt_panels[i]); - for (U32 j = i + 1; j <= ALTITUDE_SLIDER_COUNT; j++) + for (U32 j = i + 1; j < ALTITUDE_SLIDER_COUNT; j++) { - LLTextBox* text_intr = getChild(alt_labels[j]); - if (text_cmp && text_intr) + LLView* view_intr = findChild(alt_panels[j]); + if (view_cmp && view_intr) { - LLRect cmp_rect = text_cmp->getRect(); - LLRect intr_rect = text_intr->getRect(); + LLRect cmp_rect = view_cmp->getRect(); + LLRect intr_rect = view_intr->getRect(); S32 shift = 0; if (cmp_rect.mBottom <= intr_rect.mTop && cmp_rect.mBottom >= intr_rect.mBottom) { - // Aproximate shift + // Approximate shift // We probably will need more cycle runs over all labels to get accurate one // At the moment single cycle should do since we have too little elements to do something complicated shift = (cmp_rect.mBottom - intr_rect.mTop) / 2; } else if (cmp_rect.mTop >= intr_rect.mBottom && cmp_rect.mTop <= intr_rect.mTop) { - // Aproximate shift + // Approximate shift shift = (cmp_rect.mTop - intr_rect.mBottom) / 2; } if (shift != 0) { cmp_rect.translate(0, -shift); - text_cmp->setRect(cmp_rect); + view_cmp->setRect(cmp_rect); intr_rect.translate(0, shift); - text_intr->setRect(intr_rect); + view_intr->setRect(intr_rect); } } } } -#endif } void LLPanelEnvironmentInfo::onSldDayLengthChanged(F32 value) @@ -673,7 +653,7 @@ void LLPanelEnvironmentInfo::onAltSliderCallback(LLUICtrl *cntrl, const LLSD &da } iter->second.mAltitudeIndex = new_index; - updateAltLabel(alt_labels[iter->second.mLabelIndex], iter->second.mAltitudeIndex + 1, iter->second.mAltitude); + updateAltLabel(alt_prefixes[iter->second.mLabelIndex], iter->second.mAltitudeIndex + 1, iter->second.mAltitude); iter++; } -- cgit v1.2.3 From 0969632b11383e83a53bce3a10379945be7ad8c2 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 4 Jan 2019 12:32:23 -0800 Subject: Move some estate requests into the LLEstateInfoModel and out of the Region floater. Fix issue where user could potentially be looking at one set of estate options and update the estate they were standing in by mistake. --- indra/newview/llpanelenvironment.cpp | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index b4007cfdf0..a64053f531 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -140,10 +140,13 @@ LLPanelEnvironmentInfo::~LLPanelEnvironmentInfo() mChangeMonitor.disconnect(); if (mCommitConnection.connected()) mCommitConnection.disconnect(); + if (mUpdateConnection.connected()) + mUpdateConnection.disconnect(); } 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(); }); @@ -158,6 +161,9 @@ BOOL LLPanelEnvironmentInfo::postBuild() mChangeMonitor = LLEnvironment::instance().setEnvironmentChanged([this](LLEnvironment::EnvSelection_t env, S32 version) { onEnvironmentChanged(env, version); }); + // if we ever allow LLEstateInfoModel to work for non-EMs, uncomment this line. + // mUpdateConnection = LLEstateInfoModel::instance().setUpdateCallback(boost::bind(&LLPanelEnvironmentInfo::refreshFromEstate, this)); + getChild(SDT_DROP_TARGET)->setPanel(this); return TRUE; @@ -283,21 +289,13 @@ void LLPanelEnvironmentInfo::refresh() void LLPanelEnvironmentInfo::refreshFromEstate() { - /*TODO: Bug!! estate_info seems stale if regain floater has not been opened.*/ - const LLEstateInfoModel& estate_info = LLEstateInfoModel::instance(); + /*TODO: Unfortunately only estate manager may get information from the LLEstateInfoModel. + * The proletariat is not allowed to know what options are set for an estate. We should fix this.*/ - if (isRegion()) - { // this should always work... but estate_info gives back false when it shouldn't for parcels - bool oldAO = mAllowOverride; - mAllowOverride = estate_info.getAllowEnvironmentOverride(); - if (oldAO != mAllowOverride) - refresh(); - } - else - { - // Get rid of this when I solve the above. - mAllowOverride = true; - } + bool oldAO = mAllowOverride; + mAllowOverride = (!isRegion()) || LLEstateInfoModel::instance().getAllowEnvironmentOverride(); + if (oldAO != mAllowOverride) + refresh(); } std::string LLPanelEnvironmentInfo::getInventoryNameForAssetId(LLUUID asset_id) -- cgit v1.2.3 From 64e45b5b6ef8ded7bbea1b376e5bf2cbb0d6f5a4 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 4 Jan 2019 17:10:28 -0800 Subject: SL-10041, SL-9758: Environment tab is disabled(shows can't do this) when EM does not allow parcel override. "Commit" button now reads "Apply to Parcel" or "Apply to Region" as needed. --- indra/newview/llpanelenvironment.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 3e0bb43d71..a150e66085 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -299,9 +299,11 @@ void LLPanelEnvironmentInfo::refreshFromEstate() { /*TODO: Unfortunately only estate manager may get information from the LLEstateInfoModel. * The proletariat is not allowed to know what options are set for an estate. We should fix this.*/ + LLViewerRegion *pRegion = gAgent.getRegion(); bool oldAO = mAllowOverride; - mAllowOverride = (!isRegion()) || LLEstateInfoModel::instance().getAllowEnvironmentOverride(); + //mAllowOverride = (!isRegion()) || LLEstateInfoModel::instance().getAllowEnvironmentOverride(); + mAllowOverride = (isRegion() && LLEstateInfoModel::instance().getAllowEnvironmentOverride()) || pRegion->getAllowEnvironmentOverride(); if (oldAO != mAllowOverride) refresh(); } -- cgit v1.2.3 From 1badfb0e96959725fbe2895994607a088f4a808b Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 7 Jan 2019 10:24:55 -0800 Subject: SL-9883: Hide controls and display message if parcel < 128m --- indra/newview/llpanelenvironment.cpp | 61 ++++++------------------------------ 1 file changed, 10 insertions(+), 51 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index a150e66085..a324dfb93b 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -89,6 +89,9 @@ 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 std::string LLPanelEnvironmentInfo::STR_DISALLOWED("str_disallowed"); +const std::string LLPanelEnvironmentInfo::STR_TOO_SMALL("str_too_small"); + +const S32 LLPanelEnvironmentInfo::MINIMUM_PARCEL_SIZE(128); const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_DAYCYCLE(0x01 << 0); const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_DAYLENGTH(0x01 << 1); @@ -169,9 +172,6 @@ BOOL LLPanelEnvironmentInfo::postBuild() mChangeMonitor = LLEnvironment::instance().setEnvironmentChanged([this](LLEnvironment::EnvSelection_t env, S32 version) { onEnvironmentChanged(env, version); }); - // if we ever allow LLEstateInfoModel to work for non-EMs, uncomment this line. - // mUpdateConnection = LLEstateInfoModel::instance().setUpdateCallback(boost::bind(&LLPanelEnvironmentInfo::refreshFromEstate, this)); - getChild(SDT_DROP_TARGET)->setPanel(this); return TRUE; @@ -230,32 +230,6 @@ void LLPanelEnvironmentInfo::refresh() return; } -// S32 rdo_selection = 0; -// if ((!mCurrentEnvironment->mDayCycle) || -// ((mCurrentEnvironment->mParcelId == INVALID_PARCEL_ID) && (mCurrentEnvironment->mDayCycle->getAssetId() == LLSettingsDay::GetDefaultAssetId() ))) -// { -// getChild(EDT_INVNAME)->setValue(""); -// } -// else if (!mCurrentEnvironment->mDayCycle->getAssetId().isNull()) -// { -// rdo_selection = 1; -// -// LLUUID asset_id = mCurrentEnvironment->mDayCycle->getAssetId(); -// -// std::string inventoryname = getInventoryNameForAssetId(asset_id); -// -// if (inventoryname.empty()) -// inventoryname = "(" + mCurrentEnvironment->mDayCycle->getName() + ")"; -// -// getChild(EDT_INVNAME)->setValue(inventoryname); -// } -// else -// { // asset id is null so this is a custom environment -// rdo_selection = 2; -// getChild(EDT_INVNAME)->setValue(""); -// } -// getChild(RDG_ENVIRONMENT_SELECT)->setSelectedIndex(rdo_selection); - F32Hours daylength(mCurrentEnvironment->mDayLength); F32Hours dayoffset(mCurrentEnvironment->mDayOffset); @@ -264,8 +238,6 @@ void LLPanelEnvironmentInfo::refresh() getChild(SLD_DAYLENGTH)->setValue(daylength.value()); getChild(SLD_DAYOFFSET)->setValue(dayoffset.value()); -// getChild(SLD_DAYLENGTH)->setEnabled(canEdit() && (rdo_selection != 0) && !mCurrentEnvironment->mIsLegacy); -// getChild(SLD_DAYOFFSET)->setEnabled(canEdit() && (rdo_selection != 0) && !mCurrentEnvironment->mIsLegacy); udpateApparentTimeOfDay(); @@ -297,12 +269,9 @@ void LLPanelEnvironmentInfo::refresh() void LLPanelEnvironmentInfo::refreshFromEstate() { - /*TODO: Unfortunately only estate manager may get information from the LLEstateInfoModel. - * The proletariat is not allowed to know what options are set for an estate. We should fix this.*/ LLViewerRegion *pRegion = gAgent.getRegion(); bool oldAO = mAllowOverride; - //mAllowOverride = (!isRegion()) || LLEstateInfoModel::instance().getAllowEnvironmentOverride(); mAllowOverride = (isRegion() && LLEstateInfoModel::instance().getAllowEnvironmentOverride()) || pRegion->getAllowEnvironmentOverride(); if (oldAO != mAllowOverride) refresh(); @@ -415,6 +384,7 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) { bool is_unavailable(false); bool is_legacy = (mCurrentEnvironment) ? mCurrentEnvironment->mIsLegacy : true; + bool is_bigenough = isLargeEnough(); if (mNoEnvironment || (!LLEnvironment::instance().isExtendedEnvironmentEnabled() && !isRegion())) { @@ -436,13 +406,18 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) is_unavailable = true; getChild(TXT_DISABLED)->setText(getString(STR_DISALLOWED)); } + else if (!is_bigenough) + { + is_unavailable = true; + getChild(TXT_DISABLED)->setText(getString(STR_TOO_SMALL)); + } if (is_unavailable) { getChild(PNL_SETTINGS)->setVisible(false); getChild(PNL_BUTTONS)->setVisible(false); getChild(PNL_DISABLED)->setVisible(true); - getChild(PNL_ENVIRONMENT_ALTITUDES)->setVisible(FALSE); + getChild(PNL_ENVIRONMENT_ALTITUDES)->setVisible(false); updateEditFloater(mCurrentEnvironment, false); @@ -470,22 +445,6 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) return true; } -void LLPanelEnvironmentInfo::setApplyProgress(bool started) -{ -// LLLoadingIndicator* indicator = getChild("progress_indicator"); -// -// indicator->setVisible(started); -// -// if (started) -// { -// indicator->start(); -// } -// else -// { -// indicator->stop(); -// } -} - void LLPanelEnvironmentInfo::setDirtyFlag(U32 flag) { mDirtyFlag |= flag; -- cgit v1.2.3 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 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'indra/newview/llpanelenvironment.cpp') 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() { -- cgit v1.2.3 From 13c537e9a0f05857f89085b91ac098921c317fb1 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 9 Jan 2019 21:57:12 +0200 Subject: SL-10279 Readjusting altitude slider --- indra/newview/llpanelenvironment.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index abd1913185..6e6879ca0c 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -73,6 +73,7 @@ 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"); const std::string LLPanelEnvironmentInfo::ICN_GROUND("icon_ground"); +const std::string LLPanelEnvironmentInfo::ICN_WATER("icon_water"); const std::string LLPanelEnvironmentInfo::CHK_ALLOWOVERRIDE("chk_allow_override"); const std::string LLPanelEnvironmentInfo::LBL_TIMEOFDAY("lbl_apparent_time"); const std::string LLPanelEnvironmentInfo::PNL_SETTINGS("pnl_environment_config"); @@ -107,6 +108,9 @@ const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_MASK( const U32 ALTITUDE_SLIDER_COUNT = 3; const F32 ALTITUDE_DEFAULT_HEIGHT_STEP = 1000; +const U32 ALTITUDE_MARKERS_COUNT = 3; + +const std::string slider_marker_base = "mark"; const std::string alt_sliders[] = { "sld1", @@ -441,10 +445,21 @@ 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(ICN_WATER)->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); + for (U32 idx = 0; idx < ALTITUDE_MARKERS_COUNT; idx++) + { + LLUICtrl* marker = findChild(slider_marker_base + llformat("%u", idx)); + if (marker) + { + static LLColor4 marker_color(0.75f, 0.75f, 0.75f, 1.f); + marker->setColor((can_enable && isRegion() && !is_legacy) ? marker_color : marker_color % 0.3f); + } + } + getChild(SDT_DROP_TARGET)->setDndEnabled(enabled && !is_legacy); return true; -- cgit v1.2.3 From 00d8caa359a216620db46d49696bc79a95fe8dc2 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 10 Jan 2019 22:11:11 +0200 Subject: SL-10279 Finalize drag and drop support --- indra/newview/llpanelenvironment.cpp | 54 ++++++++++++++++++++++++++++++------ 1 file changed, 45 insertions(+), 9 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 6e6879ca0c..f84ceb6853 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -109,6 +109,7 @@ const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_MASK( const U32 ALTITUDE_SLIDER_COUNT = 3; const F32 ALTITUDE_DEFAULT_HEIGHT_STEP = 1000; const U32 ALTITUDE_MARKERS_COUNT = 3; +const U32 ALTITUDE_PREFIXERS_COUNT = 5; const std::string slider_marker_base = "mark"; @@ -179,7 +180,16 @@ BOOL LLPanelEnvironmentInfo::postBuild() mChangeMonitor = LLEnvironment::instance().setEnvironmentChanged([this](LLEnvironment::EnvSelection_t env, S32 version) { onEnvironmentChanged(env, version); }); - getChild(SDT_DROP_TARGET)->setPanel(this); + for (U32 idx = 0; idx < ALTITUDE_SLIDER_COUNT; idx++) + { + LLSettingsDropTarget* drop_target = findChild("sdt_" + alt_prefixes[idx]); + if (drop_target) + { + drop_target->setPanel(this, alt_sliders[idx]); + } + } + getChild("sdt_" + alt_prefixes[3])->setPanel(this, alt_prefixes[3]); + getChild("sdt_" + alt_prefixes[4])->setPanel(this, alt_prefixes[4]); return TRUE; } @@ -260,7 +270,7 @@ void LLPanelEnvironmentInfo::refresh() { sld->addSlider(altitudes[idx + 1], alt_sliders[idx]); updateAltLabel(alt_prefixes[idx], idx + 2, altitudes[idx + 1]); - mAltitudes[alt_sliders[idx]] = AltitudeData(idx+1, idx, altitudes[idx+1]); + mAltitudes[alt_sliders[idx]] = AltitudeData(idx+2, idx, altitudes[idx+1]); } if (sld->getCurNumSliders() != ALTITUDE_SLIDER_COUNT) { @@ -460,7 +470,14 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) } } - getChild(SDT_DROP_TARGET)->setDndEnabled(enabled && !is_legacy); + for (U32 idx = 0; idx < ALTITUDE_PREFIXERS_COUNT; idx++) + { + LLSettingsDropTarget* drop_target = findChild("sdt_" + alt_prefixes[idx]); + if (drop_target) + { + drop_target->setDndEnabled(enabled && !is_legacy); + } + } return true; } @@ -621,7 +638,7 @@ void LLPanelEnvironmentInfo::onAltSliderCallback(LLUICtrl *cntrl, const LLSD &da while (iter != end) { iter2 = mAltitudes.begin(); - new_index = 1; + new_index = 2; while (iter2 != end) { if (iter->second.mAltitude > iter2->second.mAltitude) @@ -630,9 +647,9 @@ void LLPanelEnvironmentInfo::onAltSliderCallback(LLUICtrl *cntrl, const LLSD &da } iter2++; } - iter->second.mAltitudeIndex = new_index; + iter->second.mTrackIndex = new_index; - updateAltLabel(alt_prefixes[iter->second.mLabelIndex], iter->second.mAltitudeIndex + 1, iter->second.mAltitude); + updateAltLabel(alt_prefixes[iter->second.mLabelIndex], iter->second.mTrackIndex, iter->second.mAltitude); iter++; } @@ -771,7 +788,24 @@ void LLPanelEnvironmentInfo::onIdlePlay(void *data) ((LLPanelEnvironmentInfo *)data)->udpateApparentTimeOfDay(); } -void LLPanelEnvironmentInfo::onPickerCommitted(LLUUID item_id) + +void LLPanelEnvironmentInfo::onPickerCommitted(LLUUID item_id, std::string source) +{ + if (source == alt_prefixes[4]) + { + onPickerCommitted(item_id, 0); + } + else if (source == alt_prefixes[3]) + { + onPickerCommitted(item_id, 1); + } + else + { + onPickerCommitted(item_id, mAltitudes[source].mTrackIndex); + } +} + +void LLPanelEnvironmentInfo::onPickerCommitted(LLUUID item_id, S32 track_num) { LLInventoryItem *itemp = gInventory.getItem(item_id); if (itemp) @@ -779,7 +813,8 @@ void LLPanelEnvironmentInfo::onPickerCommitted(LLUUID item_id) LLHandle that_h = getHandle(); LLEnvironment::instance().updateParcel(getParcelId(), itemp->getAssetUUID(), - itemp->getName(), + itemp->getName(), + track_num, -1, -1, LLEnvironment::altitudes_vect_t(), [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); } @@ -946,7 +981,8 @@ BOOL LLSettingsDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, *accept = ACCEPT_YES_COPY_SINGLE; if (drop) { - mEnvironmentInfoPanel->onPickerCommitted(item_id); + // might be better to use name of the element + mEnvironmentInfoPanel->onPickerCommitted(item_id, mTrack); } } } -- cgit v1.2.3 From fb75cf03a551809552d118ba3871ad5612f3d953 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Tue, 15 Jan 2019 18:43:54 +0200 Subject: SL-10279 allow drag and drop settings on your own parcel --- indra/newview/llpanelenvironment.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index f84ceb6853..c2827e451f 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -457,7 +457,7 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) getChild(ICN_GROUND)->setColor((can_enable && isRegion() && !is_legacy) ? LLColor4::white : LLColor4::grey % 0.8f); getChild(ICN_WATER)->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(PNL_ENVIRONMENT_ALTITUDES)->setEnabled(can_enable && !is_legacy); getChild(CHK_ALLOWOVERRIDE)->setEnabled(can_enable && isRegion() && !is_legacy); for (U32 idx = 0; idx < ALTITUDE_MARKERS_COUNT; idx++) @@ -475,7 +475,7 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) LLSettingsDropTarget* drop_target = findChild("sdt_" + alt_prefixes[idx]); if (drop_target) { - drop_target->setDndEnabled(enabled && !is_legacy); + drop_target->setDndEnabled(can_enable && !is_legacy); } } -- cgit v1.2.3 From c00e7dbae16bee6e09843d3b2c3ed01f22bae989 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Fri, 18 Jan 2019 14:39:47 +0200 Subject: SL-10380 FIXED 'Day Length/Day Offset' values don't apply to the region from the keyboard by pressing 'Enter' --- indra/newview/llpanelenvironment.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index c2827e451f..ec6352c88d 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -172,8 +172,10 @@ BOOL LLPanelEnvironmentInfo::postBuild() getChild(SLD_DAYLENGTH)->setCommitCallback([this](LLUICtrl *, const LLSD &value) { onSldDayLengthChanged(value.asReal()); }); getChild(SLD_DAYLENGTH)->setSliderMouseUpCallback([this](LLUICtrl *, const LLSD &) { onDayLenOffsetMouseUp(); }); + getChild(SLD_DAYLENGTH)->setSliderEditorCommitCallback([this](LLUICtrl *, const LLSD &) { onDayLenOffsetMouseUp(); }); getChild(SLD_DAYOFFSET)->setCommitCallback([this](LLUICtrl *, const LLSD &value) { onSldDayOffsetChanged(value.asReal()); }); getChild(SLD_DAYOFFSET)->setSliderMouseUpCallback([this](LLUICtrl *, const LLSD &) { onDayLenOffsetMouseUp(); }); + getChild(SLD_DAYOFFSET)->setSliderEditorCommitCallback([this](LLUICtrl *, const LLSD &) { onDayLenOffsetMouseUp(); }); getChild(SLD_ALTITUDES)->setCommitCallback([this](LLUICtrl *cntrl, const LLSD &value) { onAltSliderCallback(cntrl, value); }); getChild(SLD_ALTITUDES)->setSliderMouseUpCallback([this](LLUICtrl *, const LLSD &) { onAltSliderMouseUp(); }); -- cgit v1.2.3 From deac9ae7d84776d1f8497af82ed39e5d53e722d9 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 23 Jan 2019 20:33:41 +0200 Subject: SL-1932 Day Cycle Edit feature "Load Track" Part 2 --- indra/newview/llpanelenvironment.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index ec6352c88d..000c7050ab 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -334,7 +334,7 @@ LLFloaterSettingsPicker * LLPanelEnvironmentInfo::getSettingsPicker(bool create) if (!picker && create) { picker = new LLFloaterSettingsPicker(this, - LLUUID::null, "SELECT SETTINGS"); + LLUUID::null); mSettingsFloater = picker->getHandle(); -- cgit v1.2.3 From 7c1594090e8ec3a0509b22e4d650e03fbf26fadc Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Fri, 25 Jan 2019 15:57:59 +0200 Subject: SL-10331 FIXED [EEP] Apply to Region/Parcel from the day editor sticks --- indra/newview/llpanelenvironment.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 000c7050ab..55b579d0a2 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -373,7 +373,7 @@ void LLPanelEnvironmentInfo::updateEditFloater(const LLEnvironment::EnvironmentI { LLFloaterEditExtDayCycle *dayeditor(getEditFloater(false)); - if (!dayeditor) + if (!dayeditor || !dayeditor->isInVisibleChain()) return; if (!nextenv || !nextenv->mDayCycle || !enable) -- cgit v1.2.3 From 714df9c4f7c9f24eae1064f45306dea01803ba09 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 28 Jan 2019 21:24:11 +0200 Subject: SL-10426 Fixed Inventory day cycle doesn't apply to the parcel from About Land --- indra/newview/llpanelenvironment.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 55b579d0a2..66202982a2 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -338,7 +338,7 @@ LLFloaterSettingsPicker * LLPanelEnvironmentInfo::getSettingsPicker(bool create) mSettingsFloater = picker->getHandle(); - picker->setCommitCallback([this](LLUICtrl *, const LLSD &data){ onPickerCommitted(data.asUUID()); }); + picker->setCommitCallback([this](LLUICtrl *, const LLSD &data){ onPickerCommitted(data["ItemId"].asUUID()); }); } return picker; -- cgit v1.2.3 From c8a79a59c94192741c8239eac6b34e50fe835bcd Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Wed, 30 Jan 2019 18:05:27 +0200 Subject: SL-10360 Show "Region environment" text for tracks if there is no parcel environment used. --- indra/newview/llpanelenvironment.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 66202982a2..868af617cb 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -314,6 +314,9 @@ std::string LLPanelEnvironmentInfo::getNameForTrackIndex(S32 index) if (mCurrentEnvironment->mDayCycleName.empty()) { invname = mCurrentEnvironment->mNameList[index]; + + if (!isRegion() && invname.empty()) + invname = getString("str_region_env"); } else if (!mCurrentEnvironment->mDayCycle->isTrackEmpty(index)) { -- cgit v1.2.3 From 17a4093223ce735696eb27103bfff64ef49cbe81 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 30 Jan 2019 16:29:46 +0200 Subject: SL-10279 Validate altitude input --- indra/newview/llpanelenvironment.cpp | 44 ++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 5 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 868af617cb..0e2c7bcaac 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -270,9 +270,43 @@ void LLPanelEnvironmentInfo::refresh() for (S32 idx = 0; idx < ALTITUDE_SLIDER_COUNT; ++idx) { - sld->addSlider(altitudes[idx + 1], alt_sliders[idx]); - updateAltLabel(alt_prefixes[idx], idx + 2, altitudes[idx + 1]); - mAltitudes[alt_sliders[idx]] = AltitudeData(idx+2, idx, altitudes[idx+1]); + // make sure values are in range, server is supposed to validate them, + // but issues happen, try to fix values in such case + F32 altitude = llclamp(altitudes[idx + 1], sld->getMinValue(), sld->getMaxValue()); + bool res = sld->addSlider(altitude, alt_sliders[idx]); + if (!res) + { + LL_WARNS_ONCE("ENVPANEL") << "Failed to validate altitude from server for parcel id" << getParcelId() << LL_ENDL; + // Find a spot to insert altitude. + // Assuming everything alright with slider, we should find new place in 11 steps top (step 25m, no overlap 100m) + F32 alt_step = (altitude > (sld->getMaxValue() / 2)) ? -sld->getIncrement() : sld->getIncrement(); + for (U32 i = 0; i < 30; i++) + { + altitude += alt_step; + if (altitude > sld->getMaxValue()) + { + altitude = sld->getMinValue(); + } + else if (altitude < sld->getMinValue()) + { + altitude = sld->getMaxValue(); + } + res = sld->addSlider(altitude, alt_sliders[idx]); + if (res) break; + } + if (!res) + { + // Something is very very wrong + LL_WARNS_ONCE("ENVPANEL") << "Failed to set up altitudes for parcel id " << getParcelId() << LL_ENDL; + } + else + { + // slider has some auto correction that might have kicked in + altitude = sld->getSliderValue(alt_sliders[idx]); + } + } + updateAltLabel(alt_prefixes[idx], idx + 2, altitude); + mAltitudes[alt_sliders[idx]] = AltitudeData(idx + 2, idx, altitude); } if (sld->getCurNumSliders() != ALTITUDE_SLIDER_COUNT) { @@ -310,7 +344,7 @@ std::string LLPanelEnvironmentInfo::getNameForTrackIndex(S32 index) { std::string invname; - LL_WARNS("LAPRAS") << "mDayCycleName='" << mCurrentEnvironment->mDayCycleName << "'" << LL_ENDL; + LL_WARNS("ENVPANEL") << "mDayCycleName='" << mCurrentEnvironment->mDayCycleName << "'" << LL_ENDL; if (mCurrentEnvironment->mDayCycleName.empty()) { invname = mCurrentEnvironment->mNameList[index]; @@ -565,7 +599,7 @@ void LLPanelEnvironmentInfo::readjustAltLabels() if (cmp_rect.mBottom <= intr_rect.mTop && cmp_rect.mBottom >= intr_rect.mBottom) { // Approximate shift - // We probably will need more cycle runs over all labels to get accurate one + // We probably will need more runs over all labels to get accurate shift // At the moment single cycle should do since we have too little elements to do something complicated shift = (cmp_rect.mBottom - intr_rect.mTop) / 2; } -- cgit v1.2.3 From 16b47db736fed0995eaeeed77ba4dd0d310f1072 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 30 Jan 2019 21:51:59 +0200 Subject: SL-10279 Remake altitude 'bumping' --- indra/newview/llpanelenvironment.cpp | 110 ++++++++++++++++++++++++++--------- 1 file changed, 84 insertions(+), 26 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 0e2c7bcaac..8f279c07ba 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -343,8 +343,6 @@ std::string LLPanelEnvironmentInfo::getInventoryNameForAssetId(LLUUID asset_id) std::string LLPanelEnvironmentInfo::getNameForTrackIndex(S32 index) { std::string invname; - - LL_WARNS("ENVPANEL") << "mDayCycleName='" << mCurrentEnvironment->mDayCycleName << "'" << LL_ENDL; if (mCurrentEnvironment->mDayCycleName.empty()) { invname = mCurrentEnvironment->mNameList[index]; @@ -583,41 +581,101 @@ void LLPanelEnvironmentInfo::readjustAltLabels() { // Re-adjust all labels // Very simple "adjust after the fact" method - // Note: labels can be in any ordered - for (U32 i = 0; i < ALTITUDE_SLIDER_COUNT - 1; i++) - { - LLView* view_cmp = findChild(alt_panels[i]); + // Note: labels can be in any order + + LLMultiSliderCtrl *sld = findChild(SLD_ALTITUDES); + if (!sld) return; - for (U32 j = i + 1; j < ALTITUDE_SLIDER_COUNT; j++) + LLView* view_midle = NULL; + U32 midle_ind = 0; + S32 shift_up = 0; + S32 shift_down = 0; + LLRect sld_rect = sld->getRect(); + + // Find the middle one + for (U32 i = 0; i < ALTITUDE_SLIDER_COUNT; i++) + { + LLView* cmp_view = findChild(alt_panels[i], true); + if (!cmp_view) return; + LLRect cmp_rect = cmp_view->getRect(); + S32 pos = 0; + shift_up = 0; + shift_down = 0; + + for (U32 j = 0; j < ALTITUDE_SLIDER_COUNT; j++) { - LLView* view_intr = findChild(alt_panels[j]); - if (view_cmp && view_intr) + if (i != j) { - LLRect cmp_rect = view_cmp->getRect(); - LLRect intr_rect = view_intr->getRect(); - S32 shift = 0; - if (cmp_rect.mBottom <= intr_rect.mTop && cmp_rect.mBottom >= intr_rect.mBottom) + LLView* intr_view = findChild(alt_panels[j], true); + if (!intr_view) return; + LLRect intr_rect = intr_view->getRect(); + if (cmp_rect.mBottom >= intr_rect.mBottom) { - // Approximate shift - // We probably will need more runs over all labels to get accurate shift - // At the moment single cycle should do since we have too little elements to do something complicated - shift = (cmp_rect.mBottom - intr_rect.mTop) / 2; + pos++; } - else if (cmp_rect.mTop >= intr_rect.mBottom && cmp_rect.mTop <= intr_rect.mTop) + if (intr_rect.mBottom <= cmp_rect.mTop && intr_rect.mBottom >= cmp_rect.mBottom) { - // Approximate shift - shift = (cmp_rect.mTop - intr_rect.mBottom) / 2; + shift_up = cmp_rect.mTop - intr_rect.mBottom; } - if (shift != 0) + else if (intr_rect.mTop >= cmp_rect.mBottom && intr_rect.mBottom <= cmp_rect.mBottom) { - cmp_rect.translate(0, -shift); - view_cmp->setRect(cmp_rect); - - intr_rect.translate(0, shift); - view_intr->setRect(intr_rect); + shift_down = cmp_rect.mBottom - intr_rect.mTop; } } } + if (pos == 1) // middle + { + view_midle = cmp_view; + midle_ind = i; + break; + } + } + + // Account for edges + LLRect midle_rect = view_midle->getRect(); + F32 factor = 0.5f; + S32 edge_zone_height = midle_rect.getHeight() * 1.5f; + + if (midle_rect.mBottom - sld_rect.mBottom < edge_zone_height) + { + factor = 1 - ((midle_rect.mBottom - sld_rect.mBottom) / (edge_zone_height * 2)); + } + else if (sld_rect.mTop - midle_rect.mTop < edge_zone_height ) + { + factor = ((sld_rect.mTop - midle_rect.mTop) / (edge_zone_height * 2)); + } + + S32 shift_middle = (S32)(((F32)shift_down * factor) + ((F32)shift_up * (1.f - factor))); + shift_down = shift_down - shift_middle; + shift_up = shift_up - shift_middle; + + // fix crossings + for (U32 i = 0; i < ALTITUDE_SLIDER_COUNT; i++) + { + if (i != midle_ind) + { + LLView* trn_view = findChild(alt_panels[i], true); + LLRect trn_rect = trn_view->getRect(); + + if (trn_rect.mBottom <= midle_rect.mTop && trn_rect.mBottom >= midle_rect.mBottom) + { + // Approximate shift + trn_rect.translate(0, shift_up); + trn_view->setRect(trn_rect); + } + else if (trn_rect.mTop >= midle_rect.mBottom && trn_rect.mBottom <= midle_rect.mBottom) + { + // Approximate shift + trn_rect.translate(0, shift_down); + trn_view->setRect(trn_rect); + } + } + } + + if (shift_middle != 0) + { + midle_rect.translate(0, -shift_middle); //reversed relative to others + view_midle->setRect(midle_rect); } } -- cgit v1.2.3 From 462281b7f5a32e75e85b43eddd2c0f8d215d6ce4 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Thu, 31 Jan 2019 14:50:24 +0200 Subject: SL-10279 Update altitude value after slider correction --- indra/newview/llpanelenvironment.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 8f279c07ba..d20cc096de 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -263,6 +263,7 @@ void LLPanelEnvironmentInfo::refresh() updateEditFloater(mCurrentEnvironment, canEdit()); LLEnvironment::altitude_list_t altitudes = LLEnvironment::instance().getRegionAltitudes(); + if (altitudes.size() > 0) { LLMultiSliderCtrl *sld = getChild(SLD_ALTITUDES); @@ -294,16 +295,16 @@ void LLPanelEnvironmentInfo::refresh() res = sld->addSlider(altitude, alt_sliders[idx]); if (res) break; } - if (!res) - { - // Something is very very wrong - LL_WARNS_ONCE("ENVPANEL") << "Failed to set up altitudes for parcel id " << getParcelId() << LL_ENDL; - } - else - { - // slider has some auto correction that might have kicked in - altitude = sld->getSliderValue(alt_sliders[idx]); - } + } + if (res) + { + // slider has some auto correction that might have kicked in + altitude = sld->getSliderValue(alt_sliders[idx]); + } + else + { + // Something is very very wrong + LL_WARNS_ONCE("ENVPANEL") << "Failed to set up altitudes for parcel id " << getParcelId() << LL_ENDL; } updateAltLabel(alt_prefixes[idx], idx + 2, altitude); mAltitudes[alt_sliders[idx]] = AltitudeData(idx + 2, idx, altitude); -- cgit v1.2.3 From b5a7874ba522089cf942fb9ad6fcd35383f69a88 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Tue, 5 Feb 2019 15:30:06 +0200 Subject: SL-10279 Use stored environment instead of region one --- indra/newview/llpanelenvironment.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index d20cc096de..2cfd0c8fc9 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -262,7 +262,7 @@ void LLPanelEnvironmentInfo::refresh() updateEditFloater(mCurrentEnvironment, canEdit()); - LLEnvironment::altitude_list_t altitudes = LLEnvironment::instance().getRegionAltitudes(); + LLEnvironment::altitude_list_t altitudes = mCurrentEnvironment->mAltitudes; if (altitudes.size() > 0) { -- cgit v1.2.3 From 43327798dec61590dc256697771e0423eb1ece9c Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Thu, 7 Feb 2019 17:58:25 +0200 Subject: SL-10495 [EEP] Include a confirmation when clicking the Use Region Settings button --- indra/newview/llpanelenvironment.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 2cfd0c8fc9..06504bac37 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -42,6 +42,7 @@ #include "llfloaterreg.h" #include "llfloatereditextdaycycle.h" #include "llmultisliderctrl.h" +#include "llnotificationsutil.h" #include "llsettingsvo.h" #include "llappviewer.h" @@ -779,9 +780,17 @@ void LLPanelEnvironmentInfo::onAltSliderMouseUp() void LLPanelEnvironmentInfo::onBtnDefault() { LLHandle that_h = getHandle(); - - LLEnvironment::instance().resetParcel(getParcelId(), - [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); + S32 parcel_id = getParcelId(); + LLNotificationsUtil::add("SettingsConfirmReset", LLSD(), LLSD(), + [that_h, parcel_id](const LLSD¬if, const LLSD&resp) + { + S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp); + if (opt == 0) + { + LLEnvironment::instance().resetParcel(parcel_id, + [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); + } + }); } void LLPanelEnvironmentInfo::onBtnEdit() -- cgit v1.2.3 From 54c022f1b6162656363bc7b659363170afdf6f1d Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Wed, 20 Feb 2019 17:35:22 +0200 Subject: SL-10568 Disable controls on non-eep region --- indra/newview/llpanelenvironment.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 06504bac37..ca9c8bdffa 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -486,18 +486,18 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) 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); - getChild(BTN_USEDEFAULT)->setEnabled(can_enable && !is_legacy); + bool can_enable = enabled && !is_legacy && mCurrentEnvironment && (mCurEnvVersion != INVALID_PARCEL_ENVIRONMENT_VERSION); + getChild(BTN_SELECTINV)->setEnabled(can_enable); + getChild(BTN_USEDEFAULT)->setEnabled(can_enable); getChild(BTN_EDIT)->setEnabled(can_enable); - getChild(SLD_DAYLENGTH)->setEnabled(can_enable && !is_legacy); - 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(ICN_WATER)->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 && !is_legacy); - getChild(CHK_ALLOWOVERRIDE)->setEnabled(can_enable && isRegion() && !is_legacy); + getChild(SLD_DAYLENGTH)->setEnabled(can_enable); + getChild(SLD_DAYOFFSET)->setEnabled(can_enable); + getChild(SLD_ALTITUDES)->setEnabled(can_enable && isRegion()); + getChild(ICN_GROUND)->setColor((can_enable && isRegion()) ? LLColor4::white : LLColor4::grey % 0.8f); + getChild(ICN_WATER)->setColor((can_enable && isRegion()) ? LLColor4::white : LLColor4::grey % 0.8f); + getChild(BTN_RST_ALTITUDES)->setEnabled(can_enable && isRegion()); + getChild(PNL_ENVIRONMENT_ALTITUDES)->setEnabled(can_enable); + getChild(CHK_ALLOWOVERRIDE)->setEnabled(can_enable && isRegion()); for (U32 idx = 0; idx < ALTITUDE_MARKERS_COUNT; idx++) { @@ -505,7 +505,7 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) if (marker) { static LLColor4 marker_color(0.75f, 0.75f, 0.75f, 1.f); - marker->setColor((can_enable && isRegion() && !is_legacy) ? marker_color : marker_color % 0.3f); + marker->setColor((can_enable && isRegion()) ? marker_color : marker_color % 0.3f); } } @@ -514,7 +514,7 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) LLSettingsDropTarget* drop_target = findChild("sdt_" + alt_prefixes[idx]); if (drop_target) { - drop_target->setDndEnabled(can_enable && !is_legacy); + drop_target->setDndEnabled(can_enable); } } -- cgit v1.2.3 From 8740c54fb074b8ab2349dc5a3317e1578de3d812 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Thu, 7 Mar 2019 15:26:01 -0800 Subject: SL-10700: If a track is empty show the name of the track used below it. If all tracks are empty for a parcel are empty report thath it uses region settings. --- indra/newview/llpanelenvironment.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index ca9c8bdffa..ef307ad079 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -55,6 +55,8 @@ namespace { const std::string FLOATER_DAY_CYCLE_EDIT("env_edit_extdaycycle"); + const std::string STRING_REGION_ENV("str_region_env"); + const std::string STRING_EMPTY_NAME("str_empty"); inline bool ends_with(std::string const & value, std::string const & ending) { @@ -86,7 +88,6 @@ const std::string LLPanelEnvironmentInfo::SDT_DROP_TARGET("sdt_drop_target"); 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"); @@ -332,33 +333,32 @@ void LLPanelEnvironmentInfo::refreshFromEstate() refresh(); } -std::string LLPanelEnvironmentInfo::getInventoryNameForAssetId(LLUUID asset_id) -{ - std::string name(LLFloaterSettingsPicker::findItemName(asset_id, false, false)); - - if (name.empty()) - return getString(STR_LABEL_UNKNOWNINV); - return name; -} - - std::string LLPanelEnvironmentInfo::getNameForTrackIndex(S32 index) { + std::string invname; if (mCurrentEnvironment->mDayCycleName.empty()) { invname = mCurrentEnvironment->mNameList[index]; - if (!isRegion() && invname.empty()) - invname = getString("str_region_env"); + if (invname.empty()) + { + if (index <= LLSettingsDay::TRACK_GROUND_LEVEL) + invname = getString(isRegion() ? STRING_EMPTY_NAME : STRING_REGION_ENV); + } } else if (!mCurrentEnvironment->mDayCycle->isTrackEmpty(index)) { invname = mCurrentEnvironment->mDayCycleName; } + if (invname.empty()) - invname = getString("str_empty"); + { + invname = getNameForTrackIndex(index - 1); + if (invname[0] != '(') + invname = "(" + invname + ")"; + } return invname; } -- cgit v1.2.3 From b5bcba51b26f059b96cdb122b877fefad1e24e5c Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 8 Mar 2019 09:19:05 -0800 Subject: Fix tabs. --- indra/newview/llpanelenvironment.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index ef307ad079..9cda37d05e 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -1064,10 +1064,10 @@ LLSettingsDropTarget::LLSettingsDropTarget(const LLSettingsDropTarget::Params& p {} BOOL LLSettingsDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, - EDragAndDropType cargo_type, - void* cargo_data, - EAcceptance* accept, - std::string& tooltip_msg) + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg) { BOOL handled = FALSE; -- cgit v1.2.3 From 868cd32e5e229e503f1b5b1d5ec543fd6f76cb7f Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 12 Mar 2019 11:07:23 -0700 Subject: More tab restoration. Also fix ref to removed extra GLSL link module. 'warn-on-failure:no-tabs' --- indra/newview/llpanelenvironment.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 9cda37d05e..ef307ad079 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -1064,10 +1064,10 @@ LLSettingsDropTarget::LLSettingsDropTarget(const LLSettingsDropTarget::Params& p {} BOOL LLSettingsDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, - EDragAndDropType cargo_type, - void* cargo_data, - EAcceptance* accept, - std::string& tooltip_msg) + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg) { BOOL handled = FALSE; -- cgit v1.2.3 From 7171e581f968f71b83be28ac610854bd61b7e8a1 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 18 Mar 2019 17:08:17 +0200 Subject: BUG-226547 Crashfixes --- indra/newview/llpanelenvironment.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index ef307ad079..44806e7d23 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -335,9 +335,12 @@ void LLPanelEnvironmentInfo::refreshFromEstate() std::string LLPanelEnvironmentInfo::getNameForTrackIndex(S32 index) { - std::string invname; - if (mCurrentEnvironment->mDayCycleName.empty()) + if (mCurrentEnvironment || index < LLSettingsDay::TRACK_WATER || index >= LLSettingsDay::TRACK_MAX) + { + invname = getString(STRING_EMPTY_NAME); + } + else if (mCurrentEnvironment->mDayCycleName.empty()) { invname = mCurrentEnvironment->mNameList[index]; -- cgit v1.2.3 From 66f07e418e5c402f6328f0701cffd1314af56ad5 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 19 Mar 2019 10:57:51 -0700 Subject: SL-10773: Logic was reversed. Test for mCurrentEvenriont missing --- indra/newview/llpanelenvironment.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 44806e7d23..b343c913e5 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -336,7 +336,7 @@ void LLPanelEnvironmentInfo::refreshFromEstate() std::string LLPanelEnvironmentInfo::getNameForTrackIndex(S32 index) { std::string invname; - if (mCurrentEnvironment || index < LLSettingsDay::TRACK_WATER || index >= LLSettingsDay::TRACK_MAX) + if (!mCurrentEnvironment || index < LLSettingsDay::TRACK_WATER || index >= LLSettingsDay::TRACK_MAX) { invname = getString(STRING_EMPTY_NAME); } -- cgit v1.2.3 From c2864468d69d6ef94ba6ec2db23729c490ec8f3d Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 28 Mar 2019 19:51:08 +0200 Subject: SL-10766 Viewer is crashed after changing "day offset" settings --- indra/newview/llpanelenvironment.cpp | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index b343c913e5..876b965fe9 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -686,30 +686,36 @@ void LLPanelEnvironmentInfo::readjustAltLabels() void LLPanelEnvironmentInfo::onSldDayLengthChanged(F32 value) { - F32Hours daylength(value); + if (mCurrentEnvironment) + { + F32Hours daylength(value); - mCurrentEnvironment->mDayLength = daylength; - setDirtyFlag(DIRTY_FLAG_DAYLENGTH); + mCurrentEnvironment->mDayLength = daylength; + setDirtyFlag(DIRTY_FLAG_DAYLENGTH); - udpateApparentTimeOfDay(); + udpateApparentTimeOfDay(); + } } void LLPanelEnvironmentInfo::onSldDayOffsetChanged(F32 value) { - F32Hours dayoffset(value); + if (mCurrentEnvironment) + { + F32Hours dayoffset(value); - if (dayoffset.value() <= 0.0f) - dayoffset += F32Hours(24.0); + if (dayoffset.value() <= 0.0f) + dayoffset += F32Hours(24.0); - mCurrentEnvironment->mDayOffset = dayoffset; - setDirtyFlag(DIRTY_FLAG_DAYOFFSET); + mCurrentEnvironment->mDayOffset = dayoffset; + setDirtyFlag(DIRTY_FLAG_DAYOFFSET); - udpateApparentTimeOfDay(); + udpateApparentTimeOfDay(); + } } void LLPanelEnvironmentInfo::onDayLenOffsetMouseUp() { - if (getDirtyFlag() & (DIRTY_FLAG_DAYLENGTH | DIRTY_FLAG_DAYOFFSET)) + if (mCurrentEnvironment && (getDirtyFlag() & (DIRTY_FLAG_DAYLENGTH | DIRTY_FLAG_DAYOFFSET))) { clearDirtyFlag(DIRTY_FLAG_DAYOFFSET); clearDirtyFlag(DIRTY_FLAG_DAYLENGTH); -- cgit v1.2.3 From 0a6d87458149fed16f98aac59447307c006db4b7 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 29 Mar 2019 17:09:30 +0200 Subject: SL-9650 About Land UI is corrupted --- indra/newview/llpanelenvironment.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 876b965fe9..cda1137182 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -191,6 +191,8 @@ BOOL LLPanelEnvironmentInfo::postBuild() { drop_target->setPanel(this, alt_sliders[idx]); } + // set initial values to prevent [ALTITUDE] from displaying + updateAltLabel(alt_prefixes[idx], idx + 2, idx * 1000); } getChild("sdt_" + alt_prefixes[3])->setPanel(this, alt_prefixes[3]); getChild("sdt_" + alt_prefixes[4])->setPanel(this, alt_prefixes[4]); -- cgit v1.2.3 From c8fdbdd5a56e5dfca699a3bad09b32b6c5f3fe1e Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Fri, 17 May 2019 17:46:40 +0300 Subject: SL-11205 [EEP] The Sky Altitude icons should move only if they are dragged. --- indra/newview/llpanelenvironment.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index cda1137182..034e5f81b4 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -318,6 +318,7 @@ void LLPanelEnvironmentInfo::refresh() LL_WARNS("ENVPANEL") << "Failed to add altitude sliders!" << LL_ENDL; } readjustAltLabels(); + sld->resetCurSlider(); } updateAltLabel(alt_prefixes[3], 1, 0); // ground @@ -780,11 +781,8 @@ void LLPanelEnvironmentInfo::onAltSliderMouseUp() { alts.push_back(alt.second.mAltitude); } - - 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); }); - + setControlsEnabled(false); + LLEnvironment::instance().updateParcel(getParcelId(), LLSettingsDay::ptr_t(), -1, -1, alts); } } -- cgit v1.2.3 From 7049757342a45a60d1d35bd59a6af307a17cf0d4 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Thu, 6 Jun 2019 17:38:36 +0300 Subject: SL-11376 FIXED [EEP] The 'Environment' tab becomes inactive after CTRL + left-clicking on the 'Sky Altitudes' --- indra/newview/llpanelenvironment.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 034e5f81b4..554fe6e9bc 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -736,6 +736,9 @@ void LLPanelEnvironmentInfo::onAltSliderCallback(LLUICtrl *cntrl, const LLSD &da { LLMultiSliderCtrl *sld = (LLMultiSliderCtrl *)cntrl; std::string sld_name = sld->getCurSlider(); + + if (sld_name.empty()) return; + F32 sld_value = sld->getCurSliderValue(); mAltitudes[sld_name].mAltitude = sld_value; -- cgit v1.2.3 From bfc4b9fcf4bb3266e06c2f954854a430cca5075f Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 2 Aug 2019 20:23:06 +0300 Subject: SL-11668 Changes caused by Arrow Keys were not commited --- indra/newview/llpanelenvironment.cpp | 68 +++++++++++++++++++++++++++++------- 1 file changed, 56 insertions(+), 12 deletions(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 554fe6e9bc..d63ae4e434 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -215,6 +215,8 @@ void LLPanelEnvironmentInfo::onVisibilityChange(BOOL new_visibility) } else { + commitDayLenOffsetChanges(false); // arrow-key changes + LLFloaterSettingsPicker *picker = getSettingsPicker(false); if (picker) { @@ -717,6 +719,11 @@ void LLPanelEnvironmentInfo::onSldDayOffsetChanged(F32 value) } void LLPanelEnvironmentInfo::onDayLenOffsetMouseUp() +{ + commitDayLenOffsetChanges(true); +} + +void LLPanelEnvironmentInfo::commitDayLenOffsetChanges(bool need_callback) { if (mCurrentEnvironment && (getDirtyFlag() & (DIRTY_FLAG_DAYLENGTH | DIRTY_FLAG_DAYOFFSET))) { @@ -725,9 +732,23 @@ void LLPanelEnvironmentInfo::onDayLenOffsetMouseUp() LLHandle that_h = getHandle(); - LLEnvironment::instance().updateParcel(getParcelId(), LLSettingsDay::ptr_t(), - mCurrentEnvironment->mDayLength.value(), mCurrentEnvironment->mDayOffset.value(), LLEnvironment::altitudes_vect_t(), - [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); + if (need_callback) + { + LLEnvironment::instance().updateParcel(getParcelId(), + LLSettingsDay::ptr_t(), + mCurrentEnvironment->mDayLength.value(), + mCurrentEnvironment->mDayOffset.value(), + LLEnvironment::altitudes_vect_t(), + [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); + } + else + { + LLEnvironment::instance().updateParcel(getParcelId(), + LLSettingsDay::ptr_t(), + mCurrentEnvironment->mDayLength.value(), + mCurrentEnvironment->mDayOffset.value(), + LLEnvironment::altitudes_vect_t()); + } } } @@ -776,6 +797,8 @@ void LLPanelEnvironmentInfo::onAltSliderMouseUp() if (isRegion() && (getDirtyFlag() & DIRTY_FLAG_ALTITUDES)) { clearDirtyFlag(DIRTY_FLAG_ALTITUDES); + clearDirtyFlag(DIRTY_FLAG_DAYLENGTH); + clearDirtyFlag(DIRTY_FLAG_DAYOFFSET); LLHandle that_h = getHandle(); LLEnvironment::altitudes_vect_t alts; @@ -785,7 +808,11 @@ void LLPanelEnvironmentInfo::onAltSliderMouseUp() alts.push_back(alt.second.mAltitude); } setControlsEnabled(false); - LLEnvironment::instance().updateParcel(getParcelId(), LLSettingsDay::ptr_t(), -1, -1, alts); + LLEnvironment::instance().updateParcel(getParcelId(), + LLSettingsDay::ptr_t(), + mCurrentEnvironment ? mCurrentEnvironment->mDayLength.value() : -1, + mCurrentEnvironment ? mCurrentEnvironment->mDayOffset.value() : -1, + alts); } } @@ -852,14 +879,21 @@ void LLPanelEnvironmentInfo::onBtnRstAltitudes() LLHandle that_h = getHandle(); LLEnvironment::altitudes_vect_t alts; + clearDirtyFlag(DIRTY_FLAG_ALTITUDES); + clearDirtyFlag(DIRTY_FLAG_DAYLENGTH); + clearDirtyFlag(DIRTY_FLAG_DAYOFFSET); + 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, + LLEnvironment::instance().updateParcel(getParcelId(), + LLSettingsDay::ptr_t(), + mCurrentEnvironment ? mCurrentEnvironment->mDayLength.value() : -1, + mCurrentEnvironment ? mCurrentEnvironment->mDayOffset.value() : -1, + alts, [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); } } @@ -930,11 +964,16 @@ void LLPanelEnvironmentInfo::onPickerCommitted(LLUUID item_id, S32 track_num) if (itemp) { LLHandle that_h = getHandle(); + clearDirtyFlag(DIRTY_FLAG_DAYLENGTH); + clearDirtyFlag(DIRTY_FLAG_DAYOFFSET); - LLEnvironment::instance().updateParcel(getParcelId(), itemp->getAssetUUID(), - itemp->getName(), - track_num, - -1, -1, LLEnvironment::altitudes_vect_t(), + LLEnvironment::instance().updateParcel(getParcelId(), + itemp->getAssetUUID(), + itemp->getName(), + track_num, + mCurrentEnvironment ? mCurrentEnvironment->mDayLength.value() : -1, + mCurrentEnvironment ? mCurrentEnvironment->mDayOffset.value() : -1, + LLEnvironment::altitudes_vect_t(), [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); } } @@ -960,9 +999,14 @@ void LLPanelEnvironmentInfo::onEditCommitted(LLSettingsDay::ptr_t newday) if (newhash != oldhash) { LLHandle that_h = getHandle(); + clearDirtyFlag(DIRTY_FLAG_DAYLENGTH); + clearDirtyFlag(DIRTY_FLAG_DAYOFFSET); - LLEnvironment::instance().updateParcel(getParcelId(), newday, - -1, -1, LLEnvironment::altitudes_vect_t(), + LLEnvironment::instance().updateParcel(getParcelId(), + newday, + mCurrentEnvironment ? mCurrentEnvironment->mDayLength.value() : -1, + mCurrentEnvironment ? mCurrentEnvironment->mDayOffset.value() : -1, + LLEnvironment::altitudes_vect_t(), [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); } } -- cgit v1.2.3 From 1f656735d339fc4d83da86efbb400af1361c27db Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 26 Aug 2019 11:43:45 -0700 Subject: SL-11705, SL-11706: New flags in llsettings base for tracking by simulator. --- indra/newview/llpanelenvironment.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index d63ae4e434..c4fa4244b1 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -440,6 +440,7 @@ void LLPanelEnvironmentInfo::updateEditFloater(const LLEnvironment::EnvironmentI // old settings will be invalid. mEditorLastParcelId = nextenv->mParcelId; mEditorLastRegionId = nextenv->mRegionId; + dayeditor->setEditDayCycle(nextenv->mDayCycle); } } @@ -967,12 +968,23 @@ void LLPanelEnvironmentInfo::onPickerCommitted(LLUUID item_id, S32 track_num) clearDirtyFlag(DIRTY_FLAG_DAYLENGTH); clearDirtyFlag(DIRTY_FLAG_DAYOFFSET); + U32 flags(0); + + if (itemp) + { + if (!itemp->getPermissions().allowOperationBy(PERM_MODIFY, gAgent.getID())) + flags |= LLSettingsBase::FLAG_NOMOD; + if (!itemp->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID())) + flags |= LLSettingsBase::FLAG_NOTRANS; + } + LLEnvironment::instance().updateParcel(getParcelId(), itemp->getAssetUUID(), itemp->getName(), track_num, mCurrentEnvironment ? mCurrentEnvironment->mDayLength.value() : -1, mCurrentEnvironment ? mCurrentEnvironment->mDayOffset.value() : -1, + flags, LLEnvironment::altitudes_vect_t(), [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); } -- cgit v1.2.3 From 7ff09d05f2023ce8eb26acc46da22f8d86743de5 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Mon, 7 Oct 2019 12:41:00 +0300 Subject: SL-12024 Remove 'Estate warning' message and show just region name instead --- indra/newview/llpanelenvironment.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanelenvironment.cpp') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index c4fa4244b1..2ad7a23278 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -84,6 +84,7 @@ const std::string LLPanelEnvironmentInfo::PNL_ENVIRONMENT_ALTITUDES("pnl_environ 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::PNL_REGION_MSG("pnl_environment_region_msg"); const std::string LLPanelEnvironmentInfo::SDT_DROP_TARGET("sdt_drop_target"); const std::string LLPanelEnvironmentInfo::STR_LABEL_USEDEFAULT("str_label_use_default"); @@ -483,7 +484,7 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) getChild(PNL_BUTTONS)->setVisible(false); getChild(PNL_DISABLED)->setVisible(true); getChild(PNL_ENVIRONMENT_ALTITUDES)->setVisible(false); - + getChild(PNL_REGION_MSG)->setVisible(false); updateEditFloater(mCurrentEnvironment, false); return false; @@ -491,6 +492,7 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) getChild(PNL_SETTINGS)->setVisible(true); getChild(PNL_BUTTONS)->setVisible(true); getChild(PNL_DISABLED)->setVisible(false); + getChild(PNL_REGION_MSG)->setVisible(isRegion()); getChild(PNL_ENVIRONMENT_ALTITUDES)->setVisible(LLEnvironment::instance().isExtendedEnvironmentEnabled()); getChild(BTN_RST_ALTITUDES)->setVisible(isRegion()); -- cgit v1.2.3