From 0d1cc56eb128755ce9e63d8cdf852b0e3b6f4fb1 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Fri, 10 Jun 2011 18:21:32 +0300 Subject: STORM-1279 FIXED Changing sky preset with a keyboard shortcut now updates the Environment Settings floater. Changes: * Subscribed the floater to the "settings changed" signal of the environment manager. * Rewrote the floater to not modify settings only when the Save button is pressed. * Refactoring to eliminate code duplication. --- indra/newview/llenvmanager.cpp | 174 ++++++++++++++++++++++++- indra/newview/llenvmanager.h | 21 ++- indra/newview/llfloaterenvironmentsettings.cpp | 141 +++++++++++--------- indra/newview/llfloaterenvironmentsettings.h | 11 +- indra/newview/llwaterparammanager.cpp | 57 ++------ indra/newview/llwaterparammanager.h | 4 +- indra/newview/llwlparammanager.cpp | 58 +-------- indra/newview/llwlparammanager.h | 6 - 8 files changed, 279 insertions(+), 193 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llenvmanager.cpp b/indra/newview/llenvmanager.cpp index 03b37ecaed..6b506574b6 100644 --- a/indra/newview/llenvmanager.cpp +++ b/indra/newview/llenvmanager.cpp @@ -685,7 +685,21 @@ bool LLEnvManagerNew::usePrefs() bool LLEnvManagerNew::useDefaults() { - bool rslt = useWaterPreset("Default") && useDayCycle("Default", LLEnvKey::SCOPE_LOCAL); + bool rslt; + + rslt = useDefaultWater(); + rslt &= useDefaultSky(); + + return rslt; +} + +bool LLEnvManagerNew::useRegionSettings() +{ + bool rslt; + + rslt = useRegionSky(); + rslt &= useRegionWater(); + return rslt; } @@ -705,6 +719,22 @@ bool LLEnvManagerNew::useWaterParams(const LLSD& params) return true; } +bool LLEnvManagerNew::useSkyPreset(const std::string& name) +{ + LLWLParamManager& sky_mgr = LLWLParamManager::instance(); + LLWLParamSet param_set; + + if (!sky_mgr.getParamSet(LLWLParamKey(name, LLEnvKey::SCOPE_LOCAL), param_set)) + { + llwarns << "No sky preset named " << name << llendl; + return false; + } + + LL_DEBUGS("Windlight") << "Displaying sky preset " << name << LL_ENDL; + sky_mgr.applySkyParams(param_set.getAll()); + return true; +} + bool LLEnvManagerNew::useSkyParams(const LLSD& params) { LL_DEBUGS("Windlight") << "Displaying sky params" << LL_ENDL; @@ -737,11 +767,10 @@ bool LLEnvManagerNew::useDayCycle(const std::string& name, LLEnvKey::EScope scop return rslt; } -bool LLEnvManagerNew::useDayCycleParams(const LLSD& params, LLEnvKey::EScope scope) +bool LLEnvManagerNew::useDayCycleParams(const LLSD& params, LLEnvKey::EScope scope, F32 time /* = 0.5*/) { LL_DEBUGS("Windlight") << "Displaying day cycle params" << LL_ENDL; - LLWLParamManager::instance().applyDayCycleParams(params, scope); - return true; + return LLWLParamManager::instance().applyDayCycleParams(params, scope); } void LLEnvManagerNew::setUseRegionSettings(bool val) @@ -811,6 +840,8 @@ void LLEnvManagerNew::saveUserPrefs() gSavedSettings.setBOOL("UseEnvironmentFromRegion", getUseRegionSettings()); gSavedSettings.setBOOL("UseDayCycle", getUseDayCycle()); + + mUsePrefsChangeSignal(); } void LLEnvManagerNew::setUserPrefs( @@ -908,6 +939,11 @@ bool LLEnvManagerNew::sendRegionSettings(const LLEnvironmentSettings& new_settin return LLEnvironmentApply::initiateRequest(new_settings.makePacket(metadata)); } +boost::signals2::connection LLEnvManagerNew::setPreferencesChangeCallback(const prefs_change_signal_t::slot_type& cb) +{ + return mUsePrefsChangeSignal.connect(cb); +} + boost::signals2::connection LLEnvManagerNew::setRegionSettingsChangeCallback(const region_settings_change_signal_t::slot_type& cb) { return mRegionSettingsChangeSignal.connect(cb); @@ -993,15 +1029,141 @@ void LLEnvManagerNew::initSingleton() loadUserPrefs(); } +void LLEnvManagerNew::updateSkyFromPrefs() +{ + bool success = true; + + // Sync sky with user prefs. + if (getUseRegionSettings()) // apply region-wide settings + { + success = useRegionSky(); + } + else // apply user-specified settings + { + if (getUseDayCycle()) + { + success = useDayCycle(getDayCycleName(), LLEnvKey::SCOPE_LOCAL); + } + else + { + success = useSkyPreset(getSkyPresetName()); + } + } + + // If something went wrong, fall back to defaults. + if (!success) + { + // *TODO: fix user prefs + useDefaultSky(); + } +} + +void LLEnvManagerNew::updateWaterFromPrefs(bool interpolate) +{ + LLWaterParamManager& water_mgr = LLWaterParamManager::instance(); + LLSD target_water_params; + + // Determine new water settings based on user prefs. + + { + // Fall back to default water. + LLWaterParamSet default_water; + water_mgr.getParamSet("Default", default_water); + target_water_params = default_water.getAll(); + } + + if (getUseRegionSettings()) + { + // *TODO: make sure whether region settings belong to the current region? + const LLSD& region_water_params = getRegionSettings().getWaterParams(); + if (region_water_params.size() != 0) // region has no water settings + { + LL_DEBUGS("Windlight") << "Applying region water" << LL_ENDL; + target_water_params = region_water_params; + } + else + { + LL_DEBUGS("Windlight") << "Applying default water" << LL_ENDL; + } + } + else + { + std::string water = getWaterPresetName(); + LL_DEBUGS("Windlight") << "Applying water preset [" << water << "]" << LL_ENDL; + LLWaterParamSet params; + if (!water_mgr.getParamSet(water, params)) + { + llwarns << "No water preset named " << water << ", falling back to defaults" << llendl; + water_mgr.getParamSet("Default", params); + + // *TODO: Fix user preferences accordingly. + } + target_water_params = params.getAll(); + } + + // Sync water with user prefs. + water_mgr.applyParams(target_water_params, interpolate); +} + void LLEnvManagerNew::updateManagersFromPrefs(bool interpolate) { // Apply water settings. - LLWaterParamManager::instance().applyUserPrefs(interpolate); + updateWaterFromPrefs(interpolate); // Apply sky settings. - LLWLParamManager::instance().applyUserPrefs(interpolate); + updateSkyFromPrefs(); } +bool LLEnvManagerNew::useRegionSky() +{ + const LLEnvironmentSettings& region_settings = getRegionSettings(); + + // If region is set to defaults, + if (region_settings.getSkyMap().size() == 0) + { + // well... apply the default sky settings. + useDefaultSky(); + return true; + } + + // *TODO: Support fixed sky from region. + + // Otherwise apply region day cycle. + LL_DEBUGS("Windlight") << "Applying region sky" << LL_ENDL; + return useDayCycleParams( + region_settings.getWLDayCycle(), + LLEnvKey::SCOPE_REGION, + region_settings.getDayTime()); +} + +bool LLEnvManagerNew::useRegionWater() +{ + const LLEnvironmentSettings& region_settings = getRegionSettings(); + const LLSD& region_water = region_settings.getWaterParams(); + + // If region is set to defaults, + if (region_water.size() == 0) + { + // well... apply the default water settings. + return useDefaultWater(); + } + + // Otherwise apply region water. + LL_DEBUGS("Windlight") << "Applying region sky" << LL_ENDL; + return useWaterParams(region_water); +} + +bool LLEnvManagerNew::useDefaultSky() +{ + return useDayCycle("Default", LLEnvKey::SCOPE_LOCAL); +} + +bool LLEnvManagerNew::useDefaultWater() +{ + return useWaterPreset("Default"); +} + + void LLEnvManagerNew::onRegionChange(bool interpolate) { // Avoid duplicating region setting requests diff --git a/indra/newview/llenvmanager.h b/indra/newview/llenvmanager.h index 4d7c0fe5e4..343416634c 100644 --- a/indra/newview/llenvmanager.h +++ b/indra/newview/llenvmanager.h @@ -267,6 +267,7 @@ class LLEnvManagerNew : public LLSingleton { LOG_CLASS(LLEnvManagerNew); public: + typedef boost::signals2::signal prefs_change_signal_t; typedef boost::signals2::signal region_settings_change_signal_t; typedef boost::signals2::signal region_change_signal_t; typedef boost::signals2::signal region_settings_applied_signal_t; @@ -295,31 +296,34 @@ public: // Change environment w/o changing user preferences. bool usePrefs(); bool useDefaults(); + bool useRegionSettings(); bool useWaterPreset(const std::string& name); bool useWaterParams(const LLSD& params); + bool useSkyPreset(const std::string& name); bool useSkyParams(const LLSD& params); bool useDayCycle(const std::string& name, LLEnvKey::EScope scope); - bool useDayCycleParams(const LLSD& params, LLEnvKey::EScope scope); + bool useDayCycleParams(const LLSD& params, LLEnvKey::EScope scope, F32 time = 0.5); // setters for user env. preferences void setUseRegionSettings(bool val); void setUseWaterPreset(const std::string& name); void setUseSkyPreset(const std::string& name); void setUseDayCycle(const std::string& name); - - // Preferences manipulation. void setUserPrefs( const std::string& water_preset, const std::string& sky_preset, const std::string& day_cycle_preset, bool use_fixed_sky, bool use_region_settings); + + // debugging methods void dumpUserPrefs(); void dumpPresets(); // Misc. void requestRegionSettings(); bool sendRegionSettings(const LLEnvironmentSettings& new_settings); + boost::signals2::connection setPreferencesChangeCallback(const prefs_change_signal_t::slot_type& cb); boost::signals2::connection setRegionSettingsChangeCallback(const region_settings_change_signal_t::slot_type& cb); boost::signals2::connection setRegionChangeCallback(const region_change_signal_t::slot_type& cb); boost::signals2::connection setRegionSettingsAppliedCallback(const region_settings_applied_signal_t::slot_type& cb); @@ -339,10 +343,21 @@ private: void loadUserPrefs(); void saveUserPrefs(); + void updateSkyFromPrefs(); + void updateWaterFromPrefs(bool interpolate); void updateManagersFromPrefs(bool interpolate); + bool useRegionSky(); + bool useRegionWater(); + + bool useDefaultSky(); + bool useDefaultWater(); + void onRegionChange(bool interpolate); + /// Emitted when user environment preferences change. + prefs_change_signal_t mUsePrefsChangeSignal; + /// Emitted when region environment settings update comes. region_settings_change_signal_t mRegionSettingsChangeSignal; diff --git a/indra/newview/llfloaterenvironmentsettings.cpp b/indra/newview/llfloaterenvironmentsettings.cpp index 4517063460..23da78f99f 100644 --- a/indra/newview/llfloaterenvironmentsettings.cpp +++ b/indra/newview/llfloaterenvironmentsettings.cpp @@ -47,10 +47,6 @@ LLFloaterEnvironmentSettings::LLFloaterEnvironmentSettings(const LLSD &key) { } -LLFloaterEnvironmentSettings::~LLFloaterEnvironmentSettings() -{ -} - // virtual BOOL LLFloaterEnvironmentSettings::postBuild() { @@ -76,6 +72,7 @@ BOOL LLFloaterEnvironmentSettings::postBuild() setCloseCallback(boost::bind(&LLFloaterEnvironmentSettings::cancel, this)); + LLEnvManagerNew::instance().setPreferencesChangeCallback(boost::bind(&LLFloaterEnvironmentSettings::refresh, this)); LLDayCycleManager::instance().setModifyCallback(boost::bind(&LLFloaterEnvironmentSettings::populateDayCyclePresetsList, this)); LLWLParamManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterEnvironmentSettings::populateSkyPresetsList, this)); LLWaterParamManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterEnvironmentSettings::populateWaterPresetsList, this)); @@ -86,47 +83,14 @@ BOOL LLFloaterEnvironmentSettings::postBuild() // virtual void LLFloaterEnvironmentSettings::onOpen(const LLSD& key) { - LLEnvManagerNew *env_mgr = LLEnvManagerNew::getInstance(); - - // Save UseRegionSettings and UseFixedSky settings to restore them - // in case of "Cancel" button has been pressed. - mUseRegionSettings = env_mgr->getUseRegionSettings(); - mUseFixedSky = env_mgr->getUseFixedSky(); - - mRegionSettingsRadioGroup->setSelectedIndex(mUseRegionSettings ? 0 : 1); - mDayCycleSettingsRadioGroup->setSelectedIndex(mUseFixedSky ? 0 : 1); - - // Populate the combo boxes with appropriate lists of available presets. - populateWaterPresetsList(); - populateSkyPresetsList(); - populateDayCyclePresetsList(); - - // Enable/disable other controls based on user preferences. - getChild("user_environment_settings")->setEnabled(!mUseRegionSettings); - mSkyPresetCombo->setEnabled(mUseFixedSky); - mDayCyclePresetCombo->setEnabled(!mUseFixedSky); - - // Save water, sky and day cycle presets to restore them - // in case of "Cancel" button has been pressed. - mWaterPreset = env_mgr->getWaterPresetName(); - mSkyPreset = env_mgr->getSkyPresetName(); - mDayCyclePreset = env_mgr->getDayCycleName(); - - // Select the current presets in combo boxes. - mWaterPresetCombo->selectByValue(mWaterPreset); - mSkyPresetCombo->selectByValue(mSkyPreset); - mDayCyclePresetCombo->selectByValue(mDayCyclePreset); - - mDirty = false; + refresh(); } void LLFloaterEnvironmentSettings::onSwitchRegionSettings() { getChild("user_environment_settings")->setEnabled(mRegionSettingsRadioGroup->getSelectedIndex() != 0); - LLEnvManagerNew::getInstance()->setUseRegionSettings(mRegionSettingsRadioGroup->getSelectedIndex() == 0); - - mDirty = true; + apply(); } void LLFloaterEnvironmentSettings::onSwitchDayCycle() @@ -136,54 +100,109 @@ void LLFloaterEnvironmentSettings::onSwitchDayCycle() mSkyPresetCombo->setEnabled(is_fixed_sky); mDayCyclePresetCombo->setEnabled(!is_fixed_sky); - if (is_fixed_sky) - { - LLEnvManagerNew::getInstance()->setUseSkyPreset(mSkyPresetCombo->getValue().asString()); - } - else - { - LLEnvManagerNew::getInstance()->setUseDayCycle(mDayCyclePresetCombo->getValue().asString()); - } - - mDirty = true; + apply(); } void LLFloaterEnvironmentSettings::onSelectWaterPreset() { - LLEnvManagerNew::getInstance()->setUseWaterPreset(mWaterPresetCombo->getValue().asString()); - mDirty = true; + apply(); } void LLFloaterEnvironmentSettings::onSelectSkyPreset() { - LLEnvManagerNew::getInstance()->setUseSkyPreset(mSkyPresetCombo->getValue().asString()); - mDirty = true; + apply(); } void LLFloaterEnvironmentSettings::onSelectDayCyclePreset() { - LLEnvManagerNew::getInstance()->setUseDayCycle(mDayCyclePresetCombo->getValue().asString()); - mDirty = true; + apply(); } void LLFloaterEnvironmentSettings::onBtnOK() { - mDirty = false; + // Save and apply new user preferences. + bool use_region_settings = mRegionSettingsRadioGroup->getSelectedIndex() == 0; + bool use_fixed_sky = mDayCycleSettingsRadioGroup->getSelectedIndex() == 0; + std::string water_preset = mWaterPresetCombo->getValue().asString(); + std::string sky_preset = mSkyPresetCombo->getValue().asString(); + std::string day_cycle = mDayCyclePresetCombo->getValue().asString(); + + LLEnvManagerNew::instance().setUserPrefs( + water_preset, + sky_preset, + day_cycle, + use_fixed_sky, + use_region_settings); + + // *TODO: This triggers applying user preferences again, which is suboptimal. closeFloater(); } void LLFloaterEnvironmentSettings::onBtnCancel() { - cancel(); closeFloater(); } -void LLFloaterEnvironmentSettings::cancel() +void LLFloaterEnvironmentSettings::refresh() { - if (!mDirty) return; + LLEnvManagerNew& env_mgr = LLEnvManagerNew::instance(); + + bool use_region_settings = env_mgr.getUseRegionSettings(); + bool use_fixed_sky = env_mgr.getUseFixedSky(); + + // Set up radio buttons according to user preferences. + mRegionSettingsRadioGroup->setSelectedIndex(use_region_settings ? 0 : 1); + mDayCycleSettingsRadioGroup->setSelectedIndex(use_fixed_sky ? 0 : 1); + + // Populate the combo boxes with appropriate lists of available presets. + populateWaterPresetsList(); + populateSkyPresetsList(); + populateDayCyclePresetsList(); + + // Enable/disable other controls based on user preferences. + getChild("user_environment_settings")->setEnabled(!use_region_settings); + mSkyPresetCombo->setEnabled(use_fixed_sky); + mDayCyclePresetCombo->setEnabled(!use_fixed_sky); - // Restore the saved user prefs - LLEnvManagerNew::getInstance()->setUserPrefs(mWaterPreset, mSkyPreset, mDayCyclePreset, mUseFixedSky, mUseRegionSettings); + // Select the current presets in combo boxes. + mWaterPresetCombo->selectByValue(env_mgr.getWaterPresetName()); + mSkyPresetCombo->selectByValue(env_mgr.getSkyPresetName()); + mDayCyclePresetCombo->selectByValue(env_mgr.getDayCycleName()); +} + +void LLFloaterEnvironmentSettings::apply() +{ + // Update environment with the user choice. + bool use_region_settings = mRegionSettingsRadioGroup->getSelectedIndex() == 0; + bool use_fixed_sky = mDayCycleSettingsRadioGroup->getSelectedIndex() == 0; + std::string water_preset = mWaterPresetCombo->getValue().asString(); + std::string sky_preset = mSkyPresetCombo->getValue().asString(); + std::string day_cycle = mDayCyclePresetCombo->getValue().asString(); + + LLEnvManagerNew& env_mgr = LLEnvManagerNew::instance(); + if (use_region_settings) + { + env_mgr.useRegionSettings(); + } + else + { + if (use_fixed_sky) + { + env_mgr.useSkyPreset(sky_preset); + } + else + { + env_mgr.useDayCycle(day_cycle, LLEnvKey::SCOPE_LOCAL); + } + + env_mgr.useWaterPreset(water_preset); + } +} + +void LLFloaterEnvironmentSettings::cancel() +{ + // Revert environment to user preferences. + LLEnvManagerNew::instance().usePrefs(); } void LLFloaterEnvironmentSettings::populateWaterPresetsList() diff --git a/indra/newview/llfloaterenvironmentsettings.h b/indra/newview/llfloaterenvironmentsettings.h index 0953ab4a65..0ab458a0f6 100644 --- a/indra/newview/llfloaterenvironmentsettings.h +++ b/indra/newview/llfloaterenvironmentsettings.h @@ -38,7 +38,6 @@ class LLFloaterEnvironmentSettings : public LLFloater public: LLFloaterEnvironmentSettings(const LLSD &key); - /*virtual*/ ~LLFloaterEnvironmentSettings(); /*virtual*/ BOOL postBuild(); /*virtual*/ void onOpen(const LLSD& key); @@ -53,6 +52,8 @@ private: void onBtnOK(); void onBtnCancel(); + void refresh(); /// update controls with user prefs + void apply(); void cancel(); void populateWaterPresetsList(); @@ -65,14 +66,6 @@ private: LLComboBox* mWaterPresetCombo; LLComboBox* mSkyPresetCombo; LLComboBox* mDayCyclePresetCombo; - - std::string mWaterPreset; - std::string mSkyPreset; - std::string mDayCyclePreset; - - bool mUseRegionSettings; - bool mUseFixedSky; - bool mDirty; }; #endif // LL_LLFLOATERENVIRONMENTSETTINGS_H diff --git a/indra/newview/llwaterparammanager.cpp b/indra/newview/llwaterparammanager.cpp index d84ccb0ada..aab621738c 100644 --- a/indra/newview/llwaterparammanager.cpp +++ b/indra/newview/llwaterparammanager.cpp @@ -198,67 +198,26 @@ void LLWaterParamManager::updateShaderUniforms(LLGLSLShader * shader) } } -static LLFastTimer::DeclareTimer FTM_UPDATE_WATERPARAM("Update Water Params"); - -void LLWaterParamManager::applyUserPrefs(bool interpolate) +void LLWaterParamManager::applyParams(const LLSD& params, bool interpolate) { - LLSD target_water_params; - - // Determine new water settings based on user prefs. - - { - // Fall back to default water. - LLWaterParamSet default_water; - getParamSet("Default", default_water); - target_water_params = default_water.getAll(); - } - - if (LLEnvManagerNew::instance().getUseRegionSettings()) - { - // *TODO: make sure whether region settings belong to the current region? - const LLSD& region_water_params = LLEnvManagerNew::instance().getRegionSettings().getWaterParams(); - if (region_water_params.size() != 0) // region has no water settings - { - LL_DEBUGS("Windlight") << "Applying region water" << LL_ENDL; - target_water_params = region_water_params; - } - else - { - LL_DEBUGS("Windlight") << "Applying default water" << LL_ENDL; - } - } - else + if (params.size() == 0) { - std::string water = LLEnvManagerNew::instance().getWaterPresetName(); - LL_DEBUGS("Windlight") << "Applying water preset [" << water << "]" << LL_ENDL; - LLWaterParamSet params; - if (!getParamSet(water, params)) - { - llwarns << "No wayer preset named " << water << ", falling back to defaults" << llendl; - getParamSet("Default", params); - - // *TODO: Fix user preferences accordingly. - } - target_water_params = params.getAll(); - } - - // Apply them with or without interpolation. - if (target_water_params.size() == 0) - { - llwarns << "Undefined target water params" << llendl; + llwarns << "Undefined water params" << llendl; return; } if (interpolate) { - LLWLParamManager::getInstance()->mAnimator.startInterpolation(target_water_params); + LLWLParamManager::getInstance()->mAnimator.startInterpolation(params); } else { - LLWaterParamManager::getInstance()->mCurParams.setAll(target_water_params); + mCurParams.setAll(params); } } +static LLFastTimer::DeclareTimer FTM_UPDATE_WATERPARAM("Update Water Params"); + void LLWaterParamManager::update(LLViewerCamera * cam) { LLFastTimer ftm(FTM_UPDATE_WATERPARAM); @@ -442,7 +401,7 @@ void LLWaterParamManager::initSingleton() { LL_DEBUGS("Windlight") << "Initializing water" << LL_ENDL; loadAllPresets(); - applyUserPrefs(false); + LLEnvManagerNew::instance().usePrefs(); } // static diff --git a/indra/newview/llwaterparammanager.h b/indra/newview/llwaterparammanager.h index 1f599f57dc..cb838866b1 100644 --- a/indra/newview/llwaterparammanager.h +++ b/indra/newview/llwaterparammanager.h @@ -224,8 +224,8 @@ public: /// send the parameters to the shaders void propagateParameters(void); - /// apply user water preferences - void applyUserPrefs(bool interpolate); + // display specified water + void applyParams(const LLSD& params, bool interpolate); /// update information for the shader void update(LLViewerCamera * cam); diff --git a/indra/newview/llwlparammanager.cpp b/indra/newview/llwlparammanager.cpp index df52f3328f..944773de17 100644 --- a/indra/newview/llwlparammanager.cpp +++ b/indra/newview/llwlparammanager.cpp @@ -501,62 +501,6 @@ void LLWLParamManager::update(LLViewerCamera * cam) } } -void LLWLParamManager::applyUserPrefs(bool interpolate) -{ - LLEnvManagerNew& env_mgr = LLEnvManagerNew::instance(); - - if (env_mgr.getUseRegionSettings()) // apply region-wide settings - { - if (env_mgr.getRegionSettings().getSkyMap().size() == 0) - { - applyDefaults(); - } - else - { - // *TODO: Support fixed sky from region. - LL_DEBUGS("Windlight") << "Applying region sky" << LL_ENDL; - - // Apply region day cycle. - const LLEnvironmentSettings& region_settings = env_mgr.getRegionSettings(); - applyDayCycleParams( - region_settings.getWLDayCycle(), - LLEnvKey::SCOPE_REGION, - region_settings.getDayTime()); - } - } - else // apply user-specified settings - { - if (env_mgr.getUseDayCycle()) - { - if (!env_mgr.useDayCycle(env_mgr.getDayCycleName(), LLEnvKey::SCOPE_LOCAL)) - { - // *TODO: fix user prefs - applyDefaults(); - } - } - else - { - LLWLParamSet param_set; - std::string sky = env_mgr.getSkyPresetName(); - - if (!getParamSet(LLWLParamKey(sky, LLWLParamKey::SCOPE_LOCAL), param_set)) - { - llwarns << "No sky named " << sky << llendl; - } - else - { - LL_DEBUGS("Windlight") << "Loading fixed sky " << sky << LL_ENDL; - applySkyParams(param_set.getAll()); - } - } - } -} - -void LLWLParamManager::applyDefaults() -{ - LLEnvManagerNew::instance().useDayCycle("Default", LLEnvKey::SCOPE_LOCAL); -} - bool LLWLParamManager::applyDayCycleParams(const LLSD& params, LLEnvKey::EScope scope, F32 time) { mDay.loadDayCycle(params, scope); @@ -731,7 +675,7 @@ void LLWLParamManager::initSingleton() // but use linden time sets it to what the estate is mAnimator.setTimeType(LLWLAnimator::TIME_LINDEN); - applyUserPrefs(false); + LLEnvManagerNew::instance().usePrefs(); } // static diff --git a/indra/newview/llwlparammanager.h b/indra/newview/llwlparammanager.h index 8e1e0ddaff..4a76542b95 100644 --- a/indra/newview/llwlparammanager.h +++ b/indra/newview/llwlparammanager.h @@ -234,12 +234,6 @@ public: /// update information camera dependent parameters void update(LLViewerCamera * cam); - /// apply specified params - void applyUserPrefs(bool interpolate); - - /// apply default sky params - void applyDefaults(); - /// apply specified day cycle, setting time to noon by default bool applyDayCycleParams(const LLSD& params, LLEnvKey::EScope scope, F32 time = 0.5); -- cgit v1.2.3