summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorVadim ProductEngine <vsavchuk@productengine.com>2011-05-26 19:32:20 +0300
committerVadim ProductEngine <vsavchuk@productengine.com>2011-05-26 19:32:20 +0300
commitc0037909d576fc4922b92dfcc83d865d61ac43cb (patch)
tree3c60062923b841324281e073e22481b5c217b0e8 /indra/newview
parentc32b19f31d4d5d0b32fcf64cce1cebd7d79b9b05 (diff)
STORM-1284 FIXED Changes to region environment are now visible immediately.
Pressing "Apply" sends the settings update to server. Pressing "Cancel" reverts to current region settings.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llenvmanager.cpp78
-rw-r--r--indra/newview/llenvmanager.h9
-rw-r--r--indra/newview/llfloaterregioninfo.cpp242
-rw-r--r--indra/newview/llfloaterregioninfo.h13
-rw-r--r--indra/newview/llwlparammanager.cpp68
-rw-r--r--indra/newview/llwlparammanager.h10
-rw-r--r--indra/newview/skins/default/xui/en/panel_region_environment.xml4
7 files changed, 330 insertions, 94 deletions
diff --git a/indra/newview/llenvmanager.cpp b/indra/newview/llenvmanager.cpp
index f12c3e54ff..d5d03ff1e5 100644
--- a/indra/newview/llenvmanager.cpp
+++ b/indra/newview/llenvmanager.cpp
@@ -37,6 +37,7 @@
#include "llagent.h"
#include "llviewerregion.h"
+#include "lldaycyclemanager.h"
#include "llfloaterreg.h"
#include "llfloaterwindlight.h"
#include "llfloaterwater.h"
@@ -668,6 +669,74 @@ const LLEnvironmentSettings& LLEnvManagerNew::getRegionSettings() const
return mCachedRegionPrefs;
}
+bool LLEnvManagerNew::usePrefs()
+{
+ LL_DEBUGS("Windlight") << "Displaying preferred environment" << LL_ENDL;
+ updateManagersFromPrefs(false);
+ return true;
+}
+
+bool LLEnvManagerNew::useDefaults()
+{
+ bool rslt = useWaterPreset("Default") && useDayCycle("Default", LLEnvKey::SCOPE_LOCAL);
+ return rslt;
+}
+
+bool LLEnvManagerNew::useWaterPreset(const std::string& name)
+{
+ LL_DEBUGS("Windlight") << "Displaying water preset " << name << LL_ENDL;
+ LLWaterParamManager& water_mgr = LLWaterParamManager::instance();
+ bool rslt = water_mgr.getParamSet(name, water_mgr.mCurParams);
+ llassert(rslt == true);
+ return rslt;
+}
+
+bool LLEnvManagerNew::useWaterParams(const LLSD& params)
+{
+ LL_DEBUGS("Windlight") << "Displaying water params" << LL_ENDL;
+ LLWaterParamManager::instance().mCurParams.setAll(params);
+ return true;
+}
+
+bool LLEnvManagerNew::useSkyParams(const LLSD& params)
+{
+ LL_DEBUGS("Windlight") << "Displaying sky params" << LL_ENDL;
+ LLWLParamManager::instance().applySkyParams(params);
+ return true;
+}
+
+bool LLEnvManagerNew::useDayCycle(const std::string& name, LLEnvKey::EScope scope)
+{
+ LLSD params;
+
+ if (scope == LLEnvKey::SCOPE_REGION)
+ {
+ LL_DEBUGS("Windlight") << "Displaying region day cycle " << name << LL_ENDL;
+ params = getRegionSettings().getWLDayCycle();
+ }
+ else
+ {
+ LL_DEBUGS("Windlight") << "Displaying local day cycle " << name << LL_ENDL;
+
+ if (!LLDayCycleManager::instance().getPreset(name, params))
+ {
+ llwarns << "No day cycle named " << name << llendl;
+ return false;
+ }
+ }
+
+ bool rslt = LLWLParamManager::instance().applyDayCycleParams(params, scope);
+ llassert(rslt == true);
+ return rslt;
+}
+
+bool LLEnvManagerNew::useDayCycleParams(const LLSD& params, LLEnvKey::EScope scope)
+{
+ LL_DEBUGS("Windlight") << "Displaying day cycle params" << LL_ENDL;
+ LLWLParamManager::instance().applyDayCycleParams(params, scope);
+ return true;
+}
+
void LLEnvManagerNew::setUseRegionSettings(bool val)
{
mUserPrefs.setUseDefaults(val);
@@ -818,9 +887,14 @@ void LLEnvManagerNew::onRegionSettingsResponse(const LLSD& content)
LLEnvironmentSettings new_settings(content[1], content[2], content[3], sun_hour);
mCachedRegionPrefs = new_settings;
+ // Load region sky presets.
+ LLWLParamManager::instance().refreshRegionPresets();
+
// If using server settings, update managers.
- // This also adds server skies to the WL param mgr.
- updateManagersFromPrefs(mInterpNextChangeMessage);
+ if (getUseRegionSettings())
+ {
+ updateManagersFromPrefs(mInterpNextChangeMessage);
+ }
// Let interested parties know about the region settings update.
mRegionSettingsChangeSignal();
diff --git a/indra/newview/llenvmanager.h b/indra/newview/llenvmanager.h
index 223654151b..21b771bed8 100644
--- a/indra/newview/llenvmanager.h
+++ b/indra/newview/llenvmanager.h
@@ -276,6 +276,15 @@ public:
/// @return cached env. settings of the current region.
const LLEnvironmentSettings& getRegionSettings() const;
+ // Change environment w/o changing user preferences.
+ bool usePrefs();
+ bool useDefaults();
+ bool useWaterPreset(const std::string& name);
+ bool useWaterParams(const LLSD& params);
+ bool useSkyParams(const LLSD& params);
+ bool useDayCycle(const std::string& name, LLEnvKey::EScope scope);
+ bool useDayCycleParams(const LLSD& params, LLEnvKey::EScope scope);
+
// setters for user env. preferences
void setUseRegionSettings(bool val);
void setUseWaterPreset(const std::string& name);
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index 6a5b577396..ee3d00206f 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -1124,7 +1124,7 @@ F32 LLPanelRegionTerrainInfo::getSunHour()
// virtual
bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region)
{
- LLEnvManager::instance().maybeClearEditingScope(LLEnvKey::SCOPE_REGION, false, false);
+ //LLEnvManager::instance().maybeClearEditingScope(LLEnvKey::SCOPE_REGION, false, false);
BOOL owner_or_god = gAgent.isGodlike()
|| (region && (region->getOwner() == gAgent.getID()));
@@ -2088,7 +2088,7 @@ void LLFloaterRegionInfo::onClose(bool app_quitting)
{
if(!app_quitting)
{
- LLEnvManager::getInstance()->maybeClearEditingScope(true, false);
+ //LLEnvManager::getInstance()->maybeClearEditingScope(true, false);
LLPanelRegionTerrainInfo::onFloaterClose(app_quitting);
}
}
@@ -3198,10 +3198,15 @@ BOOL LLPanelEnvironmentInfo::postBuild()
mDayCycleSettingsRadioGroup->setCommitCallback(boost::bind(&LLPanelEnvironmentInfo::onSwitchDayCycle, this));
mWaterPresetCombo = getChild<LLComboBox>("water_settings_preset_combo");
+ mWaterPresetCombo->setCommitCallback(boost::bind(&LLPanelEnvironmentInfo::onSelectWaterPreset, this));
+
mSkyPresetCombo = getChild<LLComboBox>("sky_settings_preset_combo");
+ mSkyPresetCombo->setCommitCallback(boost::bind(&LLPanelEnvironmentInfo::onSelectSkyPreset, this));
+
mDayCyclePresetCombo = getChild<LLComboBox>("dayc_settings_preset_combo");
+ mDayCyclePresetCombo->setCommitCallback(boost::bind(&LLPanelEnvironmentInfo::onSelectDayCycle, this));
- childSetCommitCallback("save_btn", boost::bind(&LLPanelEnvironmentInfo::onBtnSave, this), NULL);
+ childSetCommitCallback("apply_btn", boost::bind(&LLPanelEnvironmentInfo::onBtnApply, this), NULL);
childSetCommitCallback("cancel_btn", boost::bind(&LLPanelEnvironmentInfo::onBtnCancel, this), NULL);
LLEnvManagerNew::instance().setRegionSettingsChangeCallback(boost::bind(&LLPanelEnvironmentInfo::onRegionSettingschange, this));
@@ -3218,6 +3223,17 @@ void LLPanelEnvironmentInfo::onOpen(const LLSD& key)
}
// virtual
+void LLPanelEnvironmentInfo::handleVisibilityChange(BOOL new_visibility)
+{
+ // If hiding (user switched to another tab or closed the floater),
+ // display user's preferred environment.
+ if (!new_visibility)
+ {
+ LLEnvManagerNew::instance().usePrefs();
+ }
+}
+
+// virtual
bool LLPanelEnvironmentInfo::refreshFromRegion(LLViewerRegion* region)
{
LL_DEBUGS("Windlight") << "Region updated, enabling/disabling controls" << LL_ENDL;
@@ -3257,14 +3273,18 @@ void LLPanelEnvironmentInfo::setControlsEnabled(bool enabled)
mSkyPresetCombo->setEnabled(enabled);
mDayCyclePresetCombo->setEnabled(enabled);
- getChildView("save_btn")->setEnabled(enabled);
+ getChildView("apply_btn")->setEnabled(enabled);
getChildView("cancel_btn")->setEnabled(enabled);
if (enabled)
{
// Enable/disable some controls based on currently selected radio buttons.
- LLPanelEnvironmentInfo::onSwitchRegionSettings();
- LLPanelEnvironmentInfo::onSwitchDayCycle();
+ bool use_defaults = mRegionSettingsRadioGroup->getSelectedIndex() == 0;
+ getChild<LLView>("user_environment_settings")->setEnabled(!use_defaults);
+
+ bool is_fixed_sky = mDayCycleSettingsRadioGroup->getSelectedIndex() == 0;
+ mSkyPresetCombo->setEnabled(is_fixed_sky);
+ mDayCyclePresetCombo->setEnabled(!is_fixed_sky);
}
}
@@ -3367,9 +3387,97 @@ void LLPanelEnvironmentInfo::populateDayCyclesList()
// Current day cycle is already selected.
}
+bool LLPanelEnvironmentInfo::getSelectedWaterParams(LLSD& water_params)
+{
+ LLWLParamKey water_key(mWaterPresetCombo->getSelectedValue());
+
+ if (water_key.scope == LLEnvKey::SCOPE_REGION)
+ {
+ water_params = LLEnvManagerNew::instance().getRegionSettings().getWaterParams();
+ }
+ else
+ {
+ LLWaterParamSet param_set;
+ if (!LLWaterParamManager::instance().getParamSet(water_key.name, param_set))
+ {
+ llwarns << "Error getting water preset: " << water_key.name << llendl;
+ return false;
+ }
+
+ water_params = param_set.getAll();
+ }
+
+ return true;
+}
+
+bool LLPanelEnvironmentInfo::getSelectedSkyParams(LLSD& sky_params, std::string& preset_name)
+{
+ std::string preset_key(mSkyPresetCombo->getValue().asString());
+ LLWLParamKey preset(preset_key);
+
+ // Get the preset sky params.
+ LLWLParamSet param_set;
+ if (!LLWLParamManager::instance().getParamSet(preset, param_set))
+ {
+ llwarns << "Error getting sky params: " << preset.toLLSD() << llendl;
+ return false;
+ }
+
+ sky_params = param_set.getAll();
+ preset_name = preset.name;
+ return true;
+}
+
+bool LLPanelEnvironmentInfo::getSelectedDayCycleParams(LLSD& day_cycle, LLSD& sky_map, short& scope)
+{
+ std::string preset_key(mDayCyclePresetCombo->getValue().asString());
+ LLWLParamKey dc(preset_key);
+ LL_DEBUGS("Windlight") << "Use day cycle: " << dc.toLLSD() << LL_ENDL;
+
+ if (dc.scope == LLEnvKey::SCOPE_REGION) // current region day cycle
+ {
+ const LLEnvironmentSettings& cur_region_settings = LLEnvManagerNew::instance().getRegionSettings();
+ day_cycle = cur_region_settings.getWLDayCycle();
+ sky_map = cur_region_settings.getSkyMap();
+ }
+ else // a local day cycle
+ {
+ if (!LLDayCycleManager::instance().getPreset(dc.name, day_cycle))
+ {
+ llwarns << "Error getting day cycle " << dc.name << llendl;
+ return false;
+ }
+
+ // Create sky map from the day cycle.
+ {
+ std::map<LLWLParamKey, LLWLParamSet> refs;
+ LLWLDayCycle tmp_day;
+
+ tmp_day.loadDayCycle(day_cycle, dc.scope);
+ tmp_day.getSkyRefs(refs);
+
+ sky_map = LLWLParamManager::createSkyMap(refs);
+ }
+ }
+
+ scope = dc.scope;
+
+ return true;
+}
void LLPanelEnvironmentInfo::onSwitchRegionSettings()
{
- getChild<LLView>("user_environment_settings")->setEnabled(mRegionSettingsRadioGroup->getSelectedIndex() != 0);
+ bool use_defaults = mRegionSettingsRadioGroup->getSelectedIndex() == 0;
+ getChild<LLView>("user_environment_settings")->setEnabled(!use_defaults);
+
+ if (use_defaults)
+ {
+ LLEnvManagerNew::instance().useDefaults();
+ }
+ else
+ {
+ onSelectWaterPreset();
+ onSwitchDayCycle();
+ }
}
void LLPanelEnvironmentInfo::onSwitchDayCycle()
@@ -3378,13 +3486,52 @@ void LLPanelEnvironmentInfo::onSwitchDayCycle()
mSkyPresetCombo->setEnabled(is_fixed_sky);
mDayCyclePresetCombo->setEnabled(!is_fixed_sky);
+
+ if (is_fixed_sky)
+ {
+ onSelectSkyPreset();
+ }
+ else
+ {
+ onSelectDayCycle();
+ }
+}
+
+void LLPanelEnvironmentInfo::onSelectWaterPreset()
+{
+ LLSD water_params;
+
+ if (getSelectedWaterParams(water_params))
+ {
+ LLEnvManagerNew::instance().useWaterParams(water_params);
+ }
}
-void LLPanelEnvironmentInfo::onBtnSave()
+void LLPanelEnvironmentInfo::onSelectSkyPreset()
{
- LL_DEBUGS("Windlight") << "About to save region settings" << LL_ENDL;
+ LLSD params;
+ std::string dummy;
+
+ if (getSelectedSkyParams(params, dummy))
+ {
+ LLEnvManagerNew::instance().useSkyParams(params);
+ }
+}
+
+void LLPanelEnvironmentInfo::onSelectDayCycle()
+{
+ LLSD day_cycle;
+ LLSD sky_map; // unused
+ short scope;
- const LLEnvironmentSettings& old_region_settings = LLEnvManagerNew::instance().getRegionSettings();
+ if (getSelectedDayCycleParams(day_cycle, sky_map, scope))
+ {
+ LLEnvManagerNew::instance().useDayCycleParams(day_cycle, (LLEnvKey::EScope) scope);
+ }
+}
+
+void LLPanelEnvironmentInfo::onBtnApply()
+{
const bool use_defaults = mRegionSettingsRadioGroup->getSelectedIndex() == 0;
const bool use_fixed_sky = mDayCycleSettingsRadioGroup->getSelectedIndex() == 0;
@@ -3402,79 +3549,44 @@ void LLPanelEnvironmentInfo::onBtnSave()
if (use_fixed_sky)
{
LL_DEBUGS("Windlight") << "Use fixed sky" << LL_ENDL;
- std::string preset_key(mSkyPresetCombo->getValue().asString());
- LLWLParamKey preset(preset_key);
- // Get the preset sky params.
- LLWLParamSet params;
- if (!LLWLParamManager::instance().getParamSet(preset, params))
+ // Get selected sky params.
+ LLSD params;
+ std::string preset_name;
+ if (!getSelectedSkyParams(params, preset_name))
{
- llwarns << "Error getting sky params: " << preset.toLLSD() << llendl;
return;
}
// Create a day cycle consisting of a single sky preset.
LLSD key(LLSD::emptyArray());
key.append(-1.0f); // indicate that user preference is actually fixed sky, not a day cycle
- key.append(preset.name);
+ key.append(preset_name);
day_cycle.append(key);
// Create a sky map consisting of only the sky preset.
std::map<LLWLParamKey, LLWLParamSet> refs;
- refs[preset] = params;
+ LLWLParamSet param_set;
+ param_set.setAll(params);
+ refs[LLWLParamKey(preset_name, LLEnvKey::SCOPE_LOCAL)] = param_set; // scope doesn't matter here
sky_map = LLWLParamManager::createSkyMap(refs);
}
else // use day cycle
{
- std::string preset_key(mDayCyclePresetCombo->getValue().asString());
- LLWLParamKey dc(preset_key);
- LL_DEBUGS("Windlight") << "Use day cycle: " << dc.toLLSD() << LL_ENDL;
+ LL_DEBUGS("Windlight") << "Use day cycle" << LL_ENDL;
- if (dc.scope == LLEnvKey::SCOPE_REGION) // current region day cycle
- {
- day_cycle = old_region_settings.getWLDayCycle();
- sky_map = old_region_settings.getSkyMap();
- }
- else // a local day cycle
+ short scope; // unused
+ if (!getSelectedDayCycleParams(day_cycle, sky_map, scope))
{
- if (!LLDayCycleManager::instance().getPreset(dc.name, day_cycle))
- {
- llwarns << "Error getting day cycle " << dc.name << llendl;
- return;
- }
-
- // Create sky map from the day cycle.
- {
- std::map<LLWLParamKey, LLWLParamSet> refs;
- LLWLDayCycle tmp_day;
-
- tmp_day.loadDayCycle(day_cycle, dc.scope);
- tmp_day.getSkyRefs(refs);
-
- sky_map = LLWLParamManager::createSkyMap(refs);
- }
-
- LL_DEBUGS("Windlight") << "day_cycle: " << day_cycle << LL_ENDL;
- LL_DEBUGS("Windlight") << "sky_map: " << sky_map << LL_ENDL;
+ return;
}
}
// Get water params.
- LLWLParamKey water_key(mWaterPresetCombo->getSelectedValue());
- if (water_key.scope == LLEnvKey::SCOPE_REGION)
- {
- water_params = old_region_settings.getWaterParams();
- }
- else
+ if (!getSelectedWaterParams(water_params))
{
- LLWaterParamSet param_set;
- if (!LLWaterParamManager::instance().getParamSet(water_key.name, param_set))
- {
- llwarns << "Error getting water preset: " << water_key.name << llendl;
- return;
- }
-
- water_params = param_set.getAll();
+ // *TODO: show a notification?
+ return;
}
}
@@ -3492,8 +3604,16 @@ void LLPanelEnvironmentInfo::onBtnSave()
void LLPanelEnvironmentInfo::onBtnCancel()
{
- // Reload current region settings.
+ // Reload last saved region settings.
refresh();
+
+ // Apply them.
+ LLEnvManagerNew& env_mgr = LLEnvManagerNew::instance();
+ const LLEnvironmentSettings& cur_settings = env_mgr.getRegionSettings();
+ const LLSD& region_day_cycle = cur_settings.getWLDayCycle();
+ const LLSD& region_water = cur_settings.getWaterParams();
+ env_mgr.useWaterParams(region_water);
+ env_mgr.useDayCycleParams(region_day_cycle, LLEnvKey::SCOPE_REGION);
}
void LLPanelEnvironmentInfo::onRegionSettingschange()
diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h
index d96ab1339f..713afae1f6 100644
--- a/indra/newview/llfloaterregioninfo.h
+++ b/indra/newview/llfloaterregioninfo.h
@@ -433,6 +433,9 @@ public:
/*virtual*/ BOOL postBuild();
/*virtual*/ void onOpen(const LLSD& key);
+ // LLView
+ /*virtual*/ void handleVisibilityChange(BOOL new_visibility);
+
// LLPanelRegionInfo
/*virtual*/ bool refreshFromRegion(LLViewerRegion* region);
@@ -445,10 +448,18 @@ private:
void populateSkyPresetsList();
void populateDayCyclesList();
+ bool getSelectedWaterParams(LLSD& water_params);
+ bool getSelectedSkyParams(LLSD& sky_params, std::string& preset_name);
+ bool getSelectedDayCycleParams(LLSD& day_cycle, LLSD& sky_map, short& scope);
+
void onSwitchRegionSettings();
void onSwitchDayCycle();
- void onBtnSave();
+ void onSelectWaterPreset();
+ void onSelectSkyPreset();
+ void onSelectDayCycle();
+
+ void onBtnApply();
void onBtnCancel();
void onRegionSettingschange();
diff --git a/indra/newview/llwlparammanager.cpp b/indra/newview/llwlparammanager.cpp
index 396c61b4b6..3dad7b2f4e 100644
--- a/indra/newview/llwlparammanager.cpp
+++ b/indra/newview/llwlparammanager.cpp
@@ -256,6 +256,15 @@ void LLWLParamManager::addAllSkies(const LLWLParamKey::EScope scope, const LLSD&
}
}
+void LLWLParamManager::refreshRegionPresets()
+{
+ // 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());
+}
+
void LLWLParamManager::loadPresets(const std::string& file_name)
{
std::string path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", ""));
@@ -587,16 +596,11 @@ void LLWLParamManager::update(LLViewerCamera * cam)
void LLWLParamManager::applyUserPrefs(bool interpolate)
{
- // Remove all region sky presets because they may belong to a previously visited region.
- clearParamSetsOfScope(LLEnvKey::SCOPE_REGION);
+ LLEnvManagerNew& env_mgr = LLEnvManagerNew::instance();
- // Add all sky presets belonging to the current region.
- const LLEnvironmentSettings& region_settings = LLEnvManagerNew::instance().getRegionSettings();
- addAllSkies(LLEnvKey::SCOPE_REGION, region_settings.getSkyMap());
-
- if (LLEnvManagerNew::instance().getUseRegionSettings()) // apply region-wide settings
+ if (env_mgr.getUseRegionSettings()) // apply region-wide settings
{
- if (region_settings.getSkyMap().size() == 0)
+ if (env_mgr.getRegionSettings().getSkyMap().size() == 0)
{
applyDefaults();
}
@@ -606,15 +610,18 @@ void LLWLParamManager::applyUserPrefs(bool interpolate)
LL_DEBUGS("Windlight") << "Applying region sky" << LL_ENDL;
// Apply region day cycle.
- mDay.loadDayCycle(region_settings.getWLDayCycle(), LLEnvKey::SCOPE_REGION);
- resetAnimator(region_settings.getDayTime(), true);
+ const LLEnvironmentSettings& region_settings = env_mgr.getRegionSettings();
+ applyDayCycleParams(
+ region_settings.getWLDayCycle(),
+ LLEnvKey::SCOPE_REGION,
+ region_settings.getDayTime());
}
}
else // apply user-specified settings
{
- if (LLEnvManagerNew::instance().getUseDayCycle())
+ if (env_mgr.getUseDayCycle())
{
- if (!applyDayCycle(LLEnvManagerNew::instance().getDayCycleName()))
+ if (!env_mgr.useDayCycle(env_mgr.getDayCycleName(), LLEnvKey::SCOPE_LOCAL));
{
// *TODO: fix user prefs
applyDefaults();
@@ -622,30 +629,39 @@ void LLWLParamManager::applyUserPrefs(bool interpolate)
}
else
{
- mAnimator.deactivate();
- std::string sky = LLEnvManagerNew::instance().getSkyPresetName();
- LL_DEBUGS("Windlight") << "Loading fixed sky " << sky << LL_ENDL;
- getParamSet(LLWLParamKey(sky, LLWLParamKey::SCOPE_LOCAL), mCurParams);
+ 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()
{
- llassert(applyDayCycle("Default") == true);
+ LLEnvManagerNew& env_mgr = LLEnvManagerNew::instance();
+ llassert(env_mgr.useDayCycle("Default", LLEnvKey::SCOPE_LOCAL) == true);
}
-bool LLWLParamManager::applyDayCycle(const std::string& day_cycle)
+bool LLWLParamManager::applyDayCycleParams(const LLSD& params, LLEnvKey::EScope scope, F32 time)
{
- LL_DEBUGS("Windlight") << "Applying day cycle [" << day_cycle << "]" << LL_ENDL;
-
- if (!LLDayCycleManager::instance().getPreset(day_cycle, mDay))
- {
- llwarns << "No day cycle named " << day_cycle << llendl;
- return false;
- }
+ mDay.loadDayCycle(params, scope);
+ resetAnimator(time, true); // set to specified time and start animator
+ return true;
+}
- resetAnimator(0.5, true); // set to noon and start animator
+bool LLWLParamManager::applySkyParams(const LLSD& params)
+{
+ mAnimator.deactivate();
+ mCurParams.setAll(params);
return true;
}
diff --git a/indra/newview/llwlparammanager.h b/indra/newview/llwlparammanager.h
index eb810a4086..7903661a7e 100644
--- a/indra/newview/llwlparammanager.h
+++ b/indra/newview/llwlparammanager.h
@@ -245,8 +245,11 @@ public:
/// apply default sky params
void applyDefaults();
- /// apply default sky params
- bool applyDayCycle(const std::string& day);
+ /// apply specified day cycle, setting time to noon by default
+ bool applyDayCycleParams(const LLSD& params, LLEnvKey::EScope scope, F32 time = 0.5);
+
+ /// apply specified fixed sky params
+ bool applySkyParams(const LLSD& params);
// get where the light is pointing
inline LLVector4 getLightDir(void) const;
@@ -288,6 +291,9 @@ public:
/// add all skies in LLSD using the given scope
void addAllSkies(LLEnvKey::EScope scope, const LLSD& preset_map);
+ /// refresh region-scope presets
+ void refreshRegionPresets();
+
// 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.)
std::map<LLWLParamKey, LLWLParamSet> finalizeFromDayCycle(LLWLParamKey::EScope scope);
diff --git a/indra/newview/skins/default/xui/en/panel_region_environment.xml b/indra/newview/skins/default/xui/en/panel_region_environment.xml
index 956ba53a26..91d0bbe6bf 100644
--- a/indra/newview/skins/default/xui/en/panel_region_environment.xml
+++ b/indra/newview/skins/default/xui/en/panel_region_environment.xml
@@ -123,10 +123,10 @@
<button
follows="left|top"
height="23"
- label="Save"
+ label="Apply"
layout="topleft"
right="-160"
- name="save_btn"
+ name="apply_btn"
top_pad="150"
width="100" />
<button