summaryrefslogtreecommitdiff
path: root/indra/newview/lldaycyclemanager.cpp
diff options
context:
space:
mode:
authorandreykproductengine <akleshchev@productengine.com>2017-04-24 19:55:55 +0300
committerandreykproductengine <akleshchev@productengine.com>2017-04-24 19:55:55 +0300
commit5b5ee18f6fb1bb6c5ef8590f933014069c5613a9 (patch)
tree4c686434ca129ecb55ca2dfa5af81f00d7447ed7 /indra/newview/lldaycyclemanager.cpp
parenta48da201406f435d917b564a08b53eef6e4e321e (diff)
MAINT-7330 Fixed circularity of environmental singletons
Diffstat (limited to 'indra/newview/lldaycyclemanager.cpp')
-rw-r--r--indra/newview/lldaycyclemanager.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/indra/newview/lldaycyclemanager.cpp b/indra/newview/lldaycyclemanager.cpp
index 803e2b2fb2..e7bf989850 100644
--- a/indra/newview/lldaycyclemanager.cpp
+++ b/indra/newview/lldaycyclemanager.cpp
@@ -163,6 +163,28 @@ void LLDayCycleManager::initSingleton()
{
LL_DEBUGS("Windlight") << "Loading all day cycles" << LL_ENDL;
loadAllPresets();
+
+ // presets loaded, can set params
+ if (LLEnvManagerNew::instance().getUseDayCycle())
+ {
+ LLSD params;
+ std::string preferred_day = LLEnvManagerNew::getInstance()->getDayCycleName();
+ if (getPreset(preferred_day, params))
+ {
+ // Same as through useDayCycle(), but it will call LLDayCycleManager and we are initializing
+ // so no need to cycle
+ LLWLParamManager::getInstance()->applyDayCycleParams(params, LLEnvKey::SCOPE_LOCAL);
+ }
+ else
+ {
+ LL_WARNS() << "No day cycle named " << preferred_day << ", reverting LLWLParamManager to defaults" << LL_ENDL;
+ LLWLParamManager::getInstance()->setDefaultDay();
+ }
+ }
+ else
+ {
+ LLWLParamManager::getInstance()->setDefaultDay();
+ }
}
void LLDayCycleManager::loadAllPresets()