From e045d212d35354d679c2d2e05c6d4689f9f8ac95 Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Mon, 27 Sep 2010 22:56:08 -0400 Subject: STORM-1126 WIP Windlight Estate Settings port from 1.23: first pass at merging in windlight estate settings to viewer-dev codebase. not built, not tested. Probably needs a bunch of fixes to be able to be integrated. (resubmitted by Vadim ProductEngine) --- indra/newview/llfloaterdaycycle.cpp | 436 +++++++++++++++++++++++------------- 1 file changed, 275 insertions(+), 161 deletions(-) (limited to 'indra/newview/llfloaterdaycycle.cpp') diff --git a/indra/newview/llfloaterdaycycle.cpp b/indra/newview/llfloaterdaycycle.cpp index 22816ee802..efaac5cfc5 100644 --- a/indra/newview/llfloaterdaycycle.cpp +++ b/indra/newview/llfloaterdaycycle.cpp @@ -2,25 +2,31 @@ * @file llfloaterdaycycle.cpp * @brief LLFloaterDayCycle class definition * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * $LicenseInfo:firstyear=2007&license=viewergpl$ + * + * Copyright (c) 2007-2009, 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. + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 * - * 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. + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * - * 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 + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. * $/LicenseInfo$ */ @@ -51,34 +57,23 @@ #include "llwlparammanager.h" #include "llpostprocess.h" #include "llfloaterwindlight.h" +#include "llwindlightscrubbers.h" +#include "llenvmanager.h" - -std::map LLFloaterDayCycle::sSliderToKey; +LLFloaterDayCycle* LLFloaterDayCycle::sDayCycle = NULL; const F32 LLFloaterDayCycle::sHoursPerDay = 24.0f; +std::map LLFloaterDayCycle::sSliderToKey; +LLEnvKey::EScope LLFloaterDayCycle::sScope; +std::string LLFloaterDayCycle::sOriginalTitle; +LLWLAnimator::ETime LLFloaterDayCycle::sPreviousTimeType = LLWLAnimator::TIME_LINDEN; -LLFloaterDayCycle::LLFloaterDayCycle(const LLSD& key) -: LLFloater(key) +LLFloaterDayCycle::LLFloaterDayCycle() : LLFloater(std::string("Day Cycle Floater")) { -} + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_day_cycle_options.xml", NULL, FALSE); + sOriginalTitle = getTitle(); -BOOL LLFloaterDayCycle::postBuild() -{ - // add the combo boxes - LLComboBox* keyCombo = getChild("WLKeyPresets"); - - if(keyCombo != NULL) - { - keyCombo->removeall(); - std::map::iterator mIt = - LLWLParamManager::instance()->mParamList.begin(); - for(; mIt != LLWLParamManager::instance()->mParamList.end(); mIt++) - { - keyCombo->add(std::string(mIt->first)); - } - - // set defaults on combo boxes - keyCombo->selectFirstItem(); - } + llassert(MAX_LOCAL_KEY_FRAMES <= getChild("WLDayCycleKeys")->getMaxSliderCount() && + MAX_REGION_KEYFRAMES <= getChild("WLDayCycleKeys")->getMaxSliderCount()); // add the time slider LLMultiSliderCtrl* sldr = getChild("WLTimeSlider"); @@ -87,57 +82,67 @@ BOOL LLFloaterDayCycle::postBuild() // load it up initCallbacks(); - - syncMenu(); - syncSliderTrack(); - - return TRUE; } LLFloaterDayCycle::~LLFloaterDayCycle() { } +void LLFloaterDayCycle::onClickHelp(void* data) +{ + LLFloaterDayCycle* self = LLFloaterDayCycle::instance(); + + std::string xml_alert = *(std::string *) data; + LLNotifications::instance().add(self->contextualNotification(xml_alert)); +} + +void LLFloaterDayCycle::initHelpBtn(const std::string& name, const std::string& xml_alert) +{ + childSetAction(name, onClickHelp, new std::string(xml_alert)); +} + void LLFloaterDayCycle::initCallbacks(void) { + initHelpBtn("WLDayCycleHelp", "HelpDayCycle"); + // WL Day Cycle - getChild("WLTimeSlider")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onTimeSliderMoved, this, _1)); - getChild("WLDayCycleKeys")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onKeyTimeMoved, this, _1)); - getChild("WLCurKeyHour")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onKeyTimeChanged, this, _1)); - getChild("WLCurKeyMin")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onKeyTimeChanged, this, _1)); - getChild("WLKeyPresets")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onKeyPresetChanged, this, _1)); - - getChild("WLLengthOfDayHour")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onTimeRateChanged, this, _1)); - getChild("WLLengthOfDayMin")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onTimeRateChanged, this, _1)); - getChild("WLLengthOfDaySec")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onTimeRateChanged, this, _1)); - getChild("WLUseLindenTime")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onUseLindenTime, this, _1)); - getChild("WLAnimSky")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onRunAnimSky, this, _1)); - getChild("WLStopAnimSky")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onStopAnimSky, this, _1)); - - getChild("WLLoadDayCycle")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onLoadDayCycle, this, _1)); - getChild("WLSaveDayCycle")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onSaveDayCycle, this, _1)); - - getChild("WLAddKey")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onAddKey, this, _1)); - getChild("WLDeleteKey")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onDeleteKey, this, _1)); + childSetCommitCallback("WLTimeSlider", onTimeSliderMoved, NULL); + childSetCommitCallback("WLDayCycleKeys", onKeyTimeMoved, NULL); + childSetCommitCallback("WLCurKeyHour", onKeyTimeChanged, NULL); + childSetCommitCallback("WLCurKeyMin", onKeyTimeChanged, NULL); + childSetCommitCallback("WLKeyPresets", onKeyPresetChanged, NULL); + + childSetCommitCallback("WLLengthOfDayHour", onTimeRateChanged, NULL); + childSetCommitCallback("WLLengthOfDayMin", onTimeRateChanged, NULL); + childSetCommitCallback("WLLengthOfDaySec", onTimeRateChanged, NULL); + childSetAction("WLUseLindenTime", onUseLindenTime, NULL); + childSetAction("WLAnimSky", onRunAnimSky, NULL); + childSetAction("WLStopAnimSky", onStopAnimSky, NULL); + + childSetAction("WLLoadDayCycle", onLoadDayCycle, NULL); + childSetAction("WLSaveDayCycle", onSaveDayCycle, NULL); + + childSetAction("WLAddKey", onAddKey, NULL); + childSetAction("WLDeleteKey", onDeleteKey, NULL); } void LLFloaterDayCycle::syncMenu() { -// std::map & currentParams = LLWLParamManager::instance()->mCurParams.mParamValues; +// std::map & currentParams = LLWLParamManager::getInstance()->mCurParams.mParamValues; // set time - LLMultiSliderCtrl* sldr = getChild("WLTimeSlider"); - sldr->setCurSliderValue((F32)LLWLParamManager::instance()->mAnimator.getDayTime() * sHoursPerDay); + LLMultiSliderCtrl* sldr = LLFloaterDayCycle::sDayCycle->getChild("WLTimeSlider"); + sldr->setCurSliderValue((F32)LLWLParamManager::getInstance()->mAnimator.getDayTime() * sHoursPerDay); - LLSpinCtrl* secSpin = getChild("WLLengthOfDaySec"); - LLSpinCtrl* minSpin = getChild("WLLengthOfDayMin"); - LLSpinCtrl* hourSpin = getChild("WLLengthOfDayHour"); + LLSpinCtrl* secSpin = sDayCycle->getChild("WLLengthOfDaySec"); + LLSpinCtrl* minSpin = sDayCycle->getChild("WLLengthOfDayMin"); + LLSpinCtrl* hourSpin = sDayCycle->getChild("WLLengthOfDayHour"); F32 curRate; F32 hours, min, sec; // get the current rate - curRate = LLWLParamManager::instance()->mDay.mDayRate; + curRate = LLWLParamManager::getInstance()->mDay.mDayRate; hours = (F32)((int)(curRate / 60 / 60)); curRate -= (hours * 60 * 60); min = (F32)((int)(curRate / 60)); @@ -149,28 +154,28 @@ void LLFloaterDayCycle::syncMenu() secSpin->setValue(sec); // turn off Use Estate Time button if it's already being used - if( LLWLParamManager::instance()->mAnimator.mUseLindenTime == true) + if( LLWLParamManager::getInstance()->mAnimator.getUseLindenTime()) { - getChildView("WLUseLindenTime")->setEnabled(FALSE); + LLFloaterDayCycle::sDayCycle->childDisable("WLUseLindenTime"); } else { - getChildView("WLUseLindenTime")->setEnabled(TRUE); + LLFloaterDayCycle::sDayCycle->childEnable("WLUseLindenTime"); } } void LLFloaterDayCycle::syncSliderTrack() { // clear the slider - LLMultiSliderCtrl* kSldr = getChild("WLDayCycleKeys"); + LLMultiSliderCtrl* kSldr = sDayCycle->getChild("WLDayCycleKeys"); kSldr->clear(); sSliderToKey.clear(); // add sliders - std::map::iterator mIt = - LLWLParamManager::instance()->mDay.mTimeMap.begin(); - for(; mIt != LLWLParamManager::instance()->mDay.mTimeMap.end(); mIt++) + std::map::iterator mIt = + LLWLParamManager::getInstance()->mDay.mTimeMap.begin(); + for(; mIt != LLWLParamManager::getInstance()->mDay.mTimeMap.end(); mIt++) { addSliderKey(mIt->first * sHoursPerDay, mIt->second); } @@ -185,34 +190,115 @@ void LLFloaterDayCycle::syncTrack() } LLMultiSliderCtrl* sldr; - sldr = getChild( + sldr = sDayCycle->getChild( "WLDayCycleKeys"); llassert_always(sSliderToKey.size() == sldr->getValue().size()); LLMultiSliderCtrl* tSldr; - tSldr = getChild( + tSldr = sDayCycle->getChild( "WLTimeSlider"); // create a new animation track - LLWLParamManager::instance()->mDay.clearKeys(); + LLWLParamManager::getInstance()->mDay.clearKeyframes(); // add the keys one by one - std::map::iterator mIt = sSliderToKey.begin(); + std::map::iterator mIt = sSliderToKey.begin(); for(; mIt != sSliderToKey.end(); mIt++) { - LLWLParamManager::instance()->mDay.addKey(mIt->second.time / sHoursPerDay, - mIt->second.presetName); + LLWLParamManager::getInstance()->mDay.addKeyframe(mIt->second.time / sHoursPerDay, + mIt->second.keyframe); } // set the param manager's track to the new one - LLWLParamManager::instance()->resetAnimator( + LLWLParamManager::getInstance()->resetAnimator( tSldr->getCurSliderValue() / sHoursPerDay, false); - LLWLParamManager::instance()->mAnimator.update( - LLWLParamManager::instance()->mCurParams); + LLWLParamManager::getInstance()->mAnimator.update( + LLWLParamManager::getInstance()->mCurParams); +} + +void LLFloaterDayCycle::refreshPresetsFromParamManager() +{ + LLComboBox* keyCombo = sDayCycle->getChild("WLKeyPresets"); + + if(keyCombo != NULL) + { + std::map::iterator mIt = + LLWLParamManager::getInstance()->mParamList.begin(); + for(; mIt != LLWLParamManager::getInstance()->mParamList.end(); mIt++) + { + if(mIt->first.scope <= sScope) + { + llinfos << "Adding key: " << mIt->first.toString() << llendl; + keyCombo->add(mIt->first.toString(), LLSD(mIt->first.toStringVal())); + } + } + + // set defaults on combo boxes + keyCombo->selectFirstItem(); + } } -void LLFloaterDayCycle::onRunAnimSky(LLUICtrl* ctrl) +// static +LLFloaterDayCycle* LLFloaterDayCycle::instance() +{ + if (!sDayCycle) + { + sDayCycle = new LLFloaterDayCycle(); + // sDayCycle->open(); + // sDayCycle->setFocus(TRUE); + } + return sDayCycle; +} + +bool LLFloaterDayCycle::isOpen() +{ + if (sDayCycle != NULL) + { + return true; + } + return false; +} + +void LLFloaterDayCycle::show(LLEnvKey::EScope scope) +{ + LLFloaterDayCycle* dayCycle = instance(); + if(scope != sScope && ((LLView*)dayCycle)->getVisible()) + { + LLNotifications::instance().add("EnvOtherScopeAlreadyOpen", LLSD()); + return; + } + sScope = scope; + std::string title = sOriginalTitle + " (" + LLEnvManager::getScopeString(sScope) + ")"; + dayCycle->setTitle(title); + refreshPresetsFromParamManager(); + dayCycle->syncMenu(); + syncSliderTrack(); + + // set drop-down menu to match preset of currently-selected keyframe (one is automatically selected initially) + const std::string& curSldr = sDayCycle->getChild("WLDayCycleKeys")->getCurSlider(); + if(strlen(curSldr.c_str()) > 0) // only do this if there is a curSldr, otherwise we put an invalid entry into the map + { + sDayCycle->getChild("WLKeyPresets")->selectByValue(sSliderToKey[curSldr].keyframe.toStringVal()); + } + + // comment in if you want the menu to rebuild each time + //LLUICtrlFactory::getInstance()->buildFloater(dayCycle, "floater_day_cycle_options.xml"); + //dayCycle->initCallbacks(); + + dayCycle->open(); +} + +// virtual +void LLFloaterDayCycle::onClose(bool app_quitting) +{ + if (sDayCycle) + { + sDayCycle->setVisible(FALSE); + } +} + +void LLFloaterDayCycle::onRunAnimSky(void* userData) { // if no keys, do nothing if(sSliderToKey.size() == 0) @@ -221,46 +307,47 @@ void LLFloaterDayCycle::onRunAnimSky(LLUICtrl* ctrl) } LLMultiSliderCtrl* sldr; - sldr = getChild("WLDayCycleKeys"); + sldr = sDayCycle->getChild("WLDayCycleKeys"); llassert_always(sSliderToKey.size() == sldr->getValue().size()); - LLMultiSliderCtrl* tSldr; - tSldr = getChild("WLTimeSlider"); + LLMultiSliderCtrl* tSldr = sDayCycle->getChild("WLTimeSlider"); + + sPreviousTimeType = LLWLParamManager::getInstance()->mAnimator.getTimeType(); // turn off linden time - LLWLParamManager::instance()->mAnimator.mUseLindenTime = false; + LLWLParamManager::getInstance()->mAnimator.setTimeType(LLWLAnimator::TIME_CUSTOM); // set the param manager's track to the new one - LLWLParamManager::instance()->resetAnimator( - tSldr->getCurSliderValue() / sHoursPerDay, true); + LLWLParamManager::getInstance()->resetAnimator(tSldr->getCurSliderValue() / sHoursPerDay, true); - llassert_always(LLWLParamManager::instance()->mAnimator.mTimeTrack.size() == sldr->getValue().size()); + llassert_always(LLWLParamManager::getInstance()->mAnimator.mTimeTrack.size() == sldr->getValue().size()); } -void LLFloaterDayCycle::onStopAnimSky(LLUICtrl* ctrl) +void LLFloaterDayCycle::onStopAnimSky(void* userData) { // if no keys, do nothing if(sSliderToKey.size() == 0) { return; } - // turn off animation and using linden time - LLWLParamManager::instance()->mAnimator.mIsRunning = false; - LLWLParamManager::instance()->mAnimator.mUseLindenTime = false; + LLWLParamManager::getInstance()->mAnimator.deactivate(); // turn off animation and using linden time + LLMultiSliderCtrl* tSldr = sDayCycle->getChild("WLTimeSlider"); + LLWLParamManager::getInstance()->resetAnimator(tSldr->getCurSliderValue() / sHoursPerDay, false); + LLWLParamManager::getInstance()->mAnimator.setTimeType(sPreviousTimeType); } -void LLFloaterDayCycle::onUseLindenTime(LLUICtrl* ctrl) +void LLFloaterDayCycle::onUseLindenTime(void* userData) { - LLComboBox* box = getChild("WLPresetsCombo"); + LLFloaterWindLight* wl = LLFloaterWindLight::instance(); + LLComboBox* box = wl->getChild("WLPresetsCombo"); box->selectByValue(""); - LLWLParamManager::instance()->mAnimator.mIsRunning = true; - LLWLParamManager::instance()->mAnimator.mUseLindenTime = true; + LLWLParamManager::getInstance()->mAnimator.deactivate(); } -void LLFloaterDayCycle::onLoadDayCycle(LLUICtrl* ctrl) +void LLFloaterDayCycle::onLoadDayCycle(void* userData) { - LLWLParamManager::instance()->mDay.loadDayCycle("Default.xml"); + LLWLParamManager::getInstance()->mDay.loadDayCycleFromFile("Default.xml"); // sync it all up syncSliderTrack(); @@ -268,46 +355,45 @@ void LLFloaterDayCycle::onLoadDayCycle(LLUICtrl* ctrl) // set the param manager's track to the new one LLMultiSliderCtrl* tSldr; - tSldr = getChild( + tSldr = sDayCycle->getChild( "WLTimeSlider"); - LLWLParamManager::instance()->resetAnimator( + LLWLParamManager::getInstance()->resetAnimator( tSldr->getCurSliderValue() / sHoursPerDay, false); // and draw it - LLWLParamManager::instance()->mAnimator.update( - LLWLParamManager::instance()->mCurParams); + LLWLParamManager::getInstance()->mAnimator.update( + LLWLParamManager::getInstance()->mCurParams); } -void LLFloaterDayCycle::onSaveDayCycle(LLUICtrl* ctrl) +void LLFloaterDayCycle::onSaveDayCycle(void* userData) { - LLWLParamManager::instance()->mDay.saveDayCycle("Default.xml"); + LLWLParamManager::getInstance()->mDay.saveDayCycle("Default.xml"); } -void LLFloaterDayCycle::onTimeSliderMoved(LLUICtrl* ctrl) +void LLFloaterDayCycle::onTimeSliderMoved(LLUICtrl* ctrl, void* userData) { - LLMultiSliderCtrl* sldr = getChild( + LLMultiSliderCtrl* sldr = sDayCycle->getChild( "WLTimeSlider"); /// get the slider value F32 val = sldr->getCurSliderValue() / sHoursPerDay; // set the value, turn off animation - LLWLParamManager::instance()->mAnimator.setDayTime((F64)val); - LLWLParamManager::instance()->mAnimator.mIsRunning = false; - LLWLParamManager::instance()->mAnimator.mUseLindenTime = false; + LLWLParamManager::getInstance()->mAnimator.setDayTime((F64)val); + LLWLParamManager::getInstance()->mAnimator.deactivate(); // then call update once - LLWLParamManager::instance()->mAnimator.update( - LLWLParamManager::instance()->mCurParams); + LLWLParamManager::getInstance()->mAnimator.update( + LLWLParamManager::getInstance()->mCurParams); } -void LLFloaterDayCycle::onKeyTimeMoved(LLUICtrl* ctrl) +void LLFloaterDayCycle::onKeyTimeMoved(LLUICtrl* ctrl, void* userData) { - LLComboBox* comboBox = getChild("WLKeyPresets"); - LLMultiSliderCtrl* sldr = getChild("WLDayCycleKeys"); - LLSpinCtrl* hourSpin = getChild("WLCurKeyHour"); - LLSpinCtrl* minSpin = getChild("WLCurKeyMin"); + LLComboBox* comboBox = sDayCycle->getChild("WLKeyPresets"); + LLMultiSliderCtrl* sldr = sDayCycle->getChild("WLDayCycleKeys"); + LLSpinCtrl* hourSpin = sDayCycle->getChild("WLCurKeyHour"); + LLSpinCtrl* minSpin = sDayCycle->getChild("WLCurKeyMin"); if(sldr->getValue().size() == 0) { return; @@ -322,11 +408,11 @@ void LLFloaterDayCycle::onKeyTimeMoved(LLUICtrl* ctrl) F32 time = sldr->getCurSliderValue(); // check to see if a key exists - std::string presetName = sSliderToKey[curSldr].presetName; + LLWLParamKey key = sSliderToKey[curSldr].keyframe; sSliderToKey[curSldr].time = time; // if it exists, turn on check box - comboBox->selectByValue(presetName); + comboBox->selectByValue(key.toStringVal()); // now set the spinners F32 hour = (F32)((S32)time); @@ -345,18 +431,18 @@ void LLFloaterDayCycle::onKeyTimeMoved(LLUICtrl* ctrl) } -void LLFloaterDayCycle::onKeyTimeChanged(LLUICtrl* ctrl) +void LLFloaterDayCycle::onKeyTimeChanged(LLUICtrl* ctrl, void* userData) { // if no keys, skipped if(sSliderToKey.size() == 0) { return; } - LLMultiSliderCtrl* sldr = getChild( + LLMultiSliderCtrl* sldr = sDayCycle->getChild( "WLDayCycleKeys"); - LLSpinCtrl* hourSpin = getChild( + LLSpinCtrl* hourSpin = sDayCycle->getChild( "WLCurKeyHour"); - LLSpinCtrl* minSpin = getChild( + LLSpinCtrl* minSpin = sDayCycle->getChild( "WLCurKeyMin"); F32 hour = hourSpin->get(); @@ -368,18 +454,17 @@ void LLFloaterDayCycle::onKeyTimeChanged(LLUICtrl* ctrl) F32 time = sldr->getCurSliderValue() / sHoursPerDay; // now set the key's time in the sliderToKey map - std::string presetName = sSliderToKey[curSldr].presetName; sSliderToKey[curSldr].time = time; syncTrack(); } -void LLFloaterDayCycle::onKeyPresetChanged(LLUICtrl* ctrl) +void LLFloaterDayCycle::onKeyPresetChanged(LLUICtrl* ctrl, void* userData) { // get the time - LLComboBox* comboBox = getChild( + LLComboBox* comboBox = sDayCycle->getChild( "WLKeyPresets"); - LLMultiSliderCtrl* sldr = getChild( + LLMultiSliderCtrl* sldr = sDayCycle->getChild( "WLDayCycleKeys"); // do nothing if no sliders @@ -388,7 +473,9 @@ void LLFloaterDayCycle::onKeyPresetChanged(LLUICtrl* ctrl) } // change the map - std::string newPreset(comboBox->getSelectedValue().asString()); + + std::string stringVal = comboBox->getSelectedValue().asString(); + LLWLParamKey newKey(stringVal); const std::string& curSldr = sldr->getCurSlider(); // if null, don't use @@ -396,21 +483,21 @@ void LLFloaterDayCycle::onKeyPresetChanged(LLUICtrl* ctrl) return; } - sSliderToKey[curSldr].presetName = newPreset; + sSliderToKey[curSldr].keyframe = newKey; syncTrack(); } -void LLFloaterDayCycle::onTimeRateChanged(LLUICtrl* ctrl) +void LLFloaterDayCycle::onTimeRateChanged(LLUICtrl* ctrl, void* userData) { // get the time - LLSpinCtrl* secSpin = getChild( + LLSpinCtrl* secSpin = sDayCycle->getChild( "WLLengthOfDaySec"); - LLSpinCtrl* minSpin = getChild( + LLSpinCtrl* minSpin = sDayCycle->getChild( "WLLengthOfDayMin"); - LLSpinCtrl* hourSpin = getChild( + LLSpinCtrl* hourSpin = sDayCycle->getChild( "WLLengthOfDayHour"); F32 hour; @@ -424,34 +511,57 @@ void LLFloaterDayCycle::onTimeRateChanged(LLUICtrl* ctrl) if(time <= 0) { time = 1; } - LLWLParamManager::instance()->mDay.mDayRate = time; + LLWLParamManager::getInstance()->mDay.mDayRate = time; syncTrack(); } -void LLFloaterDayCycle::onAddKey(LLUICtrl* ctrl) +void LLFloaterDayCycle::onAddKey(void* userData) { - LLComboBox* comboBox = getChild( + LLComboBox* comboBox = sDayCycle->getChild( "WLKeyPresets"); - LLMultiSliderCtrl* kSldr = getChild( + LLMultiSliderCtrl* kSldr = sDayCycle->getChild( "WLDayCycleKeys"); - LLMultiSliderCtrl* tSldr = getChild( + LLMultiSliderCtrl* tSldr = sDayCycle->getChild( "WLTimeSlider"); llassert_always(sSliderToKey.size() == kSldr->getValue().size()); + S32 max_sliders; + switch(sScope) + { + case LLEnvKey::SCOPE_LOCAL: + max_sliders = LLWLPacketScrubber::MAX_LOCAL_KEY_FRAMES; + break; + case LLEnvKey::SCOPE_REGION: + max_sliders = LLWLPacketScrubber::MAX_REGION_KEY_FRAMES; + break; + default: + max_sliders = kSldr->getMaxSliderCount(); + break; + } + + if(kSldr->getSliderCount() >= max_sliders) + { + LLSD args; + args["SCOPE"] = LLEnvManager::getScopeString(sScope); + args["MAX"] = max_sliders; + LLNotifications::instance().add("DayCycleTooManyKeyframes", args); + return; + } + // get the values - std::string newPreset(comboBox->getSelectedValue().asString()); + LLWLParamKey newKeyframe(comboBox->getSelectedValue()); // add the slider key - addSliderKey(tSldr->getCurSliderValue(), newPreset); + addSliderKey(tSldr->getCurSliderValue(), newKeyframe); syncTrack(); } -void LLFloaterDayCycle::addSliderKey(F32 time, const std::string & presetName) +void LLFloaterDayCycle::addSliderKey(F32 time, LLWLParamKey keyframe) { - LLMultiSliderCtrl* kSldr = getChild( + LLMultiSliderCtrl* kSldr = sDayCycle->getChild( "WLDayCycleKeys"); // make a slider @@ -461,30 +571,28 @@ void LLFloaterDayCycle::addSliderKey(F32 time, const std::string & presetName) } // set the key - LLWLSkyKey newKey; - newKey.presetName = presetName; - newKey.time = kSldr->getCurSliderValue(); + LLWLCycleSliderKey newKey(keyframe, kSldr->getCurSliderValue()); llassert_always(sldrName != LLStringUtil::null); // add to map - sSliderToKey.insert(std::pair(sldrName, newKey)); + sSliderToKey.insert(std::pair(sldrName, newKey)); llassert_always(sSliderToKey.size() == kSldr->getValue().size()); } -void LLFloaterDayCycle::deletePreset(std::string& presetName) +void LLFloaterDayCycle::deletePreset(LLWLParamKey keyframe) { - LLMultiSliderCtrl* sldr = getChild("WLDayCycleKeys"); + LLMultiSliderCtrl* sldr = sDayCycle->getChild("WLDayCycleKeys"); /// delete any reference - std::map::iterator curr_preset, next_preset; + std::map::iterator curr_preset, next_preset; for(curr_preset = sSliderToKey.begin(); curr_preset != sSliderToKey.end(); curr_preset = next_preset) { next_preset = curr_preset; ++next_preset; - if (curr_preset->second.presetName == presetName) + if (curr_preset->second.keyframe == keyframe) { sldr->deleteSlider(curr_preset->first); sSliderToKey.erase(curr_preset); @@ -492,19 +600,25 @@ void LLFloaterDayCycle::deletePreset(std::string& presetName) } } -void LLFloaterDayCycle::onDeleteKey(LLUICtrl* ctrl) +void LLFloaterDayCycle::onDeleteKey(void* userData) { - if(sSliderToKey.size() == 0) { + if(sSliderToKey.size() == 0) + { + return; + } + else if(sSliderToKey.size() == 1) + { + LLNotifications::instance().add("EnvCannotDeleteLastDayCycleKey", LLSD()); return; } - LLComboBox* comboBox = getChild( + LLComboBox* comboBox = sDayCycle->getChild( "WLKeyPresets"); - LLMultiSliderCtrl* sldr = getChild("WLDayCycleKeys"); + LLMultiSliderCtrl* sldr = sDayCycle->getChild("WLDayCycleKeys"); // delete from map const std::string& sldrName = sldr->getCurSlider(); - std::map::iterator mIt = sSliderToKey.find(sldrName); + std::map::iterator mIt = sSliderToKey.find(sldrName); sSliderToKey.erase(mIt); sldr->deleteCurSlider(); @@ -514,11 +628,11 @@ void LLFloaterDayCycle::onDeleteKey(LLUICtrl* ctrl) } const std::string& name = sldr->getCurSlider(); - comboBox->selectByValue(sSliderToKey[name].presetName); + comboBox->selectByValue(sSliderToKey[name].keyframe.toLLSD()); F32 time = sSliderToKey[name].time; - LLSpinCtrl* hourSpin = getChild("WLCurKeyHour"); - LLSpinCtrl* minSpin = getChild("WLCurKeyMin"); + LLSpinCtrl* hourSpin = sDayCycle->getChild("WLCurKeyHour"); + LLSpinCtrl* minSpin = sDayCycle->getChild("WLCurKeyMin"); // now set the spinners F32 hour = (F32)((S32)time); -- cgit v1.2.3 From 2fb337bc12984f9abecfbc7f3918c372a7b5ac6c Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Thu, 30 Sep 2010 23:21:23 -0400 Subject: STORM-1126 WIP Windlight Estate Settings port from 1.23: second pass at getting windlight ported to V2. Lots of cleanup in the floater classes. Not sure every decision was correct but it compiles now. Doesn't link yet. (resubmitted by Vadim ProductEngine) --- indra/newview/llfloaterdaycycle.cpp | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'indra/newview/llfloaterdaycycle.cpp') diff --git a/indra/newview/llfloaterdaycycle.cpp b/indra/newview/llfloaterdaycycle.cpp index efaac5cfc5..48f91aa64a 100644 --- a/indra/newview/llfloaterdaycycle.cpp +++ b/indra/newview/llfloaterdaycycle.cpp @@ -47,6 +47,7 @@ #include "llcombobox.h" #include "lllineeditor.h" #include "llwlanimator.h" +#include "llnotifications.h" #include "v4math.h" #include "llviewerdisplay.h" @@ -59,6 +60,7 @@ #include "llfloaterwindlight.h" #include "llwindlightscrubbers.h" #include "llenvmanager.h" +#include "llfloaterreg.h" LLFloaterDayCycle* LLFloaterDayCycle::sDayCycle = NULL; const F32 LLFloaterDayCycle::sHoursPerDay = 24.0f; @@ -67,13 +69,12 @@ LLEnvKey::EScope LLFloaterDayCycle::sScope; std::string LLFloaterDayCycle::sOriginalTitle; LLWLAnimator::ETime LLFloaterDayCycle::sPreviousTimeType = LLWLAnimator::TIME_LINDEN; -LLFloaterDayCycle::LLFloaterDayCycle() : LLFloater(std::string("Day Cycle Floater")) +LLFloaterDayCycle::LLFloaterDayCycle(const LLSD &key) : LLFloater(key) { - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_day_cycle_options.xml", NULL, FALSE); sOriginalTitle = getTitle(); - llassert(MAX_LOCAL_KEY_FRAMES <= getChild("WLDayCycleKeys")->getMaxSliderCount() && - MAX_REGION_KEYFRAMES <= getChild("WLDayCycleKeys")->getMaxSliderCount()); + llassert(LLWLPacketScrubber::MAX_LOCAL_KEY_FRAMES <= getChild("WLDayCycleKeys")->getMaxValue() && + LLWLPacketScrubber::MAX_REGION_KEY_FRAMES <= getChild("WLDayCycleKeys")->getMaxValue()); // add the time slider LLMultiSliderCtrl* sldr = getChild("WLTimeSlider"); @@ -90,10 +91,8 @@ LLFloaterDayCycle::~LLFloaterDayCycle() void LLFloaterDayCycle::onClickHelp(void* data) { - LLFloaterDayCycle* self = LLFloaterDayCycle::instance(); - std::string xml_alert = *(std::string *) data; - LLNotifications::instance().add(self->contextualNotification(xml_alert)); + LLNotifications::instance().add(xml_alert, LLSD(), LLSD()); } void LLFloaterDayCycle::initHelpBtn(const std::string& name, const std::string& xml_alert) @@ -244,7 +243,7 @@ LLFloaterDayCycle* LLFloaterDayCycle::instance() { if (!sDayCycle) { - sDayCycle = new LLFloaterDayCycle(); + sDayCycle = new LLFloaterDayCycle("Day Cycle Floater"); // sDayCycle->open(); // sDayCycle->setFocus(TRUE); } @@ -265,7 +264,7 @@ void LLFloaterDayCycle::show(LLEnvKey::EScope scope) LLFloaterDayCycle* dayCycle = instance(); if(scope != sScope && ((LLView*)dayCycle)->getVisible()) { - LLNotifications::instance().add("EnvOtherScopeAlreadyOpen", LLSD()); + LLNotifications::instance().add("EnvOtherScopeAlreadyOpen", LLSD(), LLSD()); return; } sScope = scope; @@ -286,7 +285,7 @@ void LLFloaterDayCycle::show(LLEnvKey::EScope scope) //LLUICtrlFactory::getInstance()->buildFloater(dayCycle, "floater_day_cycle_options.xml"); //dayCycle->initCallbacks(); - dayCycle->open(); + dayCycle->openFloater(); } // virtual @@ -537,16 +536,16 @@ void LLFloaterDayCycle::onAddKey(void* userData) max_sliders = LLWLPacketScrubber::MAX_REGION_KEY_FRAMES; break; default: - max_sliders = kSldr->getMaxSliderCount(); + max_sliders = (S32)kSldr->getMaxValue(); break; } - if(kSldr->getSliderCount() >= max_sliders) + if(kSldr->getValue().asInteger() >= max_sliders) { LLSD args; args["SCOPE"] = LLEnvManager::getScopeString(sScope); args["MAX"] = max_sliders; - LLNotifications::instance().add("DayCycleTooManyKeyframes", args); + LLNotifications::instance().add("DayCycleTooManyKeyframes", LLSD(), args); return; } @@ -608,7 +607,7 @@ void LLFloaterDayCycle::onDeleteKey(void* userData) } else if(sSliderToKey.size() == 1) { - LLNotifications::instance().add("EnvCannotDeleteLastDayCycleKey", LLSD()); + LLNotifications::instance().add("EnvCannotDeleteLastDayCycleKey", LLSD(), LLSD()); return; } -- cgit v1.2.3 From 6bb02e0e260df2d00ab53376cf15af5e7e2fd12f Mon Sep 17 00:00:00 2001 From: Celierra Darling Date: Mon, 10 Jan 2011 15:06:30 -0500 Subject: STORM-1126 WIP Windlight Estate Settings port from 1.23: Various changes to allow compilation (resubmitted by Vadim ProductEngine) --- indra/newview/llfloaterdaycycle.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'indra/newview/llfloaterdaycycle.cpp') diff --git a/indra/newview/llfloaterdaycycle.cpp b/indra/newview/llfloaterdaycycle.cpp index 48f91aa64a..c54540d827 100644 --- a/indra/newview/llfloaterdaycycle.cpp +++ b/indra/newview/llfloaterdaycycle.cpp @@ -58,7 +58,7 @@ #include "llwlparammanager.h" #include "llpostprocess.h" #include "llfloaterwindlight.h" -#include "llwindlightscrubbers.h" +//#include "llwindlightscrubbers.h" // *HACK commented out since this code isn't released (yet) #include "llenvmanager.h" #include "llfloaterreg.h" @@ -73,8 +73,9 @@ LLFloaterDayCycle::LLFloaterDayCycle(const LLSD &key) : LLFloater(key) { sOriginalTitle = getTitle(); - llassert(LLWLPacketScrubber::MAX_LOCAL_KEY_FRAMES <= getChild("WLDayCycleKeys")->getMaxValue() && - LLWLPacketScrubber::MAX_REGION_KEY_FRAMES <= getChild("WLDayCycleKeys")->getMaxValue()); + // *HACK commented out since this code isn't released (yet) + //llassert(LLWLPacketScrubber::MAX_LOCAL_KEY_FRAMES <= getChild("WLDayCycleKeys")->getMaxValue() && + // LLWLPacketScrubber::MAX_REGION_KEY_FRAMES <= getChild("WLDayCycleKeys")->getMaxValue()); // add the time slider LLMultiSliderCtrl* sldr = getChild("WLTimeSlider"); @@ -530,10 +531,10 @@ void LLFloaterDayCycle::onAddKey(void* userData) switch(sScope) { case LLEnvKey::SCOPE_LOCAL: - max_sliders = LLWLPacketScrubber::MAX_LOCAL_KEY_FRAMES; + max_sliders = 20; // *HACK this should be LLWLPacketScrubber::MAX_LOCAL_KEY_FRAMES; break; case LLEnvKey::SCOPE_REGION: - max_sliders = LLWLPacketScrubber::MAX_REGION_KEY_FRAMES; + max_sliders = 12; // *HACK this should be LLWLPacketScrubber::MAX_REGION_KEY_FRAMES; break; default: max_sliders = (S32)kSldr->getMaxValue(); -- cgit v1.2.3 From 758fdbfe125d75bd2253a69337eab7fec7406ecf Mon Sep 17 00:00:00 2001 From: "tiggs@lindenlab.com" Date: Wed, 23 Feb 2011 17:44:18 -0500 Subject: STORM-1126 WIP Windlight Estate Settings port from 1.23: baseline: read only windlight works (resubmitted by Vadim ProductEngine) --- indra/newview/llfloaterdaycycle.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'indra/newview/llfloaterdaycycle.cpp') diff --git a/indra/newview/llfloaterdaycycle.cpp b/indra/newview/llfloaterdaycycle.cpp index c54540d827..8979c7d6f7 100644 --- a/indra/newview/llfloaterdaycycle.cpp +++ b/indra/newview/llfloaterdaycycle.cpp @@ -338,10 +338,12 @@ void LLFloaterDayCycle::onStopAnimSky(void* userData) void LLFloaterDayCycle::onUseLindenTime(void* userData) { - LLFloaterWindLight* wl = LLFloaterWindLight::instance(); - LLComboBox* box = wl->getChild("WLPresetsCombo"); - box->selectByValue(""); - + LLFloaterWindLight* wlfloater = LLFloaterReg::findTypedInstance("env_windlight"); + if (wlfloater) + { + LLComboBox* box = wlfloater->getChild("WLPresetsCombo"); + box->selectByValue(""); + } LLWLParamManager::getInstance()->mAnimator.deactivate(); } -- cgit v1.2.3 From 79fb8e2ec26dc2c5a42ef1ee48ebaaa39183c67b Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 31 Mar 2011 18:24:01 +0300 Subject: STORM-1126 WIP Windlight Estate Settings integration: pass 4 Changes: * Fixed incorrect way to pass parameters to notifications. * Fixed crashes in the Advanced Sky floater and the Region Terrain panel. * Fixed initialization and multiple instantiation of the Day Cycle floater (that might lead to incorrect behavior). * Fixed and re-enabled committing env. settings changes to region. * Fixed day cycle and sky settings being sent as empty arrays and therefore not passing validation on server. It is now possible to change region environment settings. * Added debug messages. --- indra/newview/llfloaterdaycycle.cpp | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'indra/newview/llfloaterdaycycle.cpp') diff --git a/indra/newview/llfloaterdaycycle.cpp b/indra/newview/llfloaterdaycycle.cpp index 8979c7d6f7..c7132a96ab 100644 --- a/indra/newview/llfloaterdaycycle.cpp +++ b/indra/newview/llfloaterdaycycle.cpp @@ -48,6 +48,7 @@ #include "lllineeditor.h" #include "llwlanimator.h" #include "llnotifications.h" +#include "llnotificationsutil.h" #include "v4math.h" #include "llviewerdisplay.h" @@ -70,6 +71,11 @@ std::string LLFloaterDayCycle::sOriginalTitle; LLWLAnimator::ETime LLFloaterDayCycle::sPreviousTimeType = LLWLAnimator::TIME_LINDEN; LLFloaterDayCycle::LLFloaterDayCycle(const LLSD &key) : LLFloater(key) +{ +} + +// virtual +BOOL LLFloaterDayCycle::postBuild() { sOriginalTitle = getTitle(); @@ -84,6 +90,8 @@ LLFloaterDayCycle::LLFloaterDayCycle(const LLSD &key) : LLFloater(key) // load it up initCallbacks(); + + return TRUE; } LLFloaterDayCycle::~LLFloaterDayCycle() @@ -173,6 +181,9 @@ void LLFloaterDayCycle::syncSliderTrack() sSliderToKey.clear(); // add sliders + + lldebugs << "Adding " << LLWLParamManager::getInstance()->mDay.mTimeMap.size() << " keys to slider" << llendl; + std::map::iterator mIt = LLWLParamManager::getInstance()->mDay.mTimeMap.begin(); for(; mIt != LLWLParamManager::getInstance()->mDay.mTimeMap.end(); mIt++) @@ -183,9 +194,12 @@ void LLFloaterDayCycle::syncSliderTrack() void LLFloaterDayCycle::syncTrack() { + lldebugs << "Syncing track (" << sSliderToKey.size() << ")" << llendl; + // if no keys, do nothing if(sSliderToKey.size() == 0) { + lldebugs << "No keys, not syncing" << llendl; return; } @@ -244,7 +258,9 @@ LLFloaterDayCycle* LLFloaterDayCycle::instance() { if (!sDayCycle) { - sDayCycle = new LLFloaterDayCycle("Day Cycle Floater"); + lldebugs << "Instantiating Day Cycle floater" << llendl; + sDayCycle = LLFloaterReg::getTypedInstance("env_day_cycle"); + llassert(sDayCycle); // sDayCycle->open(); // sDayCycle->setFocus(TRUE); } @@ -294,7 +310,8 @@ void LLFloaterDayCycle::onClose(bool app_quitting) { if (sDayCycle) { - sDayCycle->setVisible(FALSE); + lldebugs << "Destorying Day Cycle floater" << llendl; + sDayCycle = NULL; } } @@ -548,7 +565,7 @@ void LLFloaterDayCycle::onAddKey(void* userData) LLSD args; args["SCOPE"] = LLEnvManager::getScopeString(sScope); args["MAX"] = max_sliders; - LLNotifications::instance().add("DayCycleTooManyKeyframes", LLSD(), args); + LLNotificationsUtil::add("DayCycleTooManyKeyframes", args); return; } -- cgit v1.2.3 From 48309dcb3f5609ae72ca81a161a6efae3b2e91a1 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 31 Mar 2011 18:24:01 +0300 Subject: STORM-1126 WIP Windlight Estate Settings integration: pass 8 Eliminated more merge artifacts (superflous copyright changes). --- indra/newview/llfloaterdaycycle.cpp | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) (limited to 'indra/newview/llfloaterdaycycle.cpp') diff --git a/indra/newview/llfloaterdaycycle.cpp b/indra/newview/llfloaterdaycycle.cpp index c7132a96ab..8fec624edf 100644 --- a/indra/newview/llfloaterdaycycle.cpp +++ b/indra/newview/llfloaterdaycycle.cpp @@ -2,31 +2,25 @@ * @file llfloaterdaycycle.cpp * @brief LLFloaterDayCycle class definition * - * $LicenseInfo:firstyear=2007&license=viewergpl$ - * - * Copyright (c) 2007-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, 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. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * 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. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * 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 * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ -- cgit v1.2.3 From 099da38ca9d6fc4c257d58f92f3892f7fd0fbfc6 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 20 Apr 2011 23:35:43 +0300 Subject: STORM-1158 FIX Added notification when day cycle keyframe limit is reached. Fixed a seemingly wrong condition. Besides, fixed a runtime warning (nonexistent functor) shown when you click "OK" in the notification. --- indra/newview/llfloaterdaycycle.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloaterdaycycle.cpp') diff --git a/indra/newview/llfloaterdaycycle.cpp b/indra/newview/llfloaterdaycycle.cpp index 8fec624edf..6b5b3ee106 100644 --- a/indra/newview/llfloaterdaycycle.cpp +++ b/indra/newview/llfloaterdaycycle.cpp @@ -554,12 +554,12 @@ void LLFloaterDayCycle::onAddKey(void* userData) break; } - if(kSldr->getValue().asInteger() >= max_sliders) + if (sSliderToKey.size() >= max_sliders) { LLSD args; args["SCOPE"] = LLEnvManager::getScopeString(sScope); args["MAX"] = max_sliders; - LLNotificationsUtil::add("DayCycleTooManyKeyframes", args); + LLNotificationsUtil::add("DayCycleTooManyKeyframes", args, LLSD(), LLNotificationFunctorRegistry::instance().DONOTHING); return; } -- cgit v1.2.3 From bc3317576fd48e2b2d42edaba0ad3d765a726959 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 21 Apr 2011 19:12:50 +0300 Subject: Fixing Windows build ("signed/unsigned mismatch" warning). --- indra/newview/llfloaterdaycycle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llfloaterdaycycle.cpp') diff --git a/indra/newview/llfloaterdaycycle.cpp b/indra/newview/llfloaterdaycycle.cpp index 6b5b3ee106..eb429d7803 100644 --- a/indra/newview/llfloaterdaycycle.cpp +++ b/indra/newview/llfloaterdaycycle.cpp @@ -554,7 +554,7 @@ void LLFloaterDayCycle::onAddKey(void* userData) break; } - if (sSliderToKey.size() >= max_sliders) + if ((S32)sSliderToKey.size() >= max_sliders) { LLSD args; args["SCOPE"] = LLEnvManager::getScopeString(sScope); -- cgit v1.2.3 From 5fc0cd9bf7d0c7f97bb63c5f887cce27e27a05f9 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Wed, 25 May 2011 08:55:03 -0400 Subject: storm-1156: remove "test day" controls and associated code --- indra/newview/llfloaterdaycycle.cpp | 134 ------------------------------------ 1 file changed, 134 deletions(-) (limited to 'indra/newview/llfloaterdaycycle.cpp') diff --git a/indra/newview/llfloaterdaycycle.cpp b/indra/newview/llfloaterdaycycle.cpp index eb429d7803..ebf7b98148 100644 --- a/indra/newview/llfloaterdaycycle.cpp +++ b/indra/newview/llfloaterdaycycle.cpp @@ -114,47 +114,16 @@ void LLFloaterDayCycle::initCallbacks(void) childSetCommitCallback("WLCurKeyMin", onKeyTimeChanged, NULL); childSetCommitCallback("WLKeyPresets", onKeyPresetChanged, NULL); - childSetCommitCallback("WLLengthOfDayHour", onTimeRateChanged, NULL); - childSetCommitCallback("WLLengthOfDayMin", onTimeRateChanged, NULL); - childSetCommitCallback("WLLengthOfDaySec", onTimeRateChanged, NULL); - childSetAction("WLUseLindenTime", onUseLindenTime, NULL); - childSetAction("WLAnimSky", onRunAnimSky, NULL); - childSetAction("WLStopAnimSky", onStopAnimSky, NULL); - - childSetAction("WLLoadDayCycle", onLoadDayCycle, NULL); - childSetAction("WLSaveDayCycle", onSaveDayCycle, NULL); - childSetAction("WLAddKey", onAddKey, NULL); childSetAction("WLDeleteKey", onDeleteKey, NULL); } void LLFloaterDayCycle::syncMenu() { -// std::map & currentParams = LLWLParamManager::getInstance()->mCurParams.mParamValues; - // set time LLMultiSliderCtrl* sldr = LLFloaterDayCycle::sDayCycle->getChild("WLTimeSlider"); sldr->setCurSliderValue((F32)LLWLParamManager::getInstance()->mAnimator.getDayTime() * sHoursPerDay); - LLSpinCtrl* secSpin = sDayCycle->getChild("WLLengthOfDaySec"); - LLSpinCtrl* minSpin = sDayCycle->getChild("WLLengthOfDayMin"); - LLSpinCtrl* hourSpin = sDayCycle->getChild("WLLengthOfDayHour"); - - F32 curRate; - F32 hours, min, sec; - - // get the current rate - curRate = LLWLParamManager::getInstance()->mDay.mDayRate; - hours = (F32)((int)(curRate / 60 / 60)); - curRate -= (hours * 60 * 60); - min = (F32)((int)(curRate / 60)); - curRate -= (min * 60); - sec = curRate; - - hourSpin->setValue(hours); - minSpin->setValue(min); - secSpin->setValue(sec); - // turn off Use Estate Time button if it's already being used if( LLWLParamManager::getInstance()->mAnimator.getUseLindenTime()) { @@ -309,81 +278,6 @@ void LLFloaterDayCycle::onClose(bool app_quitting) } } -void LLFloaterDayCycle::onRunAnimSky(void* userData) -{ - // if no keys, do nothing - if(sSliderToKey.size() == 0) - { - return; - } - - LLMultiSliderCtrl* sldr; - sldr = sDayCycle->getChild("WLDayCycleKeys"); - llassert_always(sSliderToKey.size() == sldr->getValue().size()); - - LLMultiSliderCtrl* tSldr = sDayCycle->getChild("WLTimeSlider"); - - sPreviousTimeType = LLWLParamManager::getInstance()->mAnimator.getTimeType(); - - // turn off linden time - LLWLParamManager::getInstance()->mAnimator.setTimeType(LLWLAnimator::TIME_CUSTOM); - - // set the param manager's track to the new one - LLWLParamManager::getInstance()->resetAnimator(tSldr->getCurSliderValue() / sHoursPerDay, true); - - llassert_always(LLWLParamManager::getInstance()->mAnimator.mTimeTrack.size() == sldr->getValue().size()); -} - -void LLFloaterDayCycle::onStopAnimSky(void* userData) -{ - // if no keys, do nothing - if(sSliderToKey.size() == 0) { - return; - } - - LLWLParamManager::getInstance()->mAnimator.deactivate(); // turn off animation and using linden time - LLMultiSliderCtrl* tSldr = sDayCycle->getChild("WLTimeSlider"); - LLWLParamManager::getInstance()->resetAnimator(tSldr->getCurSliderValue() / sHoursPerDay, false); - LLWLParamManager::getInstance()->mAnimator.setTimeType(sPreviousTimeType); -} - -void LLFloaterDayCycle::onUseLindenTime(void* userData) -{ - LLFloaterWindLight* wlfloater = LLFloaterReg::findTypedInstance("env_windlight"); - if (wlfloater) - { - LLComboBox* box = wlfloater->getChild("WLPresetsCombo"); - box->selectByValue(""); - } - LLWLParamManager::getInstance()->mAnimator.deactivate(); -} - -void LLFloaterDayCycle::onLoadDayCycle(void* userData) -{ - LLWLParamManager::getInstance()->mDay.loadDayCycleFromFile("Default.xml"); - - // sync it all up - syncSliderTrack(); - syncMenu(); - - // set the param manager's track to the new one - LLMultiSliderCtrl* tSldr; - tSldr = sDayCycle->getChild( - "WLTimeSlider"); - LLWLParamManager::getInstance()->resetAnimator( - tSldr->getCurSliderValue() / sHoursPerDay, false); - - // and draw it - LLWLParamManager::getInstance()->mAnimator.update( - LLWLParamManager::getInstance()->mCurParams); -} - -void LLFloaterDayCycle::onSaveDayCycle(void* userData) -{ - LLWLParamManager::getInstance()->mDay.saveDayCycle("Default.xml"); -} - - void LLFloaterDayCycle::onTimeSliderMoved(LLUICtrl* ctrl, void* userData) { LLMultiSliderCtrl* sldr = sDayCycle->getChild( @@ -501,34 +395,6 @@ void LLFloaterDayCycle::onKeyPresetChanged(LLUICtrl* ctrl, void* userData) syncTrack(); } -void LLFloaterDayCycle::onTimeRateChanged(LLUICtrl* ctrl, void* userData) -{ - // get the time - LLSpinCtrl* secSpin = sDayCycle->getChild( - "WLLengthOfDaySec"); - - LLSpinCtrl* minSpin = sDayCycle->getChild( - "WLLengthOfDayMin"); - - LLSpinCtrl* hourSpin = sDayCycle->getChild( - "WLLengthOfDayHour"); - - F32 hour; - hour = (F32)hourSpin->getValue().asReal(); - F32 min; - min = (F32)minSpin->getValue().asReal(); - F32 sec; - sec = (F32)secSpin->getValue().asReal(); - - F32 time = 60.0f * 60.0f * hour + 60.0f * min + sec; - if(time <= 0) { - time = 1; - } - LLWLParamManager::getInstance()->mDay.mDayRate = time; - - syncTrack(); -} - void LLFloaterDayCycle::onAddKey(void* userData) { LLComboBox* comboBox = sDayCycle->getChild( -- 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/llfloaterdaycycle.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'indra/newview/llfloaterdaycycle.cpp') diff --git a/indra/newview/llfloaterdaycycle.cpp b/indra/newview/llfloaterdaycycle.cpp index ebf7b98148..9fcfc41f77 100644 --- a/indra/newview/llfloaterdaycycle.cpp +++ b/indra/newview/llfloaterdaycycle.cpp @@ -200,14 +200,15 @@ void LLFloaterDayCycle::refreshPresetsFromParamManager() if(keyCombo != NULL) { - std::map::iterator mIt = - LLWLParamManager::getInstance()->mParamList.begin(); - for(; mIt != LLWLParamManager::getInstance()->mParamList.end(); mIt++) + LLWLParamManager::preset_key_list_t preset_keys; + LLWLParamManager::instance().getPresetKeys(preset_keys); + for (LLWLParamManager::preset_key_list_t::const_iterator it = preset_keys.begin(); it != preset_keys.end(); ++it) { - if(mIt->first.scope <= sScope) + if (it->scope <= sScope) { - llinfos << "Adding key: " << mIt->first.toString() << llendl; - keyCombo->add(mIt->first.toString(), LLSD(mIt->first.toStringVal())); + const LLWLParamKey& key = *it; + llinfos << "Adding key: " << key.toString() << llendl; + keyCombo->add(key.toString(), LLSD(key.toStringVal())); } } -- 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/llfloaterdaycycle.cpp | 525 ------------------------------------ 1 file changed, 525 deletions(-) delete mode 100644 indra/newview/llfloaterdaycycle.cpp (limited to 'indra/newview/llfloaterdaycycle.cpp') diff --git a/indra/newview/llfloaterdaycycle.cpp b/indra/newview/llfloaterdaycycle.cpp deleted file mode 100644 index 9fcfc41f77..0000000000 --- a/indra/newview/llfloaterdaycycle.cpp +++ /dev/null @@ -1,525 +0,0 @@ -/** - * @file llfloaterdaycycle.cpp - * @brief LLFloaterDayCycle class definition - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, 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 "llfloaterdaycycle.h" - -#include "pipeline.h" -#include "llsky.h" - -#include "llsliderctrl.h" -#include "llmultislider.h" -#include "llmultisliderctrl.h" -#include "llspinctrl.h" -#include "llcheckboxctrl.h" -#include "lluictrlfactory.h" -#include "llviewercamera.h" -#include "llcombobox.h" -#include "lllineeditor.h" -#include "llwlanimator.h" -#include "llnotifications.h" -#include "llnotificationsutil.h" - -#include "v4math.h" -#include "llviewerdisplay.h" -#include "llviewercontrol.h" -#include "llviewerwindow.h" - -#include "llwlparamset.h" -#include "llwlparammanager.h" -#include "llpostprocess.h" -#include "llfloaterwindlight.h" -//#include "llwindlightscrubbers.h" // *HACK commented out since this code isn't released (yet) -#include "llenvmanager.h" -#include "llfloaterreg.h" - -LLFloaterDayCycle* LLFloaterDayCycle::sDayCycle = NULL; -const F32 LLFloaterDayCycle::sHoursPerDay = 24.0f; -std::map LLFloaterDayCycle::sSliderToKey; -LLEnvKey::EScope LLFloaterDayCycle::sScope; -std::string LLFloaterDayCycle::sOriginalTitle; -LLWLAnimator::ETime LLFloaterDayCycle::sPreviousTimeType = LLWLAnimator::TIME_LINDEN; - -LLFloaterDayCycle::LLFloaterDayCycle(const LLSD &key) : LLFloater(key) -{ -} - -// virtual -BOOL LLFloaterDayCycle::postBuild() -{ - sOriginalTitle = getTitle(); - - // *HACK commented out since this code isn't released (yet) - //llassert(LLWLPacketScrubber::MAX_LOCAL_KEY_FRAMES <= getChild("WLDayCycleKeys")->getMaxValue() && - // LLWLPacketScrubber::MAX_REGION_KEY_FRAMES <= getChild("WLDayCycleKeys")->getMaxValue()); - - // add the time slider - LLMultiSliderCtrl* sldr = getChild("WLTimeSlider"); - - sldr->addSlider(); - - // load it up - initCallbacks(); - - return TRUE; -} - -LLFloaterDayCycle::~LLFloaterDayCycle() -{ -} - -void LLFloaterDayCycle::onClickHelp(void* data) -{ - std::string xml_alert = *(std::string *) data; - LLNotifications::instance().add(xml_alert, LLSD(), LLSD()); -} - -void LLFloaterDayCycle::initHelpBtn(const std::string& name, const std::string& xml_alert) -{ - childSetAction(name, onClickHelp, new std::string(xml_alert)); -} - -void LLFloaterDayCycle::initCallbacks(void) -{ - initHelpBtn("WLDayCycleHelp", "HelpDayCycle"); - - // WL Day Cycle - childSetCommitCallback("WLTimeSlider", onTimeSliderMoved, NULL); - childSetCommitCallback("WLDayCycleKeys", onKeyTimeMoved, NULL); - childSetCommitCallback("WLCurKeyHour", onKeyTimeChanged, NULL); - childSetCommitCallback("WLCurKeyMin", onKeyTimeChanged, NULL); - childSetCommitCallback("WLKeyPresets", onKeyPresetChanged, NULL); - - childSetAction("WLAddKey", onAddKey, NULL); - childSetAction("WLDeleteKey", onDeleteKey, NULL); -} - -void LLFloaterDayCycle::syncMenu() -{ - // set time - LLMultiSliderCtrl* sldr = LLFloaterDayCycle::sDayCycle->getChild("WLTimeSlider"); - sldr->setCurSliderValue((F32)LLWLParamManager::getInstance()->mAnimator.getDayTime() * sHoursPerDay); - - // turn off Use Estate Time button if it's already being used - if( LLWLParamManager::getInstance()->mAnimator.getUseLindenTime()) - { - LLFloaterDayCycle::sDayCycle->childDisable("WLUseLindenTime"); - } - else - { - LLFloaterDayCycle::sDayCycle->childEnable("WLUseLindenTime"); - } -} - -void LLFloaterDayCycle::syncSliderTrack() -{ - // clear the slider - LLMultiSliderCtrl* kSldr = sDayCycle->getChild("WLDayCycleKeys"); - - kSldr->clear(); - sSliderToKey.clear(); - - // add sliders - - lldebugs << "Adding " << LLWLParamManager::getInstance()->mDay.mTimeMap.size() << " keys to slider" << llendl; - - std::map::iterator mIt = - LLWLParamManager::getInstance()->mDay.mTimeMap.begin(); - for(; mIt != LLWLParamManager::getInstance()->mDay.mTimeMap.end(); mIt++) - { - addSliderKey(mIt->first * sHoursPerDay, mIt->second); - } -} - -void LLFloaterDayCycle::syncTrack() -{ - lldebugs << "Syncing track (" << sSliderToKey.size() << ")" << llendl; - - // if no keys, do nothing - if(sSliderToKey.size() == 0) - { - lldebugs << "No keys, not syncing" << llendl; - return; - } - - LLMultiSliderCtrl* sldr; - sldr = sDayCycle->getChild( - "WLDayCycleKeys"); - llassert_always(sSliderToKey.size() == sldr->getValue().size()); - - LLMultiSliderCtrl* tSldr; - tSldr = sDayCycle->getChild( - "WLTimeSlider"); - - // create a new animation track - LLWLParamManager::getInstance()->mDay.clearKeyframes(); - - // add the keys one by one - std::map::iterator mIt = sSliderToKey.begin(); - for(; mIt != sSliderToKey.end(); mIt++) - { - LLWLParamManager::getInstance()->mDay.addKeyframe(mIt->second.time / sHoursPerDay, - mIt->second.keyframe); - } - - // set the param manager's track to the new one - LLWLParamManager::getInstance()->resetAnimator( - tSldr->getCurSliderValue() / sHoursPerDay, false); - - LLWLParamManager::getInstance()->mAnimator.update( - LLWLParamManager::getInstance()->mCurParams); -} - -void LLFloaterDayCycle::refreshPresetsFromParamManager() -{ - LLComboBox* keyCombo = sDayCycle->getChild("WLKeyPresets"); - - if(keyCombo != NULL) - { - LLWLParamManager::preset_key_list_t preset_keys; - LLWLParamManager::instance().getPresetKeys(preset_keys); - for (LLWLParamManager::preset_key_list_t::const_iterator it = preset_keys.begin(); it != preset_keys.end(); ++it) - { - if (it->scope <= sScope) - { - const LLWLParamKey& key = *it; - llinfos << "Adding key: " << key.toString() << llendl; - keyCombo->add(key.toString(), LLSD(key.toStringVal())); - } - } - - // set defaults on combo boxes - keyCombo->selectFirstItem(); - } -} - -// static -LLFloaterDayCycle* LLFloaterDayCycle::instance() -{ - if (!sDayCycle) - { - lldebugs << "Instantiating Day Cycle floater" << llendl; - sDayCycle = LLFloaterReg::getTypedInstance("env_day_cycle"); - llassert(sDayCycle); - // sDayCycle->open(); - // sDayCycle->setFocus(TRUE); - } - return sDayCycle; -} - -bool LLFloaterDayCycle::isOpen() -{ - if (sDayCycle != NULL) - { - return true; - } - return false; -} - -void LLFloaterDayCycle::show(LLEnvKey::EScope scope) -{ - LLFloaterDayCycle* dayCycle = instance(); - if(scope != sScope && ((LLView*)dayCycle)->getVisible()) - { - LLNotifications::instance().add("EnvOtherScopeAlreadyOpen", LLSD(), LLSD()); - return; - } - sScope = scope; - std::string title = sOriginalTitle + " (" + LLEnvManager::getScopeString(sScope) + ")"; - dayCycle->setTitle(title); - refreshPresetsFromParamManager(); - dayCycle->syncMenu(); - syncSliderTrack(); - - // set drop-down menu to match preset of currently-selected keyframe (one is automatically selected initially) - const std::string& curSldr = sDayCycle->getChild("WLDayCycleKeys")->getCurSlider(); - if(strlen(curSldr.c_str()) > 0) // only do this if there is a curSldr, otherwise we put an invalid entry into the map - { - sDayCycle->getChild("WLKeyPresets")->selectByValue(sSliderToKey[curSldr].keyframe.toStringVal()); - } - - // comment in if you want the menu to rebuild each time - //LLUICtrlFactory::getInstance()->buildFloater(dayCycle, "floater_day_cycle_options.xml"); - //dayCycle->initCallbacks(); - - dayCycle->openFloater(); -} - -// virtual -void LLFloaterDayCycle::onClose(bool app_quitting) -{ - if (sDayCycle) - { - lldebugs << "Destorying Day Cycle floater" << llendl; - sDayCycle = NULL; - } -} - -void LLFloaterDayCycle::onTimeSliderMoved(LLUICtrl* ctrl, void* userData) -{ - LLMultiSliderCtrl* sldr = sDayCycle->getChild( - "WLTimeSlider"); - - /// get the slider value - F32 val = sldr->getCurSliderValue() / sHoursPerDay; - - // 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 LLFloaterDayCycle::onKeyTimeMoved(LLUICtrl* ctrl, void* userData) -{ - LLComboBox* comboBox = sDayCycle->getChild("WLKeyPresets"); - LLMultiSliderCtrl* sldr = sDayCycle->getChild("WLDayCycleKeys"); - LLSpinCtrl* hourSpin = sDayCycle->getChild("WLCurKeyHour"); - LLSpinCtrl* minSpin = sDayCycle->getChild("WLCurKeyMin"); - - if(sldr->getValue().size() == 0) { - return; - } - - // make sure we have a slider - const std::string& curSldr = sldr->getCurSlider(); - if(curSldr == "") { - return; - } - - F32 time = sldr->getCurSliderValue(); - - // check to see if a key exists - LLWLParamKey key = sSliderToKey[curSldr].keyframe; - sSliderToKey[curSldr].time = time; - - // if it exists, turn on check box - comboBox->selectByValue(key.toStringVal()); - - // now set the spinners - F32 hour = (F32)((S32)time); - F32 min = (time - hour) * 60; - - // handle imprecision - if(min >= 59) { - min = 0; - hour += 1; - } - - hourSpin->set(hour); - minSpin->set(min); - - syncTrack(); - -} - -void LLFloaterDayCycle::onKeyTimeChanged(LLUICtrl* ctrl, void* userData) -{ - // if no keys, skipped - if(sSliderToKey.size() == 0) { - return; - } - - LLMultiSliderCtrl* sldr = sDayCycle->getChild( - "WLDayCycleKeys"); - LLSpinCtrl* hourSpin = sDayCycle->getChild( - "WLCurKeyHour"); - LLSpinCtrl* minSpin = sDayCycle->getChild( - "WLCurKeyMin"); - - F32 hour = hourSpin->get(); - F32 min = minSpin->get(); - F32 val = hour + min / 60.0f; - - const std::string& curSldr = sldr->getCurSlider(); - sldr->setCurSliderValue(val, TRUE); - F32 time = sldr->getCurSliderValue() / sHoursPerDay; - - // now set the key's time in the sliderToKey map - sSliderToKey[curSldr].time = time; - - syncTrack(); -} - -void LLFloaterDayCycle::onKeyPresetChanged(LLUICtrl* ctrl, void* userData) -{ - // get the time - LLComboBox* comboBox = sDayCycle->getChild( - "WLKeyPresets"); - LLMultiSliderCtrl* sldr = sDayCycle->getChild( - "WLDayCycleKeys"); - - // do nothing if no sliders - if(sldr->getValue().size() == 0) { - return; - } - - // change the map - - std::string stringVal = comboBox->getSelectedValue().asString(); - LLWLParamKey newKey(stringVal); - const std::string& curSldr = sldr->getCurSlider(); - - // if null, don't use - if(curSldr == "") { - return; - } - - sSliderToKey[curSldr].keyframe = newKey; - - syncTrack(); -} - -void LLFloaterDayCycle::onAddKey(void* userData) -{ - LLComboBox* comboBox = sDayCycle->getChild( - "WLKeyPresets"); - LLMultiSliderCtrl* kSldr = sDayCycle->getChild( - "WLDayCycleKeys"); - LLMultiSliderCtrl* tSldr = sDayCycle->getChild( - "WLTimeSlider"); - - llassert_always(sSliderToKey.size() == kSldr->getValue().size()); - - S32 max_sliders; - switch(sScope) - { - 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)kSldr->getMaxValue(); - break; - } - - if ((S32)sSliderToKey.size() >= max_sliders) - { - LLSD args; - args["SCOPE"] = LLEnvManager::getScopeString(sScope); - args["MAX"] = max_sliders; - LLNotificationsUtil::add("DayCycleTooManyKeyframes", args, LLSD(), LLNotificationFunctorRegistry::instance().DONOTHING); - return; - } - - // get the values - LLWLParamKey newKeyframe(comboBox->getSelectedValue()); - - // add the slider key - addSliderKey(tSldr->getCurSliderValue(), newKeyframe); - - syncTrack(); -} - -void LLFloaterDayCycle::addSliderKey(F32 time, LLWLParamKey keyframe) -{ - LLMultiSliderCtrl* kSldr = sDayCycle->getChild( - "WLDayCycleKeys"); - - // make a slider - const std::string& sldrName = kSldr->addSlider(time); - if(sldrName == "") { - return; - } - - // set the key - LLWLCycleSliderKey newKey(keyframe, kSldr->getCurSliderValue()); - - llassert_always(sldrName != LLStringUtil::null); - - // add to map - sSliderToKey.insert(std::pair(sldrName, newKey)); - - llassert_always(sSliderToKey.size() == kSldr->getValue().size()); - -} - -void LLFloaterDayCycle::deletePreset(LLWLParamKey keyframe) -{ - LLMultiSliderCtrl* sldr = sDayCycle->getChild("WLDayCycleKeys"); - - /// delete any reference - std::map::iterator curr_preset, next_preset; - for(curr_preset = sSliderToKey.begin(); curr_preset != sSliderToKey.end(); curr_preset = next_preset) - { - next_preset = curr_preset; - ++next_preset; - if (curr_preset->second.keyframe == keyframe) - { - sldr->deleteSlider(curr_preset->first); - sSliderToKey.erase(curr_preset); - } - } -} - -void LLFloaterDayCycle::onDeleteKey(void* userData) -{ - if(sSliderToKey.size() == 0) - { - return; - } - else if(sSliderToKey.size() == 1) - { - LLNotifications::instance().add("EnvCannotDeleteLastDayCycleKey", LLSD(), LLSD()); - return; - } - - LLComboBox* comboBox = sDayCycle->getChild( - "WLKeyPresets"); - LLMultiSliderCtrl* sldr = sDayCycle->getChild("WLDayCycleKeys"); - - // delete from map - const std::string& sldrName = sldr->getCurSlider(); - std::map::iterator mIt = sSliderToKey.find(sldrName); - sSliderToKey.erase(mIt); - - sldr->deleteCurSlider(); - - if(sSliderToKey.size() == 0) { - return; - } - - const std::string& name = sldr->getCurSlider(); - comboBox->selectByValue(sSliderToKey[name].keyframe.toLLSD()); - F32 time = sSliderToKey[name].time; - - LLSpinCtrl* hourSpin = sDayCycle->getChild("WLCurKeyHour"); - LLSpinCtrl* minSpin = sDayCycle->getChild("WLCurKeyMin"); - - // now set the spinners - F32 hour = (F32)((S32)time); - F32 min = (time - hour) / 60; - hourSpin->set(hour); - minSpin->set(min); - - syncTrack(); - -} -- cgit v1.2.3