MAINT-7699: Deliver new settings to viewer via cap
parent
1df10afa2a
commit
8211f57205
|
|
@ -35,7 +35,7 @@
|
|||
//=========================================================================
|
||||
namespace
|
||||
{
|
||||
const F32 BREAK_POINT = 0.5;
|
||||
const F64 BREAK_POINT = 0.5;
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
|
|
@ -44,7 +44,7 @@ const std::string LLSettingsBase::SETTING_NAME("name");
|
|||
const std::string LLSettingsBase::SETTING_HASH("hash");
|
||||
const std::string LLSettingsBase::SETTING_TYPE("type");
|
||||
|
||||
const F32Seconds LLSettingsBlender::DEFAULT_THRESHOLD(0.01);
|
||||
const F64Seconds LLSettingsBlender::DEFAULT_THRESHOLD(0.01);
|
||||
|
||||
//=========================================================================
|
||||
LLSettingsBase::LLSettingsBase():
|
||||
|
|
@ -60,7 +60,7 @@ LLSettingsBase::LLSettingsBase(const LLSD setting) :
|
|||
}
|
||||
|
||||
//=========================================================================
|
||||
void LLSettingsBase::lerpSettings(const LLSettingsBase &other, F32 mix)
|
||||
void LLSettingsBase::lerpSettings(const LLSettingsBase &other, F64 mix)
|
||||
{
|
||||
mSettings = interpolateSDMap(mSettings, other.mSettings, mix);
|
||||
setDirtyFlag(true);
|
||||
|
|
@ -140,7 +140,7 @@ LLSD LLSettingsBase::combineSDMaps(const LLSD &settings, const LLSD &other) cons
|
|||
return newSettings;
|
||||
}
|
||||
|
||||
LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, F32 mix) const
|
||||
LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, F64 mix) const
|
||||
{
|
||||
LLSD newSettings;
|
||||
|
||||
|
|
@ -535,9 +535,9 @@ bool LLSettingsBase::Validator::verifyQuaternionNormal(LLSD &value)
|
|||
|
||||
bool LLSettingsBase::Validator::verifyFloatRange(LLSD &value, LLSD range)
|
||||
{
|
||||
F32 real = value.asReal();
|
||||
F64 real = value.asReal();
|
||||
|
||||
F32 clampedval = llclamp(LLSD::Real(real), range[0].asReal(), range[1].asReal());
|
||||
F64 clampedval = llclamp(LLSD::Real(real), range[0].asReal(), range[1].asReal());
|
||||
|
||||
if (is_approx_equal(clampedval, real))
|
||||
return true;
|
||||
|
|
@ -561,7 +561,7 @@ bool LLSettingsBase::Validator::verifyIntegerRange(LLSD &value, LLSD range)
|
|||
|
||||
//=========================================================================
|
||||
|
||||
void LLSettingsBlender::update(F32Seconds timedelta)
|
||||
void LLSettingsBlender::update(F64Seconds timedelta)
|
||||
{
|
||||
mTimeSpent += timedelta;
|
||||
|
||||
|
|
@ -573,7 +573,7 @@ void LLSettingsBlender::update(F32Seconds timedelta)
|
|||
return;
|
||||
}
|
||||
|
||||
F32 blendf = fmod(mTimeSpent.value(), mSeconds.value()) / mSeconds.value();
|
||||
F64 blendf = fmod(mTimeSpent.value(), mSeconds.value()) / mSeconds.value();
|
||||
|
||||
mTarget->replaceSettings(mInitial->getSettings());
|
||||
mTarget->blend(mFinal, blendf);
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ public:
|
|||
(const_cast<LLSettingsBase *>(this))->updateSettings();
|
||||
}
|
||||
|
||||
virtual void blend(const ptr_t &end, F32 blendf) = 0;
|
||||
virtual void blend(const ptr_t &end, F64 blendf) = 0;
|
||||
|
||||
virtual bool validate();
|
||||
|
||||
|
|
@ -198,8 +198,8 @@ protected:
|
|||
typedef std::set<std::string> stringset_t;
|
||||
|
||||
// combining settings objects. Customize for specific setting types
|
||||
virtual void lerpSettings(const LLSettingsBase &other, F32 mix);
|
||||
LLSD interpolateSDMap(const LLSD &settings, const LLSD &other, F32 mix) const;
|
||||
virtual void lerpSettings(const LLSettingsBase &other, F64 mix);
|
||||
LLSD interpolateSDMap(const LLSD &settings, const LLSD &other, F64 mix) const;
|
||||
|
||||
/// when lerping between settings, some may require special handling.
|
||||
/// Get a list of these key to be skipped by the default settings lerp.
|
||||
|
|
@ -240,10 +240,10 @@ public:
|
|||
typedef boost::signals2::signal<void(const ptr_t &)> finish_signal_t;
|
||||
typedef boost::signals2::connection connection_t;
|
||||
|
||||
static const F32Seconds DEFAULT_THRESHOLD;
|
||||
static const F64Seconds DEFAULT_THRESHOLD;
|
||||
|
||||
LLSettingsBlender(const LLSettingsBase::ptr_t &target,
|
||||
const LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F32Seconds seconds) :
|
||||
const LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F64Seconds seconds) :
|
||||
mTarget(target),
|
||||
mInitial(initsetting),
|
||||
mFinal(endsetting),
|
||||
|
|
@ -254,23 +254,34 @@ public:
|
|||
mTimeSpent(0.0f)
|
||||
{
|
||||
mTarget->replaceSettings(mInitial->getSettings());
|
||||
mTimeStart = F32Seconds(LLDate::now().secondsSinceEpoch());
|
||||
mTimeStart = F64Seconds(LLDate::now().secondsSinceEpoch());
|
||||
mLastUpdate = mTimeStart;
|
||||
}
|
||||
|
||||
~LLSettingsBlender() {}
|
||||
|
||||
void reset( LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F64 seconds )
|
||||
{
|
||||
mInitial = initsetting;
|
||||
mFinal = endsetting;
|
||||
mSeconds.value(seconds);
|
||||
mTarget->replaceSettings(mInitial->getSettings());
|
||||
mTimeStart.value(LLDate::now().secondsSinceEpoch());
|
||||
mLastUpdate = mTimeStart;
|
||||
mTimeSpent.value(0.0f);
|
||||
}
|
||||
|
||||
connection_t setOnFinished(const finish_signal_t::slot_type &onfinished)
|
||||
{
|
||||
return mOnFinished.connect(onfinished);
|
||||
}
|
||||
|
||||
void setUpdateThreshold(F32Seconds threshold)
|
||||
void setUpdateThreshold(F64Seconds threshold)
|
||||
{
|
||||
mBlendThreshold = threshold;
|
||||
}
|
||||
|
||||
F32Seconds getUpdateThreshold() const
|
||||
F64Seconds getUpdateThreshold() const
|
||||
{
|
||||
return mBlendThreshold;
|
||||
}
|
||||
|
|
@ -290,17 +301,17 @@ public:
|
|||
return mFinal;
|
||||
}
|
||||
|
||||
void update(F32Seconds time);
|
||||
void update(F64Seconds time);
|
||||
private:
|
||||
LLSettingsBase::ptr_t mTarget;
|
||||
LLSettingsBase::ptr_t mInitial;
|
||||
LLSettingsBase::ptr_t mFinal;
|
||||
F32Seconds mSeconds;
|
||||
F64Seconds mSeconds;
|
||||
finish_signal_t mOnFinished;
|
||||
F32Seconds mBlendThreshold;
|
||||
F32Seconds mLastUpdate;
|
||||
F32Seconds mTimeSpent;
|
||||
F32Seconds mTimeStart;
|
||||
F64Seconds mBlendThreshold;
|
||||
F64Seconds mLastUpdate;
|
||||
F64Seconds mTimeSpent;
|
||||
F64Seconds mTimeStart;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -104,11 +104,14 @@ const std::string LLSettingsDay::SETTING_KEYHASH("key_hash");
|
|||
const std::string LLSettingsDay::SETTING_TRACKS("tracks");
|
||||
const std::string LLSettingsDay::SETTING_FRAMES("frames");
|
||||
|
||||
const S64 LLSettingsDay::MINIMUM_DAYLENGTH( 300); // 5 mins
|
||||
|
||||
//const S64 LLSettingsDay::MINIMUM_DAYLENGTH( 14400); // 4 hours
|
||||
const S64 LLSettingsDay::MINIMUM_DAYLENGTH( 300); // 5 mins
|
||||
const S64 LLSettingsDay::DEFAULT_DAYLENGTH( 14400); // 4 hours
|
||||
const S64 LLSettingsDay::MAXIMUM_DAYLENGTH(604800); // 7 days
|
||||
|
||||
const S32 LLSettingsDay::MINIMUM_DAYOFFSET( 0);
|
||||
const S32 LLSettingsDay::DEFAULT_DAYOFFSET(57600); // +16 hours == -8 hours (SLT time offset)
|
||||
const S32 LLSettingsDay::MAXIMUM_DAYOFFSET(86400); // 24 hours
|
||||
|
||||
const S32 LLSettingsDay::TRACK_WATER(0); // water track is 0
|
||||
const S32 LLSettingsDay::TRACK_MAX(5); // 5 tracks, 4 skys, 1 water
|
||||
const S32 LLSettingsDay::FRAME_MAX(56);
|
||||
|
|
@ -116,14 +119,18 @@ const S32 LLSettingsDay::FRAME_MAX(56);
|
|||
//=========================================================================
|
||||
LLSettingsDay::LLSettingsDay(const LLSD &data) :
|
||||
LLSettingsBase(data),
|
||||
mInitialized(false)
|
||||
mInitialized(false),
|
||||
mDayLength(DEFAULT_DAYLENGTH),
|
||||
mDayOffset(DEFAULT_DAYOFFSET)
|
||||
{
|
||||
mDayTracks.resize(TRACK_MAX);
|
||||
}
|
||||
|
||||
LLSettingsDay::LLSettingsDay() :
|
||||
LLSettingsBase(),
|
||||
mInitialized(false)
|
||||
mInitialized(false),
|
||||
mDayLength(DEFAULT_DAYLENGTH),
|
||||
mDayOffset(DEFAULT_DAYOFFSET)
|
||||
{
|
||||
mDayTracks.resize(TRACK_MAX);
|
||||
}
|
||||
|
|
@ -266,7 +273,7 @@ LLSD LLSettingsDay::defaults()
|
|||
return dfltsetting;
|
||||
}
|
||||
|
||||
void LLSettingsDay::blend(const LLSettingsBase::ptr_t &other, F32 mix)
|
||||
void LLSettingsDay::blend(const LLSettingsBase::ptr_t &other, F64 mix)
|
||||
{
|
||||
LL_ERRS("DAYCYCLE") << "Day cycles are not blendable!" << LL_ENDL;
|
||||
}
|
||||
|
|
@ -337,19 +344,30 @@ LLSettingsDay::validation_list_t LLSettingsDay::getValidationList() const
|
|||
return validation;
|
||||
}
|
||||
|
||||
LLSettingsDay::CycleTrack_t &LLSettingsDay::getCycleTrack(S32 track)
|
||||
{
|
||||
static CycleTrack_t emptyTrack;
|
||||
if (mDayTracks.size() <= track)
|
||||
return emptyTrack;
|
||||
|
||||
return mDayTracks[track];
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
F32 LLSettingsDay::secondsToKeyframe(S64Seconds seconds)
|
||||
{
|
||||
S64Seconds daylength = getDayLength();
|
||||
S64Seconds dayoffset = getDayOffset();
|
||||
|
||||
return llclamp(static_cast<F32>(seconds.value() % daylength.value()) / static_cast<F32>(daylength.value()), 0.0f, 1.0f);
|
||||
return llclamp(static_cast<F32>((seconds.value() + dayoffset.value()) % daylength.value()) / static_cast<F32>(daylength.value()), 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
F64Seconds LLSettingsDay::keyframeToSeconds(F32 keyframe)
|
||||
{
|
||||
S64Seconds daylength = getDayLength();
|
||||
S64Seconds dayoffset = getDayOffset();
|
||||
|
||||
return F64Seconds(static_cast<S32>(keyframe * static_cast<F32>(daylength.value())));
|
||||
return F64Seconds(static_cast<S64>(keyframe * static_cast<F32>(daylength.value())) - dayoffset.value());
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
|
|
@ -424,13 +442,6 @@ void LLSettingsDay::updateSettings()
|
|||
}
|
||||
|
||||
//=========================================================================
|
||||
void LLSettingsDay::setDayLength(S64Seconds seconds)
|
||||
{
|
||||
S32 val = llclamp(seconds.value(), MINIMUM_DAYLENGTH, MAXIMUM_DAYLENGTH);
|
||||
|
||||
setValue(SETTING_DAYLENGTH, val);
|
||||
}
|
||||
|
||||
LLSettingsDay::KeyframeList_t LLSettingsDay::getTrackKeyframes(S32 trackno)
|
||||
{
|
||||
if ((trackno < 1) || (trackno >= TRACK_MAX))
|
||||
|
|
|
|||
|
|
@ -48,8 +48,13 @@ public:
|
|||
static const std::string SETTING_FRAMES;
|
||||
|
||||
static const S64 MINIMUM_DAYLENGTH;
|
||||
static const S64 DEFAULT_DAYLENGTH;
|
||||
static const S64 MAXIMUM_DAYLENGTH;
|
||||
|
||||
static const S32 MINIMUM_DAYOFFSET;
|
||||
static const S32 DEFAULT_DAYOFFSET;
|
||||
static const S32 MAXIMUM_DAYOFFSET;
|
||||
|
||||
static const S32 TRACK_WATER;
|
||||
static const S32 TRACK_MAX;
|
||||
static const S32 FRAME_MAX;
|
||||
|
|
@ -74,17 +79,30 @@ public:
|
|||
virtual std::string getSettingType() const { return std::string("daycycle"); }
|
||||
|
||||
// Settings status
|
||||
virtual void blend(const LLSettingsBase::ptr_t &other, F32 mix);
|
||||
virtual void blend(const LLSettingsBase::ptr_t &other, F64 mix);
|
||||
|
||||
static LLSD defaults();
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
S64Seconds getDayLength() const
|
||||
{
|
||||
return S64Seconds(mSettings[SETTING_DAYLENGTH].asInteger());
|
||||
return mDayLength;
|
||||
}
|
||||
|
||||
void setDayLength(S64Seconds seconds);
|
||||
void setDayLength(S64Seconds seconds)
|
||||
{
|
||||
mDayLength = seconds;
|
||||
}
|
||||
|
||||
S64Seconds getDayOffset() const
|
||||
{
|
||||
return mDayOffset;
|
||||
}
|
||||
|
||||
void setDayOffset(S64Seconds seconds)
|
||||
{
|
||||
mDayOffset = seconds;
|
||||
}
|
||||
|
||||
KeyframeList_t getTrackKeyframes(S32 track);
|
||||
TimeList_t getTrackTimes(S32 track);
|
||||
|
|
@ -117,6 +135,7 @@ public:
|
|||
virtual LLSettingsWaterPtr_t getNamedWater(const std::string &) const = 0;
|
||||
|
||||
void setInitialized(bool value = true) { mInitialized = value; }
|
||||
CycleTrack_t & getCycleTrack(S32 track);
|
||||
protected:
|
||||
LLSettingsDay();
|
||||
|
||||
|
|
@ -137,6 +156,9 @@ private:
|
|||
|
||||
F64Seconds mLastUpdateTime;
|
||||
|
||||
S64Seconds mDayLength;
|
||||
S64Seconds mDayOffset;
|
||||
|
||||
F32 secondsToKeyframe(S64Seconds seconds);
|
||||
F64Seconds keyframeToSeconds(F32 keyframe);
|
||||
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ LLSettingsSky::LLSettingsSky():
|
|||
{
|
||||
}
|
||||
|
||||
void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F32 blendf)
|
||||
void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf)
|
||||
{
|
||||
LLSettingsSky::ptr_t other = boost::static_pointer_cast<LLSettingsSky>(end);
|
||||
LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf);
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ public:
|
|||
virtual std::string getSettingType() const { return std::string("sky"); }
|
||||
|
||||
// Settings status
|
||||
virtual void blend(const LLSettingsBase::ptr_t &end, F32 blendf);
|
||||
virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf);
|
||||
|
||||
static LLSD defaults();
|
||||
|
||||
|
|
@ -410,6 +410,10 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
static const std::string SETTING_LEGACY_EAST_ANGLE;
|
||||
static const std::string SETTING_LEGACY_ENABLE_CLOUD_SCROLL;
|
||||
static const std::string SETTING_LEGACY_SUN_ANGLE;
|
||||
|
||||
LLSettingsSky();
|
||||
|
||||
virtual stringset_t getSlerpKeys() const;
|
||||
|
|
@ -421,10 +425,6 @@ protected:
|
|||
static LLSD translateLegacySettings(LLSD legacy);
|
||||
|
||||
private:
|
||||
static const std::string SETTING_LEGACY_EAST_ANGLE;
|
||||
static const std::string SETTING_LEGACY_ENABLE_CLOUD_SCROLL;
|
||||
static const std::string SETTING_LEGACY_SUN_ANGLE;
|
||||
|
||||
static const F32 NIGHTTIME_ELEVATION;
|
||||
static const F32 NIGHTTIME_ELEVATION_COS;
|
||||
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ LLSD LLSettingsWater::translateLegacySettings(LLSD legacy)
|
|||
return newsettings;
|
||||
}
|
||||
|
||||
void LLSettingsWater::blend(const LLSettingsBase::ptr_t &end, F32 blendf)
|
||||
void LLSettingsWater::blend(const LLSettingsBase::ptr_t &end, F64 blendf)
|
||||
{
|
||||
LLSettingsWater::ptr_t other = boost::static_pointer_cast<LLSettingsWater>(end);
|
||||
LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf);
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public:
|
|||
virtual std::string getSettingType() const { return std::string("water"); }
|
||||
|
||||
// Settings status
|
||||
virtual void blend(const LLSettingsBase::ptr_t &end, F32 blendf);
|
||||
virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf);
|
||||
|
||||
static LLSD defaults();
|
||||
|
||||
|
|
@ -199,16 +199,6 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
LLSettingsWater();
|
||||
|
||||
virtual validation_list_t getValidationList() const;
|
||||
|
||||
static LLSD translateLegacySettings(LLSD legacy);
|
||||
|
||||
LLVector4 mWaterPlane;
|
||||
F32 mWaterFogKS;
|
||||
|
||||
private:
|
||||
static const std::string SETTING_LEGACY_BLUR_MULTIPILER;
|
||||
static const std::string SETTING_LEGACY_FOG_COLOR;
|
||||
static const std::string SETTING_LEGACY_FOG_DENSITY;
|
||||
|
|
@ -222,6 +212,17 @@ private:
|
|||
static const std::string SETTING_LEGACY_WAVE1_DIR;
|
||||
static const std::string SETTING_LEGACY_WAVE2_DIR;
|
||||
|
||||
LLSettingsWater();
|
||||
|
||||
virtual validation_list_t getValidationList() const;
|
||||
|
||||
static LLSD translateLegacySettings(LLSD legacy);
|
||||
|
||||
LLVector4 mWaterPlane;
|
||||
F32 mWaterFogKS;
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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 ®ionId, 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;
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,4 +60,6 @@ private:
|
|||
static void environmentApplyCoro(std::string url, LLSD content);
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // LL_LLWLHANDLERS_H
|
||||
|
|
|
|||
Loading…
Reference in New Issue