summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorandreykproductengine <akleshchev@productengine.com>2017-04-25 17:48:34 +0300
committerandreykproductengine <akleshchev@productengine.com>2017-04-25 17:48:34 +0300
commit0dcb423cf3dc42e11621eece972801b036657e91 (patch)
tree88b0493918f6340d2e038b9cc0cde1cad6f493ff /indra/newview
parent288f93c7e0aa605464ddb09a3cdca504c0805c48 (diff)
MAINT-7145 Eliminate LLSingleton circular references
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/lldaycyclemanager.cpp22
-rw-r--r--indra/newview/llenvmanager.cpp21
-rw-r--r--indra/newview/llsky.cpp2
-rw-r--r--indra/newview/llstartup.cpp1
-rw-r--r--indra/newview/llwlparammanager.cpp25
-rw-r--r--indra/newview/llwlparammanager.h5
6 files changed, 32 insertions, 44 deletions
diff --git a/indra/newview/lldaycyclemanager.cpp b/indra/newview/lldaycyclemanager.cpp
index e7bf989850..803e2b2fb2 100644
--- a/indra/newview/lldaycyclemanager.cpp
+++ b/indra/newview/lldaycyclemanager.cpp
@@ -163,28 +163,6 @@ 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/llenvmanager.cpp b/indra/newview/llenvmanager.cpp
index b97e483fd9..12c3070474 100644
--- a/indra/newview/llenvmanager.cpp
+++ b/indra/newview/llenvmanager.cpp
@@ -476,7 +476,7 @@ void LLEnvManagerNew::onRegionSettingsResponse(const LLSD& content)
mCachedRegionPrefs = new_settings;
// Load region sky presets.
- LLWLParamManager::instance().refreshRegionPresets();
+ LLWLParamManager::instance().refreshRegionPresets(getRegionSettings().getSkyMap());
// If using server settings, update managers.
if (getUseRegionSettings())
@@ -509,6 +509,25 @@ void LLEnvManagerNew::initSingleton()
LL_DEBUGS("Windlight") << "Initializing LLEnvManagerNew" << LL_ENDL;
loadUserPrefs();
+
+ // preferences loaded, can set params
+ std::string preferred_day = getDayCycleName();
+ if (!useDayCycle(preferred_day, LLEnvKey::SCOPE_LOCAL))
+ {
+ LL_WARNS() << "No day cycle named " << preferred_day << ", reverting LLWLParamManager to defaults" << LL_ENDL;
+ LLWLParamManager::instance().setDefaultDay();
+ }
+
+ std::string sky = getSkyPresetName();
+ if (!useSkyPreset(sky))
+ {
+ LL_WARNS() << "No sky preset named " << sky << ", falling back to defaults" << LL_ENDL;
+ LLWLParamManager::instance().setDefaultSky();
+
+ // *TODO: Fix user preferences accordingly.
+ }
+
+ LLWLParamManager::instance().resetAnimator(0.5 /*noon*/, getUseDayCycle());
}
void LLEnvManagerNew::updateSkyFromPrefs()
diff --git a/indra/newview/llsky.cpp b/indra/newview/llsky.cpp
index 7a292fe0ef..3ef89ba920 100644
--- a/indra/newview/llsky.cpp
+++ b/indra/newview/llsky.cpp
@@ -341,8 +341,6 @@ void LLSky::init(const LLVector3 &sun_direction)
LLGLState::checkTextureChannels();
mUpdatedThisFrame = TRUE;
-
- LLEnvManagerNew::instance().usePrefs(); //inits day cycles and water
}
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 0a85344025..33b6352bf5 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -1462,6 +1462,7 @@ bool idle_startup()
LLGLState::checkStates();
LLGLState::checkTextureChannels();
+ LLEnvManagerNew::getInstance()->usePrefs(); // Load all presets and settings
gSky.init(initial_sun_direction);
LLGLState::checkStates();
diff --git a/indra/newview/llwlparammanager.cpp b/indra/newview/llwlparammanager.cpp
index debe467a9a..4b4393b07b 100644
--- a/indra/newview/llwlparammanager.cpp
+++ b/indra/newview/llwlparammanager.cpp
@@ -50,7 +50,6 @@
#include "llagent.h"
#include "llviewerregion.h"
-#include "llenvmanager.h"
#include "llwlparamset.h"
#include "llpostprocess.h"
@@ -251,13 +250,13 @@ void LLWLParamManager::addAllSkies(const LLWLParamKey::EScope scope, const LLSD&
}
}
-void LLWLParamManager::refreshRegionPresets()
+void LLWLParamManager::refreshRegionPresets(const LLSD& region_sky_presets)
{
// Remove all region sky presets because they may belong to a previously visited region.
clearParamSetsOfScope(LLEnvKey::SCOPE_REGION);
// Add all sky presets belonging to the current region.
- addAllSkies(LLEnvKey::SCOPE_REGION, LLEnvManagerNew::instance().getRegionSettings().getSkyMap());
+ addAllSkies(LLEnvKey::SCOPE_REGION, region_sky_presets);
}
void LLWLParamManager::loadAllPresets()
@@ -489,7 +488,6 @@ bool LLWLParamManager::applyDayCycleParams(const LLSD& params, LLEnvKey::EScope
void LLWLParamManager::setDefaultDay()
{
mDay.loadDayCycleFromFile("Default.xml");
- resetAnimator(0.5, LLEnvManagerNew::getInstance()->getUseDayCycle());
}
bool LLWLParamManager::applySkyParams(const LLSD& params)
@@ -499,6 +497,12 @@ bool LLWLParamManager::applySkyParams(const LLSD& params)
return true;
}
+void LLWLParamManager::setDefaultSky()
+{
+ getParamSet(LLWLParamKey("Default", LLWLParamKey::SCOPE_LOCAL), mCurParams);
+}
+
+
void LLWLParamManager::resetAnimator(F32 curTime, bool run)
{
mAnimator.setTrack(mDay.mTimeMap, mDay.mDayRate,
@@ -677,19 +681,6 @@ void LLWLParamManager::initSingleton()
loadAllPresets();
- // *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))
- {
- LL_WARNS() << "No sky preset named " << sky << ", falling back to defaults" << LL_ENDL;
- getParamSet(LLWLParamKey("Default", LLWLParamKey::SCOPE_LOCAL), mCurParams);
-
- // *TODO: Fix user preferences accordingly.
- }
-
- // set it to noon
- resetAnimator(0.5, LLEnvManagerNew::instance().getUseDayCycle());
-
// but use linden time sets it to what the estate is
mAnimator.setTimeType(LLWLAnimator::TIME_LINDEN);
}
diff --git a/indra/newview/llwlparammanager.h b/indra/newview/llwlparammanager.h
index db3c285e76..a8029839a7 100644
--- a/indra/newview/llwlparammanager.h
+++ b/indra/newview/llwlparammanager.h
@@ -29,7 +29,6 @@
#include <list>
#include <map>
-#include "llenvmanager.h"
#include "llwlparamset.h"
#include "llwlanimator.h"
#include "llwldaycycle.h"
@@ -246,6 +245,8 @@ public:
/// apply specified fixed sky params
bool applySkyParams(const LLSD& params);
+ void setDefaultSky();
+
// get where the light is pointing
inline LLVector4 getLightDir(void) const;
@@ -305,7 +306,7 @@ public:
void addAllSkies(LLEnvKey::EScope scope, const LLSD& preset_map);
/// refresh region-scope presets
- void refreshRegionPresets();
+ void refreshRegionPresets(const LLSD& region_sky_presets);
// returns all skies referenced by the current day cycle (in mDay), with their final names
// side effect: applies changes to all internal structures! (trashes all unreferenced skies in scope, keys in day cycle rescoped to scope, etc.)