From bbde07245bdcedd05bd37863d573c94c2af4c6f7 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 26 May 2011 23:09:30 +0300 Subject: STORM-1285 WIP Connected "Create/Edit Water / Sky / Day Cycle" floaters (not functional) to the main menu. --- indra/newview/llfloatereditdaycycle.cpp | 73 +++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 indra/newview/llfloatereditdaycycle.cpp (limited to 'indra/newview/llfloatereditdaycycle.cpp') diff --git a/indra/newview/llfloatereditdaycycle.cpp b/indra/newview/llfloatereditdaycycle.cpp new file mode 100644 index 0000000000..6275b48203 --- /dev/null +++ b/indra/newview/llfloatereditdaycycle.cpp @@ -0,0 +1,73 @@ +/** + * @file llfloatereditdaycycle.cpp + * @brief Floater to create or edit a day cycle + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, 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 "llfloatereditdaycycle.h" + +// libs +#include "llbutton.h" + +// newview + +LLFloaterEditDayCycle::LLFloaterEditDayCycle(const LLSD &key) +: LLFloater(key) +{ +} + +// virtual +BOOL LLFloaterEditDayCycle::postBuild() +{ + getChild("cancel")->setCommitCallback(boost::bind(&LLFloaterEditDayCycle::onBtnCancel, this)); + + // Disable some non-functional controls. + getChildView("day_cycle_combo")->setEnabled(FALSE); + getChildView("save")->setEnabled(FALSE); + + return TRUE; +} + +// virtual +void LLFloaterEditDayCycle::onOpen(const LLSD& key) +{ + std::string param = key.asString(); + std::string floater_title = getString(std::string("title_") + param); + std::string hint = getString(std::string("hint_" + param)); + + // Update floater title. + setTitle(floater_title); + + // Update the hint at the top. + getChild("hint")->setValue(hint); + + // Hide the hint to the right of the combo if we're invoked to create a new preset. + getChildView("note")->setVisible(param == "edit"); +} + +void LLFloaterEditDayCycle::onBtnCancel() +{ + closeFloater(); +} -- cgit v1.2.3 From 657e434fd59139436e8b97e5ecd01ca686e82269 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Mon, 30 May 2011 22:34:56 +0300 Subject: STORM-1253 WIP New day cycle editor. Done: * Creating new local day cycles. * Editing existing local day cycles. * Deleting day cycles. To do: * Editing region day cycle, dealing with skies in region scope. * Handle teleport while editing a day cycle. * Update UI when a day cycle or sky preset gets deleted. * Make the time ctrl increase/decrease consistently. --- indra/newview/llfloatereditdaycycle.cpp | 599 +++++++++++++++++++++++++++++++- 1 file changed, 594 insertions(+), 5 deletions(-) (limited to 'indra/newview/llfloatereditdaycycle.cpp') diff --git a/indra/newview/llfloatereditdaycycle.cpp b/indra/newview/llfloatereditdaycycle.cpp index 6275b48203..91809e0707 100644 --- a/indra/newview/llfloatereditdaycycle.cpp +++ b/indra/newview/llfloatereditdaycycle.cpp @@ -30,22 +30,53 @@ // libs #include "llbutton.h" +#include "llcheckboxctrl.h" +#include "llcombobox.h" +#include "llmultisliderctrl.h" +#include "llnotifications.h" +#include "llnotificationsutil.h" +#include "llspinctrl.h" +#include "lltimectrl.h" // newview +#include "llagent.h" +#include "lldaycyclemanager.h" +#include "llenvmanager.h" +#include "llviewerregion.h" +#include "llwlparammanager.h" + +const F32 LLFloaterEditDayCycle::sHoursPerDay = 24.0f; LLFloaterEditDayCycle::LLFloaterEditDayCycle(const LLSD &key) : LLFloater(key) +, mDayCycleNameEditor(NULL) +, mDayCyclesCombo(NULL) +, mTimeSlider(NULL) +, mKeysSlider(NULL) +, mSkyPresetsCombo(NULL) +, mTimeCtrl(NULL) +, mMakeDefaultCheckBox(NULL) +, mSaveButton(NULL) { } // virtual BOOL LLFloaterEditDayCycle::postBuild() { - getChild("cancel")->setCommitCallback(boost::bind(&LLFloaterEditDayCycle::onBtnCancel, this)); + mDayCycleNameEditor = getChild("day_cycle_name"); + mDayCyclesCombo = getChild("day_cycle_combo"); + + mTimeSlider = getChild("WLTimeSlider"); + mKeysSlider = getChild("WLDayCycleKeys"); + mSkyPresetsCombo = getChild("WLSkyPresets"); + mTimeCtrl = getChild("time"); + mSaveButton = getChild("save"); + mMakeDefaultCheckBox = getChild("make_default_cb"); - // Disable some non-functional controls. - getChildView("day_cycle_combo")->setEnabled(FALSE); - getChildView("save")->setEnabled(FALSE); + initCallbacks(); + + // add the time slider + mTimeSlider->addSlider(); return TRUE; } @@ -53,6 +84,7 @@ BOOL LLFloaterEditDayCycle::postBuild() // virtual void LLFloaterEditDayCycle::onOpen(const LLSD& key) { + bool new_day = isNewDay(); std::string param = key.asString(); std::string floater_title = getString(std::string("title_") + param); std::string hint = getString(std::string("hint_" + param)); @@ -64,10 +96,567 @@ void LLFloaterEditDayCycle::onOpen(const LLSD& key) getChild("hint")->setValue(hint); // Hide the hint to the right of the combo if we're invoked to create a new preset. - getChildView("note")->setVisible(param == "edit"); + getChildView("note")->setVisible(!new_day); + + // Switch between the day cycle presets combobox and day cycle name input field. + mDayCyclesCombo->setVisible(!new_day); + mDayCycleNameEditor->setVisible(new_day); + + // TODO: Make sure only one instance of the floater exists? + + reset(); +} + +// virtual +void LLFloaterEditDayCycle::onClose(bool app_quitting) +{ + if (!app_quitting) // there's no point to change environment if we're quitting + { + LLEnvManagerNew::instance().usePrefs(); // revert changes made to current day cycle + } +} + +// virtual +void LLFloaterEditDayCycle::draw() +{ + syncTimeSlider(); + LLFloater::draw(); +} + +void LLFloaterEditDayCycle::initCallbacks(void) +{ + mDayCycleNameEditor->setKeystrokeCallback(boost::bind(&LLFloaterEditDayCycle::onDayCycleNameEdited, this), NULL); + mDayCyclesCombo->setCommitCallback(boost::bind(&LLFloaterEditDayCycle::onDayCycleSelected, this)); + mTimeSlider->setCommitCallback(boost::bind(&LLFloaterEditDayCycle::onTimeSliderMoved, this)); + mKeysSlider->setCommitCallback(boost::bind(&LLFloaterEditDayCycle::onKeyTimeMoved, this)); + mTimeCtrl->setCommitCallback(boost::bind(&LLFloaterEditDayCycle::onKeyTimeChanged, this)); + mSkyPresetsCombo->setCommitCallback(boost::bind(&LLFloaterEditDayCycle::onKeyPresetChanged, this)); + + getChild("WLAddKey")->setClickedCallback(boost::bind(&LLFloaterEditDayCycle::onAddKey, this)); + getChild("WLDeleteKey")->setClickedCallback(boost::bind(&LLFloaterEditDayCycle::onDeleteKey, this)); + + mSaveButton->setCommitCallback(boost::bind(&LLFloaterEditDayCycle::onBtnSave, this)); + mSaveButton->setRightMouseDownCallback(boost::bind(&LLFloaterEditDayCycle::dumpTrack, this)); + getChild("cancel")->setCommitCallback(boost::bind(&LLFloaterEditDayCycle::onBtnCancel, this)); +} + +void LLFloaterEditDayCycle::syncTimeSlider() +{ + // set time + mTimeSlider->setCurSliderValue((F32)LLWLParamManager::getInstance()->mAnimator.getDayTime() * sHoursPerDay); +} + +void LLFloaterEditDayCycle::loadTrack() +{ + // clear the slider + mKeysSlider->clear(); + mSliderToKey.clear(); + + // add sliders + + lldebugs << "Adding " << LLWLParamManager::getInstance()->mDay.mTimeMap.size() << " keys to slider" << llendl; + + LLWLDayCycle& cur_dayp = LLWLParamManager::instance().mDay; + for (std::map::iterator it = cur_dayp.mTimeMap.begin(); it != cur_dayp.mTimeMap.end(); ++it) + { + addSliderKey(it->first * sHoursPerDay, it->second); + } + + // set drop-down menu to match preset of currently-selected keyframe (one is automatically selected initially) + const std::string& cur_sldr = mKeysSlider->getCurSlider(); + if (strlen(cur_sldr.c_str()) > 0) // only do this if there is a curSldr, otherwise we put an invalid entry into the map + { + mSkyPresetsCombo->selectByValue(mSliderToKey[cur_sldr].keyframe.toStringVal()); + } + + syncTimeSlider(); +} + +void LLFloaterEditDayCycle::applyTrack() +{ + lldebugs << "Applying track (" << mSliderToKey.size() << ")" << llendl; + + // if no keys, do nothing + if (mSliderToKey.size() == 0) + { + lldebugs << "No keys, not syncing" << llendl; + return; + } + + llassert_always(mSliderToKey.size() == mKeysSlider->getValue().size()); + + // create a new animation track + LLWLParamManager::getInstance()->mDay.clearKeyframes(); + + // add the keys one by one + for (std::map::iterator it = mSliderToKey.begin(); + it != mSliderToKey.end(); ++it) + { + LLWLParamManager::getInstance()->mDay.addKeyframe(it->second.time / sHoursPerDay, + it->second.keyframe); + } + + // set the param manager's track to the new one + LL_DEBUGS("Windlight") << "Time slider val: " << mTimeSlider->getCurSliderValue() / sHoursPerDay << " (" << mTimeSlider->getCurSliderValue() << ")" << LL_ENDL; + LLWLParamManager::getInstance()->resetAnimator( + mTimeSlider->getCurSliderValue() / sHoursPerDay, false); + + LLWLParamManager::getInstance()->mAnimator.update( + LLWLParamManager::getInstance()->mCurParams); +} + +void LLFloaterEditDayCycle::refreshSkyPresetsList() +{ + LLWLParamManager& sky_mgr = LLWLParamManager::instance(); + for (std::map::iterator it = sky_mgr.mParamList.begin(); + it != sky_mgr.mParamList.end(); ++it) + { + const LLWLParamKey& key = it->first; + + std::string item_title = key.name; + if (key.scope == LLEnvKey::SCOPE_REGION) + { + item_title += " (" + getRegionName() + ")"; + } + + mSkyPresetsCombo->add(item_title, LLSD(key.toStringVal())); + } + + // set defaults on combo boxes + mSkyPresetsCombo->selectFirstItem(); +} + +void LLFloaterEditDayCycle::refreshDayCyclesList() +{ + llassert(isNewDay() == false); + + mDayCyclesCombo->removeall(); + + const LLSD& region_day = LLEnvManagerNew::instance().getRegionSettings().getWLDayCycle(); + if (region_day.size() > 0) + { + LLWLParamKey key(getRegionName(), LLEnvKey::SCOPE_REGION); + mDayCyclesCombo->add(key.name, key.toLLSD()); + mDayCyclesCombo->addSeparator(); + } + + const LLDayCycleManager::dc_map_t& map = LLDayCycleManager::instance().getPresets(); + for (LLDayCycleManager::dc_map_t::const_iterator it = map.begin(); it != map.end(); ++it) + { + LLWLParamKey key(it->first, LLEnvKey::SCOPE_LOCAL); + mDayCyclesCombo->add(key.name, key.toLLSD()); + } + + mDayCyclesCombo->setLabel(getString("combo_label")); +} + +void LLFloaterEditDayCycle::onTimeSliderMoved() +{ + /// get the slider value + F32 val = mTimeSlider->getCurSliderValue() / sHoursPerDay; + LL_DEBUGS("Windlight") << "Time slider val: " << val << " (" << mTimeSlider->getCurSliderValue() << ")" << LL_ENDL; + + // set the value, turn off animation + LLWLParamManager::getInstance()->mAnimator.setDayTime((F64)val); + LLWLParamManager::getInstance()->mAnimator.deactivate(); + + // then call update once + LLWLParamManager::getInstance()->mAnimator.update( + LLWLParamManager::getInstance()->mCurParams); +} + +void LLFloaterEditDayCycle::onKeyTimeMoved() +{ + if (mKeysSlider->getValue().size() == 0) + { + return; + } + + // make sure we have a slider + const std::string& cur_sldr = mKeysSlider->getCurSlider(); + if (cur_sldr == "") + { + return; + } + + F32 time24 = mKeysSlider->getCurSliderValue(); + + // check to see if a key exists + LLWLParamKey key = mSliderToKey[cur_sldr].keyframe; + lldebugs << "Setting key time: " << time24 << LL_ENDL; + mSliderToKey[cur_sldr].time = time24; + + // if it exists, turn on check box + mSkyPresetsCombo->selectByValue(key.toStringVal()); + + mTimeCtrl->setTime24(time24); + + applyTrack(); +} + +void LLFloaterEditDayCycle::onKeyTimeChanged() +{ + // if no keys, skipped + if (mSliderToKey.size() == 0) + { + return; + } + + F32 time24 = mTimeCtrl->getTime24(); + + const std::string& cur_sldr = mKeysSlider->getCurSlider(); + mKeysSlider->setCurSliderValue(time24, TRUE); + F32 time = mKeysSlider->getCurSliderValue() / sHoursPerDay; + + // now set the key's time in the sliderToKey map + lldebugs << "Setting key time: " << time << LL_ENDL; + mSliderToKey[cur_sldr].time = time; + + applyTrack(); +} + +void LLFloaterEditDayCycle::onKeyPresetChanged() +{ + // do nothing if no sliders + if (mKeysSlider->getValue().size() == 0) + { + return; + } + + // change the map + + std::string stringVal = mSkyPresetsCombo->getSelectedValue().asString(); + LLWLParamKey new_key(stringVal); + const std::string& cur_sldr = mKeysSlider->getCurSlider(); + + // if null, don't use + if (cur_sldr == "") + { + return; + } + + mSliderToKey[cur_sldr].keyframe = new_key; + + // Apply changes to current day cycle. + applyTrack(); +} + +void LLFloaterEditDayCycle::onAddKey() +{ + llassert_always(mSliderToKey.size() == mKeysSlider->getValue().size()); + + S32 max_sliders; + LLEnvKey::EScope scope = LLEnvKey::SCOPE_LOCAL; // *TODO: editing region day cycle + switch (scope) + { + case LLEnvKey::SCOPE_LOCAL: + max_sliders = 20; // *HACK this should be LLWLPacketScrubber::MAX_LOCAL_KEY_FRAMES; + break; + case LLEnvKey::SCOPE_REGION: + max_sliders = 12; // *HACK this should be LLWLPacketScrubber::MAX_REGION_KEY_FRAMES; + break; + default: + max_sliders = (S32) mKeysSlider->getMaxValue(); + break; + } + + if ((S32)mSliderToKey.size() >= max_sliders) + { + LLSD args; + args["SCOPE"] = LLEnvManager::getScopeString(scope); + args["MAX"] = max_sliders; + LLNotificationsUtil::add("DayCycleTooManyKeyframes", args, LLSD(), LLNotificationFunctorRegistry::instance().DONOTHING); + return; + } + + // add the slider key + LLWLParamKey sky_params(mSkyPresetsCombo->getSelectedValue()); + F32 time = mTimeSlider->getCurSliderValue(); + addSliderKey(time, sky_params); + + // apply the change to current day cycles + applyTrack(); +} + +void LLFloaterEditDayCycle::addSliderKey(F32 time, LLWLParamKey keyframe) +{ + // make a slider + const std::string& sldr_name = mKeysSlider->addSlider(time); + if (sldr_name.empty()) + { + return; + } + + // set the key + SliderKey newKey(keyframe, mKeysSlider->getCurSliderValue()); + + llassert_always(sldr_name != LLStringUtil::null); + + // add to map + mSliderToKey.insert(std::pair(sldr_name, newKey)); + + llassert_always(mSliderToKey.size() == mKeysSlider->getValue().size()); +} + +LLWLParamKey LLFloaterEditDayCycle::getSelectedDayCycle() +{ + LLWLParamKey dc_key; + + if (mDayCycleNameEditor->getVisible()) + { + dc_key.name = mDayCycleNameEditor->getText(); + dc_key.scope = LLEnvKey::SCOPE_LOCAL; + } + else + { + LLSD combo_val = mDayCyclesCombo->getValue(); + + if (!combo_val.isArray()) // manually typed text + { + dc_key.name = combo_val.asString(); + dc_key.scope = LLEnvKey::SCOPE_LOCAL; + } + else + { + dc_key.fromLLSD(combo_val); + } + } + + return dc_key; +} + +void LLFloaterEditDayCycle::deletePreset(LLWLParamKey keyframe) +{ + // *TODO: This should be called when a sky preset gets deleted. + + /// delete any reference + std::map::iterator curr_preset, next_preset; + for (curr_preset = mSliderToKey.begin(); curr_preset != mSliderToKey.end(); curr_preset = next_preset) + { + next_preset = curr_preset; + ++next_preset; + if (curr_preset->second.keyframe == keyframe) + { + mKeysSlider->deleteSlider(curr_preset->first); + mSliderToKey.erase(curr_preset); + } + } +} + +bool LLFloaterEditDayCycle::isNewDay() const +{ + return mKey.asString() == "new"; +} + +void LLFloaterEditDayCycle::dumpTrack() +{ + LL_DEBUGS("Windlight") << "Dumping day cycle" << LL_ENDL; + + LLWLDayCycle& cur_dayp = LLWLParamManager::instance().mDay; + for (std::map::iterator it = cur_dayp.mTimeMap.begin(); it != cur_dayp.mTimeMap.end(); ++it) + { + F32 time = it->first * 24.0f; + S32 h = time; + S32 m = (time - h) * 60.0f; + LL_DEBUGS("Windlight") << llformat("(%.3f) %02d:%02d", time, h, m) << " => " << it->second.name << LL_ENDL; + } +} + +void LLFloaterEditDayCycle::enableEditing(bool enable) +{ + mSkyPresetsCombo->setEnabled(enable); + mTimeCtrl->setEnabled(enable); + getChild("day_cycle_slider_panel")->setCtrlsEnabled(enable); + mSaveButton->setEnabled(enable); + mMakeDefaultCheckBox->setEnabled(enable); +} + +void LLFloaterEditDayCycle::reset() +{ + // clear the slider + mKeysSlider->clear(); + mSliderToKey.clear(); + + refreshSkyPresetsList(); + + if (isNewDay()) + { + mDayCycleNameEditor->setValue(LLSD()); + F32 time = 0.5f * sHoursPerDay; + mSaveButton->setEnabled(FALSE); // will be enabled as soon as users enters a name + mTimeSlider->setCurSliderValue(time); + + addSliderKey(time, LLWLParamKey("Default", LLEnvKey::SCOPE_LOCAL)); + onKeyTimeMoved(); // update the time control and sky sky combo + + applyTrack(); + } + else + { + refreshDayCyclesList(); + + // Disable controls until a day cycle to edit is selected. + enableEditing(false); + } +} + +void LLFloaterEditDayCycle::onDeleteKey() +{ + if (mSliderToKey.size() == 0) + { + return; + } + else if (mSliderToKey.size() == 1) + { + LLNotifications::instance().add("EnvCannotDeleteLastDayCycleKey", LLSD(), LLSD()); + return; + } + + // delete from map + const std::string& sldr_name = mKeysSlider->getCurSlider(); + std::map::iterator mIt = mSliderToKey.find(sldr_name); + mSliderToKey.erase(mIt); + + mKeysSlider->deleteCurSlider(); + + if (mSliderToKey.size() == 0) + { + return; + } + + const std::string& name = mKeysSlider->getCurSlider(); + mSkyPresetsCombo->selectByValue(mSliderToKey[name].keyframe.toStringVal()); + F32 time24 = mSliderToKey[name].time; + + mTimeCtrl->setTime24(time24); + + applyTrack(); +} + +void LLFloaterEditDayCycle::onDayCycleNameEdited() +{ + // Disable saving a day cycle having empty name. + LLWLParamKey key = getSelectedDayCycle(); + mSaveButton->setEnabled(!key.name.empty()); +} + +void LLFloaterEditDayCycle::onDayCycleSelected() +{ + LLSD day_data; + LLWLParamKey dc_key = getSelectedDayCycle(); + + if (dc_key.scope == LLEnvKey::SCOPE_LOCAL) + { + if (!LLDayCycleManager::instance().getPreset(dc_key.name, day_data)) + { + llwarns << "No day cycle named " << dc_key.name << llendl; + return; + } + } + else + { + day_data = LLEnvManagerNew::instance().getRegionSettings().getWLDayCycle(); + if (day_data.size() == 0) + { + llwarns << "Empty region day cycle" << llendl; + llassert(day_data.size() > 0); + return; + } + } + + F32 slider_time = mTimeSlider->getCurSliderValue() / sHoursPerDay; + LL_DEBUGS("Windlight") << "Time slider val: " << slider_time << " (" << mTimeSlider->getCurSliderValue() << ")" << LL_ENDL; + LLWLParamManager::instance().applyDayCycleParams(day_data, dc_key.scope, slider_time); + loadTrack(); + + enableEditing(true); +} + +void LLFloaterEditDayCycle::onBtnSave() +{ + LLDayCycleManager& day_mgr = LLDayCycleManager::instance(); + LLWLParamKey selected_day = getSelectedDayCycle(); + + if (selected_day.scope == LLEnvKey::SCOPE_REGION) + { + llwarns << "Saving to a local day cycle" << llendl; + } + + std::string name = selected_day.name; + if (name.empty()) + { + // *TODO: show an alert + llwarns << "Empty day cycle name" << llendl; + return; + } + + // Don't allow overwriting system presets. + if (day_mgr.isSystemPreset(name)) + { + LLNotificationsUtil::add("WLNoEditDefault"); + return; + } + + // Save, ask for confirmation for overwriting an existing preset. + if (day_mgr.presetExists(name)) + { + LLNotificationsUtil::add("WLSavePresetAlert", LLSD(), LLSD(), boost::bind(&LLFloaterEditDayCycle::onSaveAnswer, this, _1, _2)); + } + else + { + // new preset, hence no confirmation needed + onSaveConfirmed(); + } } void LLFloaterEditDayCycle::onBtnCancel() { +#if 0 // temporary + onClose(false); + reset(); +#else + closeFloater(); +#endif +} + +bool LLFloaterEditDayCycle::onSaveAnswer(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + + // If they choose save, do it. Otherwise, don't do anything + if (option == 0) + { + onSaveConfirmed(); + } + + return false; +} + +void LLFloaterEditDayCycle::onSaveConfirmed() +{ + std::string name = getSelectedDayCycle().name; + + // Save preset. + LLSD data = LLWLParamManager::instance().mDay.asLLSD(); + LL_DEBUGS("Windlight") << "Saving day cycle " << name << ": " << data << LL_ENDL; + LLDayCycleManager::instance().savePreset(name, data); + + // Change preference if requested. + if (mMakeDefaultCheckBox->getValue()) + { + LL_DEBUGS("Windlight") << name << " is now the new preferred day cycle" << llendl; + LLEnvManagerNew::instance().setUseDayCycle(name); + } + +#if 0 // temporary + reset(); +#else closeFloater(); +#endif +} + +// static +std::string LLFloaterEditDayCycle::getRegionName() +{ + return gAgent.getRegion() ? gAgent.getRegion()->getName() : LLTrans::getString("Unknown"); } -- cgit v1.2.3 From a079ac98c702bcb9de9860cd33c440941fb04a2a Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 31 May 2011 03:12:36 +0300 Subject: STORM-1253 WIP Fixed more compiler warnings. --- indra/newview/llfloatereditdaycycle.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloatereditdaycycle.cpp') diff --git a/indra/newview/llfloatereditdaycycle.cpp b/indra/newview/llfloatereditdaycycle.cpp index 91809e0707..2ff6901652 100644 --- a/indra/newview/llfloatereditdaycycle.cpp +++ b/indra/newview/llfloatereditdaycycle.cpp @@ -456,8 +456,8 @@ void LLFloaterEditDayCycle::dumpTrack() for (std::map::iterator it = cur_dayp.mTimeMap.begin(); it != cur_dayp.mTimeMap.end(); ++it) { F32 time = it->first * 24.0f; - S32 h = time; - S32 m = (time - h) * 60.0f; + S32 h = (S32) time; + S32 m = (S32) ((time - h) * 60.0f); LL_DEBUGS("Windlight") << llformat("(%.3f) %02d:%02d", time, h, m) << " => " << it->second.name << LL_ENDL; } } -- cgit v1.2.3 From 778088b74c19773646a50b5c0aa40015f2b242f3 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 31 May 2011 22:36:26 +0300 Subject: STORM-1253 WIP Implemented editing region day cycle. --- indra/newview/llfloatereditdaycycle.cpp | 130 +++++++++++++++++++++++++++++++- 1 file changed, 128 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloatereditdaycycle.cpp') diff --git a/indra/newview/llfloatereditdaycycle.cpp b/indra/newview/llfloatereditdaycycle.cpp index 2ff6901652..a62f348129 100644 --- a/indra/newview/llfloatereditdaycycle.cpp +++ b/indra/newview/llfloatereditdaycycle.cpp @@ -32,6 +32,7 @@ #include "llbutton.h" #include "llcheckboxctrl.h" #include "llcombobox.h" +#include "llloadingindicator.h" #include "llmultisliderctrl.h" #include "llnotifications.h" #include "llnotificationsutil.h" @@ -42,6 +43,7 @@ #include "llagent.h" #include "lldaycyclemanager.h" #include "llenvmanager.h" +#include "llregioninfomodel.h" #include "llviewerregion.h" #include "llwlparammanager.h" @@ -138,6 +140,15 @@ void LLFloaterEditDayCycle::initCallbacks(void) mSaveButton->setCommitCallback(boost::bind(&LLFloaterEditDayCycle::onBtnSave, this)); mSaveButton->setRightMouseDownCallback(boost::bind(&LLFloaterEditDayCycle::dumpTrack, this)); getChild("cancel")->setCommitCallback(boost::bind(&LLFloaterEditDayCycle::onBtnCancel, this)); + + // Connect to env manager events. + LLEnvManagerNew& env_mgr = LLEnvManagerNew::instance(); + env_mgr.setRegionSettingsChangeCallback(boost::bind(&LLFloaterEditDayCycle::onRegionSettingsChange, this)); + env_mgr.setRegionChangeCallback(boost::bind(&LLFloaterEditDayCycle::onRegionChange, this)); + env_mgr.setRegionSettingsAppliedCallback(boost::bind(&LLFloaterEditDayCycle::onRegionSettingsApplied, this, _1)); + + // Connect to region info updates. + LLRegionInfoModel::instance().setUpdateCallback(boost::bind(&LLFloaterEditDayCycle::onRegionInfoUpdate, this)); } void LLFloaterEditDayCycle::syncTimeSlider() @@ -500,6 +511,50 @@ void LLFloaterEditDayCycle::reset() } } +void LLFloaterEditDayCycle::saveRegionDayCycle() +{ + LLEnvManagerNew& env_mgr = LLEnvManagerNew::instance(); + LLWLDayCycle& cur_dayp = LLWLParamManager::instance().mDay; // the day cycle being edited + + // Get current day cycle and the sky preset it references. + LLSD day_cycle = cur_dayp.asLLSD(); + LLSD sky_map; + cur_dayp.getSkyMap(sky_map); + + // Apply it to the region. + LLEnvironmentSettings new_region_settings; + new_region_settings.saveParams(day_cycle, sky_map, env_mgr.getRegionSettings().getWaterParams(), 0.0f); + + if (!LLEnvManagerNew::instance().sendRegionSettings(new_region_settings)) + { + llwarns << "Error applying region environment settings" << llendl; + return; + } + + setApplyProgress(true); +} + +void LLFloaterEditDayCycle::setApplyProgress(bool started) +{ + LLLoadingIndicator* indicator = getChild("progress_indicator"); + + indicator->setVisible(started); + + if (started) + { + indicator->start(); + } + else + { + indicator->stop(); + } +} + +bool LLFloaterEditDayCycle::getApplyProgress() const +{ + return getChild("progress_indicator")->getVisible(); +} + void LLFloaterEditDayCycle::onDeleteKey() { if (mSliderToKey.size() == 0) @@ -533,6 +588,62 @@ void LLFloaterEditDayCycle::onDeleteKey() applyTrack(); } +void LLFloaterEditDayCycle::onRegionSettingsChange() +{ + LL_DEBUGS("Windlight") << "Region settings changed" << LL_ENDL; + + if (getApplyProgress()) // our region settings have being applied + { + setApplyProgress(false); + + // Change preference if requested. + if (mMakeDefaultCheckBox->getValue()) + { + LL_DEBUGS("Windlight") << "Changed environment preference to region settings" << llendl; + LLEnvManagerNew::instance().setUseRegionSettings(true); + } + + closeFloater(); + } +} + +void LLFloaterEditDayCycle::onRegionChange() +{ + LL_DEBUGS("Windlight") << "Region changed" << LL_ENDL; + + // If we're editing the region day cycle + if (getSelectedDayCycle().scope == LLEnvKey::SCOPE_REGION) + { + reset(); // undoes all unsaved changes + } +} + +void LLFloaterEditDayCycle::onRegionSettingsApplied(bool success) +{ + LL_DEBUGS("Windlight") << "Region settings applied: " << success << LL_ENDL; + + if (!success) + { + // stop progress indicator + setApplyProgress(false); + } +} + +void LLFloaterEditDayCycle::onRegionInfoUpdate() +{ + LL_DEBUGS("Windlight") << "Region info updated" << LL_ENDL; + bool can_edit = true; + + // If we've selected the region day cycle for editing. + if (getSelectedDayCycle().scope == LLEnvKey::SCOPE_REGION) + { + // check whether we have the access + can_edit = canEditRegionSettings(); + } + + enableEditing(can_edit); +} + void LLFloaterEditDayCycle::onDayCycleNameEdited() { // Disable saving a day cycle having empty name. @@ -544,6 +655,7 @@ void LLFloaterEditDayCycle::onDayCycleSelected() { LLSD day_data; LLWLParamKey dc_key = getSelectedDayCycle(); + bool can_edit = true; if (dc_key.scope == LLEnvKey::SCOPE_LOCAL) { @@ -562,6 +674,8 @@ void LLFloaterEditDayCycle::onDayCycleSelected() llassert(day_data.size() > 0); return; } + + can_edit = canEditRegionSettings(); } F32 slider_time = mTimeSlider->getCurSliderValue() / sHoursPerDay; @@ -569,7 +683,7 @@ void LLFloaterEditDayCycle::onDayCycleSelected() LLWLParamManager::instance().applyDayCycleParams(day_data, dc_key.scope, slider_time); loadTrack(); - enableEditing(true); + enableEditing(can_edit); } void LLFloaterEditDayCycle::onBtnSave() @@ -579,7 +693,8 @@ void LLFloaterEditDayCycle::onBtnSave() if (selected_day.scope == LLEnvKey::SCOPE_REGION) { - llwarns << "Saving to a local day cycle" << llendl; + saveRegionDayCycle(); + return; } std::string name = selected_day.name; @@ -660,3 +775,14 @@ std::string LLFloaterEditDayCycle::getRegionName() { return gAgent.getRegion() ? gAgent.getRegion()->getName() : LLTrans::getString("Unknown"); } + +// static +bool LLFloaterEditDayCycle::canEditRegionSettings() +{ + LLViewerRegion* region = gAgent.getRegion(); + BOOL owner_or_god = gAgent.isGodlike() || (region && region->getOwner() == gAgent.getID()); + BOOL owner_or_god_or_manager = owner_or_god || (region && region->isEstateManager()); + + LL_DEBUGS("Windlight") << "Can edit region settings: " << owner_or_god_or_manager << LL_ENDL; + return owner_or_god_or_manager; +} -- cgit v1.2.3 From 5db9e5551b9e2cc0ab6f61c643141299db859603 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 31 May 2011 22:43:59 +0300 Subject: STORM-1253 WIP Removed temporary code. --- indra/newview/llfloatereditdaycycle.cpp | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'indra/newview/llfloatereditdaycycle.cpp') diff --git a/indra/newview/llfloatereditdaycycle.cpp b/indra/newview/llfloatereditdaycycle.cpp index a62f348129..8c85f6833b 100644 --- a/indra/newview/llfloatereditdaycycle.cpp +++ b/indra/newview/llfloatereditdaycycle.cpp @@ -208,7 +208,6 @@ void LLFloaterEditDayCycle::applyTrack() } // set the param manager's track to the new one - LL_DEBUGS("Windlight") << "Time slider val: " << mTimeSlider->getCurSliderValue() / sHoursPerDay << " (" << mTimeSlider->getCurSliderValue() << ")" << LL_ENDL; LLWLParamManager::getInstance()->resetAnimator( mTimeSlider->getCurSliderValue() / sHoursPerDay, false); @@ -265,7 +264,6 @@ void LLFloaterEditDayCycle::onTimeSliderMoved() { /// get the slider value F32 val = mTimeSlider->getCurSliderValue() / sHoursPerDay; - LL_DEBUGS("Windlight") << "Time slider val: " << val << " (" << mTimeSlider->getCurSliderValue() << ")" << LL_ENDL; // set the value, turn off animation LLWLParamManager::getInstance()->mAnimator.setDayTime((F64)val); @@ -679,7 +677,6 @@ void LLFloaterEditDayCycle::onDayCycleSelected() } F32 slider_time = mTimeSlider->getCurSliderValue() / sHoursPerDay; - LL_DEBUGS("Windlight") << "Time slider val: " << slider_time << " (" << mTimeSlider->getCurSliderValue() << ")" << LL_ENDL; LLWLParamManager::instance().applyDayCycleParams(day_data, dc_key.scope, slider_time); loadTrack(); @@ -726,12 +723,7 @@ void LLFloaterEditDayCycle::onBtnSave() void LLFloaterEditDayCycle::onBtnCancel() { -#if 0 // temporary - onClose(false); - reset(); -#else closeFloater(); -#endif } bool LLFloaterEditDayCycle::onSaveAnswer(const LLSD& notification, const LLSD& response) @@ -763,11 +755,7 @@ void LLFloaterEditDayCycle::onSaveConfirmed() LLEnvManagerNew::instance().setUseDayCycle(name); } -#if 0 // temporary - reset(); -#else closeFloater(); -#endif } // static -- cgit v1.2.3 From 995a006b58f2be1d7236b32be3570b6d7250013b Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 1 Jun 2011 18:26:36 +0300 Subject: STORM-1253 WIP Update UI when a day cycle gets added or deleted. --- indra/newview/llfloatereditdaycycle.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'indra/newview/llfloatereditdaycycle.cpp') diff --git a/indra/newview/llfloatereditdaycycle.cpp b/indra/newview/llfloatereditdaycycle.cpp index 8c85f6833b..f77e73c30b 100644 --- a/indra/newview/llfloatereditdaycycle.cpp +++ b/indra/newview/llfloatereditdaycycle.cpp @@ -147,6 +147,9 @@ void LLFloaterEditDayCycle::initCallbacks(void) env_mgr.setRegionChangeCallback(boost::bind(&LLFloaterEditDayCycle::onRegionChange, this)); env_mgr.setRegionSettingsAppliedCallback(boost::bind(&LLFloaterEditDayCycle::onRegionSettingsApplied, this, _1)); + // Connect to day cycle manager events. + LLDayCycleManager::instance().setModifyCallback(boost::bind(&LLFloaterEditDayCycle::onDayCycleListChange, this)); + // Connect to region info updates. LLRegionInfoModel::instance().setUpdateCallback(boost::bind(&LLFloaterEditDayCycle::onRegionInfoUpdate, this)); } @@ -758,6 +761,14 @@ void LLFloaterEditDayCycle::onSaveConfirmed() closeFloater(); } +void LLFloaterEditDayCycle::onDayCycleListChange() +{ + if (!isNewDay()) + { + refreshDayCyclesList(); + } +} + // static std::string LLFloaterEditDayCycle::getRegionName() { -- cgit v1.2.3 From e184c7598680f2069e2bcf5caa3c86967d7ab0a1 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 2 Jun 2011 18:56:49 +0300 Subject: STORM-1253 WIP Changed the workflow to modify region day cycle. Was: Press "Save" after editing the region day cycle in the Day Cycle Editor. Now: - Press "Save" in the Day Cycle Editor. - Open Region / Estate -> Environment tab. - Select the region day cycle. - Press "Apply". --- indra/newview/llfloatereditdaycycle.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloatereditdaycycle.cpp') diff --git a/indra/newview/llfloatereditdaycycle.cpp b/indra/newview/llfloatereditdaycycle.cpp index f77e73c30b..52cfbb512a 100644 --- a/indra/newview/llfloatereditdaycycle.cpp +++ b/indra/newview/llfloatereditdaycycle.cpp @@ -220,6 +220,8 @@ void LLFloaterEditDayCycle::applyTrack() void LLFloaterEditDayCycle::refreshSkyPresetsList() { + mSkyPresetsCombo->removeall(); + LLWLParamManager& sky_mgr = LLWLParamManager::instance(); for (std::map::iterator it = sky_mgr.mParamList.begin(); it != sky_mgr.mParamList.end(); ++it) @@ -339,6 +341,7 @@ void LLFloaterEditDayCycle::onKeyPresetChanged() std::string stringVal = mSkyPresetsCombo->getSelectedValue().asString(); LLWLParamKey new_key(stringVal); + llassert(!new_key.name.empty()); const std::string& cur_sldr = mKeysSlider->getCurSlider(); // if null, don't use @@ -382,7 +385,10 @@ void LLFloaterEditDayCycle::onAddKey() } // add the slider key - LLWLParamKey sky_params(mSkyPresetsCombo->getSelectedValue()); + std::string key_val = mSkyPresetsCombo->getSelectedValue().asString(); + LLWLParamKey sky_params(key_val); + llassert(!sky_params.name.empty()); + F32 time = mTimeSlider->getCurSliderValue(); addSliderKey(time, sky_params); @@ -526,6 +532,9 @@ void LLFloaterEditDayCycle::saveRegionDayCycle() LLEnvironmentSettings new_region_settings; new_region_settings.saveParams(day_cycle, sky_map, env_mgr.getRegionSettings().getWaterParams(), 0.0f); +#if 1 + LLEnvManagerNew::instance().setRegionSettings(new_region_settings); +#else // Temporary disabled ability to upload new region settings from the Day Cycle Editor. if (!LLEnvManagerNew::instance().sendRegionSettings(new_region_settings)) { llwarns << "Error applying region environment settings" << llendl; @@ -533,6 +542,7 @@ void LLFloaterEditDayCycle::saveRegionDayCycle() } setApplyProgress(true); +#endif } void LLFloaterEditDayCycle::setApplyProgress(bool started) @@ -694,6 +704,7 @@ void LLFloaterEditDayCycle::onBtnSave() if (selected_day.scope == LLEnvKey::SCOPE_REGION) { saveRegionDayCycle(); + closeFloater(); return; } -- cgit v1.2.3 From bbc1283848e01bfd5284293d044eec53cde10d0e Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 2 Jun 2011 19:13:33 +0300 Subject: STORM-1253 WIP Region sky presets are not accessible anymore when editing local day cycles. --- indra/newview/llfloatereditdaycycle.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'indra/newview/llfloatereditdaycycle.cpp') diff --git a/indra/newview/llfloatereditdaycycle.cpp b/indra/newview/llfloatereditdaycycle.cpp index 52cfbb512a..36f71d6161 100644 --- a/indra/newview/llfloatereditdaycycle.cpp +++ b/indra/newview/llfloatereditdaycycle.cpp @@ -220,6 +220,10 @@ void LLFloaterEditDayCycle::applyTrack() void LLFloaterEditDayCycle::refreshSkyPresetsList() { + // Don't allow selecting region skies for a local day cycle, + // because thus we may end up with invalid day cycle. + bool include_region_skies = getSelectedDayCycle().scope == LLEnvKey::SCOPE_REGION; + mSkyPresetsCombo->removeall(); LLWLParamManager& sky_mgr = LLWLParamManager::instance(); @@ -231,6 +235,11 @@ void LLFloaterEditDayCycle::refreshSkyPresetsList() std::string item_title = key.name; if (key.scope == LLEnvKey::SCOPE_REGION) { + if (!include_region_skies) + { + continue; + } + item_title += " (" + getRegionName() + ")"; } @@ -689,6 +698,9 @@ void LLFloaterEditDayCycle::onDayCycleSelected() can_edit = canEditRegionSettings(); } + // We may need to add or remove region skies from the list. + refreshSkyPresetsList(); + F32 slider_time = mTimeSlider->getCurSliderValue() / sHoursPerDay; LLWLParamManager::instance().applyDayCycleParams(day_data, dc_key.scope, slider_time); loadTrack(); -- cgit v1.2.3 From 27fdb654927db4c4597f733381a7b6568cfbb94b Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 2 Jun 2011 23:16:08 +0300 Subject: STORM-1253 WIP Disabled ability to edit existing day cycle until the workflow is clear enough. --- indra/newview/llfloatereditdaycycle.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llfloatereditdaycycle.cpp') diff --git a/indra/newview/llfloatereditdaycycle.cpp b/indra/newview/llfloatereditdaycycle.cpp index 36f71d6161..28ff353369 100644 --- a/indra/newview/llfloatereditdaycycle.cpp +++ b/indra/newview/llfloatereditdaycycle.cpp @@ -256,6 +256,7 @@ void LLFloaterEditDayCycle::refreshDayCyclesList() mDayCyclesCombo->removeall(); +#if 0 // Disable editing existing day cycle until the workflow is clear enough. const LLSD& region_day = LLEnvManagerNew::instance().getRegionSettings().getWLDayCycle(); if (region_day.size() > 0) { @@ -263,6 +264,7 @@ void LLFloaterEditDayCycle::refreshDayCyclesList() mDayCyclesCombo->add(key.name, key.toLLSD()); mDayCyclesCombo->addSeparator(); } +#endif const LLDayCycleManager::dc_map_t& map = LLDayCycleManager::instance().getPresets(); for (LLDayCycleManager::dc_map_t::const_iterator it = map.begin(); it != map.end(); ++it) -- cgit v1.2.3 From 9f4779e09997e70246c3c0c5f831bf55d4ed6a4f Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Mon, 6 Jun 2011 23:46:35 +0300 Subject: STORM-1255 WIP Made the check for region permissions reusable. --- indra/newview/llfloatereditdaycycle.cpp | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'indra/newview/llfloatereditdaycycle.cpp') diff --git a/indra/newview/llfloatereditdaycycle.cpp b/indra/newview/llfloatereditdaycycle.cpp index 28ff353369..f6bd4ad6b9 100644 --- a/indra/newview/llfloatereditdaycycle.cpp +++ b/indra/newview/llfloatereditdaycycle.cpp @@ -660,7 +660,7 @@ void LLFloaterEditDayCycle::onRegionInfoUpdate() if (getSelectedDayCycle().scope == LLEnvKey::SCOPE_REGION) { // check whether we have the access - can_edit = canEditRegionSettings(); + can_edit = LLEnvManagerNew::canEditRegionSettings(); } enableEditing(can_edit); @@ -697,7 +697,7 @@ void LLFloaterEditDayCycle::onDayCycleSelected() return; } - can_edit = canEditRegionSettings(); + can_edit = LLEnvManagerNew::canEditRegionSettings(); } // We may need to add or remove region skies from the list. @@ -799,14 +799,3 @@ std::string LLFloaterEditDayCycle::getRegionName() { return gAgent.getRegion() ? gAgent.getRegion()->getName() : LLTrans::getString("Unknown"); } - -// static -bool LLFloaterEditDayCycle::canEditRegionSettings() -{ - LLViewerRegion* region = gAgent.getRegion(); - BOOL owner_or_god = gAgent.isGodlike() || (region && region->getOwner() == gAgent.getID()); - BOOL owner_or_god_or_manager = owner_or_god || (region && region->isEstateManager()); - - LL_DEBUGS("Windlight") << "Can edit region settings: " << owner_or_god_or_manager << LL_ENDL; - return owner_or_god_or_manager; -} -- cgit v1.2.3 From 7151a4e6b02f02155387fc595034a42aebd7ec9c Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 7 Jun 2011 17:41:26 +0300 Subject: STORM-1255 WIP Consistency pass on sky presets removal. * Update all related floaters when a sky preset gets removed. * Don't allow removing skies referenced by (local) day cycles. * Other minor fixes. --- indra/newview/llfloatereditdaycycle.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'indra/newview/llfloatereditdaycycle.cpp') diff --git a/indra/newview/llfloatereditdaycycle.cpp b/indra/newview/llfloatereditdaycycle.cpp index f6bd4ad6b9..257644d80c 100644 --- a/indra/newview/llfloatereditdaycycle.cpp +++ b/indra/newview/llfloatereditdaycycle.cpp @@ -150,6 +150,9 @@ void LLFloaterEditDayCycle::initCallbacks(void) // Connect to day cycle manager events. LLDayCycleManager::instance().setModifyCallback(boost::bind(&LLFloaterEditDayCycle::onDayCycleListChange, this)); + // Connect to sky preset list changes. + LLWLParamManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterEditDayCycle::onSkyPresetListChange, this)); + // Connect to region info updates. LLRegionInfoModel::instance().setUpdateCallback(boost::bind(&LLFloaterEditDayCycle::onRegionInfoUpdate, this)); } @@ -794,6 +797,14 @@ void LLFloaterEditDayCycle::onDayCycleListChange() } } +void LLFloaterEditDayCycle::onSkyPresetListChange() +{ + refreshSkyPresetsList(); + + // Refresh sliders from the currently visible day cycle. + loadTrack(); +} + // static std::string LLFloaterEditDayCycle::getRegionName() { -- cgit v1.2.3 From b68a4fdcd7f4f2f8599e9336714d2d0a2b8fd259 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 7 Jun 2011 18:46:36 +0300 Subject: STORM-1255 Removed dead code. --- indra/newview/llfloatereditdaycycle.cpp | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'indra/newview/llfloatereditdaycycle.cpp') diff --git a/indra/newview/llfloatereditdaycycle.cpp b/indra/newview/llfloatereditdaycycle.cpp index 257644d80c..ebb8369c8f 100644 --- a/indra/newview/llfloatereditdaycycle.cpp +++ b/indra/newview/llfloatereditdaycycle.cpp @@ -457,24 +457,6 @@ LLWLParamKey LLFloaterEditDayCycle::getSelectedDayCycle() return dc_key; } -void LLFloaterEditDayCycle::deletePreset(LLWLParamKey keyframe) -{ - // *TODO: This should be called when a sky preset gets deleted. - - /// delete any reference - std::map::iterator curr_preset, next_preset; - for (curr_preset = mSliderToKey.begin(); curr_preset != mSliderToKey.end(); curr_preset = next_preset) - { - next_preset = curr_preset; - ++next_preset; - if (curr_preset->second.keyframe == keyframe) - { - mKeysSlider->deleteSlider(curr_preset->first); - mSliderToKey.erase(curr_preset); - } - } -} - bool LLFloaterEditDayCycle::isNewDay() const { return mKey.asString() == "new"; -- cgit v1.2.3 From e4d00671037e25bfe233bcd441140e113aeba64d Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 9 Jun 2011 19:01:37 +0300 Subject: STORM-1253 WIP Gray out the save button if empty name entered in the combo box. --- indra/newview/llfloatereditdaycycle.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llfloatereditdaycycle.cpp') diff --git a/indra/newview/llfloatereditdaycycle.cpp b/indra/newview/llfloatereditdaycycle.cpp index ebb8369c8f..2cbe889322 100644 --- a/indra/newview/llfloatereditdaycycle.cpp +++ b/indra/newview/llfloatereditdaycycle.cpp @@ -129,6 +129,7 @@ void LLFloaterEditDayCycle::initCallbacks(void) { mDayCycleNameEditor->setKeystrokeCallback(boost::bind(&LLFloaterEditDayCycle::onDayCycleNameEdited, this), NULL); mDayCyclesCombo->setCommitCallback(boost::bind(&LLFloaterEditDayCycle::onDayCycleSelected, this)); + mDayCyclesCombo->setTextEntryCallback(boost::bind(&LLFloaterEditDayCycle::onDayCycleNameEdited, this)); mTimeSlider->setCommitCallback(boost::bind(&LLFloaterEditDayCycle::onTimeSliderMoved, this)); mKeysSlider->setCommitCallback(boost::bind(&LLFloaterEditDayCycle::onKeyTimeMoved, this)); mTimeCtrl->setCommitCallback(boost::bind(&LLFloaterEditDayCycle::onKeyTimeChanged, this)); -- cgit v1.2.3 From 4fd946fa3e5217b8f64e0fcd91d268c7eaf1bbf5 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Fri, 10 Jun 2011 23:44:13 +0300 Subject: STORM-1305 WIP User sky presets now go first in all lists. --- indra/newview/llfloatereditdaycycle.cpp | 43 +++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 13 deletions(-) (limited to 'indra/newview/llfloatereditdaycycle.cpp') diff --git a/indra/newview/llfloatereditdaycycle.cpp b/indra/newview/llfloatereditdaycycle.cpp index 2cbe889322..4f4739384d 100644 --- a/indra/newview/llfloatereditdaycycle.cpp +++ b/indra/newview/llfloatereditdaycycle.cpp @@ -230,24 +230,41 @@ void LLFloaterEditDayCycle::refreshSkyPresetsList() mSkyPresetsCombo->removeall(); - LLWLParamManager& sky_mgr = LLWLParamManager::instance(); - for (std::map::iterator it = sky_mgr.mParamList.begin(); - it != sky_mgr.mParamList.end(); ++it) - { - const LLWLParamKey& key = it->first; + 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); - std::string item_title = key.name; - if (key.scope == LLEnvKey::SCOPE_REGION) + if (include_region_skies) + { + // Add region presets. + for (LLWLParamManager::preset_name_list_t::const_iterator it = region_presets.begin(); it != region_presets.end(); ++it) { - if (!include_region_skies) - { - continue; - } + std::string preset_name = *it; + std::string item_title = preset_name + " (" + getRegionName() + ")"; + mSkyPresetsCombo->add(preset_name, LLWLParamKey(*it, LLEnvKey::SCOPE_REGION).toStringVal()); + } - item_title += " (" + getRegionName() + ")"; + if (!region_presets.empty()) + { + mSkyPresetsCombo->addSeparator(); } + } + + // Add user presets. + for (LLWLParamManager::preset_name_list_t::const_iterator it = user_presets.begin(); it != user_presets.end(); ++it) + { + mSkyPresetsCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toStringVal()); + } + + if (!user_presets.empty()) + { + mSkyPresetsCombo->addSeparator(); + } - mSkyPresetsCombo->add(item_title, LLSD(key.toStringVal())); + // Add system presets. + for (LLWLParamManager::preset_name_list_t::const_iterator it = sys_presets.begin(); it != sys_presets.end(); ++it) + { + mSkyPresetsCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toStringVal()); } // set defaults on combo boxes -- cgit v1.2.3 From ab431d1774d5b282836a3327dd0bfa8b3b91632b Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 14 Jun 2011 18:04:29 +0300 Subject: STORM-1305 WIP User day cycles now go first in all lists. --- indra/newview/llfloatereditdaycycle.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'indra/newview/llfloatereditdaycycle.cpp') diff --git a/indra/newview/llfloatereditdaycycle.cpp b/indra/newview/llfloatereditdaycycle.cpp index 4f4739384d..165b271133 100644 --- a/indra/newview/llfloatereditdaycycle.cpp +++ b/indra/newview/llfloatereditdaycycle.cpp @@ -287,11 +287,24 @@ void LLFloaterEditDayCycle::refreshDayCyclesList() } #endif - const LLDayCycleManager::dc_map_t& map = LLDayCycleManager::instance().getPresets(); - for (LLDayCycleManager::dc_map_t::const_iterator it = map.begin(); it != map.end(); ++it) + LLDayCycleManager::preset_name_list_t user_days, sys_days; + LLDayCycleManager::instance().getPresetNames(user_days, sys_days); + + // Add user days. + for (LLDayCycleManager::preset_name_list_t::const_iterator it = user_days.begin(); it != user_days.end(); ++it) { - LLWLParamKey key(it->first, LLEnvKey::SCOPE_LOCAL); - mDayCyclesCombo->add(key.name, key.toLLSD()); + mDayCyclesCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toLLSD()); + } + + if (user_days.size() > 0) + { + mDayCyclesCombo->addSeparator(); + } + + // Add system days. + for (LLDayCycleManager::preset_name_list_t::const_iterator it = sys_days.begin(); it != sys_days.end(); ++it) + { + mDayCyclesCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toLLSD()); } mDayCyclesCombo->setLabel(getString("combo_label")); -- cgit v1.2.3 From 31c1cff64fe6e963722e580c8779d69cef4b14ba Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 6 Jul 2011 00:42:28 +0300 Subject: STORM-1262 FIXED Removed the original Windlight Region Settings implementation. --- indra/newview/llfloatereditdaycycle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llfloatereditdaycycle.cpp') diff --git a/indra/newview/llfloatereditdaycycle.cpp b/indra/newview/llfloatereditdaycycle.cpp index 165b271133..b63677b258 100644 --- a/indra/newview/llfloatereditdaycycle.cpp +++ b/indra/newview/llfloatereditdaycycle.cpp @@ -423,7 +423,7 @@ void LLFloaterEditDayCycle::onAddKey() if ((S32)mSliderToKey.size() >= max_sliders) { LLSD args; - args["SCOPE"] = LLEnvManager::getScopeString(scope); + args["SCOPE"] = LLEnvManagerNew::getScopeString(scope); args["MAX"] = max_sliders; LLNotificationsUtil::add("DayCycleTooManyKeyframes", args, LLSD(), LLNotificationFunctorRegistry::instance().DONOTHING); return; -- cgit v1.2.3