diff options
author | Vadim ProductEngine <vsavchuk@productengine.com> | 2011-05-26 19:32:20 +0300 |
---|---|---|
committer | Vadim ProductEngine <vsavchuk@productengine.com> | 2011-05-26 19:32:20 +0300 |
commit | c0037909d576fc4922b92dfcc83d865d61ac43cb (patch) | |
tree | 3c60062923b841324281e073e22481b5c217b0e8 /indra/newview/llenvmanager.cpp | |
parent | c32b19f31d4d5d0b32fcf64cce1cebd7d79b9b05 (diff) |
STORM-1284 FIXED Changes to region environment are now visible immediately.
Pressing "Apply" sends the settings update to server.
Pressing "Cancel" reverts to current region settings.
Diffstat (limited to 'indra/newview/llenvmanager.cpp')
-rw-r--r-- | indra/newview/llenvmanager.cpp | 78 |
1 files changed, 76 insertions, 2 deletions
diff --git a/indra/newview/llenvmanager.cpp b/indra/newview/llenvmanager.cpp index f12c3e54ff..d5d03ff1e5 100644 --- a/indra/newview/llenvmanager.cpp +++ b/indra/newview/llenvmanager.cpp @@ -37,6 +37,7 @@ #include "llagent.h" #include "llviewerregion.h" +#include "lldaycyclemanager.h" #include "llfloaterreg.h" #include "llfloaterwindlight.h" #include "llfloaterwater.h" @@ -668,6 +669,74 @@ const LLEnvironmentSettings& LLEnvManagerNew::getRegionSettings() const return mCachedRegionPrefs; } +bool LLEnvManagerNew::usePrefs() +{ + LL_DEBUGS("Windlight") << "Displaying preferred environment" << LL_ENDL; + updateManagersFromPrefs(false); + return true; +} + +bool LLEnvManagerNew::useDefaults() +{ + bool rslt = useWaterPreset("Default") && useDayCycle("Default", LLEnvKey::SCOPE_LOCAL); + return rslt; +} + +bool LLEnvManagerNew::useWaterPreset(const std::string& name) +{ + LL_DEBUGS("Windlight") << "Displaying water preset " << name << LL_ENDL; + LLWaterParamManager& water_mgr = LLWaterParamManager::instance(); + bool rslt = water_mgr.getParamSet(name, water_mgr.mCurParams); + llassert(rslt == true); + return rslt; +} + +bool LLEnvManagerNew::useWaterParams(const LLSD& params) +{ + LL_DEBUGS("Windlight") << "Displaying water params" << LL_ENDL; + LLWaterParamManager::instance().mCurParams.setAll(params); + return true; +} + +bool LLEnvManagerNew::useSkyParams(const LLSD& params) +{ + LL_DEBUGS("Windlight") << "Displaying sky params" << LL_ENDL; + LLWLParamManager::instance().applySkyParams(params); + return true; +} + +bool LLEnvManagerNew::useDayCycle(const std::string& name, LLEnvKey::EScope scope) +{ + LLSD params; + + if (scope == LLEnvKey::SCOPE_REGION) + { + LL_DEBUGS("Windlight") << "Displaying region day cycle " << name << LL_ENDL; + params = getRegionSettings().getWLDayCycle(); + } + else + { + LL_DEBUGS("Windlight") << "Displaying local day cycle " << name << LL_ENDL; + + if (!LLDayCycleManager::instance().getPreset(name, params)) + { + llwarns << "No day cycle named " << name << llendl; + return false; + } + } + + bool rslt = LLWLParamManager::instance().applyDayCycleParams(params, scope); + llassert(rslt == true); + return rslt; +} + +bool LLEnvManagerNew::useDayCycleParams(const LLSD& params, LLEnvKey::EScope scope) +{ + LL_DEBUGS("Windlight") << "Displaying day cycle params" << LL_ENDL; + LLWLParamManager::instance().applyDayCycleParams(params, scope); + return true; +} + void LLEnvManagerNew::setUseRegionSettings(bool val) { mUserPrefs.setUseDefaults(val); @@ -818,9 +887,14 @@ void LLEnvManagerNew::onRegionSettingsResponse(const LLSD& content) LLEnvironmentSettings new_settings(content[1], content[2], content[3], sun_hour); mCachedRegionPrefs = new_settings; + // Load region sky presets. + LLWLParamManager::instance().refreshRegionPresets(); + // If using server settings, update managers. - // This also adds server skies to the WL param mgr. - updateManagersFromPrefs(mInterpNextChangeMessage); + if (getUseRegionSettings()) + { + updateManagersFromPrefs(mInterpNextChangeMessage); + } // Let interested parties know about the region settings update. mRegionSettingsChangeSignal(); |