diff options
author | Vadim ProductEngine <vsavchuk@productengine.com> | 2011-03-31 18:24:01 +0300 |
---|---|---|
committer | Vadim ProductEngine <vsavchuk@productengine.com> | 2011-03-31 18:24:01 +0300 |
commit | 38f87d0e21cfb6807e262e0289e1f6b08904a4e7 (patch) | |
tree | 29fa2d175e9cd8931ec090b7f4f4177c884e5713 /indra | |
parent | 7419abc12ba07380593fa3c0571155b248b8c8a6 (diff) |
STORM-1126 WIP Windlight Estate Settings integration: pass 6
* Made it possible to update a region sky preset with the Save button.
* Fixed resetting day cycle when you start editing region environment settings.
* Fixed: if you press "Cancel Changes" in the region envitonment settings
and then choose to resume editing in the confirmation dialog,
you won't be able to cancel your changes later.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llenvmanager.cpp | 31 | ||||
-rw-r--r-- | indra/newview/llenvmanager.h | 2 | ||||
-rw-r--r-- | indra/newview/llfloaterwindlight.cpp | 17 |
3 files changed, 46 insertions, 4 deletions
diff --git a/indra/newview/llenvmanager.cpp b/indra/newview/llenvmanager.cpp index 010ecc267b..9300161837 100644 --- a/indra/newview/llenvmanager.cpp +++ b/indra/newview/llenvmanager.cpp @@ -109,6 +109,12 @@ void LLEnvManager::startEditingScope(LLEnvKey::EScope scope) mIsEditing = true; mCurEditingScope = scope; + // Back up local settings so that we can switch back to them later. + if (scope != LLEnvKey::SCOPE_LOCAL) + { + backUpLocalSettingsIfNeeded(); + } + // show scope being edited loadSettingsIntoManagers(scope, false); @@ -160,16 +166,17 @@ void LLEnvManager::maybeClearEditingScope(bool user_initiated, bool was_commit) void LLEnvManager::clearEditingScope(const LLSD& notification, const LLSD& response) { - LL_DEBUGS("Windlight") << "Clearing editing scope " << mCurNormalScope << LL_ENDL; - if(notification.isDefined() && response.isDefined() && LLNotification::getSelectedOption(notification, response) != 0) { +#if 0 // *TODO: select terrain panel here mIsEditing = false; LLFloaterReg::showTypedInstance<LLFloaterRegionInfo>("regioninfo"); +#endif return; } + LL_DEBUGS("Windlight") << "Clearing editing scope " << mCurNormalScope << LL_ENDL; mIsEditing = false; updateUIFromEditability(); @@ -244,6 +251,12 @@ bool LLEnvManager::canEdit(LLEnvKey::EScope scope) void LLEnvManager::refreshFromStorage(LLEnvKey::EScope scope) { + // Back up local env. settings so that we can switch to them later. + if (scope != LLEnvKey::SCOPE_LOCAL) + { + backUpLocalSettingsIfNeeded(); + } + switch (scope) { case LLEnvKey::SCOPE_LOCAL: @@ -473,6 +486,20 @@ void LLEnvManager::saveSettingsFromManagers(LLEnvKey::EScope scope) } } +void LLEnvManager::backUpLocalSettingsIfNeeded() +{ + // *HACK: Back up local env. settings so that we can switch to them later. + // Otherwise local day cycle is likely to be reset. + static bool sSavedLocalSettings = false; + + if (!sSavedLocalSettings) + { + LL_DEBUGS("Windlight") << "Backing up local environment settings" << LL_ENDL; + saveSettingsFromManagers(LLEnvKey::SCOPE_LOCAL); + sSavedLocalSettings = true; + } +} + /******* * Setting desired display level *******/ diff --git a/indra/newview/llenvmanager.h b/indra/newview/llenvmanager.h index 138921b432..60298b12e4 100644 --- a/indra/newview/llenvmanager.h +++ b/indra/newview/llenvmanager.h @@ -189,6 +189,8 @@ private: void loadSettingsIntoManagers(LLEnvKey::EScope scope, bool interpolate); // save from current display and UI into memory (mOrigSettingStore) void saveSettingsFromManagers(LLEnvKey::EScope scope); + // If not done already, save current local environment settings, so that we can switch to them later. + void backUpLocalSettingsIfNeeded(); // Save copy of settings from the current ones in the param managers LLEnvironmentSettings collateFromParamManagers(); diff --git a/indra/newview/llfloaterwindlight.cpp b/indra/newview/llfloaterwindlight.cpp index 04adf62733..5682bc1f17 100644 --- a/indra/newview/llfloaterwindlight.cpp +++ b/indra/newview/llfloaterwindlight.cpp @@ -790,9 +790,22 @@ void LLFloaterWindLight::onSavePreset(void* userData) return; } + // If region scope, save immediately. + // We don't actually save to file in this case, but just update the preset + // so that the changes can be uploaded to server. + LLWLParamKey key(comboBox->getSelectedValue()); + if (key.scope == LLEnvKey::SCOPE_REGION) + { + // *TODO: Eliminate code duplication. + LL_DEBUGS("Windlight") << "Saving region sky preset: " << key.name << llendl; + LLWLParamManager * param_mgr = LLWLParamManager::getInstance(); + param_mgr->mCurParams.mName = key.name; + param_mgr->setParamSet(key, param_mgr->mCurParams); + return; + } + // check to see if it's a default and shouldn't be overwritten - std::set<LLWLParamKey>::iterator sIt = sDefaultPresets.find( - LLWLParamKey(comboBox->getSelectedValue())); + std::set<LLWLParamKey>::iterator sIt = sDefaultPresets.find(LLWLParamKey(key)); if(sIt != sDefaultPresets.end() && !gSavedSettings.getBOOL("SkyEditPresets")) { LLNotifications::instance().add("WLNoEditDefault", LLSD(), LLSD()); |