summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim ProductEngine <vsavchuk@productengine.com>2011-06-02 18:56:49 +0300
committerVadim ProductEngine <vsavchuk@productengine.com>2011-06-02 18:56:49 +0300
commite184c7598680f2069e2bcf5caa3c86967d7ab0a1 (patch)
treed81f175d87211813b4da62c200ccd9d79a43fc94
parentdda7df4ac94d1e269aa0ce9eff6c6078f756cbd9 (diff)
STORM-1253 WIP Changed the workflow to modify region day cycle.
Was: Press "Save" after editing the region day cycle in the Day Cycle Editor. Now: - Press "Save" in the Day Cycle Editor. - Open Region / Estate -> Environment tab. - Select the region day cycle. - Press "Apply".
-rw-r--r--indra/newview/llenvmanager.cpp16
-rw-r--r--indra/newview/llenvmanager.h19
-rw-r--r--indra/newview/llfloatereditdaycycle.cpp13
-rw-r--r--indra/newview/llwldaycycle.cpp9
4 files changed, 51 insertions, 6 deletions
diff --git a/indra/newview/llenvmanager.cpp b/indra/newview/llenvmanager.cpp
index dd8db7b785..8e4b7197d6 100644
--- a/indra/newview/llenvmanager.cpp
+++ b/indra/newview/llenvmanager.cpp
@@ -666,7 +666,14 @@ std::string LLEnvManagerNew::getDayCycleName() const
const LLEnvironmentSettings& LLEnvManagerNew::getRegionSettings() const
{
- return mCachedRegionPrefs;
+ return !mNewRegionPrefs.isEmpty() ? mNewRegionPrefs : mCachedRegionPrefs;
+}
+
+void LLEnvManagerNew::setRegionSettings(const LLEnvironmentSettings& new_settings)
+{
+ // Set region settings override that will be used locally
+ // until user either uploads the changes or goes to another region.
+ mNewRegionPrefs = new_settings;
}
bool LLEnvManagerNew::usePrefs()
@@ -958,6 +965,10 @@ void LLEnvManagerNew::onRegionSettingsResponse(const LLSD& content)
void LLEnvManagerNew::onRegionSettingsApplyResponse(bool ok)
{
LL_DEBUGS("Windlight") << "Applying region settings " << (ok ? "succeeded" : "failed") << LL_ENDL;
+
+ // Clear locally modified region settings because they have just been uploaded.
+ mNewRegionPrefs.clear();
+
mRegionSettingsAppliedSignal(ok);
}
@@ -991,6 +1002,9 @@ void LLEnvManagerNew::onRegionChange(bool interpolate)
return;
}
+ // Clear locally modified region settings.
+ mNewRegionPrefs.clear();
+
// *TODO: clear environment settings of the previous region?
// Request environment settings of the new region.
diff --git a/indra/newview/llenvmanager.h b/indra/newview/llenvmanager.h
index 62ec08b09f..7d4e647e90 100644
--- a/indra/newview/llenvmanager.h
+++ b/indra/newview/llenvmanager.h
@@ -99,6 +99,16 @@ public:
return mDayTime;
}
+ bool isEmpty() const
+ {
+ return mWLDayCycle.size() == 0;
+ }
+
+ void clear()
+ {
+ *this = LLEnvironmentSettings();
+ }
+
LLSD makePacket(const LLSD& metadata) const
{
LLSD full_packet = LLSD::emptyArray();
@@ -276,6 +286,14 @@ public:
/// @return cached env. settings of the current region.
const LLEnvironmentSettings& getRegionSettings() const;
+ /**
+ * Set new region settings without uploading them to the region.
+ *
+ * The override will be reset when the changes are applied to the region (=uploaded)
+ * or user teleports to another region.
+ */
+ void setRegionSettings(const LLEnvironmentSettings& new_settings);
+
// Change environment w/o changing user preferences.
bool usePrefs();
bool useDefaults();
@@ -335,6 +353,7 @@ private:
LLEnvPrefs mUserPrefs; /// User environment preferences.
LLEnvironmentSettings mCachedRegionPrefs; /// Cached region environment settings.
+ LLEnvironmentSettings mNewRegionPrefs; /// Not-yet-uploaded modified region env. settings.
bool mInterpNextChangeMessage; /// Interpolate env. settings on next region change.
LLUUID mCurRegionUUID; /// To avoid duplicated region env. settings requests.
LLUUID mLastReceivedID; /// Id of last received region env. settings.
diff --git a/indra/newview/llfloatereditdaycycle.cpp b/indra/newview/llfloatereditdaycycle.cpp
index f77e73c30b..52cfbb512a 100644
--- a/indra/newview/llfloatereditdaycycle.cpp
+++ b/indra/newview/llfloatereditdaycycle.cpp
@@ -220,6 +220,8 @@ void LLFloaterEditDayCycle::applyTrack()
void LLFloaterEditDayCycle::refreshSkyPresetsList()
{
+ mSkyPresetsCombo->removeall();
+
LLWLParamManager& sky_mgr = LLWLParamManager::instance();
for (std::map<LLWLParamKey, LLWLParamSet>::iterator it = sky_mgr.mParamList.begin();
it != sky_mgr.mParamList.end(); ++it)
@@ -339,6 +341,7 @@ void LLFloaterEditDayCycle::onKeyPresetChanged()
std::string stringVal = mSkyPresetsCombo->getSelectedValue().asString();
LLWLParamKey new_key(stringVal);
+ llassert(!new_key.name.empty());
const std::string& cur_sldr = mKeysSlider->getCurSlider();
// if null, don't use
@@ -382,7 +385,10 @@ void LLFloaterEditDayCycle::onAddKey()
}
// add the slider key
- LLWLParamKey sky_params(mSkyPresetsCombo->getSelectedValue());
+ std::string key_val = mSkyPresetsCombo->getSelectedValue().asString();
+ LLWLParamKey sky_params(key_val);
+ llassert(!sky_params.name.empty());
+
F32 time = mTimeSlider->getCurSliderValue();
addSliderKey(time, sky_params);
@@ -526,6 +532,9 @@ void LLFloaterEditDayCycle::saveRegionDayCycle()
LLEnvironmentSettings new_region_settings;
new_region_settings.saveParams(day_cycle, sky_map, env_mgr.getRegionSettings().getWaterParams(), 0.0f);
+#if 1
+ LLEnvManagerNew::instance().setRegionSettings(new_region_settings);
+#else // Temporary disabled ability to upload new region settings from the Day Cycle Editor.
if (!LLEnvManagerNew::instance().sendRegionSettings(new_region_settings))
{
llwarns << "Error applying region environment settings" << llendl;
@@ -533,6 +542,7 @@ void LLFloaterEditDayCycle::saveRegionDayCycle()
}
setApplyProgress(true);
+#endif
}
void LLFloaterEditDayCycle::setApplyProgress(bool started)
@@ -694,6 +704,7 @@ void LLFloaterEditDayCycle::onBtnSave()
if (selected_day.scope == LLEnvKey::SCOPE_REGION)
{
saveRegionDayCycle();
+ closeFloater();
return;
}
diff --git a/indra/newview/llwldaycycle.cpp b/indra/newview/llwldaycycle.cpp
index ca5b65f0da..80001525f8 100644
--- a/indra/newview/llwldaycycle.cpp
+++ b/indra/newview/llwldaycycle.cpp
@@ -67,9 +67,10 @@ void LLWLDayCycle::loadDayCycle(const LLSD& day_data, LLWLParamKey::EScope scope
LLWLParamManager::getInstance()->getParamSet(frame, pset);
if(!success)
{
- // *HACK try the local-scope ones for "A-something" defaults
- // (because our envManager.lindenDefault() doesn't have the skies yet)
- if (frame.name.find("A-") == 0)
+ // *HACK: If loading region day cycle, try local sky presets as well.
+ // Local presets may be referenced by a region day cycle after
+ // it has been edited but the changes have not been uploaded.
+ if (scope == LLEnvKey::SCOPE_REGION)
{
frame.scope = LLEnvKey::SCOPE_LOCAL;
success = LLWLParamManager::getInstance()->getParamSet(frame, pset);
@@ -80,7 +81,7 @@ void LLWLDayCycle::loadDayCycle(const LLSD& day_data, LLWLParamKey::EScope scope
// alert the user
LLSD args;
args["SKY"] = day_data[i][1].asString();
- LLNotifications::instance().add("WLMissingSky", LLSD(), args);
+ LLNotifications::instance().add("WLMissingSky", args, LLSD());
continue;
}
}