diff options
-rw-r--r-- | indra/llinventory/llsettingsbase.cpp | 2 | ||||
-rw-r--r-- | indra/llinventory/llsettingsdaycycle.h | 29 | ||||
-rw-r--r-- | indra/llinventory/llsettingssky.cpp | 2 | ||||
-rw-r--r-- | indra/llinventory/llsettingssky.h | 4 | ||||
-rw-r--r-- | indra/llinventory/llsettingswater.cpp | 2 | ||||
-rw-r--r-- | indra/llinventory/llsettingswater.h | 4 | ||||
-rw-r--r-- | indra/newview/llfloatereditextdaycycle.cpp | 1456 | ||||
-rw-r--r-- | indra/newview/llfloatereditextdaycycle.h | 146 | ||||
-rw-r--r-- | indra/newview/llfloaterregioninfo.cpp | 7 | ||||
-rw-r--r-- | indra/newview/llfloaterregioninfo.h | 61 | ||||
-rw-r--r-- | indra/newview/llpanelenvironment.cpp | 27 | ||||
-rw-r--r-- | indra/newview/llpanelenvironment.h | 3 | ||||
-rw-r--r-- | indra/newview/llsettingsvo.cpp | 109 | ||||
-rw-r--r-- | indra/newview/llviewerfloaterreg.cpp | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml | 611 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_test_layout_stacks.xml | 353 |
16 files changed, 1219 insertions, 1599 deletions
diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index fb9d8de053..a35504e0e6 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -251,7 +251,7 @@ LLSD LLSettingsBase::getSettings() const LLSD LLSettingsBase::cloneSettings() const { - return combineSDMaps(mSettings, LLSD()); + return combineSDMaps(getSettings(), LLSD()); } size_t LLSettingsBase::getHash() const diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index b3cf53869f..4a7bc02871 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -84,25 +84,6 @@ public: static LLSD defaults(); //--------------------------------------------------------------------- - S64Seconds getDayLength() const - { - return mDayLength; - } - - void setDayLength(S64Seconds seconds) - { - mDayLength = seconds; - } - - S64Seconds getDayOffset() const - { - return mDayOffset; - } - - void setDayOffset(S64Seconds seconds) - { - mDayOffset = seconds; - } KeyframeList_t getTrackKeyframes(S32 track); TimeList_t getTrackTimes(S32 track); @@ -139,6 +120,12 @@ public: virtual validation_list_t getValidationList() const; static validation_list_t validationList(); + + S64Seconds getDayLength() const { return mDayLength; } + void setDayLength(S64Seconds val ) { mDayLength = val; } + S64Seconds getDayOffset() const { return mDayOffset; } + void setDayOffset(S64Seconds val) { mDayOffset = val; } + protected: LLSettingsDay(); @@ -157,8 +144,8 @@ private: F64Seconds mLastUpdateTime; - S64Seconds mDayLength; - S64Seconds mDayOffset; + S64Seconds mDayLength; + S64Seconds mDayOffset; F32 secondsToKeyframe(S64Seconds seconds); F64Seconds keyframeToSeconds(F32 keyframe); diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 14024cf4f7..c02d99fb67 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -270,6 +270,8 @@ LLSD LLSettingsSky::defaults() dfltsetting[SETTING_MOON_TEXTUREID] = IMG_MOON; // gMoonTextureID; // These two are returned by the login... wow! dfltsetting[SETTING_SUN_TEXUTUREID] = IMG_SUN; // gSunTextureID; + dfltsetting[SETTING_TYPE] = "sky"; + return dfltsetting; } diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index d36de571f6..9947ffc022 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -412,6 +412,8 @@ public: virtual validation_list_t getValidationList() const; static validation_list_t validationList(); + static LLSD translateLegacySettings(LLSD legacy); + protected: static const std::string SETTING_LEGACY_EAST_ANGLE; static const std::string SETTING_LEGACY_ENABLE_CLOUD_SCROLL; @@ -423,8 +425,6 @@ protected: virtual void updateSettings(); - static LLSD translateLegacySettings(LLSD legacy); - private: static const F32 NIGHTTIME_ELEVATION; static const F32 NIGHTTIME_ELEVATION_COS; diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index 67a9cd39cb..0fe3de44d3 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -100,6 +100,8 @@ LLSD LLSettingsWater::defaults() dfltsetting[SETTING_WAVE1_DIR] = LLVector2(1.04999f, -0.42000f).getValue(); dfltsetting[SETTING_WAVE2_DIR] = LLVector2(1.10999f, -1.16000f).getValue(); + dfltsetting[SETTING_TYPE] = "water"; + return dfltsetting; } diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h index 94e5583fd7..4c61e2a34c 100644 --- a/indra/llinventory/llsettingswater.h +++ b/indra/llinventory/llsettingswater.h @@ -201,6 +201,8 @@ public: virtual validation_list_t getValidationList() const; static validation_list_t validationList(); + static LLSD translateLegacySettings(LLSD legacy); + protected: static const std::string SETTING_LEGACY_BLUR_MULTIPILER; static const std::string SETTING_LEGACY_FOG_COLOR; @@ -217,8 +219,6 @@ protected: LLSettingsWater(); - static LLSD translateLegacySettings(LLSD legacy); - LLVector4 mWaterPlane; F32 mWaterFogKS; diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index c62ef85b02..76c275e47c 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -47,129 +47,180 @@ #include "llenvironment.h" #include "lltrans.h" -const F32 LLFloaterEditExtDayCycle::sHoursPerDay = 24.0f; - -LLFloaterEditExtDayCycle::LLFloaterEditExtDayCycle(const LLSD &key) -: LLFloater(key) -, mDayCycleNameEditor(NULL) -, mDayCyclesCombo(NULL) -, mTimeSlider(NULL) -, mKeysSlider(NULL) -, mSkyPresetsCombo(NULL) -, mTimeCtrl(NULL) -, mMakeDefaultCheckBox(NULL) -, mSaveButton(NULL) + +LLFloaterEditExtDayCycle::LLFloaterEditExtDayCycle(const LLSD &key): + LLFloater(key), + mDayPresetsCombo(NULL), + mSaveButton(NULL), + mCancelButton(NULL) +// mDayCyclesCombo(NULL) +// , mTimeSlider(NULL) +// , mKeysSlider(NULL) +// , mTimeCtrl(NULL) +// , mMakeDefaultCheckBox(NULL) +// , { } // virtual BOOL LLFloaterEditExtDayCycle::postBuild() { - mDayCycleNameEditor = getChild<LLLineEditor>("day_cycle_name"); - mDayCyclesCombo = getChild<LLComboBox>("day_cycle_combo"); +// mDayCyclesCombo = getChild<LLComboBox>("day_cycle_preset_combo"); + +// mTimeSlider = getChild<LLMultiSliderCtrl>("WLTimeSlider"); +// mKeysSlider = getChild<LLMultiSliderCtrl>("WLDayCycleKeys"); + mDayPresetsCombo = getChild<LLComboBox>("day_cycle_preset_combo"); +// mTimeCtrl = getChild<LLTimeCtrl>("time"); + mSaveButton = getChild<LLButton>("save_btn"); + mCancelButton = getChild<LLButton>("cancel_btn"); +// mMakeDefaultCheckBox = getChild<LLCheckBoxCtrl>("make_default_cb"); - mTimeSlider = getChild<LLMultiSliderCtrl>("WLTimeSlider"); - mKeysSlider = getChild<LLMultiSliderCtrl>("WLDayCycleKeys"); - mSkyPresetsCombo = getChild<LLComboBox>("WLSkyPresets"); - mTimeCtrl = getChild<LLTimeCtrl>("time"); - mSaveButton = getChild<LLButton>("save"); - mMakeDefaultCheckBox = getChild<LLCheckBoxCtrl>("make_default_cb"); - initCallbacks(); + mDayPresetsCombo->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onDayPresetChanged, this)); + mSaveButton->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onBtnSave, this)); + mCancelButton->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onBtnCancel, this)); - // add the time slider - mTimeSlider->addSlider(); + //initCallbacks(); + +// // add the time slider +// mTimeSlider->addSlider(); return TRUE; } -// virtual void LLFloaterEditExtDayCycle::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)); - - // Update floater title. - setTitle(floater_title); - - // Update the hint at the top. - getChild<LLUICtrl>("hint")->setValue(hint); - - // Hide the hint to the right of the combo if we're invoked to create a new preset. - 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(); + refreshSkyPresetsList(); } -// virtual void LLFloaterEditExtDayCycle::onClose(bool app_quitting) { if (!app_quitting) // there's no point to change environment if we're quitting { + /* TODO: don't restore this environment. We may have gotten here from land or region. */ LLEnvironment::instance().applyChosenEnvironment(); } } -// virtual -void LLFloaterEditExtDayCycle::draw() +void LLFloaterEditExtDayCycle::onVisibilityChange(BOOL new_visibility) { - syncTimeSlider(); - LLFloater::draw(); + if (new_visibility) + { + LLEnvironment::instance().selectDayCycle(mEditDay, LLEnvironment::TRANSITION_FAST); + } + else + { + /* TODO: don't restore this environment. We may have gotten here from land or region. */ + LLEnvironment::instance().applyChosenEnvironment(); + } } -void LLFloaterEditExtDayCycle::initCallbacks(void) +//------------------------------------------------------------------------- +void LLFloaterEditExtDayCycle::onDayPresetChanged() { -#if 0 - mDayCycleNameEditor->setKeystrokeCallback(boost::bind(&LLFloaterEditExtDayCycle::onDayCycleNameEdited, this), NULL); - mDayCyclesCombo->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onDayCycleSelected, this)); - mDayCyclesCombo->setTextEntryCallback(boost::bind(&LLFloaterEditExtDayCycle::onDayCycleNameEdited, this)); - mTimeSlider->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onTimeSliderMoved, this)); - mKeysSlider->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onKeyTimeMoved, this)); - mTimeCtrl->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onKeyTimeChanged, this)); - mSkyPresetsCombo->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onKeyPresetChanged, this)); - - getChild<LLButton>("WLAddKey")->setClickedCallback(boost::bind(&LLFloaterEditExtDayCycle::onAddKey, this)); - getChild<LLButton>("WLDeleteKey")->setClickedCallback(boost::bind(&LLFloaterEditExtDayCycle::onDeleteKey, this)); - - mSaveButton->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onBtnSave, this)); - mSaveButton->setRightMouseDownCallback(boost::bind(&LLFloaterEditExtDayCycle::dumpTrack, this)); - getChild<LLButton>("cancel")->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onBtnCancel, this)); - - // Connect to env manager events. - LLEnvManagerNew& env_mgr = LLEnvManagerNew::instance(); - env_mgr.setRegionSettingsChangeCallback(boost::bind(&LLFloaterEditExtDayCycle::onRegionSettingsChange, this)); - gAgent.addRegionChangedCallback(boost::bind(&LLFloaterEditExtDayCycle::onRegionChange, this)); - env_mgr.setRegionSettingsAppliedCallback(boost::bind(&LLFloaterEditExtDayCycle::onRegionSettingsApplied, this, _1)); - // Connect to day cycle manager events. - LLDayCycleManager::instance().setModifyCallback(boost::bind(&LLFloaterEditExtDayCycle::onDayCycleListChange, this)); - - // Connect to sky preset list changes. - LLWLParamManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterEditExtDayCycle::onSkyPresetListChange, this)); - - - // Connect to region info updates. - LLRegionInfoModel::instance().setUpdateCallback(boost::bind(&LLFloaterEditExtDayCycle::onRegionInfoUpdate, this)); -#endif + std::string dayname = mDayPresetsCombo->getSelectedValue().asString(); + + LLSettingsDay::ptr_t pday = LLEnvironment::instance().findDayCycleByName(dayname); + + if (pday) + { + pday = pday->buildClone(); + LLEnvironment::instance().selectDayCycle(pday, LLEnvironment::TRANSITION_INSTANT); + mEditDay = pday; + } + } -void LLFloaterEditExtDayCycle::syncTimeSlider() +void LLFloaterEditExtDayCycle::onBtnSave() +{ + if (!mCommitSignal.empty()) + mCommitSignal(mEditDay); + closeFloater(); +} + +void LLFloaterEditExtDayCycle::onBtnCancel() { -#if 0 - // set time - mTimeSlider->setCurSliderValue((F32)LLWLParamManager::getInstance()->mAnimator.getDayTime() * sHoursPerDay); -#endif + closeFloater(); } -void LLFloaterEditExtDayCycle::loadTrack() + +//------------------------------------------------------------------------- +void LLFloaterEditExtDayCycle::refreshSkyPresetsList() { + mDayPresetsCombo->removeall(); + + LLEnvironment::list_name_id_t cyclelist = LLEnvironment::instance().getDayCycleList(); + + mDayPresetsCombo->removeall(); + + + for (LLEnvironment::list_name_id_t::iterator it = cyclelist.begin(); it != cyclelist.end(); ++it) + { + mDayPresetsCombo->add((*it).first); + } + + // set defaults on combo boxes + mDayPresetsCombo->selectFirstItem(); +} + +LLFloaterEditExtDayCycle::connection_t LLFloaterEditExtDayCycle::setEditCommitSignal(LLFloaterEditExtDayCycle::edit_commit_signal_t::slot_type cb) +{ + return mCommitSignal.connect(cb); +} + +// +// virtual +// void LLFloaterEditExtDayCycle::draw() +// { +// syncTimeSlider(); +// LLFloater::draw(); +// } +// +// void LLFloaterEditExtDayCycle::initCallbacks(void) +// { +// #if 0 +// mDayCycleNameEditor->setKeystrokeCallback(boost::bind(&LLFloaterEditExtDayCycle::onDayCycleNameEdited, this), NULL); +// mDayCyclesCombo->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onDayCycleSelected, this)); +// mDayCyclesCombo->setTextEntryCallback(boost::bind(&LLFloaterEditExtDayCycle::onDayCycleNameEdited, this)); +// mTimeSlider->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onTimeSliderMoved, this)); +// mKeysSlider->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onKeyTimeMoved, this)); +// mTimeCtrl->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onKeyTimeChanged, this)); +// mSkyPresetsCombo->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onKeyPresetChanged, this)); +// +// getChild<LLButton>("WLAddKey")->setClickedCallback(boost::bind(&LLFloaterEditExtDayCycle::onAddKey, this)); +// getChild<LLButton>("WLDeleteKey")->setClickedCallback(boost::bind(&LLFloaterEditExtDayCycle::onDeleteKey, this)); +// +// mSaveButton->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onBtnSave, this)); +// mSaveButton->setRightMouseDownCallback(boost::bind(&LLFloaterEditExtDayCycle::dumpTrack, this)); +// getChild<LLButton>("cancel")->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onBtnCancel, this)); +// +// // Connect to env manager events. +// LLEnvManagerNew& env_mgr = LLEnvManagerNew::instance(); +// env_mgr.setRegionSettingsChangeCallback(boost::bind(&LLFloaterEditExtDayCycle::onRegionSettingsChange, this)); +// gAgent.addRegionChangedCallback(boost::bind(&LLFloaterEditExtDayCycle::onRegionChange, this)); +// env_mgr.setRegionSettingsAppliedCallback(boost::bind(&LLFloaterEditExtDayCycle::onRegionSettingsApplied, this, _1)); +// // Connect to day cycle manager events. +// LLDayCycleManager::instance().setModifyCallback(boost::bind(&LLFloaterEditExtDayCycle::onDayCycleListChange, this)); +// +// // Connect to sky preset list changes. +// LLWLParamManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterEditExtDayCycle::onSkyPresetListChange, this)); +// +// +// // Connect to region info updates. +// LLRegionInfoModel::instance().setUpdateCallback(boost::bind(&LLFloaterEditExtDayCycle::onRegionInfoUpdate, this)); +// #endif +// } +// +// void LLFloaterEditExtDayCycle::syncTimeSlider() +// { +// #if 0 +// // set time +// mTimeSlider->setCurSliderValue((F32)LLWLParamManager::getInstance()->mAnimator.getDayTime() * sHoursPerDay); +// #endif +// } +// +// void LLFloaterEditExtDayCycle::loadTrack() +// { // // clear the slider // mKeysSlider->clear(); // mSliderToKey.clear(); @@ -192,681 +243,556 @@ void LLFloaterEditExtDayCycle::loadTrack() // } // // syncTimeSlider(); -} - -void LLFloaterEditExtDayCycle::applyTrack() -{ -#if 0 - LL_DEBUGS() << "Applying track (" << mSliderToKey.size() << ")" << LL_ENDL; - - // if no keys, do nothing - if (mSliderToKey.size() == 0) - { - LL_DEBUGS() << "No keys, not syncing" << LL_ENDL; - 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<std::string, SliderKey>::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 - LLWLParamManager::getInstance()->resetAnimator( - mTimeSlider->getCurSliderValue() / sHoursPerDay, false); - - LLWLParamManager::getInstance()->mAnimator.update( - LLWLParamManager::getInstance()->mCurParams); -#endif -} - -void LLFloaterEditExtDayCycle::refreshSkyPresetsList() -{ -#if 0 - // 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::preset_name_list_t region_presets; - LLWLParamManager::preset_name_list_t user_presets, sys_presets; - LLWLParamManager::instance().getPresetNames(region_presets, user_presets, sys_presets); - - if (include_region_skies) - { - // Add region presets. - for (LLWLParamManager::preset_name_list_t::const_iterator it = region_presets.begin(); it != region_presets.end(); ++it) - { - std::string preset_name = *it; - std::string item_title = preset_name + " (" + getRegionName() + ")"; - mSkyPresetsCombo->add(preset_name, LLWLParamKey(*it, LLEnvKey::SCOPE_REGION).toStringVal()); - } - - 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(); - } - - // 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 - mSkyPresetsCombo->selectFirstItem(); -#endif -} - -void LLFloaterEditExtDayCycle::refreshDayCyclesList() -{ -#if 0 - llassert(isNewDay() == false); - - 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) - { - LLWLParamKey key(getRegionName(), LLEnvKey::SCOPE_REGION); - mDayCyclesCombo->add(key.name, key.toLLSD()); - mDayCyclesCombo->addSeparator(); - } -#endif - - 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) - { - 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")); -#endif -} - -void LLFloaterEditExtDayCycle::onTimeSliderMoved() -{ -#if 0 - /// get the slider value - F32 val = mTimeSlider->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); -#endif -} - -void LLFloaterEditExtDayCycle::onKeyTimeMoved() -{ -#if 0 - 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; - LL_DEBUGS() << "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(); -#endif -} - -void LLFloaterEditExtDayCycle::onKeyTimeChanged() -{ -#if 0 - // 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 - LL_DEBUGS() << "Setting key time: " << time << LL_ENDL; - mSliderToKey[cur_sldr].time = time; - - applyTrack(); -#endif -} - -void LLFloaterEditExtDayCycle::onKeyPresetChanged() -{ -#if 0 - // do nothing if no sliders - if (mKeysSlider->getValue().size() == 0) - { - return; - } - - // change the map - - 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 - if (cur_sldr == "") - { - return; - } - - mSliderToKey[cur_sldr].keyframe = new_key; - - // Apply changes to current day cycle. - applyTrack(); -#endif -} - -void LLFloaterEditExtDayCycle::onAddKey() -{ -#if 0 - 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 0 - if ((S32)mSliderToKey.size() >= max_sliders) - { - LLSD args; - args["SCOPE"] = LLEnvManagerNew::getScopeString(scope); - args["MAX"] = max_sliders; - LLNotificationsUtil::add("DayCycleTooManyKeyframes", args, LLSD(), LLNotificationFunctorRegistry::instance().DONOTHING); - return; - } -#endif - - // add the slider key - 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); - - // apply the change to current day cycles - applyTrack(); -#endif -} - -#if 0 -void LLFloaterEditExtDayCycle::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<std::string, SliderKey>(sldr_name, newKey)); - - llassert_always(mSliderToKey.size() == mKeysSlider->getValue().size()); -} -#endif - -#if 0 -LLWLParamKey LLFloaterEditExtDayCycle::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; -} -#endif - -bool LLFloaterEditExtDayCycle::isNewDay() const -{ - return mKey.asString() == "new"; -} - -void LLFloaterEditExtDayCycle::dumpTrack() -{ -#if 0 - LL_DEBUGS("Windlight") << "Dumping day cycle" << LL_ENDL; - - LLWLDayCycle& cur_dayp = LLWLParamManager::instance().mDay; - for (std::map<F32, LLWLParamKey>::iterator it = cur_dayp.mTimeMap.begin(); it != cur_dayp.mTimeMap.end(); ++it) - { - F32 time = it->first * 24.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; - } -#endif -} - -void LLFloaterEditExtDayCycle::enableEditing(bool enable) -{ - mSkyPresetsCombo->setEnabled(enable); - mTimeCtrl->setEnabled(enable); - getChild<LLPanel>("day_cycle_slider_panel")->setCtrlsEnabled(enable); - mSaveButton->setEnabled(enable); - mMakeDefaultCheckBox->setEnabled(enable); -} - -void LLFloaterEditExtDayCycle::reset() -{ -#if 0 - // 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); - } -#endif -} - -void LLFloaterEditExtDayCycle::saveRegionDayCycle() -{ -#if 0 - 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 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)) - { - LL_WARNS() << "Error applying region environment settings" << LL_ENDL; - return; - } - - setApplyProgress(true); -#endif -#endif -} - -void LLFloaterEditExtDayCycle::setApplyProgress(bool started) -{ - LLLoadingIndicator* indicator = getChild<LLLoadingIndicator>("progress_indicator"); - - indicator->setVisible(started); - - if (started) - { - indicator->start(); - } - else - { - indicator->stop(); - } -} - -bool LLFloaterEditExtDayCycle::getApplyProgress() const -{ - return getChild<LLLoadingIndicator>("progress_indicator")->getVisible(); -} - -void LLFloaterEditExtDayCycle::onDeleteKey() -{ -#if 0 - 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<std::string, SliderKey>::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(); -#endif -} - -void LLFloaterEditExtDayCycle::onRegionSettingsChange() -{ -#if 0 - 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" << LL_ENDL; - LLEnvManagerNew::instance().setUseRegionSettings(true); - } - - closeFloater(); - } -#endif -} - -void LLFloaterEditExtDayCycle::onRegionChange() -{ -#if 0 - 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 - } -#endif -} - -void LLFloaterEditExtDayCycle::onRegionSettingsApplied(bool success) -{ - LL_DEBUGS("Windlight") << "Region settings applied: " << success << LL_ENDL; - - if (!success) - { - // stop progress indicator - setApplyProgress(false); - } -} - -void LLFloaterEditExtDayCycle::onRegionInfoUpdate() -{ -#if 0 - 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 = LLEnvManagerNew::canEditRegionSettings(); - } - - enableEditing(can_edit); -#endif -} - -void LLFloaterEditExtDayCycle::onDayCycleNameEdited() -{ -#if 0 - // Disable saving a day cycle having empty name. - LLWLParamKey key = getSelectedDayCycle(); - mSaveButton->setEnabled(!key.name.empty()); -#endif -} - -void LLFloaterEditExtDayCycle::onDayCycleSelected() -{ -#if 0 - - LLSD day_data; - LLWLParamKey dc_key = getSelectedDayCycle(); - bool can_edit = true; - - if (dc_key.scope == LLEnvKey::SCOPE_LOCAL) - { - if (!LLDayCycleManager::instance().getPreset(dc_key.name, day_data)) - { - LL_WARNS() << "No day cycle named " << dc_key.name << LL_ENDL; - return; - } - } - else - { - day_data = LLEnvManagerNew::instance().getRegionSettings().getWLDayCycle(); - if (day_data.size() == 0) - { - LL_WARNS() << "Empty region day cycle" << LL_ENDL; - llassert(day_data.size() > 0); - return; - } - - can_edit = LLEnvManagerNew::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(); -#endif - enableEditing(false); -} - -void LLFloaterEditExtDayCycle::onBtnSave() -{ -#if 0 - LLDayCycleManager& day_mgr = LLDayCycleManager::instance(); - LLWLParamKey selected_day = getSelectedDayCycle(); - - if (selected_day.scope == LLEnvKey::SCOPE_REGION) - { - saveRegionDayCycle(); - closeFloater(); - return; - } - - std::string name = selected_day.name; - if (name.empty()) - { - // *TODO: show an alert - LL_WARNS() << "Empty day cycle name" << LL_ENDL; - 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(&LLFloaterEditExtDayCycle::onSaveAnswer, this, _1, _2)); - } - else - { - // new preset, hence no confirmation needed - onSaveConfirmed(); - } -#endif -} - -void LLFloaterEditExtDayCycle::onBtnCancel() -{ - closeFloater(); -} - -bool LLFloaterEditExtDayCycle::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 LLFloaterEditExtDayCycle::onSaveConfirmed() -{ -#if 0 - 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" << LL_ENDL; - LLEnvManagerNew::instance().setUseDayCycle(name); - } -#endif - closeFloater(); -} - -void LLFloaterEditExtDayCycle::onDayCycleListChange() -{ - if (!isNewDay()) - { - refreshDayCyclesList(); - } -} - -void LLFloaterEditExtDayCycle::onSkyPresetListChange() -{ - refreshSkyPresetsList(); - - // Refresh sliders from the currently visible day cycle. - loadTrack(); -} - +// } +// +// void LLFloaterEditExtDayCycle::applyTrack() +// { +// #if 0 +// LL_DEBUGS() << "Applying track (" << mSliderToKey.size() << ")" << LL_ENDL; +// +// // if no keys, do nothing +// if (mSliderToKey.size() == 0) +// { +// LL_DEBUGS() << "No keys, not syncing" << LL_ENDL; +// 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<std::string, SliderKey>::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 +// LLWLParamManager::getInstance()->resetAnimator( +// mTimeSlider->getCurSliderValue() / sHoursPerDay, false); +// +// LLWLParamManager::getInstance()->mAnimator.update( +// LLWLParamManager::getInstance()->mCurParams); +// #endif +// } + +// void LLFloaterEditExtDayCycle::refreshDayCyclesList() +// { +// #if 0 +// llassert(isNewDay() == false); +// +// 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) +// { +// LLWLParamKey key(getRegionName(), LLEnvKey::SCOPE_REGION); +// mDayCyclesCombo->add(key.name, key.toLLSD()); +// mDayCyclesCombo->addSeparator(); +// } +// #endif +// +// 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) +// { +// 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")); +// #endif +// } +// +// void LLFloaterEditExtDayCycle::onTimeSliderMoved() +// { +// #if 0 +// /// get the slider value +// F32 val = mTimeSlider->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); +// #endif +// } +// +// void LLFloaterEditExtDayCycle::onKeyTimeMoved() +// { +// #if 0 +// 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; +// LL_DEBUGS() << "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(); +// #endif +// } +// +// void LLFloaterEditExtDayCycle::onKeyTimeChanged() +// { +// #if 0 +// // 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 +// LL_DEBUGS() << "Setting key time: " << time << LL_ENDL; +// mSliderToKey[cur_sldr].time = time; +// +// applyTrack(); +// #endif +// } +// +// +// void LLFloaterEditExtDayCycle::onAddKey() +// { +// #if 0 +// 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 0 +// if ((S32)mSliderToKey.size() >= max_sliders) +// { +// LLSD args; +// args["SCOPE"] = LLEnvManagerNew::getScopeString(scope); +// args["MAX"] = max_sliders; +// LLNotificationsUtil::add("DayCycleTooManyKeyframes", args, LLSD(), LLNotificationFunctorRegistry::instance().DONOTHING); +// return; +// } +// #endif +// +// // add the slider key +// 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); +// +// // apply the change to current day cycles +// applyTrack(); +// #endif +// } +// +// #if 0 +// void LLFloaterEditExtDayCycle::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<std::string, SliderKey>(sldr_name, newKey)); +// +// llassert_always(mSliderToKey.size() == mKeysSlider->getValue().size()); +// } +// #endif +// +// #if 0 +// LLWLParamKey LLFloaterEditExtDayCycle::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; +// } +// #endif +// +// bool LLFloaterEditExtDayCycle::isNewDay() const +// { +// return mKey.asString() == "new"; +// } +// +// void LLFloaterEditExtDayCycle::dumpTrack() +// { +// #if 0 +// LL_DEBUGS("Windlight") << "Dumping day cycle" << LL_ENDL; +// +// LLWLDayCycle& cur_dayp = LLWLParamManager::instance().mDay; +// for (std::map<F32, LLWLParamKey>::iterator it = cur_dayp.mTimeMap.begin(); it != cur_dayp.mTimeMap.end(); ++it) +// { +// F32 time = it->first * 24.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; +// } +// #endif +// } +// +// void LLFloaterEditExtDayCycle::enableEditing(bool enable) +// { +// mSkyPresetsCombo->setEnabled(enable); +// mTimeCtrl->setEnabled(enable); +// getChild<LLPanel>("day_cycle_slider_panel")->setCtrlsEnabled(enable); +// mSaveButton->setEnabled(enable); +// mMakeDefaultCheckBox->setEnabled(enable); +// } +// +// void LLFloaterEditExtDayCycle::reset() +// { +// #if 0 +// // 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); +// } +// #endif +// } +// +// void LLFloaterEditExtDayCycle::saveRegionDayCycle() +// { +// #if 0 +// 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 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)) +// { +// LL_WARNS() << "Error applying region environment settings" << LL_ENDL; +// return; +// } +// +// setApplyProgress(true); +// #endif +// #endif +// } +// +// void LLFloaterEditExtDayCycle::setApplyProgress(bool started) +// { +// LLLoadingIndicator* indicator = getChild<LLLoadingIndicator>("progress_indicator"); +// +// indicator->setVisible(started); +// +// if (started) +// { +// indicator->start(); +// } +// else +// { +// indicator->stop(); +// } +// } +// +// bool LLFloaterEditExtDayCycle::getApplyProgress() const +// { +// return getChild<LLLoadingIndicator>("progress_indicator")->getVisible(); +// } +// +// void LLFloaterEditExtDayCycle::onDeleteKey() +// { +// #if 0 +// 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<std::string, SliderKey>::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(); +// #endif +// } +// +// void LLFloaterEditExtDayCycle::onRegionSettingsChange() +// { +// #if 0 +// 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" << LL_ENDL; +// LLEnvManagerNew::instance().setUseRegionSettings(true); +// } +// +// closeFloater(); +// } +// #endif +// } +// +// void LLFloaterEditExtDayCycle::onRegionChange() +// { +// #if 0 +// 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 +// } +// #endif +// } +// +// void LLFloaterEditExtDayCycle::onRegionSettingsApplied(bool success) +// { +// LL_DEBUGS("Windlight") << "Region settings applied: " << success << LL_ENDL; +// +// if (!success) +// { +// // stop progress indicator +// setApplyProgress(false); +// } +// } +// +// void LLFloaterEditExtDayCycle::onRegionInfoUpdate() +// { +// #if 0 +// 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 = LLEnvManagerNew::canEditRegionSettings(); +// } +// +// enableEditing(can_edit); +// #endif +// } +// +// void LLFloaterEditExtDayCycle::onDayCycleNameEdited() +// { +// #if 0 +// // Disable saving a day cycle having empty name. +// LLWLParamKey key = getSelectedDayCycle(); +// mSaveButton->setEnabled(!key.name.empty()); +// #endif +// } +// +// void LLFloaterEditExtDayCycle::onDayCycleSelected() +// { +// #if 0 +// +// LLSD day_data; +// LLWLParamKey dc_key = getSelectedDayCycle(); +// bool can_edit = true; +// +// if (dc_key.scope == LLEnvKey::SCOPE_LOCAL) +// { +// if (!LLDayCycleManager::instance().getPreset(dc_key.name, day_data)) +// { +// LL_WARNS() << "No day cycle named " << dc_key.name << LL_ENDL; +// return; +// } +// } +// else +// { +// day_data = LLEnvManagerNew::instance().getRegionSettings().getWLDayCycle(); +// if (day_data.size() == 0) +// { +// LL_WARNS() << "Empty region day cycle" << LL_ENDL; +// llassert(day_data.size() > 0); +// return; +// } +// +// can_edit = LLEnvManagerNew::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(); +// #endif +// enableEditing(false); +// } +// +// bool LLFloaterEditExtDayCycle::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 LLFloaterEditExtDayCycle::onSaveConfirmed() +// { +// #if 0 +// 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" << LL_ENDL; +// LLEnvManagerNew::instance().setUseDayCycle(name); +// } +// #endif +// closeFloater(); +// } +// +// void LLFloaterEditExtDayCycle::onDayCycleListChange() +// { +// if (!isNewDay()) +// { +// refreshDayCyclesList(); +// } +// } +// +// void LLFloaterEditExtDayCycle::onSkyPresetListChange() +// { +// refreshSkyPresetsList(); +// +// // Refresh sliders from the currently visible day cycle. +// loadTrack(); +// } +// // static -std::string LLFloaterEditExtDayCycle::getRegionName() -{ - return gAgent.getRegion() ? gAgent.getRegion()->getName() : LLTrans::getString("Unknown"); -} +// std::string LLFloaterEditExtDayCycle::getRegionName() +// { +// return gAgent.getRegion() ? gAgent.getRegion()->getName() : LLTrans::getString("Unknown"); +// } diff --git a/indra/newview/llfloatereditextdaycycle.h b/indra/newview/llfloatereditextdaycycle.h index bed5db14b2..8b5a087edb 100644 --- a/indra/newview/llfloatereditextdaycycle.h +++ b/indra/newview/llfloatereditextdaycycle.h @@ -28,6 +28,8 @@ #define LL_LLFLOATEREDITEXTDAYCYCLE_H #include "llfloater.h" +#include "llsettingsdaycycle.h" +#include <boost/signals2.hpp> class LLCheckBoxCtrl; class LLComboBox; @@ -43,90 +45,92 @@ class LLFloaterEditExtDayCycle : public LLFloater LOG_CLASS(LLFloaterEditExtDayCycle); public: - LLFloaterEditExtDayCycle(const LLSD &key); - - /*virtual*/ BOOL postBuild(); - /*virtual*/ void onOpen(const LLSD& key); - /*virtual*/ void onClose(bool app_quitting); - /*virtual*/ void draw(); - -private: - - /// sync the time slider with day cycle structure - void syncTimeSlider(); - - // makes sure key slider has what's in day cycle - void loadTrack(); + typedef boost::signals2::signal<void(LLSettingsDay::ptr_t)> edit_commit_signal_t; + typedef boost::signals2::connection connection_t; - /// makes sure day cycle data structure has what's in menu - void applyTrack(); + LLFloaterEditExtDayCycle(const LLSD &key); - /// refresh the sky presets combobox - void refreshSkyPresetsList(); + BOOL postBuild(); + void onOpen(const LLSD& key); + void onClose(bool app_quitting); - /// refresh the day cycle combobox - void refreshDayCyclesList(); + void onVisibilityChange(BOOL new_visibility); - /// add a slider to the track -// void addSliderKey(F32 time, LLWLParamKey keyframe); +// /*virtual*/ void draw(); + connection_t setEditCommitSignal(edit_commit_signal_t::slot_type cb); - void initCallbacks(); -// LLWLParamKey getSelectedDayCycle(); - bool isNewDay() const; - void dumpTrack(); - void enableEditing(bool enable); - void reset(); - void saveRegionDayCycle(); +private: - void setApplyProgress(bool started); - bool getApplyProgress() const; +// /// sync the time slider with day cycle structure +// void syncTimeSlider(); +// +// // makes sure key slider has what's in day cycle +// void loadTrack(); +// +// /// makes sure day cycle data structure has what's in menu +// void applyTrack(); +// +// /// refresh the sky presets combobox + void refreshSkyPresetsList(); - void onTimeSliderMoved(); /// time slider moved - void onKeyTimeMoved(); /// a key frame moved - void onKeyTimeChanged(); /// a key frame's time changed - void onKeyPresetChanged(); /// sky preset selected - void onAddKey(); /// new key added on slider - void onDeleteKey(); /// a key frame deleted + void onDayPresetChanged(); /// sky preset selected - void onRegionSettingsChange(); - void onRegionChange(); - void onRegionSettingsApplied(bool success); - void onRegionInfoUpdate(); + void onBtnSave(); + void onBtnCancel(); - void onDayCycleNameEdited(); - void onDayCycleSelected(); - void onBtnSave(); - void onBtnCancel(); +// /// refresh the day cycle combobox +// void refreshDayCyclesList(); +// +// /// add a slider to the track +// // void addSliderKey(F32 time, LLWLParamKey keyframe); +// +// void initCallbacks(); +// // LLWLParamKey getSelectedDayCycle(); +// bool isNewDay() const; +// void dumpTrack(); +// void enableEditing(bool enable); +// void reset(); +// void saveRegionDayCycle(); +// +// void setApplyProgress(bool started); +// bool getApplyProgress() const; +// +// void onTimeSliderMoved(); /// time slider moved +// void onKeyTimeMoved(); /// a key frame moved +// void onKeyTimeChanged(); /// a key frame's time changed +// void onAddKey(); /// new key added on slider +// void onDeleteKey(); /// a key frame deleted +// +// void onRegionSettingsChange(); +// void onRegionChange(); +// void onRegionSettingsApplied(bool success); +// void onRegionInfoUpdate(); +// +// void onDayCycleNameEdited(); +// void onDayCycleSelected(); +// +// bool onSaveAnswer(const LLSD& notification, const LLSD& response); +// void onSaveConfirmed(); +// +// void onDayCycleListChange(); +// void onSkyPresetListChange(); +// +// static std::string getRegionName(); - bool onSaveAnswer(const LLSD& notification, const LLSD& response); - void onSaveConfirmed(); + LLSettingsDay::ptr_t mSavedDay; + LLSettingsDay::ptr_t mEditDay; - void onDayCycleListChange(); - void onSkyPresetListChange(); + LLComboBox* mDayPresetsCombo; + LLButton* mSaveButton; + LLButton* mCancelButton; - static std::string getRegionName(); + edit_commit_signal_t mCommitSignal; - /// convenience class for holding keyframes mapped to sliders -// struct SliderKey -// { -// public: -// SliderKey(LLWLParamKey kf, F32 t) : keyframe(kf), time(t) {} -// SliderKey() : keyframe(), time(0.f) {} // Don't use this default constructor -// -// LLWLParamKey keyframe; -// F32 time; -// }; - - static const F32 sHoursPerDay; - - LLLineEditor* mDayCycleNameEditor; - LLComboBox* mDayCyclesCombo; - LLMultiSliderCtrl* mTimeSlider; - LLMultiSliderCtrl* mKeysSlider; - LLComboBox* mSkyPresetsCombo; - LLTimeCtrl* mTimeCtrl; - LLCheckBoxCtrl* mMakeDefaultCheckBox; - LLButton* mSaveButton; +// LLComboBox* mDayCyclesCombo; +// LLMultiSliderCtrl* mTimeSlider; +// LLMultiSliderCtrl* mKeysSlider; + // LLTimeCtrl* mTimeCtrl; +// LLCheckBoxCtrl* mMakeDefaultCheckBox; // map of sliders to parameters // std::map<std::string, SliderKey> mSliderToKey; diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 578c85470e..bf965afbe1 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -190,6 +190,8 @@ public: protected: virtual void doApply(); + virtual void doEditCommited(LLSettingsDay::ptr_t &newday); + private: LLViewerRegion * mLastRegion; }; @@ -3437,3 +3439,8 @@ void LLPanelRegionEnvironment::doApply() LLEnvironment::instance().updateRegion(mEditingDayCycle, daylength.value(), dayoffset_s.value()); } } + +void LLPanelRegionEnvironment::doEditCommited(LLSettingsDay::ptr_t &newday) +{ + mEditingDayCycle = newday; +} diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h index 61bf33af2f..6d64ae1d60 100644 --- a/indra/newview/llfloaterregioninfo.h +++ b/indra/newview/llfloaterregioninfo.h @@ -412,67 +412,6 @@ protected: ///////////////////////////////////////////////////////////////////////////// -#if 0 -class LLPanelEnvironmentInfo : public LLPanelRegionInfo -{ - LOG_CLASS(LLPanelEnvironmentInfo); - -public: - LLPanelEnvironmentInfo(); - - // LLPanel - /*virtual*/ BOOL postBuild(); - /*virtual*/ void onOpen(const LLSD& key); - - // LLView - /*virtual*/ void onVisibilityChange(BOOL new_visibility); - - // LLPanelRegionInfo - /*virtual*/ bool refreshFromRegion(LLViewerRegion* region); - -private: - void refresh(); - void setControlsEnabled(bool enabled); - void setApplyProgress(bool started); - void setDirty(bool dirty); - - void sendRegionSunUpdate(); - void fixEstateSun(); - - void populateWaterPresetsList(); - void populateSkyPresetsList(); - void populateDayCyclesList(); - - bool getSelectedWaterParams(LLSD& water_params); - bool getSelectedSkyParams(LLSD& sky_params, std::string& preset_name); - bool getSelectedDayCycleParams(LLSD& day_cycle, LLSD& sky_map, short& scope); - - void onSwitchRegionSettings(); - void onSwitchDayCycle(); - - void onSelectWaterPreset(); - void onSelectSkyPreset(); - void onSelectDayCycle(); - - void onBtnApply(); - void onBtnCancel(); - - void onRegionSettingschange(); - void onRegionSettingsApplied(bool ok); - - /// New environment settings that are being applied to the region. -// LLEnvironmentSettings mNewRegionSettings; - - bool mEnableEditing; - - LLRadioGroup* mRegionSettingsRadioGroup; - LLRadioGroup* mDayCycleSettingsRadioGroup; - - LLComboBox* mWaterPresetCombo; - LLComboBox* mSkyPresetCombo; - LLComboBox* mDayCyclePresetCombo; -}; -#endif class LLPanelRegionExperiences : public LLPanelRegionInfo { diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index b606e1de08..c9e29e3e79 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -37,6 +37,10 @@ #include "llslurl.h" #include "lllayoutstack.h" +#include "llfloater.h" +#include "llfloaterreg.h" +#include "llfloatereditextdaycycle.h" + static LLPanelInjector<LLPanelEnvironmentInfo> register_environment_panel("environment_panel"); LLPanelEnvironmentInfo::LLPanelEnvironmentInfo(): @@ -329,7 +333,11 @@ void LLPanelEnvironmentInfo::setDirty(bool dirty) void LLPanelEnvironmentInfo::onSwitchDefaultSelection() { bool use_defaults = mRegionSettingsRadioGroup->getSelectedIndex() == 0; - getChild<LLView>("user_environment_settings")->setEnabled(!use_defaults); + + getChild<LLView>("edit_btn")->setEnabled(!use_defaults); + + mDayLengthSlider->setEnabled(!use_defaults); + mDayOffsetSlider->setEnabled(!use_defaults); setDirty(true); } @@ -352,8 +360,25 @@ void LLPanelEnvironmentInfo::onBtnCancel() void LLPanelEnvironmentInfo::onBtnEdit() { + LLFloaterEditExtDayCycle *dayeditor = (LLFloaterEditExtDayCycle *)LLFloaterReg::getInstance("env_edit_extdaycycle"); + + if (dayeditor) + { + dayeditor->setEditCommitSignal(boost::bind(&LLPanelEnvironmentInfo::onEditiCommited, this, _1)); + dayeditor->openFloater(); + } +} + +void LLPanelEnvironmentInfo::onEditiCommited(LLSettingsDay::ptr_t newday) +{ + doEditCommited(newday); } +void LLPanelEnvironmentInfo::doEditCommited(LLSettingsDay::ptr_t &newday) +{ + mEditingDayCycle = newday; + /*TODO pure virtual*/ +} // void LLPanelEnvironmentInfo::onRegionSettingschange() // { diff --git a/indra/newview/llpanelenvironment.h b/indra/newview/llpanelenvironment.h index 8b5238d3e2..4f62488f21 100644 --- a/indra/newview/llpanelenvironment.h +++ b/indra/newview/llpanelenvironment.h @@ -63,7 +63,10 @@ protected: void onBtnCancel(); void onBtnEdit(); + void onEditiCommited(LLSettingsDay::ptr_t newday); + virtual void doApply(); // = 0; + virtual void doEditCommited(LLSettingsDay::ptr_t &newday); /// New environment settings that are being applied to the region. // LLEnvironmentSettings mNewRegionSettings; diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index 7756d28879..80cb8c8357 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -263,8 +263,8 @@ LLSettingsWater::ptr_t LLSettingsVOWater::buildFromLegacyPreset(const std::strin LLSD results = LLSettingsWater::settingValidation(newsettings, validations); if (!results["success"].asBoolean()) { - LL_WARNS("SETTINGS") << "Water setting validation failed!\n" << results << LL_ENDL; - LLSettingsWater::ptr_t(); + LL_WARNS("SETTINGS") << "Water setting validation failed!: " << results << LL_ENDL; + return LLSettingsWater::ptr_t(); } LLSettingsWater::ptr_t waterp = boost::make_shared<LLSettingsVOWater>(newsettings); @@ -292,8 +292,8 @@ LLSettingsWater::ptr_t LLSettingsVOWater::buildDefaultWater() LLSD results = LLSettingsWater::settingValidation(settings, validations); if (!results["success"].asBoolean()) { - LL_WARNS("SETTINGS") << "Water setting validation failed!\n" << results << LL_ENDL; - LLSettingsWater::ptr_t(); + LL_WARNS("SETTINGS") << "Water setting validation failed!: " << results << LL_ENDL; + return LLSettingsWater::ptr_t(); } LLSettingsWater::ptr_t waterp = boost::make_shared<LLSettingsVOWater>(settings); @@ -308,8 +308,8 @@ LLSettingsWater::ptr_t LLSettingsVOWater::buildClone() LLSD results = LLSettingsWater::settingValidation(settings, validations); if (!results["success"].asBoolean()) { - LL_WARNS("SETTINGS") << "Water setting validation failed!\n" << results << LL_ENDL; - LLSettingsWater::ptr_t(); + LL_WARNS("SETTINGS") << "Water setting validation failed!: " << results << LL_ENDL; + return LLSettingsWater::ptr_t(); } LLSettingsWater::ptr_t waterp = boost::make_shared<LLSettingsVOWater>(settings); @@ -414,31 +414,48 @@ LLSettingsVODay::LLSettingsVODay(): LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyPreset(const std::string &name, const LLSD &oldsettings) { LLSD newsettings(defaults()); + std::set<std::string> framenames; newsettings[SETTING_NAME] = name; - newsettings[SETTING_DAYLENGTH] = static_cast<S32>(MINIMUM_DAYLENGTH); LLSD watertrack = LLSDArray( LLSDMap(SETTING_KEYKFRAME, LLSD::Real(0.0f)) - (SETTING_KEYNAME, "Default")); + (SETTING_KEYNAME, "water:Default")); LLSD skytrack = LLSD::emptyArray(); for (LLSD::array_const_iterator it = oldsettings.beginArray(); it != oldsettings.endArray(); ++it) { + std::string framename = (*it)[1].asString(); LLSD entry = LLSDMap(SETTING_KEYKFRAME, (*it)[0].asReal()) - (SETTING_KEYNAME, (*it)[1].asString()); + (SETTING_KEYNAME, "sky:" + framename); + framenames.insert(framename); skytrack.append(entry); } newsettings[SETTING_TRACKS] = LLSDArray(watertrack)(skytrack); + LLSD frames(LLSD::emptyMap()); + + { + LLSettingsWater::ptr_t pwater = LLEnvironment::instance().findWaterByName("Default"); + frames["water:Default"] = pwater->getSettings(); + } + + for (std::set<std::string>::iterator itn = framenames.begin(); itn != framenames.end(); ++itn) + { + LLSettingsSky::ptr_t psky = LLEnvironment::instance().findSkyByName(*itn); + frames["sky:" + (*itn)] = psky->getSettings(); + } + + newsettings[SETTING_FRAMES] = frames; + LLSettingsDay::validation_list_t validations = LLSettingsDay::validationList(); LLSD results = LLSettingsDay::settingValidation(newsettings, validations); if (!results["success"].asBoolean()) { - LL_WARNS("SETTINGS") << "Day setting validation failed!\n" << results << LL_ENDL; - LLSettingsDay::ptr_t(); + LL_WARNS("SETTINGS") << "Day setting validation failed!: " << results << LL_ENDL; + return LLSettingsDay::ptr_t(); } @@ -463,51 +480,55 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyPreset(const std::string &n LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyMessage(const LLUUID ®ionId, LLSD daycycle, LLSD skydefs, LLSD waterdef) { - LLSettingsWater::ptr_t water = LLSettingsVOWater::buildFromLegacyPreset("Region", waterdef); - - if (!water) - { - LL_WARNS("WindlightCaps") << "Water construction failed." << LL_ENDL; - return LLSettingsDay::ptr_t(); - } - - LLEnvironment::namedSettingMap_t skys; + LLSD frames(LLSD::emptyMap()); for (LLSD::map_iterator itm = skydefs.beginMap(); itm != skydefs.endMap(); ++itm) { - std::string name = (*itm).first; - LLSettingsSky::ptr_t sky = LLSettingsVOSky::buildFromLegacyPreset(name, (*itm).second); + LLSD newsettings = LLSettingsSky::translateLegacySettings((*itm).second); + std::string newname = "sky:" + (*itm).first; - if (!sky) - { - LL_WARNS("WindlightCaps") << "Sky construction failed." << LL_ENDL; - return LLSettingsDay::ptr_t(); - } + newsettings[SETTING_NAME] = newname; + frames[newname] = newsettings; - skys[name] = sky; - LL_WARNS("WindlightCaps") << "created region sky '" << name << "'" << LL_ENDL; + LL_WARNS("SETTINGS") << "created region sky '" << newname << "'" << LL_ENDL; } - LLSettingsDay::ptr_t dayp = buildFromLegacyPreset("Region (legacy)", daycycle); + LLSD watersettings = LLSettingsWater::translateLegacySettings(waterdef); + std::string watername = "water:"+ watersettings[SETTING_NAME].asString(); + watersettings[SETTING_NAME] = watername; + frames[watername] = watersettings; - dayp->setWaterAtKeyframe(water, 0.0f); + LLSD watertrack = LLSDArray( + LLSDMap(SETTING_KEYKFRAME, LLSD::Real(0.0f)) + (SETTING_KEYNAME, watername)); - for (LLSD::array_iterator ita = daycycle.beginArray(); ita != daycycle.endArray(); ++ita) + LLSD skytrack(LLSD::emptyArray()); + for (LLSD::array_const_iterator it = daycycle.beginArray(); it != daycycle.endArray(); ++it) { - F32 frame = (*ita)[0].asReal(); - std::string name = (*ita)[1].asString(); - - LLEnvironment::namedSettingMap_t::iterator it = skys.find(name); + LLSD entry = LLSDMap(SETTING_KEYKFRAME, (*it)[0].asReal()) + (SETTING_KEYNAME, "sky:" + (*it)[1].asString()); + skytrack.append(entry); + } - if (it == skys.end()) - continue; - dayp->setSkyAtKeyframe(boost::static_pointer_cast<LLSettingsSky>((*it).second), frame, 1); + LLSD newsettings = LLSDMap + ( SETTING_NAME, "Region (legacy)" ) + ( SETTING_TRACKS, LLSDArray(watertrack)(skytrack)) + ( SETTING_FRAMES, frames ); - LL_WARNS("WindlightCaps") << "Added '" << name << "' to region day cycle at " << frame << LL_ENDL; + LLSettingsSky::validation_list_t validations = LLSettingsSky::validationList(); + LLSD results = LLSettingsDay::settingValidation(newsettings, validations); + if (!results["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Day setting validation failed!:" << results << LL_ENDL; + LLSettingsDay::ptr_t(); } - dayp->setInitialized(); - + LLSettingsDay::ptr_t dayp = boost::make_shared<LLSettingsVODay>(newsettings); + + if (dayp) + { + dayp->setInitialized(); + } return dayp; } @@ -555,13 +576,13 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildClone() LLSD results = LLSettingsDay::settingValidation(settings, validations); if (!results["success"].asBoolean()) { - LL_WARNS("SETTINGS") << "Water setting validation failed!\n" << results << LL_ENDL; + LL_WARNS("SETTINGS") << "Day setting validation failed!\n" << results << LL_ENDL; LLSettingsDay::ptr_t(); } - LLSettingsDay::ptr_t dayp = boost::make_shared<LLSettingsVODay>(settings); + dayp->initialize(); return dayp; } diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index e133ef22a1..63166fe4a8 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -226,7 +226,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("env_edit_water", "floater_edit_water_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterEditWater>); LLFloaterReg::add("env_edit_day_cycle", "floater_edit_day_cycle.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterEditDayCycle>); - LLFloaterReg::add("env_edit_extdaycycle", "floater_edit_ext_daycycle.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterEditExtDayCycle>); + LLFloaterReg::add("env_edit_extdaycycle", "floater_edit_ext_day_cycle.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterEditExtDayCycle>); LLFloaterReg::add("event", "floater_event.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterEvent>); diff --git a/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml b/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml index d9a3ad0c4b..0f0acea832 100644 --- a/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml +++ b/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml @@ -1,13 +1,13 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <floater - legacy_header_height="18" - height="381" - layout="topleft" - name="Edit Day cycle" - help_topic="day_presets" - save_rect="true" - title="Edit Day Cycle" - width="705"> + legacy_header_height="18" + height="500" + layout="topleft" + name="env_edit_extdaycycle" + help_topic="day_presets" + save_rect="true" + title="Edit Day Cycle" + width="705"> <string name="title_new">Create a New Day Cycle</string> <string name="title_edit">Edit Day Cycle</string> @@ -15,471 +15,130 @@ <string name="hint_edit">To edit your day cycle, adjust the controls below and click "Save".</string> <string name="combo_label">-Select a preset-</string> - <text - follows="top|left|right" - height="10" - layout="topleft" - left="10" - name="hint" - top="25" - width="685" /> - <text - follows="top|left|right" - font="SansSerif" - height="10" - layout="topleft" - left="10" - name="label" - top_pad="25" - width="120"> - Preset Name: - </text> - <combo_box - allow_text_entry="true" - follows="top|left" - layout="topleft" - left_pad="10" - max_chars="100" - name="day_cycle_combo" - top_delta="-5" - width="200" /> - <line_editor - height="20" - left_delta="0" - name="day_cycle_name" - top_delta="0" - visible="true" - width="200" /> - <text - follows="top|left|right" - height="95" - layout="topleft" - left_pad="10" - name="note" - top_delta="0" - width="345" - wrap="true"> - Note: if you change the name of your preset, you will be creating a new preset and the existing preset will not be changed. - </text> - <!--======== Controls panel ========--> - <text - follows="left|top|right" - height="10" - layout="topleft" - left="10" - name="hint_item1" - top="100" - width="300"> - - Click on a tab to edit the specific sky settings and time. - </text> - <text - follows="left|top|right" - height="10" - layout="topleft" - name="hint_item2" - top_pad="10" - width="300"> - - Click and drag the tabs to set the transition times. - </text> - <text - follows="left|top|right" - height="10" - layout="topleft" - name="hint_item3" - top_pad="10" - width="300"> - - Use the scrubber to preview your day cycle. - </text> - <panel - follows="top|left" - height="100" - name="day_cycle_slider_panel" - layout="topleft" - left_delta="25" - top_pad="15" - width="660"> - <multi_slider - can_edit_text="true" - control_name="WLTimeSlider" - decimal_digits="0" - draw_track="false" - follows="bottom" - height="10" - increment="0.0833333" - initial_value="0" - layout="topleft" - left="20" - max_sliders="20" - max_val="24" - name="WLTimeSlider" - show_text="false" - top_pad="0" - use_triangle="true" - width="525" /> - <multi_slider - can_edit_text="true" - control_name="WLDayCycleKeys" - decimal_digits="0" - follows="bottom" - height="10" - increment="0.0833333" - initial_value="0" - layout="topleft" - left_delta="0" - max_sliders="20" - max_val="24" - name="WLDayCycleKeys" - show_text="false" - top_pad="15" - width="525" /> - <button - height="20" - label="Add Key" - label_selected="Add Key" - layout="topleft" - left_pad="20" - name="WLAddKey" - top_delta="-18" - width="96" /> - <button - height="20" - label="Delete Key" - label_selected="Delete Key" - layout="topleft" - name="WLDeleteKey" - top_pad="5" - width="96" /> - <text - type="string" - length="1" - border_visible="true" - follows="left|top|right" - height="16" - layout="topleft" - left="8" - name="WL12am" - top="74" - width="55"> - 12am - </text> - <text - type="string" - length="1" - border_visible="true" - follows="left|top|right" - height="16" - layout="topleft" - left_pad="10" - name="WL3am" - top_delta="0" - width="55"> - 3am - </text> - <text - type="string" - length="1" - border_visible="true" - follows="left|top|right" - height="16" - layout="topleft" - left_pad="10" - name="WL6am" - top_delta="0" - width="55"> - 6am - </text> - <text - type="string" - length="1" - border_visible="true" - follows="left|top|right" - height="16" - layout="topleft" - left_pad="10" - name="WL9amHash" - top_delta="0" - width="55"> - 9am - </text> - <text - type="string" - length="1" - border_visible="true" - follows="left|top|right" - height="16" - layout="topleft" - left_pad="10" - name="WL12pmHash" - top_delta="0" - width="55"> - 12pm - </text> - <text - type="string" - length="1" - border_visible="true" - follows="left|top|right" - height="16" - layout="topleft" - left_pad="10" - name="WL3pm" - top_delta="0" - width="55"> - 3pm - </text> - <text - type="string" - length="1" - border_visible="true" - follows="left|top|right" - height="16" - layout="topleft" - left_pad="10" - name="WL6pm" - top_delta="0" - width="55"> - 6pm - </text> - <text - type="string" - length="1" - border_visible="true" - follows="left|top|right" - height="16" - layout="topleft" - left_pad="10" - name="WL9pm" - top_delta="0" - width="55"> - 9pm - </text> - <text - type="string" - length="1" - border_visible="true" - follows="left|top|right" - height="16" - layout="topleft" - left_pad="10" - name="WL12am2" - top_delta="0" - width="55"> - 12am - </text> - <text - type="string" - length="1" - border_visible="true" - follows="left|top|right" - font="SansSerif" - height="14" - layout="topleft" - left="20" - name="WL12amHash" - top="54" - width="6"> - | - </text> - <text - type="string" - length="1" - border_visible="true" - follows="left|top|right" - font="SansSerif" - height="11" - layout="topleft" - left_pad="59" - name="WL3amHash" - top_delta="3" - width="6"> - I - </text> - <text - type="string" - length="1" - border_visible="true" - follows="left|top|right" - font="SansSerif" - height="14" - layout="topleft" - left_pad="59" - name="WL6amHash" - top_delta="-3" - width="6"> - | - </text> - <text - type="string" - length="1" - border_visible="true" - follows="left|top|right" - font="SansSerif" - height="11" - layout="topleft" - left_pad="59" - name="WL9amHash2" - top_delta="3" - width="6"> - I - </text> - <text - type="string" - length="1" - border_visible="true" - follows="left|top|right" - font="SansSerif" - height="14" - layout="topleft" - left_pad="59" - name="WL12pmHash2" - top_delta="-3" - width="6"> - | - </text> - <text - type="string" - length="1" - border_visible="true" - follows="left|top|right" - font="SansSerif" - height="11" - layout="topleft" - left_pad="59" - name="WL3pmHash" - top_delta="3" - width="6"> - I - </text> - <text - type="string" - length="1" - border_visible="true" - follows="left|top|right" - font="SansSerif" - height="14" - layout="topleft" - left_pad="59" - name="WL6pmHash" - top_delta="-3" - width="6"> - | - </text> - <text - type="string" - length="1" - border_visible="true" - follows="left|top|right" - font="SansSerif" - height="11" - layout="topleft" - left_pad="59" - name="WL9pmHash" - top_delta="3" - width="6"> - I - </text> - <text - type="string" - length="1" - border_visible="true" - follows="left|top|right" - font="SansSerif" - height="14" - layout="topleft" - left_pad="59" - name="WL12amHash2" - top_delta="-3" - width="6"> - | - </text> - </panel> - <text - type="string" - length="1" - border_visible="true" - follows="left|top|right" - font="SansSerif" - height="16" - layout="topleft" - left_delta="192" - name="WLCurKeyPresetText" - top_pad="10" - width="80"> - Sky Setting: - </text> - <combo_box - height="18" - label="Preset" - layout="topleft" - left_pad="5" - name="WLSkyPresets" - width="205" /> - <text - type="string" - length="1" - border_visible="true" - follows="left|top|right" - font="SansSerif" - height="16" - layout="topleft" - left_delta="-40" - name="WLCurKeyTimeText" - top_pad="15" - width="35"> - Time: - </text> - <time - follows="left|top" - height="16" - label_width="0" - layout="topleft" - left_pad="3" - name="time" - top_delta="-1" - value="6:00 AM" - width="75"/> - <view_border - bevel_style="none" - follows="top|left" - height="0" - layout="topleft" - left="10" - name="horiz_separator" - top_pad="20" - width="685"/> - <loading_indicator - height="23" - layout="topleft" - left="25" - name="progress_indicator" - top="350" - visible="false" - width="23" /> - <check_box - follows="top|left" - height="10" - label="Make this my new day cycle" - layout="topleft" - left="310" - name="make_default_cb" - top_delta="13" - width="230"/> - <button - follows="bottom|right" - height="23" - label="Save" - layout="topleft" - left_pad="0" - name="save" - top_delta="-13" - width="70"/> - <button - follows="bottom|right" - height="23" - label="Cancel" - layout="topleft" - left_pad="15" - name="cancel" - top_delta="0" - width="70"/> - </floater> + <layout_stack name="test_stack" + width="705" + height="500" + follows="all" + orientation="vertical"> + <layout_panel name="temp" + border="false" + auto_resize="false" + user_resize="true" + height="30" + min_height="30" + background_visible="false"> + <!-- This layout_panel is for loading legacy presets --> + <text + follows="top|left|right" + font="SansSerif" + height="10" + layout="topleft" + name="label" + top_offset="20" + left_offset="10" + width="120"> + Preset Name: + </text> + <combo_box + allow_text_entry="true" + follows="top|left" + layout="topleft" + left_pad="10" + max_chars="100" + name="day_cycle_preset_combo" + top_delta="-5" + width="200" /> + </layout_panel> + <layout_panel name="timeline" + border="true" + bevel_style="in" + auto_resize="false" + user_resize="true" + bg_alpha_color="red" + height="150" + min_height="0" + visible="true" + background_visible="true"> + <text + follows="top|left|right" + font="SansSerif" + height="10" + layout="topleft" + name="label" + top_offset="20" + left_offset="10" + width="120"> + Time Line Goes here + </text> + </layout_panel> + <layout_panel name="flex" + auto_resize="true" + user_resize="true" + bg_alpha_color="blue" + height="11" + min_height="0" + visible="true" + background_visible="true"> + <tab_container + follows="all" + halign="left" + height="386" + layout="topleft" + left_offset="0" + name="landtab" + tab_position="top" + tab_width="140" + tab_padding_right="3" + top_offset="6" + width="633"> + <panel + border="true" + follows="all" + label="DUMMY" + layout="topleft" + left="0" + help_topic="land_general_tab" + name="land_general_panel" + top="0"> + <text + follows="top|left|right" + font="SansSerif" + height="10" + layout="center" + name="label" + top_offset="20" + left_offset="10" + width="300"> + Space For editing selected frame + </text> + + </panel> + </tab_container> + </layout_panel> + <layout_panel name="buttons" + auto_resize="false" + user_resize="true" + height="43" + min_height="0" + background_visible="false"> + <button + follows="top|left" + height="23" + label="Save" + left_offset="160" + top_offset="60" + name="save_btn" + width="100" /> + <button + follows="top|left" + height="23" + label="Cancel" + layout="topleft" + left_pad="10" + name="cancel_btn" + width="100" /> + + </layout_panel> + </layout_stack> + +</floater> diff --git a/indra/newview/skins/default/xui/en/floater_test_layout_stacks.xml b/indra/newview/skins/default/xui/en/floater_test_layout_stacks.xml index 82ad031959..a3ed22f422 100644 --- a/indra/newview/skins/default/xui/en/floater_test_layout_stacks.xml +++ b/indra/newview/skins/default/xui/en/floater_test_layout_stacks.xml @@ -10,172 +10,217 @@ name="Test Floater" title="LAYOUTSTACK TESTS" width="420"> - <layout_stack + <layout_stack name="test_stack" left="0" top="0" - width="420" + width="100" height="250" - follows="left|right|top|bottom" + follows="left|top|bottom" orientation="vertical"> - <layout_panel + <layout_panel name="flex" auto_resize="true" user_resize="true" - bg_alpha_color="red" - max_height="200" - background_visible="false"> - <layout_stack - left="5" - top="5" - right="-5" - follows="left|right|top|bottom" - orientation="horizontal"> - <layout_panel - border="true" - bevel_style="in" - auto_resize="false" - user_resize="false" - width="160" - background_visible="true"> - <text follows="top|left" - halign="left" - text_color="white">Environment Source</text> - <radio_group - follows="top|left" - height="45" - layout="topleft" - left_delta="10" - name="environment_select_radio_group" - bottom_delta="50" - max_width="200" - width="200"> - <radio_item - label="Default Environment" - layout="topleft" - name="use_default_setting" - height="20"/> - <radio_item - label="Custom Environment" - layout="topleft" - height="20" - name="use_custom_setting"/> - </radio_group> - <button - follows="top|left" - height="23" - label="Edit Custom" - left_delta="30" - bottom_delta="30" - width="100" - name="edit_btn"/> - - </layout_panel> - <layout_panel - border="true" - bevel_style="in" - auto_resize="false" - user_resize="true" - height="11" - width="220" - background_visible="true"> - <text follows="top|left|right" - halign="left" - text_color="white">Day Settings</text> - <text - type="string" - length="1" - follows="left|top" - height="12" - layout="topleft" - left_delta="10" - top_pad="10" - width="200"> - Day Length (hours) - </text> - <slider - can_edit_text="true" - control_name="DayLengthSLD" - decimal_digits="1" - follows="left|top" - height="20" - increment="0.5" - initial_value="4" - layout="topleft" - left_delta="0" - top_pad="6" - name="day_length_sld" - min_val="4" - max_val="178" - width="200" /> - <text - type="string" - length="1" - follows="left|top" - height="12" - layout="topleft" - left_delta="0" - top_pad="10" - width="200"> - Day Offset (hours) - </text> - <slider - can_edit_text="true" - control_name="DayOffsetSLD" - decimal_digits="1" - follows="left|top" - height="20" - increment="0.5" - initial_value="-8" - layout="topleft" - left_delta="0" - top_pad="6" - name="day_offset_sld" - min_val="-12" - max_val="12" - width="200" /> - - </layout_panel> - <layout_panel name="flex" - auto_resize="true" - user_resize="true" - visible="false" - bg_alpha_color="blue" - height="100" - background_visible="true"> - </layout_panel> - </layout_stack> + bg_alpha_color="blue" + height="11" + min_height="0" + background_visible="true"> + <text follows="top|left|right" halign="center" text_color="white">flex</text> </layout_panel> <layout_panel name="flex" auto_resize="true" user_resize="true" + bg_alpha_color="blue" height="11" min_height="0" - background_visible="false"> - <check_box - control_name="may_override_chk" - height="16" - label="Parcel Owners May Override" - layout="topleft" - left="10" - top="10" - name="allow_override_chk" - width="200" /> - <button - follows="bottom|left" - height="23" - label="Apply" - right="-160" - bottom="-30" - name="apply_btn" - width="100" /> - <button - follows="bottom|left" - height="23" - label="Cancel" - layout="topleft" - left_pad="10" - name="cancel_btn" - width="100" /> - + visible="false" + background_visible="true"> + <text follows="top|left|right" halign="center" text_color="white">flex</text> + </layout_panel> + <layout_panel name="flex" + auto_resize="true" + user_resize="true" + bg_alpha_color="blue" + height="11" + min_height="0" + visible="true" + background_visible="true"> + <text follows="top|left|right" halign="center" text_color="white">flex</text> + </layout_panel> + <layout_panel name="flex" + auto_resize="true" + user_resize="true" + bg_alpha_color="blue" + height="11" + min_height="0" + background_visible="true"> + <text follows="top|left|right" halign="center" text_color="white">flex</text> + </layout_panel> + </layout_stack> + <layout_stack name="test_stack" + left_pad="5" + top="0" + width="100" + height="250" + follows="left|top|bottom" + orientation="vertical"> + <layout_panel name="flex" + auto_resize="true" + user_resize="true" + bg_alpha_color="blue" + height="100" + background_visible="true"> + <text follows="top|left|right" halign="center" text_color="white">flex</text> + </layout_panel> + <layout_panel name="flex" + auto_resize="true" + user_resize="true" + visible="false" + bg_alpha_color="blue" + height="100" + background_visible="true"> + <text follows="top|left|right" halign="center" text_color="white">flex</text> + </layout_panel> + <layout_panel name="fixed" + auto_resize="false" + user_resize="true" + height="50" + min_height="10" + bg_alpha_color="green" + background_visible="true"> + <text follows="top|left|right" halign="center" text_color="black">fixed</text> + </layout_panel> + <layout_panel name="fixed" + auto_resize="false" + user_resize="true" + height="50" + min_height="10" + bg_alpha_color="green" + background_visible="true"> + <text follows="top|left|right" halign="center" text_color="black">fixed</text> + </layout_panel> + <layout_panel name="flex" + auto_resize="true" + user_resize="true" + bg_alpha_color="blue" + height="100" + background_visible="true"> + <text follows="top|left|right" halign="center" text_color="white">flex</text> + </layout_panel> + <layout_panel name="flex" + auto_resize="true" + user_resize="true" + bg_alpha_color="blue" + height="100" + background_visible="true"> + <text follows="top|left|right" halign="center" text_color="white">flex</text> + </layout_panel> + <layout_panel name="flex" + auto_resize="true" + user_resize="true" + bg_alpha_color="blue" + height="100" + background_visible="true"> + <text follows="top|left|right" halign="center" text_color="white">flex</text> + </layout_panel> + <layout_panel name="flex" + auto_resize="true" + user_resize="true" + bg_alpha_color="blue" + height="100" + visible="true" + background_visible="true"> + <text follows="top|left|right" halign="center" text_color="white">flex</text> + </layout_panel> + </layout_stack> + <layout_stack name="test_stack" + left_pad="5" + top="0" + width="100" + height="250" + follows="left|top|bottom" + orientation="vertical"> + <layout_panel name="flex" + auto_resize="true" + user_resize="true" + height="11" + bg_alpha_color="blue" + background_visible="true"> + <text follows="top|left|right" halign="center" text_color="white">flex</text> + </layout_panel> + <layout_panel name="fixed" + auto_resize="false" + user_resize="true" + height="50" + bg_alpha_color="green" + background_visible="true"> + <text follows="top|left|right" halign="center" text_color="black">fixed</text> + </layout_panel> + <layout_panel name="flex" + auto_resize="true" + user_resize="true" + bg_alpha_color="blue" + height="11" + background_visible="true"> + <text follows="top|left|right" halign="center" text_color="white">flex</text> + </layout_panel> + </layout_stack> + <layout_stack name="test_stack" + left_pad="5" + top="0" + width="100" + height="250" + follows="left|top|bottom" + orientation="vertical"> + <layout_panel name="fixed" + auto_resize="false" + user_resize="true" + height="50" + bg_alpha_color="green" + background_visible="true"> + <text follows="top|left|right" halign="center" text_color="black">fixed</text> + </layout_panel> + <layout_panel name="fixed" + auto_resize="false" + user_resize="true" + height="50" + bg_alpha_color="green" + background_visible="true"> + <text follows="top|left|right" halign="center" text_color="black">fixed</text> + </layout_panel> + <layout_panel name="fixed" + auto_resize="false" + user_resize="true" + height="50" + bg_alpha_color="green" + background_visible="true"> + <text follows="top|left|right" halign="center" text_color="black">fixed</text> + </layout_panel> + <layout_panel name="flex" + auto_resize="true" + user_resize="true" + bg_alpha_color="blue" + height="11" + min_height="0" + background_visible="true"> + <text follows="top|left|right" halign="center" text_color="white">flex</text> + </layout_panel> + <layout_panel name="flex" + auto_resize="true" + user_resize="true" + bg_alpha_color="blue" + height="11" + min_height="0" + background_visible="true"> + <text follows="top|left|right" halign="center" text_color="white">flex</text> + </layout_panel> + <layout_panel name="flex" + auto_resize="true" + user_resize="true" + bg_alpha_color="blue" + height="11" + min_height="0" + background_visible="true"> + <text follows="top|left|right" halign="center" text_color="white">flex</text> </layout_panel> </layout_stack> </floater> |