summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim ProductEngine <vsavchuk@productengine.com>2011-05-23 19:26:17 +0300
committerVadim ProductEngine <vsavchuk@productengine.com>2011-05-23 19:26:17 +0300
commitb60c63bf075a92084ba94459a840decba846a916 (patch)
treeba4da57fcc3678449c20033fc22e620827dc9b5f
parent99fe1004a6cb4406bcac790420a5be6269e02723 (diff)
STORM-1256 WIP Implemented editing region environment settings via the Region/Estate floater.
-rw-r--r--indra/newview/llenvmanager.cpp28
-rw-r--r--indra/newview/llenvmanager.h17
-rw-r--r--indra/newview/llfloaterregioninfo.cpp262
-rw-r--r--indra/newview/llfloaterregioninfo.h30
-rw-r--r--indra/newview/llwldaycycle.cpp19
-rw-r--r--indra/newview/llwldaycycle.h3
-rw-r--r--indra/newview/llwlhandlers.cpp46
-rw-r--r--indra/newview/llwlhandlers.h20
-rw-r--r--indra/newview/llwlparammanager.cpp1
-rw-r--r--indra/newview/llwlparammanager.h2
10 files changed, 391 insertions, 37 deletions
diff --git a/indra/newview/llenvmanager.cpp b/indra/newview/llenvmanager.cpp
index 633b9c7c52..0391a5adb2 100644
--- a/indra/newview/llenvmanager.cpp
+++ b/indra/newview/llenvmanager.cpp
@@ -367,7 +367,7 @@ void LLEnvManager::commitSettings(LLEnvKey::EScope scope)
metadata["messageID"] = mLastReceivedID; // add last received update ID to outbound message so simulator can handle concurrent updates
saveSettingsFromManagers(scope); // save current settings into settings store before grabbing from settings store and sending
- success = LLEnvironmentApplyResponder::initiateRequest(makePacket(LLEnvKey::SCOPE_REGION, metadata));
+ success = LLEnvironmentApply::initiateRequest(makePacket(LLEnvKey::SCOPE_REGION, metadata));
if(success)
{
// while waiting for the return message, render old settings
@@ -484,7 +484,7 @@ void LLEnvManager::saveSettingsFromManagers(LLEnvKey::EScope scope)
{
// ensure only referenced region-scope skies are saved, resolve naming collisions, etc.
std::map<LLWLParamKey, LLWLParamSet> final_references = LLWLParamManager::getInstance()->finalizeFromDayCycle(scope);
- LLSD referenced_skies = LLWLParamManager::getInstance()->createSkyMap(final_references);
+ LLSD referenced_skies = LLWLParamManager::createSkyMap(final_references);
LL_DEBUGS("Windlight Sync") << "Dumping referenced skies (" << final_references.size() << ") to LLSD: " << referenced_skies << LL_ENDL;
@@ -764,6 +764,23 @@ void LLEnvManagerNew::dumpUserPrefs()
LL_DEBUGS("Windlight") << "UseDayCycle: " << gSavedSettings.getBOOL("UseDayCycle") << LL_ENDL;
}
+// static
+LLSD LLEnvManagerNew::getDayCycleByName(const std::string name)
+{
+ return LLWLDayCycle::loadCycleDataFromFile(name + ".xml");
+}
+
+bool LLEnvManagerNew::sendRegionSettings(const LLEnvironmentSettings& new_settings)
+{
+ LLSD metadata;
+
+ metadata["regionID"] = gAgent.getRegion()->getRegionID();
+ // add last received update ID to outbound message so simulator can handle concurrent updates
+ metadata["messageID"] = mLastReceivedID;
+
+ return LLEnvironmentApply::initiateRequest(new_settings.makePacket(metadata));
+}
+
void LLEnvManagerNew::onRegionCrossing()
{
LL_DEBUGS("Windlight") << "Crossed region" << LL_ENDL;
@@ -795,7 +812,7 @@ void LLEnvManagerNew::updateManagersFromPrefs(bool interpolate)
LLWLParamManager::instance().applyUserPrefs(interpolate);
}
-void LLEnvManagerNew::sendRegionSettingsRequest()
+void LLEnvManagerNew::requestRegionSettings()
{
LLEnvironmentRequest::initiate();
// *TODO: Indicate that current cached region settings have been invalidated?
@@ -816,11 +833,14 @@ void LLEnvManagerNew::onRegionChange(bool interpolate)
LL_DEBUGS("Windlight") << "New viewer region: " << region_uuid << LL_ENDL;
mCurRegionUUID = region_uuid;
mInterpNextChangeMessage = interpolate;
- sendRegionSettingsRequest();
+ requestRegionSettings();
}
void LLEnvManagerNew::onRegionSettingsResponse(const LLSD& content)
{
+ // If the message was valid, grab the UUID from it and save it for next outbound update message.
+ mLastReceivedID = content[0]["messageID"].asUUID();
+
// 1. Refresh cached region settings.
LL_DEBUGS("Windlight") << "Caching region environment settings: " << content << LL_ENDL;
F32 sun_hour = 0; // *TODO
diff --git a/indra/newview/llenvmanager.h b/indra/newview/llenvmanager.h
index 1f005ecce2..f52eaf5a4b 100644
--- a/indra/newview/llenvmanager.h
+++ b/indra/newview/llenvmanager.h
@@ -99,7 +99,7 @@ public:
return mDayTime;
}
- LLSD makePacket(const LLSD& metadata)
+ LLSD makePacket(const LLSD& metadata) const
{
LLSD full_packet = LLSD::emptyArray();
@@ -261,19 +261,24 @@ class LLEnvManagerNew : public LLSingleton<LLEnvManagerNew>
public:
LLEnvManagerNew();
+ // getters to access user env. preferences
bool getUseRegionSettings() const;
bool getUseDayCycle() const;
bool getUseFixedSky() const;
std::string getWaterPresetName() const;
std::string getSkyPresetName() const;
std::string getDayCycleName() const;
+
+ /// @return cached env. settings of the current region.
const LLEnvironmentSettings& getRegionSettings() const;
+ // 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 loadUserPrefs();
void saveUserPrefs();
void setUserPrefs(
@@ -284,6 +289,13 @@ public:
bool use_region_settings);
void dumpUserPrefs();
+ // Common interface to the wl/water managers.
+ static LLSD getDayCycleByName(const std::string name);
+
+ // Misc.
+ bool sendRegionSettings(const LLEnvironmentSettings& new_settings);
+
+ // Public callbacks.
void onRegionCrossing();
void onTeleport();
void onRegionSettingsResponse(const LLSD& content);
@@ -293,7 +305,7 @@ private:
/*virtual*/ void initSingleton();
void updateManagersFromPrefs(bool interpolate);
- void sendRegionSettingsRequest();
+ void requestRegionSettings();
void onRegionChange(bool interpolate);
@@ -301,6 +313,7 @@ private:
LLEnvironmentSettings mCachedRegionPrefs; /// Cached region environment 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.
};
#endif // LL_LLENVMANAGER_H
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index de959f83e0..56025c3143 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -40,6 +40,7 @@
#include "llxfermanager.h"
#include "indra_constants.h"
#include "message.h"
+#include "llradiogroup.h"
#include "llsd.h"
#include "llsdserialize.h"
@@ -83,6 +84,7 @@
#include "llviewertexteditor.h"
#include "llviewerwindow.h"
#include "llvlcomposition.h"
+#include "llwaterparammanager.h"
#include "lltrans.h"
#include "llagentui.h"
@@ -176,6 +178,7 @@ LLFloaterRegionInfo::LLFloaterRegionInfo(const LLSD& seed)
BOOL LLFloaterRegionInfo::postBuild()
{
mTab = getChild<LLTabContainer>("region_panels");
+ mTab->setCommitCallback(boost::bind(&LLFloaterRegionInfo::onTabSelected, this, _2));
// contruct the panels
LLPanelRegionInfo* panel;
@@ -423,6 +426,12 @@ LLPanelRegionTerrainInfo* LLFloaterRegionInfo::getPanelRegionTerrain()
return panel;
}
+void LLFloaterRegionInfo::onTabSelected(const LLSD& param)
+{
+ LLPanel* active_panel = getChild<LLPanel>(param.asString());
+ active_panel->onOpen(LLSD());
+}
+
void LLFloaterRegionInfo::refreshFromRegion(LLViewerRegion* region)
{
if (!region)
@@ -3160,3 +3169,256 @@ bool LLDispatchSetEstateAccess::operator()(
return true;
}
+
+LLPanelEnvironmentInfo::LLPanelEnvironmentInfo()
+: mRegionSettingsRadioGroup(NULL),
+ mDayCycleSettingsRadioGroup(NULL),
+ mWaterPresetCombo(NULL),
+ mSkyPresetCombo(NULL),
+ mDayCyclePresetCombo(NULL)
+{
+}
+
+// virtual
+BOOL LLPanelEnvironmentInfo::postBuild()
+{
+ mRegionSettingsRadioGroup = getChild<LLRadioGroup>("region_settings_radio_group");
+ mRegionSettingsRadioGroup->setCommitCallback(boost::bind(&LLPanelEnvironmentInfo::onSwitchRegionSettings, this));
+
+ mDayCycleSettingsRadioGroup = getChild<LLRadioGroup>("sky_dayc_settings_radio_group");
+ mDayCycleSettingsRadioGroup->setCommitCallback(boost::bind(&LLPanelEnvironmentInfo::onSwitchDayCycle, this));
+
+ mWaterPresetCombo = getChild<LLComboBox>("water_settings_preset_combo");
+ mSkyPresetCombo = getChild<LLComboBox>("sky_settings_preset_combo");
+ mDayCyclePresetCombo = getChild<LLComboBox>("dayc_settings_preset_combo");
+
+ childSetCommitCallback("save_btn", boost::bind(&LLPanelEnvironmentInfo::onBtnSave, this), NULL);
+ childSetCommitCallback("cancel_btn", boost::bind(&LLPanelEnvironmentInfo::onBtnCancel, this), NULL);
+
+ return TRUE;
+}
+
+// virtual
+void LLPanelEnvironmentInfo::onOpen(const LLSD& key)
+{
+ refresh();
+}
+
+void LLPanelEnvironmentInfo::refresh()
+{
+ populateWaterPresetsList();
+ populateSkyPresetsList();
+ populateDayCyclesList();
+
+ // Init radio groups.
+ const LLEnvironmentSettings& settings = LLEnvManagerNew::instance().getRegionSettings();
+ const LLSD& dc = settings.getWLDayCycle();
+ LLSD::Real first_frame_time = dc.size() > 0 ? dc[0][0].asReal() : 0.0f;
+ const bool use_fixed_sky = dc.size() == 1 && first_frame_time < 0;
+ mRegionSettingsRadioGroup->setSelectedIndex(settings.getSkyMap().size() == 0 ? 0 : 1);
+ mDayCycleSettingsRadioGroup->setSelectedIndex(use_fixed_sky ? 0 : 1);
+
+ LLPanelEnvironmentInfo::onSwitchRegionSettings();
+ LLPanelEnvironmentInfo::onSwitchDayCycle();
+}
+
+void LLPanelEnvironmentInfo::populateWaterPresetsList()
+{
+ mWaterPresetCombo->removeall();
+
+ // If the region already has water params, add them to the list.
+ const LLEnvironmentSettings& region_settings = LLEnvManagerNew::instance().getRegionSettings();
+ if (region_settings.getWaterParams().size() != 0)
+ {
+ const std::string& region_name = gAgent.getRegion()->getName();
+ mWaterPresetCombo->add(region_name, LLWLParamKey(region_name, LLEnvKey::SCOPE_REGION).toLLSD());
+ mWaterPresetCombo->addSeparator();
+ }
+
+ // Add local water presets.
+ const std::map<std::string, LLWaterParamSet> &water_params_map = LLWaterParamManager::instance().mParamList;
+ for (std::map<std::string, LLWaterParamSet>::const_iterator it = water_params_map.begin(); it != water_params_map.end(); it++)
+ {
+ mWaterPresetCombo->add(it->first, LLWLParamKey(it->first, LLEnvKey::SCOPE_LOCAL).toLLSD());
+ }
+
+ // There's no way to select current preset because its name is not stored on server.
+}
+
+void LLPanelEnvironmentInfo::populateSkyPresetsList()
+{
+ mSkyPresetCombo->removeall();
+
+ const std::map<LLWLParamKey, LLWLParamSet> &sky_params_map = LLWLParamManager::getInstance()->mParamList;
+ for (std::map<LLWLParamKey, LLWLParamSet>::const_iterator it = sky_params_map.begin(); it != sky_params_map.end(); it++)
+ {
+ std::string preset_name = it->first.name;
+ std::string item_title;
+
+ if (it->first.scope == LLEnvKey::SCOPE_LOCAL) // local preset
+ {
+ item_title = preset_name;
+ }
+ else // region preset
+ {
+ item_title = preset_name + " (" + gAgent.getRegion()->getName() + ")";
+ }
+
+ // Saving as string instead of LLSD() for selectByValue() to work, as it doesn't support non-scalar values.
+ mSkyPresetCombo->add(item_title, it->first.toStringVal());
+ }
+
+ // Select current preset.
+ LLSD sky_map = LLEnvManagerNew::instance().getRegionSettings().getSkyMap();
+ if (sky_map.size() == 1) // if the region is set to fixed sky
+ {
+ std::string preset_name = sky_map.beginMap()->first;
+ mSkyPresetCombo->selectByValue(LLWLParamKey(preset_name, LLEnvKey::SCOPE_REGION).toStringVal());
+ }
+}
+
+void LLPanelEnvironmentInfo::populateDayCyclesList()
+{
+ mDayCyclePresetCombo->removeall();
+
+ // If the region already has env. settings, add its day cycle to the list.
+ const LLSD& cur_region_dc = LLEnvManagerNew::instance().getRegionSettings().getWLDayCycle();
+ if (cur_region_dc.size() != 0)
+ {
+ LLViewerRegion* region = gAgent.getRegion();
+ llassert(region != NULL);
+
+ LLWLParamKey key(region->getName(), LLEnvKey::SCOPE_REGION);
+ mDayCyclePresetCombo->add(region->getName(), key.toLLSD());
+ mDayCyclePresetCombo->addSeparator();
+ }
+
+ // Add local day cycles.
+ // *TODO: multiple local day cycles support
+ LLWLParamKey key("Default", LLEnvKey::SCOPE_LOCAL);
+ mDayCyclePresetCombo->add("Default", key.toLLSD());
+
+ // Current day cycle is already selected.
+}
+
+void LLPanelEnvironmentInfo::onSwitchRegionSettings()
+{
+ getChild<LLView>("user_environment_settings")->setEnabled(mRegionSettingsRadioGroup->getSelectedIndex() != 0);
+}
+
+void LLPanelEnvironmentInfo::onSwitchDayCycle()
+{
+ bool is_fixed_sky = mDayCycleSettingsRadioGroup->getSelectedIndex() == 0;
+
+ mSkyPresetCombo->setEnabled(is_fixed_sky);
+ mDayCyclePresetCombo->setEnabled(!is_fixed_sky);
+}
+
+void LLPanelEnvironmentInfo::onBtnSave()
+{
+ LL_DEBUGS("Windlight") << "About to save region settings" << LL_ENDL;
+
+ const LLEnvironmentSettings& old_region_settings = LLEnvManagerNew::instance().getRegionSettings();
+ const bool use_defaults = mRegionSettingsRadioGroup->getSelectedIndex() == 0;
+ const bool use_fixed_sky = mDayCycleSettingsRadioGroup->getSelectedIndex() == 0;
+
+ LLSD day_cycle;
+ LLSD sky_map;
+ LLSD water_params;
+
+ if (use_defaults)
+ {
+ // settings will be empty
+ LL_DEBUGS("Windlight") << "Defaults" << LL_ENDL;
+ }
+ else // use custom region settings
+ {
+ 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))
+ {
+ 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);
+ day_cycle.append(key);
+
+ // Create a sky map consisting of only the sky preset.
+ std::map<LLWLParamKey, LLWLParamSet> refs;
+ refs[preset] = params;
+ sky_map = LLWLParamManager::createSkyMap(refs);
+ }
+ else // use day cycle
+ {
+ LLWLParamKey dc(mDayCyclePresetCombo->getValue());
+ LL_DEBUGS("Windlight") << "Use day cycle: " << dc.toLLSD() << 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
+ {
+ // *TODO: multiple local day cycles support
+ day_cycle = LLEnvManagerNew::instance().getDayCycleByName("Default");
+
+ // 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;
+ }
+ }
+
+ // Get water params.
+ LLWLParamKey water_key(mWaterPresetCombo->getSelectedValue());
+ if (water_key.scope == LLEnvKey::SCOPE_REGION)
+ {
+ water_params = old_region_settings.getWaterParams();
+ }
+ else
+ {
+ 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();
+ }
+ }
+
+ // Send settings apply request.
+ LLEnvironmentSettings new_region_settings;
+ new_region_settings.saveParams(day_cycle, sky_map, water_params, 0.0f);
+ if (!LLEnvManagerNew::instance().sendRegionSettings(new_region_settings))
+ {
+ llwarns << "Error applying region environment settings" << llendl;
+ }
+}
+
+void LLPanelEnvironmentInfo::onBtnCancel()
+{
+ // Reload current region settings.
+ refresh();
+}
diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h
index 412c72870a..dc5e250cc4 100644
--- a/indra/newview/llfloaterregioninfo.h
+++ b/indra/newview/llfloaterregioninfo.h
@@ -46,6 +46,7 @@ class LLInventoryItem;
class LLCheckBoxCtrl;
class LLComboBox;
class LLNameListCtrl;
+class LLRadioGroup;
class LLSliderCtrl;
class LLSpinCtrl;
class LLTextBox;
@@ -100,6 +101,7 @@ private:
~LLFloaterRegionInfo();
protected:
+ void onTabSelected(const LLSD& param);
void refreshFromRegion(LLViewerRegion* region);
// member data
@@ -422,6 +424,34 @@ protected:
class LLPanelEnvironmentInfo : public LLPanelRegionInfo
{
+ LOG_CLASS(LLPanelEnvironmentInfo);
+
+public:
+ LLPanelEnvironmentInfo();
+
+ // LLPanel
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
+
+private:
+ void refresh();
+
+ void populateWaterPresetsList();
+ void populateSkyPresetsList();
+ void populateDayCyclesList();
+
+ void onSwitchRegionSettings();
+ void onSwitchDayCycle();
+
+ void onBtnSave();
+ void onBtnCancel();
+
+ LLRadioGroup* mRegionSettingsRadioGroup;
+ LLRadioGroup* mDayCycleSettingsRadioGroup;
+
+ LLComboBox* mWaterPresetCombo;
+ LLComboBox* mSkyPresetCombo;
+ LLComboBox* mDayCyclePresetCombo;
};
#endif
diff --git a/indra/newview/llwldaycycle.cpp b/indra/newview/llwldaycycle.cpp
index 05f7fd9872..7363392042 100644
--- a/indra/newview/llwldaycycle.cpp
+++ b/indra/newview/llwldaycycle.cpp
@@ -146,6 +146,25 @@ LLSD LLWLDayCycle::asLLSD()
return day_data;
}
+bool LLWLDayCycle::getSkyRefs(std::map<LLWLParamKey, LLWLParamSet>& refs)
+{
+ bool result = true;
+ LLWLParamManager& wl_mgr = LLWLParamManager::instance();
+
+ refs.clear();
+ for (std::map<F32, LLWLParamKey>::iterator iter = mTimeMap.begin(); iter != mTimeMap.end(); ++iter)
+ {
+ LLWLParamKey& key = iter->second;
+ if (!wl_mgr.getParamSet(key, refs[key]))
+ {
+ llwarns << "Cannot find sky [" << key.name << "] referenced by a day cycle" << llendl;
+ result = false;
+ }
+ }
+
+ return result;
+}
+
void LLWLDayCycle::clearKeyframes()
{
lldebugs << "Clearing key frames" << llendl;
diff --git a/indra/newview/llwldaycycle.h b/indra/newview/llwldaycycle.h
index 988003c1af..36b5160a58 100644
--- a/indra/newview/llwldaycycle.h
+++ b/indra/newview/llwldaycycle.h
@@ -71,6 +71,9 @@ public:
/// get the LLSD data for this day cycle
LLSD asLLSD();
+ // get skies referenced by this day cycle
+ bool getSkyRefs(std::map<LLWLParamKey, LLWLParamSet>& refs);
+
/// clear keyframes
void clearKeyframes();
diff --git a/indra/newview/llwlhandlers.cpp b/indra/newview/llwlhandlers.cpp
index 905b8d83a8..32ef4ac6ad 100644
--- a/indra/newview/llwlhandlers.cpp
+++ b/indra/newview/llwlhandlers.cpp
@@ -127,21 +127,20 @@ LLEnvironmentRequestResponder::LLEnvironmentRequestResponder()
LLEnvManagerNew::getInstance()->onRegionSettingsResponse(LLSD());
}
-
/****
- * LLEnvironmentApplyResponder
+ * LLEnvironmentApply
****/
-clock_t LLEnvironmentApplyResponder::UPDATE_WAIT_SECONDS = clock_t(3.f);
-clock_t LLEnvironmentApplyResponder::sLastUpdate = clock_t(0.f);
-bool LLEnvironmentApplyResponder::initiateRequest(const LLSD& content)
+clock_t LLEnvironmentApply::UPDATE_WAIT_SECONDS = clock_t(3.f);
+clock_t LLEnvironmentApply::sLastUpdate = clock_t(0.f);
+
+// static
+bool LLEnvironmentApply::initiateRequest(const LLSD& content)
{
clock_t current = clock();
- if(current >= sLastUpdate + (UPDATE_WAIT_SECONDS * CLOCKS_PER_SEC))
- {
- sLastUpdate = current;
- }
- else
+
+ // Make sure we don't update too frequently.
+ if (current < sLastUpdate + (UPDATE_WAIT_SECONDS * CLOCKS_PER_SEC))
{
LLSD args(LLSD::emptyMap());
args["WAIT"] = (F64)UPDATE_WAIT_SECONDS;
@@ -149,20 +148,25 @@ bool LLEnvironmentApplyResponder::initiateRequest(const LLSD& content)
return false;
}
+ sLastUpdate = current;
+
+ // Send update request.
std::string url = gAgent.getRegion()->getCapability("EnvironmentSettings");
- if (!url.empty())
- {
- LL_INFOS("WindlightCaps") << "Sending windlight settings to " << url << LL_ENDL;
- LL_DEBUGS("WindlightCaps") << "content: " << content << LL_ENDL;
- LLHTTPClient::post(url, content, new LLEnvironmentApplyResponder());
- return true;
- }
- else
+ if (url.empty())
{
LL_WARNS("WindlightCaps") << "Applying windlight settings not supported" << LL_ENDL;
+ return false;
}
- return false;
+
+ LL_INFOS("WindlightCaps") << "Sending windlight settings to " << url << LL_ENDL;
+ LL_DEBUGS("WindlightCaps") << "content: " << content << LL_ENDL;
+ LLHTTPClient::post(url, content, new LLEnvironmentApplyResponder());
+ return true;
}
+
+/****
+ * LLEnvironmentApplyResponder
+ ****/
/*virtual*/ void LLEnvironmentApplyResponder::result(const LLSD& content)
{
if (content["regionID"].asUUID() != gAgent.getRegion()->getRegionID())
@@ -183,8 +187,6 @@ bool LLEnvironmentApplyResponder::initiateRequest(const LLSD& content)
args["FAIL_REASON"] = content["fail_reason"].asString();
LLNotificationsUtil::add("WLRegionApplyFail", args);
}
-
- LLEnvManager::getInstance()->commitSettingsFinished(LLEnvKey::SCOPE_REGION);
}
/*virtual*/ void LLEnvironmentApplyResponder::error(U32 status, const std::string& reason)
{
@@ -196,6 +198,4 @@ bool LLEnvironmentApplyResponder::initiateRequest(const LLSD& content)
LLSD args(LLSD::emptyMap());
args["FAIL_REASON"] = msg.str();
LLNotificationsUtil::add("WLRegionApplyFail", args);
-
- LLEnvManager::getInstance()->commitSettingsFinished(LLEnvKey::SCOPE_REGION);
}
diff --git a/indra/newview/llwlhandlers.h b/indra/newview/llwlhandlers.h
index 05b2244e8a..b5eb62b0b0 100644
--- a/indra/newview/llwlhandlers.h
+++ b/indra/newview/llwlhandlers.h
@@ -66,6 +66,18 @@ private:
int mID;
};
+class LLEnvironmentApply
+{
+ LOG_CLASS(LLEnvironmentApply);
+public:
+ /// @return true if request was successfully sent
+ static bool initiateRequest(const LLSD& content);
+
+private:
+ static clock_t sLastUpdate;
+ static clock_t UPDATE_WAIT_SECONDS;
+};
+
class LLEnvironmentApplyResponder: public LLHTTPClient::Responder
{
LOG_CLASS(LLEnvironmentApplyResponder);
@@ -89,14 +101,8 @@ public:
virtual void error(U32 status, const std::string& reason); // non-200 errors only
private:
- friend class LLEnvManager;
+ friend class LLEnvironmentApply;
- static clock_t sLastUpdate;
- static clock_t UPDATE_WAIT_SECONDS;
-
- // for format of packet expected, see llwlscrubbers.cpp in llmessage
- static bool initiateRequest(const LLSD& packet);
-
LLEnvironmentApplyResponder() {}
};
diff --git a/indra/newview/llwlparammanager.cpp b/indra/newview/llwlparammanager.cpp
index d64e2420e4..16abe2b174 100644
--- a/indra/newview/llwlparammanager.cpp
+++ b/indra/newview/llwlparammanager.cpp
@@ -234,6 +234,7 @@ std::map<LLWLParamKey, LLWLParamSet> LLWLParamManager::finalizeFromDayCycle(LLWL
return final_references;
}
+// static
LLSD LLWLParamManager::createSkyMap(std::map<LLWLParamKey, LLWLParamSet> refs)
{
LLSD skies = LLSD::emptyMap();
diff --git a/indra/newview/llwlparammanager.h b/indra/newview/llwlparammanager.h
index 2f1edce8fc..af3b9aec13 100644
--- a/indra/newview/llwlparammanager.h
+++ b/indra/newview/llwlparammanager.h
@@ -289,7 +289,7 @@ public:
std::map<LLWLParamKey, LLWLParamSet> finalizeFromDayCycle(LLWLParamKey::EScope scope);
// returns all skies in map (intended to be called with output from a finalize)
- LLSD createSkyMap(std::map<LLWLParamKey, LLWLParamSet> map);
+ static LLSD createSkyMap(std::map<LLWLParamKey, LLWLParamSet> map);
// helper variables
LLWLAnimator mAnimator;