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".
master
Vadim ProductEngine 2011-06-02 18:56:49 +03:00
parent dda7df4ac9
commit e184c75986
4 changed files with 51 additions and 6 deletions

View File

@ -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.

View File

@ -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.

View File

@ -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;
}

View File

@ -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;
}
}