summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2018-01-08 15:10:25 -0800
committerRider Linden <rider@lindenlab.com>2018-01-08 15:10:25 -0800
commit8211f57205f0008d8ffb9bfcd465ca26d906e19c (patch)
treed5ab9820e70d6828220841141abad38c548759ba /indra/newview
parent1df10afa2a7802763330475e1a90547c3cff7c06 (diff)
MAINT-7699: Deliver new settings to viewer via cap
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llenvironment.cpp270
-rw-r--r--indra/newview/llenvironment.h20
-rw-r--r--indra/newview/llsettingsvo.cpp185
-rw-r--r--indra/newview/llsettingsvo.h5
-rw-r--r--indra/newview/llviewerregion.cpp1
-rw-r--r--indra/newview/llwlhandlers.cpp4
-rw-r--r--indra/newview/llwlhandlers.h2
7 files changed, 482 insertions, 5 deletions
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp
index e8c9db045c..e14265d950 100644
--- a/indra/newview/llenvironment.cpp
+++ b/indra/newview/llenvironment.cpp
@@ -45,8 +45,11 @@
#include "lldiriterator.h"
#include "llsettingsvo.h"
+#include "llnotificationsutil.h"
#include <boost/make_shared.hpp>
+
+#define EXPORT_PRESETS 1
//=========================================================================
namespace
{
@@ -75,7 +78,9 @@ LLEnvironment::LLEnvironment():
mDayCycleByName(),
mDayCycleById(),
mUserPrefs(),
- mSelectedEnvironment(ENV_LOCAL)
+ mSelectedEnvironment(ENV_LOCAL),
+ mDayLength(LLSettingsDay::DEFAULT_DAYLENGTH),
+ mDayOffset(LLSettingsDay::DEFAULT_DAYOFFSET)
{
mSetSkys.resize(ENV_END);
mSetWater.resize(ENV_END);
@@ -146,7 +151,8 @@ void LLEnvironment::onRegionChange()
void LLEnvironment::requestRegionEnvironment()
{
- LLEnvironmentRequest::initiate();
+// LLEnvironmentRequest::initiate();
+ requestRegion();
}
void LLEnvironment::onLegacyRegionSettings(LLSD data)
@@ -182,6 +188,20 @@ bool LLEnvironment::getIsDayTime() const
return mCurrentSky->getSunDirection().mV[2] > NIGHTTIME_ELEVATION_COS;
}
+void LLEnvironment::setDayLength(S64Seconds seconds)
+{
+ mDayLength = seconds;
+ if (mCurrentDay)
+ mCurrentDay->setDayLength(mDayLength);
+}
+
+void LLEnvironment::setDayOffset(S64Seconds seconds)
+{
+ mDayOffset = seconds;
+ if (mCurrentDay)
+ mCurrentDay->setDayOffset(seconds);
+}
+
//-------------------------------------------------------------------------
void LLEnvironment::update(const LLViewerCamera * cam)
{
@@ -455,6 +475,8 @@ void LLEnvironment::selectDayCycle(const LLSettingsDay::ptr_t &daycycle, F32Seco
}
mCurrentDay = daycycle;
+ mCurrentDay->setDayLength(mDayLength);
+ mCurrentDay->setDayOffset(mDayOffset);
daycycle->startDayCycle();
selectWater(daycycle->getCurrentWater(), transition);
@@ -740,6 +762,238 @@ LLSettingsDay::ptr_t LLEnvironment::findDayCycleByName(std::string name) const
return boost::static_pointer_cast<LLSettingsDay>((*it).second);
}
+
+void LLEnvironment::applyEnvironment(LLSD environment)
+{
+ LL_WARNS("ENVIRONMENT") << "Have environment" << LL_ENDL;
+
+ S32 daylength(LLSettingsDay::DEFAULT_DAYLENGTH);
+ S32 dayoffset(LLSettingsDay::DEFAULT_DAYOFFSET);
+
+ if (environment.has("day_length"))
+ daylength = environment["day_length"].asInteger();
+ if (environment.has("day_offset"))
+ dayoffset = environment["day_cycle"].asInteger();
+
+ setDayLength(S64Seconds(daylength));
+ setDayOffset(S64Seconds(dayoffset));
+
+ if (environment.has("day_cycle"))
+ {
+ LLSettingsDay::ptr_t pday = LLSettingsVODay::buildFromEnvironmentMessage(environment["day_cycle"]);
+
+ if (pday)
+ selectDayCycle(pday);
+ }
+
+ /*TODO: track_altitudes*/
+}
+
+//=========================================================================
+void LLEnvironment::requestRegion()
+{
+ if (gAgent.getRegionCapability("ExtEnvironment").empty())
+ {
+ LLEnvironmentRequest::initiate();
+ return;
+ }
+
+ requestParcel(LLUUID::null);
+}
+
+void LLEnvironment::updateRegion(LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset)
+{
+ if (gAgent.getRegionCapability("ExtEnvironment").empty())
+ {
+ LLEnvironmentApply::initiateRequest( LLSettingsVODay::convertToLegacy(pday) );
+ return;
+ }
+
+ updateParcel(LLUUID::null, pday, day_length, day_offset);
+}
+
+void LLEnvironment::resetRegion()
+{
+ resetParcel(LLUUID::null);
+}
+
+void LLEnvironment::requestParcel(const LLUUID &parcel_id)
+{
+ std::string coroname =
+ LLCoros::instance().launch("LLEnvironment::coroRequestEnvironment",
+ boost::bind(&LLEnvironment::coroRequestEnvironment, this, parcel_id));
+
+}
+
+void LLEnvironment::updateParcel(const LLUUID &parcel_id, LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset)
+{
+ std::string coroname =
+ LLCoros::instance().launch("LLEnvironment::coroUpdateEnvironment",
+ boost::bind(&LLEnvironment::coroUpdateEnvironment, this, parcel_id, pday, day_length, day_offset));
+
+}
+
+void LLEnvironment::resetParcel(const LLUUID &parcel_id)
+{
+ std::string coroname =
+ LLCoros::instance().launch("LLEnvironment::coroResetEnvironment",
+ boost::bind(&LLEnvironment::coroResetEnvironment, this, parcel_id));
+
+}
+
+void LLEnvironment::coroRequestEnvironment(LLUUID parcel_id)
+{
+ LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
+ LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
+ httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("ResetEnvironment", httpPolicy));
+ LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
+
+ std::string url = gAgent.getRegionCapability("ExtEnvironment");
+ if (url.empty())
+ return;
+
+ if (!parcel_id.isNull())
+ url += "?parcelid=" + parcel_id.asString();
+
+ LLSD result = httpAdapter->getAndSuspend(httpRequest, url);
+ // results that come back may contain the new settings
+
+ LLSD notify;
+
+ LLSD httpResults = result["http_result"];
+ LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
+ if (!status)
+ {
+ LL_WARNS("WindlightCaps") << "Couldn't retrieve Windlight settings for " << (parcel_id.isNull() ? ("region!") : ("parcel!")) << LL_ENDL;
+
+ std::stringstream msg;
+ msg << status.toString() << " (Code " << status.toTerseString() << ")";
+ notify = LLSD::emptyMap();
+ notify["FAIL_REASON"] = msg.str();
+
+ }
+ else
+ {
+ LLSD environment = result["environment"];
+ if (environment.isDefined())
+ {
+ applyEnvironment(environment);
+ }
+ }
+
+ if (!notify.isUndefined())
+ {
+ LLNotificationsUtil::add("WLRegionApplyFail", notify);
+ //LLEnvManagerNew::instance().onRegionSettingsApplyResponse(false);
+ }
+}
+
+void LLEnvironment::coroUpdateEnvironment(LLUUID parcel_id, LLSettingsDay::ptr_t pday, S32 day_length, S32 day_offset)
+{
+ LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
+ LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
+ httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("ResetEnvironment", httpPolicy));
+ LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
+
+ std::string url = gAgent.getRegionCapability("ExtEnvironment");
+ if (url.empty())
+ return;
+
+ LLSD body(LLSD::emptyMap());
+ body["environment"] = LLSD::emptyMap();
+
+ if (day_length >= 0)
+ body["environment"]["day_length"] = day_length;
+ if (day_offset >= 0)
+ body["environment"]["day_offset"] = day_offset;
+ if (pday)
+ body["environment"]["day_cycle"] = pday->getSettings();
+
+
+ if (!parcel_id.isNull())
+ url += "?parcelid=" + parcel_id.asString();
+
+ LLSD result = httpAdapter->putAndSuspend(httpRequest, url, body);
+ // results that come back may contain the new settings
+
+ LLSD notify;
+
+ LLSD httpResults = result["http_result"];
+ LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
+ if (!status)
+ {
+ LL_WARNS("WindlightCaps") << "Couldn't update Windlight settings for " << (parcel_id.isNull() ? ("region!") : ("parcel!")) << LL_ENDL;
+
+ std::stringstream msg;
+ msg << status.toString() << " (Code " << status.toTerseString() << ")";
+ notify = LLSD::emptyMap();
+ notify["FAIL_REASON"] = msg.str();
+ }
+ else
+ {
+ LLSD environment = result["environment"];
+ if (environment.isDefined())
+ {
+ applyEnvironment(environment);
+ }
+ }
+
+ if (!notify.isUndefined())
+ {
+ LLNotificationsUtil::add("WLRegionApplyFail", notify);
+ //LLEnvManagerNew::instance().onRegionSettingsApplyResponse(false);
+ }
+}
+
+void LLEnvironment::coroResetEnvironment(LLUUID parcel_id)
+{
+ LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
+ LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
+ httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("ResetEnvironment", httpPolicy));
+ LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
+
+ std::string url = gAgent.getRegionCapability("ExtEnvironment");
+ if (url.empty())
+ return;
+
+ if (!parcel_id.isNull())
+ url += "?parcelid=" + parcel_id.asString();
+
+ LLSD result = httpAdapter->deleteAndSuspend(httpRequest, url);
+ // results that come back may contain the new settings
+
+ LLSD notify;
+
+ LLSD httpResults = result["http_result"];
+ LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
+ if (!status)
+ {
+ LL_WARNS("WindlightCaps") << "Couldn't reset Windlight settings in " << (parcel_id.isNull() ? ("region!") : ("parcel!")) << LL_ENDL;
+
+ std::stringstream msg;
+ msg << status.toString() << " (Code " << status.toTerseString() << ")";
+ notify = LLSD::emptyMap();
+ notify["FAIL_REASON"] = msg.str();
+
+ }
+ else
+ {
+ LLSD environment = result["environment"];
+ if (environment.isDefined())
+ {
+ applyEnvironment(environment);
+ }
+ }
+
+ if (!notify.isUndefined())
+ {
+ LLNotificationsUtil::add("WLRegionApplyFail", notify);
+ //LLEnvManagerNew::instance().onRegionSettingsApplyResponse(false);
+ }
+
+}
+
+
//=========================================================================
LLEnvironment::UserPrefs::UserPrefs():
mUseRegionSettings(true),
@@ -906,6 +1160,18 @@ void LLEnvironment::legacyLoadAllPresets()
LLSettingsDay::ptr_t day = LLSettingsVODay::buildFromLegacyPreset(name, data);
LLEnvironment::instance().addDayCycle(day);
+
+#ifdef EXPORT_PRESETS
+ std::string exportfile = LLURI::escape(name) + "(new).xml";
+ std::string exportpath = gDirUtilp->add(getSysDir("new"), exportfile);
+
+ LLSD settings = day->getSettings();
+
+ std::ofstream daycyclefile(exportpath);
+ LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter();
+ formatter->format(settings, daycyclefile, LLSDFormatter::OPTIONS_PRETTY);
+ daycyclefile.close();
+#endif
}
}
}
diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h
index 4d3d1f6a57..9e9c05b194 100644
--- a/indra/newview/llenvironment.h
+++ b/indra/newview/llenvironment.h
@@ -181,6 +181,10 @@ public:
inline LLVector4 getClampedLightDirection() const { return LLVector4(mCurrentSky->getClampedLightDirection(), 0.0f); }
inline LLVector4 getRotatedLight() const { return mRotatedLight; }
+ inline S64Seconds getDayLength() const { return mDayLength; }
+ void setDayLength(S64Seconds seconds);
+ inline S64Seconds getDayOffset() const { return mDayOffset; }
+ void setDayOffset(S64Seconds seconds);
//-------------------------------------------
connection_t setSkyListChange(const change_signal_t::slot_type& cb);
connection_t setWaterListChange(const change_signal_t::slot_type& cb);
@@ -190,6 +194,13 @@ public:
void onLegacyRegionSettings(LLSD data);
+ void requestRegion();
+ void updateRegion(LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset);
+ void resetRegion();
+ void requestParcel(const LLUUID &parcel_id);
+ void updateParcel(const LLUUID &parcel_id, LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset);
+ void resetParcel(const LLUUID &parcel_id);
+
protected:
virtual void initSingleton();
@@ -254,6 +265,9 @@ private:
change_signal_t mWaterListChange;
change_signal_t mDayCycleListChange;
+ S64Seconds mDayLength;
+ S64Seconds mDayOffset;
+
void onSkyTransitionDone(const LLSettingsBlender::ptr_t &blender);
void onWaterTransitionDone(const LLSettingsBlender::ptr_t &blender);
@@ -278,6 +292,12 @@ private:
void onRegionChange();
+ void coroRequestEnvironment(LLUUID parcel_id);
+ void coroUpdateEnvironment(LLUUID parcel_id, LLSettingsDay::ptr_t pday, S32 day_length, S32 day_offset);
+ void coroResetEnvironment(LLUUID parcel_id);
+
+ void applyEnvironment(LLSD environment);
+
//=========================================================================
void legacyLoadAllPresets();
LLSD legacyLoadPreset(const std::string& path);
diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp
index 76a6754573..cd32aa07a8 100644
--- a/indra/newview/llsettingsvo.cpp
+++ b/indra/newview/llsettingsvo.cpp
@@ -43,6 +43,30 @@
#include "llenvironment.h"
#include "llsky.h"
+#undef VERIFY_LEGACY_CONVERSION
+
+//=========================================================================
+namespace
+{
+LLSD ensureArray4(LLSD in, F32 fill)
+{
+ if (in.size() >= 4)
+ return in;
+
+ LLSD out(LLSD::emptyArray());
+
+ for (S32 idx = 0; idx < in.size(); ++idx)
+ {
+ out.append(in[idx]);
+ }
+
+ while (out.size() < 4)
+ {
+ out.append(LLSD::Real(fill));
+ }
+ return out;
+}
+}
//=========================================================================
LLSettingsVOSky::LLSettingsVOSky(const LLSD &data):
LLSettingsSky(data)
@@ -64,6 +88,18 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildFromLegacyPreset(const std::string &n
LLSettingsSky::ptr_t skyp = boost::make_shared<LLSettingsVOSky>(newsettings);
+#ifdef VERIFY_LEGACY_CONVERSION
+ LLSD oldsettings = LLSettingsVOSky::convertToLegacy(skyp);
+
+ if (!llsd_equals(legacy, oldsettings))
+ {
+ LL_WARNS("SKY") << "Conversion to/from legacy does not match!\n"
+ << "Old: " << legacy
+ << "new: " << oldsettings << LL_ENDL;
+ }
+
+#endif
+
if (skyp->validate())
return skyp;
@@ -95,6 +131,43 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildClone()
return LLSettingsSky::ptr_t();
}
+LLSD LLSettingsVOSky::convertToLegacy(const LLSettingsSky::ptr_t &psky)
+{
+ LLSD legacy(LLSD::emptyMap());
+ LLSD settings = psky->getSettings();
+
+ legacy[SETTING_AMBIENT] = ensureArray4(settings[SETTING_AMBIENT], 1.0f);
+ legacy[SETTING_BLUE_DENSITY] = ensureArray4(settings[SETTING_BLUE_DENSITY], 1.0);
+ legacy[SETTING_BLUE_HORIZON] = ensureArray4(settings[SETTING_BLUE_HORIZON], 1.0);
+ legacy[SETTING_CLOUD_COLOR] = ensureArray4(settings[SETTING_CLOUD_COLOR], 1.0);
+ legacy[SETTING_CLOUD_POS_DENSITY1] = ensureArray4(settings[SETTING_CLOUD_POS_DENSITY1], 1.0);
+ legacy[SETTING_CLOUD_POS_DENSITY2] = ensureArray4(settings[SETTING_CLOUD_POS_DENSITY2], 1.0);
+ legacy[SETTING_CLOUD_SCALE] = LLSDArray(settings[SETTING_CLOUD_SCALE])(LLSD::Real(0.0))(LLSD::Real(0.0))(LLSD::Real(1.0));
+
+ legacy[SETTING_CLOUD_SCROLL_RATE] = settings[SETTING_CLOUD_SCROLL_RATE];
+ legacy[SETTING_LEGACY_ENABLE_CLOUD_SCROLL] = LLSDArray(LLSD::Boolean(!is_approx_zero(settings[SETTING_CLOUD_SCROLL_RATE][0].asReal())))
+ (LLSD::Boolean(!is_approx_zero(settings[SETTING_CLOUD_SCROLL_RATE][1].asReal())));
+
+ legacy[SETTING_CLOUD_SHADOW] = LLSDArray(settings[SETTING_CLOUD_SHADOW].asReal())(0.0f)(0.0f)(1.0f);
+ legacy[SETTING_DENSITY_MULTIPLIER] = LLSDArray(settings[SETTING_DENSITY_MULTIPLIER].asReal())(0.0f)(0.0f)(1.0f);
+ legacy[SETTING_DISTANCE_MULTIPLIER] = LLSDArray(settings[SETTING_DISTANCE_MULTIPLIER].asReal())(0.0f)(0.0f)(1.0f);
+ legacy[SETTING_GAMMA] = LLSDArray(settings[SETTING_GAMMA])(0.0f)(0.0f)(1.0f);
+ legacy[SETTING_GLOW] = ensureArray4(settings[SETTING_GLOW], 1.0);
+ legacy[SETTING_HAZE_DENSITY] = LLSDArray(settings[SETTING_HAZE_DENSITY])(0.0f)(0.0f)(1.0f);
+ legacy[SETTING_HAZE_HORIZON] = LLSDArray(settings[SETTING_HAZE_HORIZON])(0.0f)(0.0f)(1.0f);
+ legacy[SETTING_LIGHT_NORMAL] = ensureArray4(psky->getLightDirection().getValue(), 0.0f);
+ legacy[SETTING_MAX_Y] = LLSDArray(settings[SETTING_MAX_Y])(0.0f)(0.0f)(1.0f);
+ legacy[SETTING_STAR_BRIGHTNESS] = settings[SETTING_STAR_BRIGHTNESS];
+ legacy[SETTING_SUNLIGHT_COLOR] = ensureArray4(settings[SETTING_SUNLIGHT_COLOR], 1.0f);
+
+ LLSettingsSky::azimalt_t azialt = psky->getSunRotationAzAl();
+
+ legacy[SETTING_LEGACY_EAST_ANGLE] = azialt.first;
+ legacy[SETTING_LEGACY_SUN_ANGLE] = azialt.second;
+
+ return legacy;
+}
+
//-------------------------------------------------------------------------
void LLSettingsVOSky::updateSettings()
{
@@ -176,6 +249,19 @@ LLSettingsWater::ptr_t LLSettingsVOWater::buildFromLegacyPreset(const std::strin
LLSettingsWater::ptr_t waterp = boost::make_shared<LLSettingsVOWater>(newsettings);
+#ifdef VERIFY_LEGACY_CONVERSION
+ LLSD oldsettings = LLSettingsVOWater::convertToLegacy(waterp);
+
+ if (!llsd_equals(legacy, oldsettings))
+ {
+ LL_WARNS("WATER") << "Conversion to/from legacy does not match!\n"
+ << "Old: " << legacy
+ << "new: " << oldsettings << LL_ENDL;
+ }
+
+#endif
+
+
if (waterp->validate())
return waterp;
@@ -207,6 +293,28 @@ LLSettingsWater::ptr_t LLSettingsVOWater::buildClone()
return LLSettingsWater::ptr_t();
}
+LLSD LLSettingsVOWater::convertToLegacy(const LLSettingsWater::ptr_t &pwater)
+{
+ LLSD legacy(LLSD::emptyMap());
+ LLSD settings = pwater->getSettings();
+
+ legacy[SETTING_LEGACY_BLUR_MULTIPILER] = settings[SETTING_BLUR_MULTIPILER];
+ legacy[SETTING_LEGACY_FOG_COLOR] = ensureArray4(settings[SETTING_FOG_COLOR], 1.0f);
+ legacy[SETTING_LEGACY_FOG_DENSITY] = settings[SETTING_FOG_DENSITY];
+ legacy[SETTING_LEGACY_FOG_MOD] = settings[SETTING_FOG_MOD];
+ legacy[SETTING_LEGACY_FRESNEL_OFFSET] = settings[SETTING_FRESNEL_OFFSET];
+ legacy[SETTING_LEGACY_FRESNEL_SCALE] = settings[SETTING_FRESNEL_SCALE];
+ legacy[SETTING_LEGACY_NORMAL_MAP] = settings[SETTING_NORMAL_MAP];
+ legacy[SETTING_LEGACY_NORMAL_SCALE] = settings[SETTING_NORMAL_SCALE];
+ legacy[SETTING_LEGACY_SCALE_ABOVE] = settings[SETTING_SCALE_ABOVE];
+ legacy[SETTING_LEGACY_SCALE_BELOW] = settings[SETTING_SCALE_BELOW];
+ legacy[SETTING_LEGACY_WAVE1_DIR] = settings[SETTING_WAVE1_DIR];
+ legacy[SETTING_LEGACY_WAVE2_DIR] = settings[SETTING_WAVE2_DIR];
+
+ //_WARNS("LAPRAS") << "Legacy water: " << legacy << LL_ENDL;
+ return legacy;
+}
+//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
void LLSettingsVOWater::applySpecial(void *ptarget)
{
@@ -303,12 +411,26 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyPreset(const std::string &n
LLSettingsDay::ptr_t dayp = boost::make_shared<LLSettingsVODay>(newsettings);
+#ifdef VERIFY_LEGACY_CONVERSION
+ LLSD testsettings = LLSettingsVODay::convertToLegacy(dayp);
+
+ if (!llsd_equals(oldsettings, testsettings))
+ {
+ LL_WARNS("DAYCYCLE") << "Conversion to/from legacy does not match!\n"
+ << "Old: " << oldsettings
+ << "new: " << testsettings << LL_ENDL;
+ }
+
+#endif
+
if (dayp->validate())
{
dayp->initialize();
return dayp;
}
+
+
return LLSettingsDay::ptr_t();
}
@@ -370,6 +492,20 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildDefaultDayCycle()
return LLSettingsDay::ptr_t();
}
+LLSettingsDay::ptr_t LLSettingsVODay::buildFromEnvironmentMessage(LLSD settings)
+{
+ LLSettingsDay::ptr_t dayp = boost::make_shared<LLSettingsVODay>(settings);
+
+ if (dayp->validate())
+ {
+ dayp->initialize();
+ return dayp;
+ }
+
+ return LLSettingsDay::ptr_t();
+}
+
+
LLSettingsDay::ptr_t LLSettingsVODay::buildClone()
{
LLSD settings = cloneSettings();
@@ -379,6 +515,55 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildClone()
return dayp;
}
+LLSD LLSettingsVODay::convertToLegacy(const LLSettingsVODay::ptr_t &pday)
+{
+ CycleTrack_t &trackwater = pday->getCycleTrack(TRACK_WATER);
+
+ LLSettingsWater::ptr_t pwater;
+ if (!trackwater.empty())
+ {
+ pwater = boost::static_pointer_cast<LLSettingsWater>((*trackwater.begin()).second);
+ }
+
+ if (!pwater)
+ pwater = LLSettingsVOWater::buildDefaultWater();
+
+ LLSD llsdwater = LLSettingsVOWater::convertToLegacy(pwater);
+
+ CycleTrack_t &tracksky = pday->getCycleTrack(1); // first sky track
+ std::map<std::string, LLSettingsSky::ptr_t> skys;
+
+ LLSD llsdcycle(LLSD::emptyArray());
+
+ for(CycleTrack_t::iterator it = tracksky.begin(); it != tracksky.end(); ++it)
+ {
+ size_t hash = (*it).second->getHash();
+ std::stringstream name;
+
+ name << hash;
+
+ skys[name.str()] = boost::static_pointer_cast<LLSettingsSky>((*it).second);
+
+ F32 frame = ((tracksky.size() == 1) && (it == tracksky.begin())) ? -1.0f : (*it).first;
+ llsdcycle.append( LLSDArray(LLSD::Real(frame))(name.str()) );
+ }
+ //_WARNS("LAPRAS") << "Cycle created with " << llsdcycle.size() << "entries: " << llsdcycle << LL_ENDL;
+
+ LLSD llsdskylist(LLSD::emptyMap());
+
+ for (std::map<std::string, LLSettingsSky::ptr_t>::iterator its = skys.begin(); its != skys.end(); ++its)
+ {
+ LLSD llsdsky = LLSettingsVOSky::convertToLegacy((*its).second);
+ llsdsky[SETTING_NAME] = (*its).first;
+
+ llsdskylist[(*its).first] = llsdsky;
+ }
+
+ //_WARNS("LAPRAS") << "Sky map with " << llsdskylist.size() << " entries created: " << llsdskylist << LL_ENDL;
+
+ return LLSDArray(LLSD::emptyMap())(llsdcycle)(llsdskylist)(llsdwater);
+}
+
LLSettingsSkyPtr_t LLSettingsVODay::getDefaultSky() const
{
return LLSettingsVOSky::buildDefaultSky();
diff --git a/indra/newview/llsettingsvo.h b/indra/newview/llsettingsvo.h
index 6ef7290ba4..ba96a19d3e 100644
--- a/indra/newview/llsettingsvo.h
+++ b/indra/newview/llsettingsvo.h
@@ -42,6 +42,7 @@ public:
static ptr_t buildDefaultSky();
virtual ptr_t buildClone();
+ static LLSD convertToLegacy(const ptr_t &);
protected:
LLSettingsVOSky();
@@ -63,6 +64,7 @@ public:
static ptr_t buildDefaultWater();
virtual ptr_t buildClone();
+ static LLSD convertToLegacy(const ptr_t &);
protected:
LLSettingsVOWater();
@@ -86,8 +88,11 @@ public:
static ptr_t buildFromLegacyPreset(const std::string &name, const LLSD &oldsettings);
static ptr_t buildFromLegacyMessage(const LLUUID &regionId, LLSD daycycle, LLSD skys, LLSD water);
static ptr_t buildDefaultDayCycle();
+ static ptr_t buildFromEnvironmentMessage(LLSD settings);
virtual ptr_t buildClone();
+ static LLSD convertToLegacy(const ptr_t &);
+
virtual LLSettingsSkyPtr_t getDefaultSky() const;
virtual LLSettingsWaterPtr_t getDefaultWater() const;
virtual LLSettingsSkyPtr_t buildSky(LLSD) const;
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index 5b61eab5f7..81be645c6a 100644
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -2823,6 +2823,7 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames)
capabilityNames.append("EnvironmentSettings");
capabilityNames.append("EstateChangeInfo");
capabilityNames.append("EventQueueGet");
+ capabilityNames.append("ExtEnvironment");
capabilityNames.append("FacebookConnect");
capabilityNames.append("FlickrConnect");
capabilityNames.append("TwitterConnect");
diff --git a/indra/newview/llwlhandlers.cpp b/indra/newview/llwlhandlers.cpp
index 0e4017a1c0..cd3310d5cb 100644
--- a/indra/newview/llwlhandlers.cpp
+++ b/indra/newview/llwlhandlers.cpp
@@ -164,7 +164,7 @@ bool LLEnvironmentApply::initiateRequest(const LLSD& content)
sLastUpdate = current;
// Send update request.
- std::string url = gAgent.getRegionCapability("EnvironmentSettings");
+ std::string url = gAgent.getRegionCapability("ExtEnvironment");
if (url.empty())
{
LL_WARNS("WindlightCaps") << "Applying windlight settings not supported" << LL_ENDL;
@@ -244,13 +244,11 @@ void LLEnvironmentApply::environmentApplyCoro(std::string url, LLSD content)
}
LL_DEBUGS("WindlightCaps") << "Success in applying windlight settings to region " << result["regionID"].asUUID() << LL_ENDL;
- //LLEnvManagerNew::instance().onRegionSettingsApplyResponse(true);
} while (false);
if (!notify.isUndefined())
{
LLNotificationsUtil::add("WLRegionApplyFail", notify);
- //LLEnvManagerNew::instance().onRegionSettingsApplyResponse(false);
}
}
diff --git a/indra/newview/llwlhandlers.h b/indra/newview/llwlhandlers.h
index eb2bbf9553..857ffa9bd3 100644
--- a/indra/newview/llwlhandlers.h
+++ b/indra/newview/llwlhandlers.h
@@ -60,4 +60,6 @@ private:
static void environmentApplyCoro(std::string url, LLSD content);
};
+
+
#endif // LL_LLWLHANDLERS_H