summaryrefslogtreecommitdiff
path: root/indra
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
parenta48da201406f435d917b564a08b53eef6e4e321e (diff)
MAINT-7330 Fixed circularity of environmental singletons
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/lldaycyclemanager.cpp22
-rw-r--r--indra/newview/llsky.cpp3
-rw-r--r--indra/newview/llwaterparammanager.cpp1
-rw-r--r--indra/newview/llwlparammanager.cpp20
-rw-r--r--indra/newview/llwlparammanager.h3
5 files changed, 34 insertions, 15 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()
diff --git a/indra/newview/llsky.cpp b/indra/newview/llsky.cpp
index a961f0e3b4..7a292fe0ef 100644
--- a/indra/newview/llsky.cpp
+++ b/indra/newview/llsky.cpp
@@ -51,6 +51,7 @@
#include "llvosky.h"
#include "llcubemap.h"
#include "llviewercontrol.h"
+#include "llenvmanager.h"
#include "llvowlsky.h"
@@ -340,6 +341,8 @@ void LLSky::init(const LLVector3 &sun_direction)
LLGLState::checkTextureChannels();
mUpdatedThisFrame = TRUE;
+
+ LLEnvManagerNew::instance().usePrefs(); //inits day cycles and water
}
diff --git a/indra/newview/llwaterparammanager.cpp b/indra/newview/llwaterparammanager.cpp
index 28ae569ba2..b484b6d709 100644
--- a/indra/newview/llwaterparammanager.cpp
+++ b/indra/newview/llwaterparammanager.cpp
@@ -427,7 +427,6 @@ void LLWaterParamManager::initSingleton()
{
LL_DEBUGS("Windlight") << "Initializing water" << LL_ENDL;
loadAllPresets();
- LLEnvManagerNew::instance().usePrefs();
}
// static
diff --git a/indra/newview/llwlparammanager.cpp b/indra/newview/llwlparammanager.cpp
index 2b6d88efef..debe467a9a 100644
--- a/indra/newview/llwlparammanager.cpp
+++ b/indra/newview/llwlparammanager.cpp
@@ -50,7 +50,6 @@
#include "llagent.h"
#include "llviewerregion.h"
-#include "lldaycyclemanager.h"
#include "llenvmanager.h"
#include "llwlparamset.h"
#include "llpostprocess.h"
@@ -487,6 +486,12 @@ bool LLWLParamManager::applyDayCycleParams(const LLSD& params, LLEnvKey::EScope
return true;
}
+void LLWLParamManager::setDefaultDay()
+{
+ mDay.loadDayCycleFromFile("Default.xml");
+ resetAnimator(0.5, LLEnvManagerNew::getInstance()->getUseDayCycle());
+}
+
bool LLWLParamManager::applySkyParams(const LLSD& params)
{
mAnimator.deactivate();
@@ -672,17 +677,6 @@ void LLWLParamManager::initSingleton()
loadAllPresets();
- // load the day
- std::string preferred_day = LLEnvManagerNew::instance().getDayCycleName();
- if (!LLDayCycleManager::instance().getPreset(preferred_day, mDay))
- {
- // Fall back to default.
- LL_WARNS() << "No day cycle named " << preferred_day << ", falling back to defaults" << LL_ENDL;
- mDay.loadDayCycleFromFile("Default.xml");
-
- // *TODO: Fix user preferences accordingly.
- }
-
// *HACK - sets cloud scrolling to what we want... fix this better in the future
std::string sky = LLEnvManagerNew::instance().getSkyPresetName();
if (!getParamSet(LLWLParamKey(sky, LLWLParamKey::SCOPE_LOCAL), mCurParams))
@@ -698,8 +692,6 @@ void LLWLParamManager::initSingleton()
// but use linden time sets it to what the estate is
mAnimator.setTimeType(LLWLAnimator::TIME_LINDEN);
-
- LLEnvManagerNew::instance().usePrefs();
}
// static
diff --git a/indra/newview/llwlparammanager.h b/indra/newview/llwlparammanager.h
index a10102edf7..db3c285e76 100644
--- a/indra/newview/llwlparammanager.h
+++ b/indra/newview/llwlparammanager.h
@@ -240,6 +240,9 @@ public:
/// apply specified day cycle, setting time to noon by default
bool applyDayCycleParams(const LLSD& params, LLEnvKey::EScope scope, F32 time = 0.5);
+ /// Apply Default.xml map
+ void setDefaultDay();
+
/// apply specified fixed sky params
bool applySkyParams(const LLSD& params);