From c32b19f31d4d5d0b32fcf64cce1cebd7d79b9b05 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 26 May 2011 15:11:01 +0300 Subject: STORM-1253 WIP Implemented switching between multiple day cycles (locally and region-wide). --- indra/newview/llwlparammanager.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'indra/newview/llwlparammanager.cpp') diff --git a/indra/newview/llwlparammanager.cpp b/indra/newview/llwlparammanager.cpp index ec7889cb93..396c61b4b6 100644 --- a/indra/newview/llwlparammanager.cpp +++ b/indra/newview/llwlparammanager.cpp @@ -50,6 +50,7 @@ #include "llagent.h" #include "llviewerregion.h" +#include "lldaycyclemanager.h" #include "llenvmanager.h" #include "llwlparamset.h" #include "llpostprocess.h" @@ -613,7 +614,11 @@ void LLWLParamManager::applyUserPrefs(bool interpolate) { if (LLEnvManagerNew::instance().getUseDayCycle()) { - applyDayCycle(LLEnvManagerNew::instance().getDayCycleName()); + if (!applyDayCycle(LLEnvManagerNew::instance().getDayCycleName())) + { + // *TODO: fix user prefs + applyDefaults(); + } } else { @@ -627,14 +632,21 @@ void LLWLParamManager::applyUserPrefs(bool interpolate) void LLWLParamManager::applyDefaults() { - applyDayCycle("Default"); + llassert(applyDayCycle("Default") == true); } -void LLWLParamManager::applyDayCycle(const std::string& day_cycle) +bool LLWLParamManager::applyDayCycle(const std::string& day_cycle) { LL_DEBUGS("Windlight") << "Applying day cycle [" << day_cycle << "]" << LL_ENDL; - mDay.loadDayCycleFromFile(day_cycle + ".xml"); + + if (!LLDayCycleManager::instance().getPreset(day_cycle, mDay)) + { + llwarns << "No day cycle named " << day_cycle << llendl; + return false; + } + resetAnimator(0.5, true); // set to noon and start animator + return true; } void LLWLParamManager::resetAnimator(F32 curTime, bool run) -- cgit v1.2.3