From b766466b3013e39831bcfcaef5d1089c07202afb Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 26 Feb 2018 09:27:14 -0800 Subject: Added settings inventory object with subtype --- indra/llmessage/llassetstorage.cpp | 34 ++++++++++++++++++++++++++++++---- indra/llmessage/llassetstorage.h | 31 +++++++++++++++++++------------ 2 files changed, 49 insertions(+), 16 deletions(-) (limited to 'indra/llmessage') diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp index 596d57c7b7..3d93f5aeb8 100644 --- a/indra/llmessage/llassetstorage.cpp +++ b/indra/llmessage/llassetstorage.cpp @@ -62,6 +62,24 @@ const LLUUID CATEGORIZE_LOST_AND_FOUND_ID(std::string("00000000-0000-0000-0000-0 const U64 TOXIC_ASSET_LIFETIME = (120 * 1000000); // microseconds +namespace +{ + template + bool operator == (const std::function &a, const std::function &b) + { + typedef T(fnType)(U...); + + auto fnPtrA = a.target(); + auto fnPtrB = b.target(); + if (fnPtrA && fnPtrB) + return (*fnPtrA == *fnPtrB); + else if (!fnPtrA && !fnPtrB) + return true; + return false; + } + +} + ///---------------------------------------------------------------------------- /// LLAssetInfo ///---------------------------------------------------------------------------- @@ -160,7 +178,7 @@ void LLAssetInfo::setFromNameValue( const LLNameValue& nv ) LLBaseDownloadRequest::LLBaseDownloadRequest(const LLUUID &uuid, const LLAssetType::EType type) : mUUID(uuid), mType(type), - mDownCallback(NULL), + mDownCallback(), mUserData(NULL), mHost(), mIsTemp(FALSE), @@ -191,7 +209,7 @@ LLBaseDownloadRequest* LLBaseDownloadRequest::getCopy() LLAssetRequest::LLAssetRequest(const LLUUID &uuid, const LLAssetType::EType type) : LLBaseDownloadRequest(uuid, type), - mUpCallback( NULL ), + mUpCallback(), mInfoCallback( NULL ), mIsLocal(FALSE), mIsUserWaiting(FALSE), @@ -496,7 +514,11 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, BOOL exists = mVFS->getExists(uuid, type); LLVFile file(mVFS, uuid, type); U32 size = exists ? file.getSize() : 0; - + +// LAPRAS TESTING +// if (type == LLAssetType::AT_SETTINGS) +// size = 0; + if (size > 0) { // we've already got the file @@ -1326,9 +1348,13 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, iter != mPendingDownloads.end(); ) { LLAssetRequest* tmp = *iter++; + + //void(*const* cbptr)(LLVFS *, const LLUUID &, LLAssetType::EType, void *, S32, LLExtStat) + auto cbptr = tmp->mDownCallback.target(); + if (type == tmp->getType() && uuid == tmp->getUUID() && - legacyGetDataCallback == tmp->mDownCallback && + (cbptr && (*cbptr == legacyGetDataCallback)) && callback == ((LLLegacyAssetRequest *)tmp->mUserData)->mDownCallback && user_data == ((LLLegacyAssetRequest *)tmp->mUserData)->mUserData) { diff --git a/indra/llmessage/llassetstorage.h b/indra/llmessage/llassetstorage.h index 33b88473b9..c799d8eefc 100644 --- a/indra/llmessage/llassetstorage.h +++ b/indra/llmessage/llassetstorage.h @@ -28,6 +28,7 @@ #ifndef LL_LLASSETSTORAGE_H #define LL_LLASSETSTORAGE_H #include +#include #include "lluuid.h" #include "lltimer.h" @@ -59,6 +60,14 @@ const int LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE = -4; const int LL_ERR_INSUFFICIENT_PERMISSIONS = -5; const int LL_ERR_PRICE_MISMATCH = -23018; +// *TODO: these typedefs are passed into the VFS via a legacy C function pointer +// future project would be to convert these to C++ callables (std::function<>) so that +// we can use bind and remove the userData parameter. +// +typedef std::function LLGetAssetCallback; +typedef std::function LLStoreAssetCallback; + + class LLAssetInfo { protected: @@ -110,7 +119,8 @@ protected: LLAssetType::EType mType; public: - void(*mDownCallback)(LLVFS*, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat); + LLGetAssetCallback mDownCallback; +// void(*mDownCallback)(LLVFS*, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat); void *mUserData; LLHost mHost; @@ -131,7 +141,8 @@ public: virtual LLBaseDownloadRequest* getCopy(); - void (*mUpCallback)(const LLUUID&, void *, S32, LLExtStat); + LLStoreAssetCallback mUpCallback; +// void (*mUpCallback)(const LLUUID&, void *, S32, LLExtStat); void (*mInfoCallback)(LLAssetInfo *, void *, S32); BOOL mIsLocal; @@ -182,12 +193,7 @@ protected: // Map of known bad assets typedef std::map toxic_asset_map_t; -// *TODO: these typedefs are passed into the VFS via a legacy C function pointer -// future project would be to convert these to C++ callables (std::function<>) so that -// we can use bind and remove the userData parameter. -// -typedef void (*LLGetAssetCallback)(LLVFS *vfs, const LLUUID &asset_id, - LLAssetType::EType asset_type, void *user_data, S32 status, LLExtStat ext_status); + class LLAssetStorage { @@ -195,7 +201,8 @@ public: // VFS member is public because static child methods need it :( LLVFS *mVFS; LLVFS *mStaticVFS; - typedef void (*LLStoreAssetCallback)(const LLUUID &asset_id, void *user_data, S32 status, LLExtStat ext_status); + typedef ::LLStoreAssetCallback LLStoreAssetCallback; + typedef ::LLGetAssetCallback LLGetAssetCallback; enum ERequestType { @@ -377,8 +384,8 @@ protected: void _cleanupRequests(BOOL all, S32 error); void _callUploadCallbacks(const LLUUID &uuid, const LLAssetType::EType asset_type, BOOL success, LLExtStat ext_status); - virtual void _queueDataRequest(const LLUUID& uuid, LLAssetType::EType type, - void (*callback)(LLVFS *vfs, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat), + virtual void _queueDataRequest(const LLUUID& uuid, LLAssetType::EType type, LLGetAssetCallback callback, +// void (*callback)(LLVFS *vfs, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat), void *user_data, BOOL duplicate, BOOL is_priority) = 0; @@ -424,7 +431,7 @@ class LLLegacyAssetRequest { public: void (*mDownCallback)(const char *, const LLUUID&, void *, S32, LLExtStat); - LLAssetStorage::LLStoreAssetCallback mUpCallback; + LLStoreAssetCallback mUpCallback; void *mUserData; }; -- cgit v1.3 From 9f2f2a28740274fa23f1cbcee7dcdefaefb2c469 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 27 Feb 2018 09:38:06 -0800 Subject: Replace variadic template with more specific expansion. --- indra/llmessage/llassetstorage.cpp | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) (limited to 'indra/llmessage') diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp index 3d93f5aeb8..2b12a062c3 100644 --- a/indra/llmessage/llassetstorage.cpp +++ b/indra/llmessage/llassetstorage.cpp @@ -64,20 +64,38 @@ const U64 TOXIC_ASSET_LIFETIME = (120 * 1000000); // microseconds namespace { - template - bool operator == (const std::function &a, const std::function &b) + bool operator == (const LLAssetStorage::LLGetAssetCallback &lhs, const LLAssetStorage::LLGetAssetCallback &rhs) { - typedef T(fnType)(U...); - - auto fnPtrA = a.target(); - auto fnPtrB = b.target(); - if (fnPtrA && fnPtrB) - return (*fnPtrA == *fnPtrB); - else if (!fnPtrA && !fnPtrB) + auto fnPtrLhs = lhs.target(); + auto fnPtrRhs = rhs.target(); + if (fnPtrLhs && fnPtrRhs) + return (*fnPtrLhs == *fnPtrRhs); + else if (!fnPtrLhs && !fnPtrRhs) return true; return false; } +// Rider: This is the general case of the operator declared above. The code compares the callback +// passed into the LLAssetStorage functions to determine if there are duplicated requests for an +// asset. Unfortunately std::function does not provide a direct way to compare two variables so +// we define the operator here. +// XCode is not very happy with the variadic temples in use below so we will just define the specific +// case of comparing two LLGetAssetCallback objects since that is all we really use. +// +// template +// bool operator == (const std::function &a, const std::function &b) +// { +// typedef T(fnType)(U...); +// +// auto fnPtrA = a.target(); +// auto fnPtrB = b.target(); +// if (fnPtrA && fnPtrB) +// return (*fnPtrA == *fnPtrB); +// else if (!fnPtrA && !fnPtrB) +// return true; +// return false; +// } + } ///---------------------------------------------------------------------------- @@ -467,7 +485,7 @@ bool LLAssetStorage::findInStaticVFSAndInvokeCallback(const LLUUID& uuid, LLAsse // IW - uuid is passed by value to avoid side effects, please don't re-add & void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, - LLGetAssetCallback callback, + LLAssetStorage::LLGetAssetCallback callback, void *user_data, BOOL is_priority) { -- cgit v1.3 From 7136956b90614bbd236be0e30231781c04346220 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Sat, 2 Jun 2018 23:28:48 +0100 Subject: Use more typedefs to simplify sync between viewer and sim env settings code. --- indra/llcommon/llmemory.cpp | 6 +- indra/llcommon/llunittype.h | 37 +++++++----- indra/llinventory/llsettingsbase.cpp | 51 +++++++++++----- indra/llinventory/llsettingsbase.h | 64 ++++++++++++-------- indra/llinventory/llsettingsdaycycle.cpp | 93 +++++++++++++++++++----------- indra/llinventory/llsettingsdaycycle.h | 65 +++++++++++---------- indra/llinventory/llsettingssky.cpp | 40 ++++++------- indra/llinventory/llsettingssky.h | 30 +++++----- indra/llinventory/llsettingswater.cpp | 19 ++++-- indra/llinventory/llsettingswater.h | 25 ++++---- indra/llmessage/llcircuit.cpp | 6 +- indra/newview/llenvironment.cpp | 45 +++++++-------- indra/newview/llenvironment.h | 7 +-- indra/newview/llfloatereditextdaycycle.cpp | 17 +++--- indra/newview/llpaneleditwater.cpp | 2 +- indra/newview/llsettingsvo.cpp | 13 ++--- 16 files changed, 294 insertions(+), 226 deletions(-) (limited to 'indra/llmessage') diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp index b3debf3550..1884d6f04f 100644 --- a/indra/llcommon/llmemory.cpp +++ b/indra/llcommon/llmemory.cpp @@ -77,7 +77,7 @@ void ll_assert_aligned_func(uintptr_t ptr,U32 alignment) //static void LLMemory::initMaxHeapSizeGB(F32Gigabytes max_heap_size, BOOL prevent_heap_failure) { - sMaxHeapSizeInKB = max_heap_size; + sMaxHeapSizeInKB = U32Kilobytes::convert(max_heap_size); sEnableMemoryFailurePrevention = prevent_heap_failure ; } @@ -93,9 +93,9 @@ void LLMemory::updateMemoryInfo() return ; } - sAllocatedMemInKB = U64Bytes(counters.WorkingSetSize) ; + sAllocatedMemInKB = U32Kilobytes::convert(U64Bytes(counters.WorkingSetSize)); sample(sAllocatedMem, sAllocatedMemInKB); - sAllocatedPageSizeInKB = U64Bytes(counters.PagefileUsage) ; + sAllocatedPageSizeInKB = U32Kilobytes::convert(U64Bytes(counters.PagefileUsage)); sample(sVirtualMem, sAllocatedPageSizeInKB); U32Kilobytes avail_phys, avail_virtual; diff --git a/indra/llcommon/llunittype.h b/indra/llcommon/llunittype.h index ac8504ca61..81f244e422 100644 --- a/indra/llcommon/llunittype.h +++ b/indra/llcommon/llunittype.h @@ -132,23 +132,34 @@ struct LLUnit return mValue; } - LL_FORCE_INLINE void value(storage_t value) + LL_FORCE_INLINE void value(const storage_t& value) { mValue = value; } template - storage_t valueInUnits() + storage_t valueInUnits() const { return LLUnit(*this).value(); } template - void valueInUnits(storage_t value) + void valueInUnits(const storage_t& value) const { *this = LLUnit(value); } + LL_FORCE_INLINE operator storage_t() const + { + return value(); + } + + /*LL_FORCE_INLINE self_t& operator= (storage_t v) + { + value(v); + return *this; + }*/ + LL_FORCE_INLINE void operator += (self_t other) { mValue += convert(other).mValue; @@ -159,60 +170,60 @@ struct LLUnit mValue -= convert(other).mValue; } - LL_FORCE_INLINE void operator *= (storage_t multiplicand) + LL_FORCE_INLINE void operator *= (const storage_t& multiplicand) { mValue *= multiplicand; } - LL_FORCE_INLINE void operator *= (self_t multiplicand) + LL_FORCE_INLINE void operator *= (const self_t& multiplicand) { // spurious use of dependent type to stop gcc from triggering the static assertion before instantiating the template LL_BAD_TEMPLATE_INSTANTIATION(STORAGE_TYPE, "Multiplication of unit types not supported."); } - LL_FORCE_INLINE void operator /= (storage_t divisor) + LL_FORCE_INLINE void operator /= (const storage_t& divisor) { mValue /= divisor; } - void operator /= (self_t divisor) + void operator /= (const self_t& divisor) { // spurious use of dependent type to stop gcc from triggering the static assertion before instantiating the template LL_BAD_TEMPLATE_INSTANTIATION(STORAGE_TYPE, "Illegal in-place division of unit types."); } template - LL_FORCE_INLINE bool operator == (LLUnit other) const + LL_FORCE_INLINE bool operator == (const LLUnit& other) const { return mValue == convert(other).value(); } template - LL_FORCE_INLINE bool operator != (LLUnit other) const + LL_FORCE_INLINE bool operator != (const LLUnit& other) const { return mValue != convert(other).value(); } template - LL_FORCE_INLINE bool operator < (LLUnit other) const + LL_FORCE_INLINE bool operator < (const LLUnit& other) const { return mValue < convert(other).value(); } template - LL_FORCE_INLINE bool operator <= (LLUnit other) const + LL_FORCE_INLINE bool operator <= (const LLUnit& other) const { return mValue <= convert(other).value(); } template - LL_FORCE_INLINE bool operator > (LLUnit other) const + LL_FORCE_INLINE bool operator > (const LLUnit& other) const { return mValue > convert(other).value(); } template - LL_FORCE_INLINE bool operator >= (LLUnit other) const + LL_FORCE_INLINE bool operator >= (const LLUnit& other) const { return mValue >= convert(other).value(); } diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index a661d52b7f..23afbdfa3a 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -35,7 +35,7 @@ //========================================================================= namespace { - const F64 BREAK_POINT = 0.5; + const LLSettingsBase::BlendFactor BREAK_POINT = 0.5; } //========================================================================= @@ -272,7 +272,8 @@ size_t LLSettingsBase::getHash() const LLSD hash_settings = llsd_shallow(getSettings(), LLSDMap(SETTING_NAME, false)(SETTING_ID, false)(SETTING_HASH, false)("*", true)); - return boost::hash{}(hash_settings); + boost::hash hasher; + return hasher(hash_settings); } bool LLSettingsBase::validate() @@ -340,17 +341,35 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &valida validated.insert(validateType.getName()); // Fields for specific settings. - for (auto &test: validations) + for (validation_list_t::iterator itv = validations.begin(); itv != validations.end(); ++itv) { - if (!test.verify(settings)) +#ifdef VALIDATION_DEBUG + LLSD oldvalue; + if (settings.has((*itv).getName())) + { + oldvalue = llsd_clone(mSettings[(*itv).getName()]); + } +#endif + + if (!(*itv).verify(settings)) { std::stringstream errtext; - errtext << "Settings LLSD fails validation and could not be corrected for '" << test.getName() << "'!\n"; + errtext << "Settings LLSD fails validation and could not be corrected for '" << (*itv).getName() << "'!\n"; errors.append( errtext.str() ); isValid = false; } - validated.insert(test.getName()); + validated.insert((*itv).getName()); + +#ifdef VALIDATION_DEBUG + if (!oldvalue.isUndefined()) + { + if (!compare_llsd(settings[(*itv).getName()], oldvalue)) + { + LL_WARNS("SETTINGS") << "Setting '" << (*itv).getName() << "' was changed: " << oldvalue << " -> " << settings[(*itv).getName()] << LL_ENDL; + } + } +#endif } // strip extra entries @@ -366,9 +385,9 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &valida } } - for (const std::string &its: strip) + for (stringset_t::iterator its = strip.begin(); its != strip.end(); ++its) { - settings.erase(its); + settings.erase(*its); } return LLSDMap("success", LLSD::Boolean(isValid)) @@ -533,13 +552,14 @@ bool LLSettingsBase::Validator::verifyIntegerRange(LLSD &value, LLSD range) } //========================================================================= -void LLSettingsBlender::update(F64 blendf) +void LLSettingsBlender::update(const LLSettingsBase::BlendFactor& blendf) { setPosition(blendf); } -F64 LLSettingsBlender::setPosition(F64 blendf) +F64 LLSettingsBlender::setPosition(const LLSettingsBase::TrackPosition& blendf_in) { + LLSettingsBase::TrackPosition blendf = blendf_in; if (blendf >= 1.0) { triggerComplete(); @@ -565,14 +585,14 @@ void LLSettingsBlender::triggerComplete() } //------------------------------------------------------------------------- -F64 LLSettingsBlenderTimeDelta::calculateBlend(F64 spanpos, F64 spanlen) const +LLSettingsBase::BlendFactor LLSettingsBlenderTimeDelta::calculateBlend(const LLSettingsBase::TrackPosition& spanpos, const LLSettingsBase::TrackPosition& spanlen) const { - return fmod(spanpos, spanlen) / spanlen; + return LLSettingsBase::BlendFactor(fmod((F64)spanpos, (F64)spanlen) / (F64)spanlen); } -void LLSettingsBlenderTimeDelta::update(F64 timedelta) +void LLSettingsBlenderTimeDelta::advance(const LLSettingsBase::Seconds& timedelta) { - mTimeSpent += LLSettingsBase::Seconds(timedelta); + mTimeSpent += timedelta; if (mTimeSpent > mBlendSpan) { @@ -580,8 +600,7 @@ void LLSettingsBlenderTimeDelta::update(F64 timedelta) return; } - F64 blendf = calculateBlend(mTimeSpent.value(), mBlendSpan.value()); - // Note no clamp here. + LLSettingsBase::BlendFactor blendf = calculateBlend(mTimeSpent, mBlendSpan); setPosition(blendf); } diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 6f072a4e50..a8e1cc5eea 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -45,8 +45,14 @@ #include "llinventorysettings.h" +#define PTR_NAMESPACE std +#define SETTINGS_OVERRIDE override + +//#define PTR_NAMESPACE boost +//#define SETTINGS_OVERRIDE + class LLSettingsBase : - public std::enable_shared_from_this, + public PTR_NAMESPACE::enable_shared_from_this, private boost::noncopyable { friend class LLEnvironment; @@ -56,6 +62,8 @@ class LLSettingsBase : public: typedef F64Seconds Seconds; + typedef F64 BlendFactor; + typedef F64 TrackPosition; static const std::string SETTING_ID; static const std::string SETTING_NAME; @@ -64,7 +72,7 @@ public: typedef std::map parammapping_t; - typedef std::shared_ptr ptr_t; + typedef PTR_NAMESPACE::shared_ptr ptr_t; virtual ~LLSettingsBase() { }; @@ -107,12 +115,17 @@ public: //--------------------------------------------------------------------- // - inline void setValue(const std::string &name, const LLSD &value) + inline void setLLSD(const std::string &name, const LLSD &value) { mSettings[name] = value; mDirty = true; } + inline void setValue(const std::string &name, const LLSD &value) + { + setLLSD(name, value); + } + inline LLSD getValue(const std::string &name, const LLSD &deflt = LLSD()) const { if (!mSettings.has(name)) @@ -120,6 +133,11 @@ public: return mSettings[name]; } + inline void setValue(const std::string &name, F32 v) + { + setLLSD(name, LLSD::Real(v)); + } + inline void setValue(const std::string &name, const LLVector2 &value) { setValue(name, value.getValue()); @@ -150,7 +168,7 @@ public: setValue(name, value.getValue()); } - inline F64 getBlendFactor() const + inline BlendFactor getBlendFactor() const { return mBlendedFactor; } @@ -165,7 +183,7 @@ public: (const_cast(this))->updateSettings(); } - virtual void blend(const ptr_t &end, F64 blendf) = 0; + virtual void blend(const ptr_t &end, BlendFactor blendf) = 0; virtual bool validate(); @@ -220,8 +238,8 @@ protected: typedef std::set stringset_t; // combining settings objects. Customize for specific setting types - virtual void lerpSettings(const LLSettingsBase &other, F64 mix); - LLSD interpolateSDMap(const LLSD &settings, const LLSD &other, F64 mix) const; + virtual void lerpSettings(const LLSettingsBase &other, BlendFactor mix); + LLSD interpolateSDMap(const LLSD &settings, const LLSD &other, BlendFactor 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. @@ -248,7 +266,7 @@ protected: LLSD cloneSettings() const; - inline void setBlendFactor(F64 blendfactor) + inline void setBlendFactor(BlendFactor blendfactor) { mBlendedFactor = blendfactor; } @@ -256,18 +274,18 @@ protected: void markDirty() { mDirty = true; } private: - bool mDirty = true; + bool mDirty; LLSD combineSDMaps(const LLSD &first, const LLSD &other) const; - F64 mBlendedFactor; + BlendFactor mBlendedFactor; }; -class LLSettingsBlender : public std::enable_shared_from_this +class LLSettingsBlender : public PTR_NAMESPACE::enable_shared_from_this { public: - typedef std::shared_ptr ptr_t; + typedef PTR_NAMESPACE::shared_ptr ptr_t; typedef boost::signals2::signal finish_signal_t; typedef boost::signals2::connection connection_t; @@ -287,7 +305,7 @@ public: virtual ~LLSettingsBlender() {} - virtual void reset( LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F64 /*span*/ = 1.0) + virtual void reset( LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, const LLSettingsBase::Seconds& span) { // note: the 'span' reset parameter is unused by the base class. if (!mInitial) @@ -322,10 +340,10 @@ public: return mOnFinished.connect(onfinished); } - virtual void update(F64 blendf); - virtual F64 setPosition(F64 blendf); + virtual void update(const LLSettingsBase::BlendFactor& blendf); + virtual F64 setPosition(const LLSettingsBase::TrackPosition& position); - virtual void switchTrack(S32 trackno, F64 position = -1.0) { /*NoOp*/ } + virtual void switchTrack(S32 trackno, const LLSettingsBase::BlendFactor& position) { /*NoOp*/ } protected: void triggerComplete(); @@ -341,7 +359,7 @@ class LLSettingsBlenderTimeDelta : public LLSettingsBlender { public: LLSettingsBlenderTimeDelta(const LLSettingsBase::ptr_t &target, - const LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F64Seconds seconds) : + const LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, LLSettingsBase::Seconds seconds) : LLSettingsBlender(target, initsetting, endsetting), mBlendSpan(seconds), mLastUpdate(0.0f), @@ -355,20 +373,20 @@ public: { } - virtual void reset(LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F64 span = 1.0) override + virtual void reset(LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, const LLSettingsBase::Seconds& span) SETTINGS_OVERRIDE { LLSettingsBlender::reset(initsetting, endsetting, span); - mBlendSpan.value(span); - mTimeStart.value(LLDate::now().secondsSinceEpoch()); + mBlendSpan = span; + mTimeStart = LLSettingsBase::Seconds(LLDate::now().secondsSinceEpoch()); mLastUpdate = mTimeStart; - mTimeSpent.value(0.0f); + mTimeSpent = LLSettingsBase::Seconds(0.0); } - virtual void update(F64 timedelta) override; + virtual void advance(const LLSettingsBase::Seconds& timedelta); protected: - F64 calculateBlend(F64 spanpos, F64 spanlen) const; + LLSettingsBase::BlendFactor calculateBlend(const LLSettingsBase::TrackPosition& spanpos, const LLSettingsBase::TrackPosition& spanlen) const; LLSettingsBase::Seconds mBlendSpan; LLSettingsBase::Seconds mLastUpdate; diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 3f2238bf7a..cd2102a527 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -42,7 +42,22 @@ namespace LLTrace::BlockTimerStatHandle FTM_BLEND_WATERVALUES("Blending Water Environment"); LLTrace::BlockTimerStatHandle FTM_UPDATE_WATERVALUES("Update Water Environment"); - LLSettingsDay::CycleTrack_t::iterator get_wrapping_atafter(LLSettingsDay::CycleTrack_t &collection, F32 key) + template + inline T get_wrapping_distance(T begin, T end) + { + if (begin < end) + { + return end - begin; + } + else if (begin > end) + { + return 1.0 - (begin - end); + } + + return 0; + } + + LLSettingsDay::CycleTrack_t::iterator get_wrapping_atafter(LLSettingsDay::CycleTrack_t &collection, const LLSettingsBase::TrackPosition& key) { if (collection.empty()) return collection.end(); @@ -57,7 +72,7 @@ namespace return it; } - LLSettingsDay::CycleTrack_t::iterator get_wrapping_atbefore(LLSettingsDay::CycleTrack_t &collection, F32 key) + LLSettingsDay::CycleTrack_t::iterator get_wrapping_atbefore(LLSettingsDay::CycleTrack_t &collection, const LLSettingsBase::TrackPosition& key) { if (collection.empty()) return collection.end(); @@ -102,7 +117,7 @@ const S32 LLSettingsDay::TRACK_MAX(5); // 5 tracks, 4 skys, 1 water const S32 LLSettingsDay::FRAME_MAX(56); // *LAPRAS* Change when Agni -const LLUUID LLSettingsDay::DEFAULT_ASSET_ID("94d296c2-6e05-963c-6b62-671199121dbb"); +static const LLUUID DEFAULT_ASSET_ID("94d296c2-6e05-963c-6b62-671199121dbb"); //========================================================================= LLSettingsDay::LLSettingsDay(const LLSD &data) : @@ -136,20 +151,20 @@ LLSD LLSettingsDay::getSettings() const LLSD tracks(LLSD::emptyArray()); - for (auto &track: mDayTracks) + for (CycleList_t::const_iterator itTrack = mDayTracks.begin(); itTrack != mDayTracks.end(); ++itTrack) { LLSD trackout(LLSD::emptyArray()); - for (auto &frame: track) + for (CycleTrack_t::const_iterator itFrame = (*itTrack).begin(); itFrame != (*itTrack).end(); ++itFrame) { - F32 frame_time = frame.first; - LLSettingsBase::ptr_t data = frame.second; + F32 frame = (*itFrame).first; + LLSettingsBase::ptr_t data = (*itFrame).second; size_t datahash = data->getHash(); std::stringstream keyname; keyname << datahash; - trackout.append(LLSD(LLSDMap(SETTING_KEYKFRAME, LLSD::Real(frame_time))(SETTING_KEYNAME, keyname.str()))); + trackout.append(LLSD(LLSDMap(SETTING_KEYKFRAME, LLSD::Real(frame))(SETTING_KEYNAME, keyname.str()))); in_use[keyname.str()] = data; } tracks.append(trackout); @@ -157,12 +172,12 @@ LLSD LLSettingsDay::getSettings() const settings[SETTING_TRACKS] = tracks; LLSD frames(LLSD::emptyMap()); - for (auto &used_frame: in_use) + for (std::map::iterator itFrame = in_use.begin(); itFrame != in_use.end(); ++itFrame) { - LLSD framesettings = llsd_clone(used_frame.second->getSettings(), + LLSD framesettings = llsd_clone((*itFrame).second->getSettings(), LLSDMap("*", true)(SETTING_NAME, false)(SETTING_ID, false)(SETTING_HASH, false)); - frames[used_frame.first] = framesettings; + frames[(*itFrame).first] = framesettings; } settings[SETTING_FRAMES] = frames; @@ -212,8 +227,9 @@ bool LLSettingsDay::initialize() LLSD curtrack = tracks[i]; for (LLSD::array_const_iterator it = curtrack.beginArray(); it != curtrack.endArray(); ++it) { - F32 keyframe = (*it)[SETTING_KEYKFRAME].asReal(); - keyframe = llclamp(keyframe, 0.0f, 1.0f); + LLSettingsBase::Seconds keyframe = LLSettingsBase::Seconds((*it)[SETTING_KEYKFRAME].asReal()); + // is this supposed to be a blend factor or a time value? + //keyframe = llclamp((F32)keyframe, 0.0f, 1.0f); LLSettingsBase::ptr_t setting; if ((*it).has(SETTING_KEYNAME)) @@ -223,7 +239,7 @@ bool LLSettingsDay::initialize() setting = used[(*it)[SETTING_KEYNAME]]; if (setting && setting->getSettingType() != "water") { - LL_WARNS("SETTINGS", "DAYCYCLE") << "Water track referencing " << setting->getSettingType() << " frame at " << keyframe << "." << LL_ENDL; + LL_WARNS("DAYCYCLE") << "Water track referencing " << setting->getSettingType() << " frame at " << keyframe << "." << LL_ENDL; setting.reset(); } } @@ -232,7 +248,7 @@ bool LLSettingsDay::initialize() setting = used[(*it)[SETTING_KEYNAME]]; if (setting && setting->getSettingType() != "sky") { - LL_WARNS("SETTINGS", "DAYCYCLE") << "Sky track #" << i << " referencing " << setting->getSettingType() << " frame at " << keyframe << "." << LL_ENDL; + LL_WARNS("DAYCYCLE") << "Sky track #" << i << " referencing " << setting->getSettingType() << " frame at " << keyframe << "." << LL_ENDL; setting.reset(); } } @@ -296,7 +312,6 @@ LLSD LLSettingsDay::defaults() dfltsetting[SETTING_FRAMES] = frames; dfltsetting[SETTING_TYPE] = "daycycle"; - return dfltsetting; } @@ -475,7 +490,6 @@ void LLSettingsDay::startDayCycle() LL_WARNS("DAYCYCLE") << "Attempt to start day cycle on uninitialized object." << LL_ENDL; return; } - } @@ -497,15 +511,15 @@ LLSettingsDay::KeyframeList_t LLSettingsDay::getTrackKeyframes(S32 trackno) keyframes.reserve(track.size()); - for (auto &frame: track) + for (CycleTrack_t::iterator it = track.begin(); it != track.end(); ++it) { - keyframes.push_back(frame.first); + keyframes.push_back((*it).first); } return keyframes; } -bool LLSettingsDay::moveTrackKeyframe(S32 trackno, F32 old_frame, F32 new_frame) +bool LLSettingsDay::moveTrackKeyframe(S32 trackno, const LLSettingsBase::Seconds& old_frame, const LLSettingsBase::Seconds& new_frame) { if ((trackno < 0) || (trackno >= TRACK_MAX)) { @@ -524,7 +538,9 @@ bool LLSettingsDay::moveTrackKeyframe(S32 trackno, F32 old_frame, F32 new_frame) { LLSettingsBase::ptr_t base = iter->second; track.erase(iter); - track[llclamp(new_frame, 0.0f, 1.0f)] = base; + // why are we clamping a time value as if its a blend factor + //track[llclamp(new_frame, 0.0f, 1.0f)] = base; + track[new_frame] = base; return true; } @@ -532,7 +548,7 @@ bool LLSettingsDay::moveTrackKeyframe(S32 trackno, F32 old_frame, F32 new_frame) } -bool LLSettingsDay::removeTrackKeyframe(S32 trackno, F32 frame) +bool LLSettingsDay::removeTrackKeyframe(S32 trackno, const LLSettingsBase::Seconds& frame) { if ((trackno < 0) || (trackno >= TRACK_MAX)) { @@ -552,17 +568,18 @@ bool LLSettingsDay::removeTrackKeyframe(S32 trackno, F32 frame) return false; } -void LLSettingsDay::setWaterAtKeyframe(const LLSettingsWaterPtr_t &water, F32 keyframe) +void LLSettingsDay::setWaterAtKeyframe(const LLSettingsWaterPtr_t &water, const LLSettingsBase::Seconds& keyframe) { setSettingsAtKeyframe(water, keyframe, TRACK_WATER); } -LLSettingsWater::ptr_t LLSettingsDay::getWaterAtKeyframe(F32 keyframe) const +LLSettingsWater::ptr_t LLSettingsDay::getWaterAtKeyframe(const LLSettingsBase::Seconds& keyframe) const { - return std::dynamic_pointer_cast(getSettingsAtKeyframe(keyframe, TRACK_WATER)); + LLSettingsBase* p = getSettingsAtKeyframe(keyframe, TRACK_WATER).get(); + return LLSettingsWater::ptr_t((LLSettingsWater*)p); } -void LLSettingsDay::setSkyAtKeyframe(const LLSettingsSky::ptr_t &sky, F32 keyframe, S32 track) +void LLSettingsDay::setSkyAtKeyframe(const LLSettingsSky::ptr_t &sky, const LLSettingsBase::Seconds& keyframe, S32 track) { if ((track < 1) || (track >= TRACK_MAX)) { @@ -573,18 +590,18 @@ void LLSettingsDay::setSkyAtKeyframe(const LLSettingsSky::ptr_t &sky, F32 keyfra setSettingsAtKeyframe(sky, keyframe, track); } -LLSettingsSky::ptr_t LLSettingsDay::getSkyAtKeyframe(F32 keyframe, S32 track) const +LLSettingsSky::ptr_t LLSettingsDay::getSkyAtKeyframe(const LLSettingsBase::Seconds& keyframe, S32 track) const { if ((track < 1) || (track >= TRACK_MAX)) { LL_WARNS("DAYCYCLE") << "Attempt to set sky track (#" << track << ") out of range!" << LL_ENDL; return LLSettingsSky::ptr_t(); } - - return std::dynamic_pointer_cast(getSettingsAtKeyframe(keyframe, track)); + LLSettingsBase* p = getSettingsAtKeyframe(keyframe, track).get(); + return LLSettingsSky::ptr_t((LLSettingsSky*)p); } -void LLSettingsDay::setSettingsAtKeyframe(const LLSettingsBase::ptr_t &settings, F32 keyframe, S32 track) +void LLSettingsDay::setSettingsAtKeyframe(const LLSettingsBase::ptr_t &settings, const LLSettingsBase::Seconds& keyframe, S32 track) { if ((track < 0) || (track >= TRACK_MAX)) { @@ -592,11 +609,12 @@ void LLSettingsDay::setSettingsAtKeyframe(const LLSettingsBase::ptr_t &settings, return; } - mDayTracks[track][llclamp(keyframe, 0.0f, 1.0f)] = settings; + //mDayTracks[track][llclamp(keyframe, 0.0f, 1.0f)] = settings; + mDayTracks[track][keyframe] = settings; setDirtyFlag(true); } -LLSettingsBase::ptr_t LLSettingsDay::getSettingsAtKeyframe(F32 keyframe, S32 track) const +LLSettingsBase::ptr_t LLSettingsDay::getSettingsAtKeyframe(const LLSettingsBase::Seconds& keyframe, S32 track) const { if ((track < 0) || (track >= TRACK_MAX)) { @@ -614,19 +632,24 @@ LLSettingsBase::ptr_t LLSettingsDay::getSettingsAtKeyframe(F32 keyframe, S32 tra return LLSettingsBase::ptr_t(); } -F32 LLSettingsDay::getUpperBoundFrame(S32 track, F32 keyframe) +LLSettingsBase::TrackPosition LLSettingsDay::getUpperBoundFrame(S32 track, const LLSettingsBase::TrackPosition& keyframe) { return get_wrapping_atafter(mDayTracks[track], keyframe)->first; } -F32 LLSettingsDay::getLowerBoundFrame(S32 track, F32 keyframe) +LLSettingsBase::TrackPosition LLSettingsDay::getLowerBoundFrame(S32 track, const LLSettingsBase::TrackPosition& keyframe) { return get_wrapping_atbefore(mDayTracks[track], keyframe)->first; } -LLSettingsDay::TrackBound_t LLSettingsDay::getBoundingEntries(LLSettingsDay::CycleTrack_t &track, F32 keyframe) +LLSettingsDay::TrackBound_t LLSettingsDay::getBoundingEntries(LLSettingsDay::CycleTrack_t &track, const LLSettingsBase::TrackPosition& keyframe) { return TrackBound_t(get_wrapping_atbefore(track, keyframe), get_wrapping_atafter(track, keyframe)); } +LLUUID LLSettingsDay::GetDefaultAssetId() +{ + return DEFAULT_ASSET_ID; +} + //========================================================================= diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index f7e5710dc1..b9038506d1 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -35,12 +35,15 @@ class LLSettingsSky; // These are alias for LLSettingsWater::ptr_t and LLSettingsSky::ptr_t respectively. // Here for definitions only. -typedef std::shared_ptr LLSettingsWaterPtr_t; -typedef std::shared_ptr LLSettingsSkyPtr_t; +typedef PTR_NAMESPACE::shared_ptr LLSettingsWaterPtr_t; +typedef PTR_NAMESPACE::shared_ptr LLSettingsSkyPtr_t; class LLSettingsDay : public LLSettingsBase { public: + // 32-bit as LLSD only supports that width at present + typedef S32Seconds Seconds; + static const std::string SETTING_KEYID; static const std::string SETTING_KEYNAME; static const std::string SETTING_KEYKFRAME; @@ -63,13 +66,12 @@ public: static const S32 TRACK_MAX; static const S32 FRAME_MAX; - static const LLUUID DEFAULT_ASSET_ID; - - typedef std::map CycleTrack_t; - typedef std::vector CycleList_t; - typedef std::shared_ptr ptr_t; - typedef std::vector KeyframeList_t; - typedef std::pair TrackBound_t; + typedef std::map CycleTrack_t; + typedef std::vector CycleList_t; + typedef PTR_NAMESPACE::shared_ptr ptr_t; + typedef PTR_NAMESPACE::weak_ptr wptr_t; + typedef std::vector KeyframeList_t; + typedef std::pair TrackBound_t; //--------------------------------------------------------------------- LLSettingsDay(const LLSD &data); @@ -78,29 +80,29 @@ public: bool initialize(); virtual ptr_t buildClone() = 0; - virtual LLSD getSettings() const override; - virtual LLSettingsType::type_e getSettingTypeValue() const override { return LLSettingsType::ST_DAYCYCLE; } + virtual LLSD getSettings() const SETTINGS_OVERRIDE; + virtual LLSettingsType::type_e getSettingTypeValue() const SETTINGS_OVERRIDE { return LLSettingsType::ST_DAYCYCLE; } //--------------------------------------------------------------------- - virtual std::string getSettingType() const override { return std::string("daycycle"); } + virtual std::string getSettingType() const SETTINGS_OVERRIDE { return std::string("daycycle"); } // Settings status - virtual void blend(const LLSettingsBase::ptr_t &other, F64 mix) override; + virtual void blend(const LLSettingsBase::ptr_t &other, F64 mix) SETTINGS_OVERRIDE; static LLSD defaults(); //--------------------------------------------------------------------- KeyframeList_t getTrackKeyframes(S32 track); - bool moveTrackKeyframe(S32 track, F32 old_frame, F32 new_frame); - bool removeTrackKeyframe(S32 track, F32 frame); - - void setWaterAtKeyframe(const LLSettingsWaterPtr_t &water, F32 keyframe); - LLSettingsWaterPtr_t getWaterAtKeyframe(F32 keyframe) const; - void setSkyAtKeyframe(const LLSettingsSkyPtr_t &sky, F32 keyframe, S32 track); - LLSettingsSkyPtr_t getSkyAtKeyframe(F32 keyframe, S32 track) const; - void setSettingsAtKeyframe(const LLSettingsBase::ptr_t &settings, F32 keyframe, S32 track); - LLSettingsBase::ptr_t getSettingsAtKeyframe(F32 keyframe, S32 track) const; + bool moveTrackKeyframe(S32 track, const LLSettingsBase::Seconds& old_frame, const LLSettingsBase::Seconds& new_frame); + bool removeTrackKeyframe(S32 track, const LLSettingsBase::Seconds& frame); + + void setWaterAtKeyframe(const LLSettingsWaterPtr_t &water, const LLSettingsBase::Seconds& keyframe); + LLSettingsWaterPtr_t getWaterAtKeyframe(const LLSettingsBase::Seconds& keyframe) const; + void setSkyAtKeyframe(const LLSettingsSkyPtr_t &sky, const LLSettingsBase::Seconds& keyframe, S32 track); + LLSettingsSkyPtr_t getSkyAtKeyframe(const LLSettingsBase::Seconds& keyframe, S32 track) const; + void setSettingsAtKeyframe(const LLSettingsBase::ptr_t &settings, const LLSettingsBase::Seconds& keyframe, S32 track); + LLSettingsBase::ptr_t getSettingsAtKeyframe(const LLSettingsBase::Seconds& keyframe, S32 track) const; //--------------------------------------------------------------------- void startDayCycle(); @@ -113,18 +115,20 @@ public: void setInitialized(bool value = true) { mInitialized = value; } CycleTrack_t & getCycleTrack(S32 track); - virtual validation_list_t getValidationList() const override; + virtual validation_list_t getValidationList() const SETTINGS_OVERRIDE; static validation_list_t validationList(); - virtual LLSettingsBase::ptr_t buildDerivedClone() override { return buildClone(); } + virtual LLSettingsBase::ptr_t buildDerivedClone() SETTINGS_OVERRIDE { return buildClone(); } - F32 getUpperBoundFrame(S32 track, F32 keyframe); - F32 getLowerBoundFrame(S32 track, F32 keyframe); + LLSettingsBase::TrackPosition getUpperBoundFrame(S32 track, const LLSettingsBase::TrackPosition& keyframe); + LLSettingsBase::TrackPosition getLowerBoundFrame(S32 track, const LLSettingsBase::TrackPosition& keyframe); + + static LLUUID GetDefaultAssetId(); protected: LLSettingsDay(); - virtual void updateSettings() override; + virtual void updateSettings() SETTINGS_OVERRIDE; bool mInitialized; @@ -135,10 +139,9 @@ private: void parseFromLLSD(LLSD &data); - static CycleTrack_t::iterator getEntryAtOrBefore(CycleTrack_t &track, F32 keyframe); - static CycleTrack_t::iterator getEntryAtOrAfter(CycleTrack_t &track, F32 keyframe); - - TrackBound_t getBoundingEntries(CycleTrack_t &track, F32 keyframe); + static CycleTrack_t::iterator getEntryAtOrBefore(CycleTrack_t &track, const LLSettingsBase::TrackPosition& keyframe); + static CycleTrack_t::iterator getEntryAtOrAfter(CycleTrack_t &track, const LLSettingsBase::TrackPosition& keyframe); + TrackBound_t getBoundingEntries(CycleTrack_t &track, const LLSettingsBase::TrackPosition& keyframe); }; #endif diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index cdd5b156d2..95502f47c3 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -106,12 +106,11 @@ const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR("exp_s const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM("linear_term"); const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM("constant_term"); -const LLUUID LLSettingsSky::DEFAULT_SUN_ID("cce0f112-878f-4586-a2e2-a8f104bba271"); // dataserver -const LLUUID LLSettingsSky::DEFAULT_MOON_ID("d07f6eed-b96a-47cd-b51d-400ad4a1c428"); // dataserver -const LLUUID LLSettingsSky::DEFAULT_CLOUD_ID("1dc1368f-e8fe-f02d-a08d-9d9f11c1af6b"); - // *LAPRAS* Change when Agni! -const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("cec9af47-90d4-9093-5245-397e5c9e7749"); +static const LLUUID DEFAULT_SUN_ID("cce0f112-878f-4586-a2e2-a8f104bba271"); // dataserver +static const LLUUID DEFAULT_MOON_ID("d07f6eed-b96a-47cd-b51d-400ad4a1c428"); // dataserver +static const LLUUID DEFAULT_CLOUD_ID("1dc1368f-e8fe-f02d-a08d-9d9f11c1af6b"); +static const LLUUID DEFAULT_ASSET_ID("cec9af47-90d4-9093-5245-397e5c9e7749"); const std::string LLSettingsSky::SETTING_LEGACY_HAZE("legacy_haze"); @@ -218,7 +217,7 @@ LLSettingsSky::validation_list_t mieValidationList() bool validateLegacyHaze(LLSD &value) { LLSettingsSky::validation_list_t legacyHazeValidations = legacyHazeValidationList(); - llassert(value.type() == LLSD::Type::TypeMap); + llassert(value.type() == LLSD::TypeMap); LLSD result = LLSettingsBase::settingValidation(value, legacyHazeValidations); if (result["errors"].size() > 0) { @@ -242,14 +241,14 @@ bool validateRayleighLayers(LLSD &value) for (LLSD::array_iterator itf = value.beginArray(); itf != value.endArray(); ++itf) { LLSD& layerConfig = (*itf); - if (layerConfig.type() == LLSD::Type::TypeMap) + if (layerConfig.type() == LLSD::TypeMap) { if (!validateRayleighLayers(layerConfig)) { allGood = false; } } - else if (layerConfig.type() == LLSD::Type::TypeArray) + else if (layerConfig.type() == LLSD::TypeArray) { return validateRayleighLayers(layerConfig); } @@ -260,7 +259,7 @@ bool validateRayleighLayers(LLSD &value) } return allGood; } - llassert(value.type() == LLSD::Type::TypeMap); + llassert(value.type() == LLSD::TypeMap); LLSD result = LLSettingsBase::settingValidation(value, rayleighValidations); if (result["errors"].size() > 0) { @@ -284,14 +283,14 @@ bool validateAbsorptionLayers(LLSD &value) for (LLSD::array_iterator itf = value.beginArray(); itf != value.endArray(); ++itf) { LLSD& layerConfig = (*itf); - if (layerConfig.type() == LLSD::Type::TypeMap) + if (layerConfig.type() == LLSD::TypeMap) { if (!validateAbsorptionLayers(layerConfig)) { allGood = false; } } - else if (layerConfig.type() == LLSD::Type::TypeArray) + else if (layerConfig.type() == LLSD::TypeArray) { return validateAbsorptionLayers(layerConfig); } @@ -302,7 +301,7 @@ bool validateAbsorptionLayers(LLSD &value) } return allGood; } - llassert(value.type() == LLSD::Type::TypeMap); + llassert(value.type() == LLSD::TypeMap); LLSD result = LLSettingsBase::settingValidation(value, absorptionValidations); if (result["errors"].size() > 0) { @@ -326,14 +325,14 @@ bool validateMieLayers(LLSD &value) for (LLSD::array_iterator itf = value.beginArray(); itf != value.endArray(); ++itf) { LLSD& layerConfig = (*itf); - if (layerConfig.type() == LLSD::Type::TypeMap) + if (layerConfig.type() == LLSD::TypeMap) { if (!validateMieLayers(layerConfig)) { allGood = false; } } - else if (layerConfig.type() == LLSD::Type::TypeArray) + else if (layerConfig.type() == LLSD::TypeArray) { return validateMieLayers(layerConfig); } @@ -379,7 +378,7 @@ LLSettingsSky::LLSettingsSky(): void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) { - LLSettingsSky::ptr_t other = std::static_pointer_cast(end); + LLSettingsSky::ptr_t other((LLSettingsSky*)end.get()); LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); replaceSettings(blenddata); @@ -416,8 +415,6 @@ LLSettingsSky::stringset_t LLSettingsSky::getSlerpKeys() const return slepSet; } - - LLSettingsSky::validation_list_t LLSettingsSky::getValidationList() const { return LLSettingsSky::validationList(); @@ -512,7 +509,6 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() validation.push_back(Validator(SETTING_SUN_ARC_RADIANS, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.1f))))); - validation.push_back(Validator(SETTING_RAYLEIGH_CONFIG, true, LLSD::TypeArray, &validateRayleighLayers)); validation.push_back(Validator(SETTING_ABSORPTION_CONFIG, true, LLSD::TypeArray, &validateAbsorptionLayers)); @@ -771,9 +767,6 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) void LLSettingsSky::updateSettings() { - LL_RECORD_BLOCK_TIME(FTM_UPDATE_SKYVALUES); - //LL_INFOS("WINDLIGHT", "SKY", "EEP") << "WL Parameters are dirty. Reticulating Splines..." << LL_ENDL; - mPositionsDirty = isDirty(); mLightingDirty = isDirty(); @@ -1051,3 +1044,8 @@ void LLSettingsSky::calculateLightSettings() const mFadeColor = mTotalAmbient + (mSunDiffuse + mMoonDiffuse) * 0.5f; mFadeColor.setAlpha(0); } + +LLUUID LLSettingsSky::GetDefaultAssetId() +{ + return DEFAULT_ASSET_ID; +} \ No newline at end of file diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 839de033b3..fd613e4299 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -88,13 +88,7 @@ public: static const std::string SETTING_LEGACY_HAZE; - static const LLUUID DEFAULT_SUN_ID; - static const LLUUID DEFAULT_MOON_ID; - static const LLUUID DEFAULT_CLOUD_ID; - - static const LLUUID DEFAULT_ASSET_ID; - - typedef std::shared_ptr ptr_t; + typedef PTR_NAMESPACE::shared_ptr ptr_t; //--------------------------------------------------------------------- LLSettingsSky(const LLSD &data); @@ -103,11 +97,11 @@ public: virtual ptr_t buildClone() = 0; //--------------------------------------------------------------------- - virtual std::string getSettingType() const override { return std::string("sky"); } - virtual LLSettingsType::type_e getSettingTypeValue() const override { return LLSettingsType::ST_SKY; } + virtual std::string getSettingType() const SETTINGS_OVERRIDE { return std::string("sky"); } + virtual LLSettingsType::type_e getSettingTypeValue() const SETTINGS_OVERRIDE { return LLSettingsType::ST_SKY; } // Settings status - virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf) override; + virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf) SETTINGS_OVERRIDE; static LLSD defaults(); @@ -374,7 +368,7 @@ public: virtual void loadTextures() { }; //===================================================================== - virtual validation_list_t getValidationList() const override; + virtual validation_list_t getValidationList() const SETTINGS_OVERRIDE; static validation_list_t validationList(); static LLSD translateLegacySettings(const LLSD& legacy); @@ -415,7 +409,9 @@ public: LLColor3 getSunDiffuse() const; LLColor4 getTotalAmbient() const; - virtual LLSettingsBase::ptr_t buildDerivedClone() override { return buildClone(); } + virtual LLSettingsBase::ptr_t buildDerivedClone() SETTINGS_OVERRIDE { return buildClone(); } + + static LLUUID GetDefaultAssetId(); protected: static const std::string SETTING_LEGACY_EAST_ANGLE; @@ -424,13 +420,13 @@ protected: LLSettingsSky(); - virtual stringset_t getSlerpKeys() const override; - virtual stringset_t getSkipInterpolateKeys() const override; - virtual void updateSettings() override; + virtual stringset_t getSlerpKeys() const SETTINGS_OVERRIDE; + virtual stringset_t getSkipInterpolateKeys() const SETTINGS_OVERRIDE; + virtual void updateSettings() SETTINGS_OVERRIDE; private: - mutable bool mPositionsDirty = true; - mutable bool mLightingDirty = true; + mutable bool mPositionsDirty; + mutable bool mLightingDirty; static LLSD rayleighConfigDefault(); static LLSD absorptionConfigDefault(); diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index aa1f0f1935..03e174b454 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -67,11 +67,8 @@ const std::string LLSettingsWater::SETTING_LEGACY_SCALE_BELOW("scaleBelow"); const std::string LLSettingsWater::SETTING_LEGACY_WAVE1_DIR("wave1Dir"); const std::string LLSettingsWater::SETTING_LEGACY_WAVE2_DIR("wave2Dir"); -const LLUUID LLSettingsWater::DEFAULT_WATER_NORMAL_ID(DEFAULT_WATER_NORMAL); - // *LAPRAS* Change when Agni -const LLUUID LLSettingsWater::DEFAULT_ASSET_ID("ce4cfe94-700a-292c-7c22-a2d9201bd661"); - +static const LLUUID DEFAULT_ASSET_ID("ce4cfe94-700a-292c-7c22-a2d9201bd661"); //========================================================================= LLSettingsWater::LLSettingsWater(const LLSD &data) : @@ -98,7 +95,7 @@ LLSD LLSettingsWater::defaults() dfltsetting[SETTING_FOG_MOD] = LLSD::Real(0.25f); dfltsetting[SETTING_FRESNEL_OFFSET] = LLSD::Real(0.5f); dfltsetting[SETTING_FRESNEL_SCALE] = LLSD::Real(0.3999); - dfltsetting[SETTING_NORMAL_MAP] = LLSD::UUID(DEFAULT_WATER_NORMAL_ID); + dfltsetting[SETTING_NORMAL_MAP] = LLSD::UUID(DEFAULT_WATER_NORMAL); dfltsetting[SETTING_NORMAL_SCALE] = LLVector3(2.0f, 2.0f, 2.0f).getValue(); dfltsetting[SETTING_SCALE_ABOVE] = LLSD::Real(0.0299f); dfltsetting[SETTING_SCALE_BELOW] = LLSD::Real(0.2000f); @@ -168,7 +165,7 @@ LLSD LLSettingsWater::translateLegacySettings(LLSD legacy) void LLSettingsWater::blend(const LLSettingsBase::ptr_t &end, F64 blendf) { - LLSettingsWater::ptr_t other = std::static_pointer_cast(end); + LLSettingsWater::ptr_t other((LLSettingsWater*)end.get()); LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); replaceSettings(blenddata); @@ -227,3 +224,13 @@ LLSettingsWater::validation_list_t LLSettingsWater::validationList() return validation; } +LLUUID LLSettingsWater::GetDefaultAssetId() +{ + return DEFAULT_ASSET_ID; +} + +LLUUID LLSettingsWater::GetDefaultWaterNormalAssetId() +{ + return DEFAULT_WATER_NORMAL; +} + diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h index a85a471bc5..92e9869e45 100644 --- a/indra/llinventory/llsettingswater.h +++ b/indra/llinventory/llsettingswater.h @@ -46,11 +46,7 @@ public: static const std::string SETTING_WAVE1_DIR; static const std::string SETTING_WAVE2_DIR; - static const LLUUID DEFAULT_WATER_NORMAL_ID; - - static const LLUUID DEFAULT_ASSET_ID; - - typedef std::shared_ptr ptr_t; + typedef PTR_NAMESPACE::shared_ptr ptr_t; //--------------------------------------------------------------------- LLSettingsWater(const LLSD &data); @@ -59,11 +55,11 @@ public: virtual ptr_t buildClone() = 0; //--------------------------------------------------------------------- - virtual std::string getSettingType() const override { return std::string("water"); } - virtual LLSettingsType::type_e getSettingTypeValue() const override { return LLSettingsType::ST_WATER; } + virtual std::string getSettingType() const SETTINGS_OVERRIDE { return std::string("water"); } + virtual LLSettingsType::type_e getSettingTypeValue() const SETTINGS_OVERRIDE { return LLSettingsType::ST_WATER; } // Settings status - virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf) override; + virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf) SETTINGS_OVERRIDE; static LLSD defaults(); @@ -208,12 +204,15 @@ public: } - virtual validation_list_t getValidationList() const override; + virtual validation_list_t getValidationList() const SETTINGS_OVERRIDE; static validation_list_t validationList(); static LLSD translateLegacySettings(LLSD legacy); - virtual LLSettingsBase::ptr_t buildDerivedClone() override { return buildClone(); } + virtual LLSettingsBase::ptr_t buildDerivedClone() SETTINGS_OVERRIDE { return buildClone(); } + + static LLUUID GetDefaultAssetId(); + static LLUUID GetDefaultWaterNormalAssetId(); protected: static const std::string SETTING_LEGACY_BLUR_MULTIPILER; @@ -231,11 +230,11 @@ protected: LLSettingsWater(); - LLVector4 mWaterPlane; - F32 mWaterFogKS; + LLVector4 mWaterPlane; + F32 mWaterFogKS; private: - LLUUID mNextNormalMapID; + LLUUID mNextNormalMapID; }; #endif diff --git a/indra/llmessage/llcircuit.cpp b/indra/llmessage/llcircuit.cpp index 8dbe2f8411..8baa2e328b 100644 --- a/indra/llmessage/llcircuit.cpp +++ b/indra/llmessage/llcircuit.cpp @@ -543,7 +543,7 @@ void LLCircuitData::checkPeriodTime() mBytesOutLastPeriod = mBytesOutThisPeriod; mBytesInThisPeriod = S32Bytes(0); mBytesOutThisPeriod = S32Bytes(0); - mLastPeriodLength = period_length; + mLastPeriodLength = F32Seconds::convert(period_length); mPeriodTime = mt_sec; } @@ -1378,8 +1378,8 @@ F32Milliseconds LLCircuitData::getPingInTransitTime() if (mPingsInTransit) { - time_since_ping_was_sent = ((mPingsInTransit*mHeartbeatInterval - F32Seconds(1)) - + (LLMessageSystem::getMessageTimeSeconds() - mPingTime)); + time_since_ping_was_sent = F32Milliseconds::convert(((mPingsInTransit*mHeartbeatInterval - F32Seconds(1)) + + (LLMessageSystem::getMessageTimeSeconds() - mPingTime))); } return time_since_ping_was_sent; diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index 3b0bc4cd55..3f6241fa0b 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -66,7 +66,7 @@ namespace LLTrace::BlockTimerStatHandle FTM_SHADER_PARAM_UPDATE("Update Shader Parameters"); //--------------------------------------------------------------------- - inline F32 get_wrapping_distance(F32 begin, F32 end) + inline LLSettingsBase::TrackPosition get_wrapping_distance(LLSettingsBase::TrackPosition begin, LLSettingsBase::TrackPosition end) { if (begin < end) { @@ -74,13 +74,13 @@ namespace } else if (begin > end) { - return 1.0 - (begin - end); + return LLSettingsBase::TrackPosition(1.0) - (begin - end); } return 0; } - LLSettingsDay::CycleTrack_t::iterator get_wrapping_atafter(LLSettingsDay::CycleTrack_t &collection, F32 key) + LLSettingsDay::CycleTrack_t::iterator get_wrapping_atafter(LLSettingsDay::CycleTrack_t &collection, const LLSettingsBase::TrackPosition& key) { if (collection.empty()) return collection.end(); @@ -95,7 +95,7 @@ namespace return it; } - LLSettingsDay::CycleTrack_t::iterator get_wrapping_atbefore(LLSettingsDay::CycleTrack_t &collection, F32 key) + LLSettingsDay::CycleTrack_t::iterator get_wrapping_atbefore(LLSettingsDay::CycleTrack_t &collection, const LLSettingsBase::TrackPosition& key) { if (collection.empty()) return collection.end(); @@ -116,7 +116,7 @@ namespace return it; } - LLSettingsDay::TrackBound_t get_bounding_entries(LLSettingsDay::CycleTrack_t &track, F32 keyframe) + LLSettingsDay::TrackBound_t get_bounding_entries(LLSettingsDay::CycleTrack_t &track, const LLSettingsBase::TrackPosition& keyframe) { return LLSettingsDay::TrackBound_t(get_wrapping_atbefore(track, keyframe), get_wrapping_atafter(track, keyframe)); } @@ -144,7 +144,7 @@ namespace } - void switchTrack(S32 trackno, F64) override + void switchTrack(S32 trackno, const LLSettingsBase::BlendFactor&) override { S32 use_trackno = selectTrackNumber(trackno); @@ -159,17 +159,16 @@ namespace LLSettingsBase::Seconds now = getAdjustedNow() + LLEnvironment::TRANSITION_ALTITUDE; LLSettingsDay::TrackBound_t bounds = getBoundingEntries(now); - LLSettingsBase::ptr_t pendsetting = (*bounds.first).second->buildDerivedClone(); - F64 targetpos = convertTimeToPosition(now) - (*bounds.first).first; - F64 targetspan = get_wrapping_distance((*bounds.first).first, (*bounds.second).first); + LLSettingsBase::ptr_t pendsetting = (*bounds.first).second->buildDerivedClone(); + LLSettingsBase::TrackPosition targetpos = convertTimeToPosition(now) - (*bounds.first).first; + LLSettingsBase::TrackPosition targetspan = get_wrapping_distance((*bounds.first).first, (*bounds.second).first); - F64 blendf = calculateBlend(targetpos, targetspan); + LLSettingsBase::BlendFactor blendf = calculateBlend(targetpos, targetspan); pendsetting->blend((*bounds.second).second, blendf); - reset(mTrackTransitionStart, pendsetting, LLEnvironment::TRANSITION_ALTITUDE.value()); + reset(mTrackTransitionStart, pendsetting, LLEnvironment::TRANSITION_ALTITUDE); } - protected: S32 selectTrackNumber(S32 trackno) { @@ -210,9 +209,9 @@ namespace return mCycleLength * get_wrapping_distance((*bounds.first).first, (*bounds.second).first); } - F64 convertTimeToPosition(LLSettingsBase::Seconds time) + LLSettingsBase::TrackPosition convertTimeToPosition(const LLSettingsBase::Seconds& time) { - F64 position = static_cast(fmod(time.value(), mCycleLength.value())) / static_cast(mCycleLength.value()); + F64 position = fmod((F64)time, (F64)mCycleLength) / (F64)mCycleLength; return llclamp(position, 0.0, 1.0); } @@ -223,11 +222,11 @@ namespace LLSettingsBase::Seconds mCycleOffset; LLSettingsBase::ptr_t mTrackTransitionStart; - void onFinishedSpan() + void onFinishedSpan() { LLSettingsDay::TrackBound_t next = getBoundingEntries(getAdjustedNow()); LLSettingsBase::Seconds nextspan = getSpanTime(next); - reset((*next.first).second, (*next.second).second, nextspan.value()); + reset((*next.first).second, (*next.second).second, nextspan); } }; @@ -241,10 +240,6 @@ const F32Seconds LLEnvironment::TRANSITION_SLOW(10.0f); const F32Seconds LLEnvironment::TRANSITION_ALTITUDE(5.0f); //*TODO* Change these when available on Agni (these are Damballah asset IDs). -const LLUUID LLEnvironment::KNOWN_SKY_DEFAULT(LLSettingsSky::DEFAULT_ASSET_ID); -const LLUUID LLEnvironment::KNOWN_WATER_DEFAULT(LLSettingsWater::DEFAULT_ASSET_ID); -const LLUUID LLEnvironment::KNOWN_DAY_DEFAULT(LLSettingsDay::DEFAULT_ASSET_ID); - const LLUUID LLEnvironment::KNOWN_SKY_SUNRISE("645d7475-19d6-d05c-6eb2-29eeacf76e06"); const LLUUID LLEnvironment::KNOWN_SKY_MIDDAY("68f5a7ec-2785-d9d8-be7c-cca93976759a"); const LLUUID LLEnvironment::KNOWN_SKY_SUNSET("06420773-757b-4b7c-a1f9-85fceb2f7bd4"); @@ -1741,7 +1736,7 @@ void LLEnvironment::DayInstance::setSkyTrack(S32 trackno) mSkyTrack = trackno; if (mBlenderSky) { - mBlenderSky->switchTrack(trackno); + mBlenderSky->switchTrack(trackno, 0.0); } } @@ -1803,7 +1798,7 @@ void LLEnvironment::DayInstance::animate() { mSky = LLSettingsVOSky::buildDefaultSky(); mBlenderSky = std::make_shared(mSky, mDayCycle, 1, mDayLength, mDayOffset); - mBlenderSky->switchTrack(mSkyTrack); + mBlenderSky->switchTrack(mSkyTrack, 0.0); } } @@ -1869,7 +1864,7 @@ LLTrackBlenderLoopingManual::LLTrackBlenderLoopingManual(const LLSettingsBase::p } } -F64 LLTrackBlenderLoopingManual::setPosition(F64 position) +LLSettingsBase::BlendFactor LLTrackBlenderLoopingManual::setPosition(const LLSettingsBase::TrackPosition& position) { mPosition = llclamp(position, 0.0, 1.0); @@ -1891,11 +1886,11 @@ F64 LLTrackBlenderLoopingManual::setPosition(F64 position) return LLSettingsBlender::setPosition(blendf); } -void LLTrackBlenderLoopingManual::switchTrack(S32 trackno, F64 position) +void LLTrackBlenderLoopingManual::switchTrack(S32 trackno, const LLSettingsBase::TrackPosition& position) { mTrackNo = trackno; - F64 useposition = (position < 0.0) ? mPosition : position; + LLSettingsBase::TrackPosition useposition = (position < 0.0) ? mPosition : position; setPosition(useposition); } diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h index 56be88f371..1be846b710 100644 --- a/indra/newview/llenvironment.h +++ b/indra/newview/llenvironment.h @@ -56,9 +56,6 @@ public: static const F32Seconds TRANSITION_SLOW; static const F32Seconds TRANSITION_ALTITUDE; - static const LLUUID KNOWN_SKY_DEFAULT; - static const LLUUID KNOWN_WATER_DEFAULT; - static const LLUUID KNOWN_DAY_DEFAULT; static const LLUUID KNOWN_SKY_SUNRISE; static const LLUUID KNOWN_SKY_MIDDAY; static const LLUUID KNOWN_SKY_SUNSET; @@ -413,8 +410,8 @@ class LLTrackBlenderLoopingManual : public LLSettingsBlender public: LLTrackBlenderLoopingManual(const LLSettingsBase::ptr_t &target, const LLSettingsDay::ptr_t &day, S32 trackno); - F64 setPosition(F64 position) override; - virtual void switchTrack(S32 trackno, F64 position) override; + F64 setPosition(const LLSettingsBase::TrackPosition& position) override; + virtual void switchTrack(S32 trackno, const LLSettingsBase::TrackPosition& position) override; S32 getTrack() const { return mTrackNo; } typedef std::shared_ptr ptr_t; diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index cac9154c98..788f58d480 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -311,9 +311,9 @@ void LLFloaterEditExtDayCycle::onAddTrack() { // todo: 2.5% safety zone std::string sldr_key = mFramesSlider->getCurSlider(); - F32 frame = mTimeSlider->getCurSliderValue(); + LLSettingsBase::Seconds frame(mTimeSlider->getCurSliderValue()); LLSettingsBase::ptr_t setting; - if (mEditDay->getSettingsAtKeyframe(frame, mCurrentTrack).get() != NULL) + if (mEditDay->getSettingsAtKeyframe(frame, mCurrentTrack) != nullptr) { return; } @@ -322,13 +322,15 @@ void LLFloaterEditExtDayCycle::onAddTrack() { // scratch water should always have the current water settings. setting = mScratchWater->buildClone(); - mEditDay->setWaterAtKeyframe(std::dynamic_pointer_cast(setting), frame); + LLSettingsWater::ptr_t water((LLSettingsWater*)setting.get()); + mEditDay->setWaterAtKeyframe(water, frame); } else { // scratch sky should always have the current sky settings. setting = mScratchSky->buildClone(); - mEditDay->setSkyAtKeyframe(std::dynamic_pointer_cast(setting), frame, mCurrentTrack); + LLSettingsSky::ptr_t sky((LLSettingsSky*)setting.get()); + mEditDay->setSkyAtKeyframe(sky, frame, mCurrentTrack); } addSliderFrame(frame, setting); @@ -657,7 +659,7 @@ void LLFloaterEditExtDayCycle::setSkyTabsEnabled(BOOL enable) void LLFloaterEditExtDayCycle::updateButtons() { - F32 frame = mTimeSlider->getCurSliderValue(); + LLSettingsBase::Seconds frame(mTimeSlider->getCurSliderValue()); LLSettingsBase::ptr_t settings = mEditDay->getSettingsAtKeyframe(frame, mCurrentTrack); bool can_add = settings.get() == NULL; mAddFrameButton->setEnabled(can_add); @@ -744,7 +746,8 @@ void LLFloaterEditExtDayCycle::removeCurrentSliderFrame() { LL_DEBUGS() << "Removing frame from " << iter->second.mFrame << LL_ENDL; mSliderKeyMap.erase(iter); - mEditDay->removeTrackKeyframe(mCurrentTrack, iter->second.mFrame); + LLSettingsBase::Seconds seconds(iter->second.mFrame); + mEditDay->removeTrackKeyframe(mCurrentTrack, seconds); } mLastFrameSlider = mFramesSlider->getCurSlider(); @@ -852,7 +855,7 @@ void LLFloaterEditExtDayCycle::syncronizeTabs() { // This should probably get moved into "updateTabs" - F32 frame = mTimeSlider->getCurSliderValue(); + LLSettingsBase::Seconds frame(mTimeSlider->getCurSliderValue()); bool canedit(false); LLSettingsWater::ptr_t psettingWater; diff --git a/indra/newview/llpaneleditwater.cpp b/indra/newview/llpaneleditwater.cpp index 940b171dfe..b0a300abe3 100644 --- a/indra/newview/llpaneleditwater.cpp +++ b/indra/newview/llpaneleditwater.cpp @@ -87,7 +87,7 @@ BOOL LLPanelSettingsWaterMainTab::postBuild() // getChild(FIELD_WATER_FOG_DENSITY)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onFogDensityChanged(getChild(FIELD_WATER_FOG_DENSITY)->getValue().asReal()); }); getChild(FIELD_WATER_UNDERWATER_MOD)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onFogUnderWaterChanged(); }); - mTxtNormalMap->setDefaultImageAssetID(LLSettingsWater::DEFAULT_WATER_NORMAL_ID); + mTxtNormalMap->setDefaultImageAssetID(LLSettingsWater::GetDefaultWaterNormalAssetId()); mTxtNormalMap->setCommitCallback([this](LLUICtrl *, const LLSD &) { onNormalMapChanged(); }); getChild(FIELD_WATER_WAVE1_X)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onLargeWaveChanged(); }); diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index 0e3bc87719..5991c42c97 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -449,14 +449,13 @@ void LLSettingsVOSky::convertAtmosphericsToLegacy(LLSD& legacy, LLSD& settings) if (settings.has(SETTING_LEGACY_HAZE)) { LLSD legacyhaze = settings[SETTING_LEGACY_HAZE]; - - legacy[SETTING_AMBIENT] = ensureArray4(legacyhaze[SETTING_AMBIENT], 1.0f); - legacy[SETTING_BLUE_DENSITY] = ensureArray4(legacyhaze[SETTING_BLUE_DENSITY], 1.0); - legacy[SETTING_BLUE_HORIZON] = ensureArray4(legacyhaze[SETTING_BLUE_HORIZON], 1.0); - legacy[SETTING_DENSITY_MULTIPLIER] = LLSDArray(legacyhaze[SETTING_DENSITY_MULTIPLIER].asReal())(0.0f)(0.0f)(1.0f); + legacy[SETTING_AMBIENT] = ensure_array_4(legacyhaze[SETTING_AMBIENT], 1.0f); + legacy[SETTING_BLUE_DENSITY] = ensure_array_4(legacyhaze[SETTING_BLUE_DENSITY], 1.0); + legacy[SETTING_BLUE_HORIZON] = ensure_array_4(legacyhaze[SETTING_BLUE_HORIZON], 1.0); + legacy[SETTING_DENSITY_MULTIPLIER] = LLSDArray(legacyhaze[SETTING_DENSITY_MULTIPLIER].asReal())(0.0f)(0.0f)(1.0f); legacy[SETTING_DISTANCE_MULTIPLIER] = LLSDArray(legacyhaze[SETTING_DISTANCE_MULTIPLIER].asReal())(0.0f)(0.0f)(1.0f); - legacy[SETTING_HAZE_DENSITY] = LLSDArray(legacyhaze[SETTING_HAZE_DENSITY])(0.0f)(0.0f)(1.0f); - legacy[SETTING_HAZE_HORIZON] = LLSDArray(legacyhaze[SETTING_HAZE_HORIZON])(0.0f)(0.0f)(1.0f); + legacy[SETTING_HAZE_DENSITY] = LLSDArray(legacyhaze[SETTING_HAZE_DENSITY])(0.0f)(0.0f)(1.0f); + legacy[SETTING_HAZE_HORIZON] = LLSDArray(legacyhaze[SETTING_HAZE_HORIZON])(0.0f)(0.0f)(1.0f); } } -- cgit v1.3 From b50d546d5ffb520228926ff1f4e6b03c69b3f857 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 3 Aug 2018 16:13:22 -0700 Subject: MAINT-7699: More robust cap protocol, better support for delete and support for individual tracks, support for setting environment by asset id in the cap MAINT-7703: Initial flags sent in message protocol for parcels --- indra/llinventory/llparcel.cpp | 3 + indra/llinventory/llparcel.h | 9 ++ indra/llinventory/llsettingsbase.cpp | 1 - indra/llmessage/message_prehash.cpp | 4 +- indra/llmessage/message_prehash.h | 3 + indra/newview/llenvironment.cpp | 183 ++++++++++++++++++----------- indra/newview/llenvironment.h | 44 ++++--- indra/newview/llsettingsvo.cpp | 2 +- indra/newview/llviewerparcelmgr.cpp | 58 ++++----- scripts/messages/message_template.msg | 5 + scripts/messages/message_template.msg.sha1 | 2 +- 11 files changed, 186 insertions(+), 128 deletions(-) (limited to 'indra/llmessage') diff --git a/indra/llinventory/llparcel.cpp b/indra/llinventory/llparcel.cpp index 0908613c10..aff7f86fd4 100644 --- a/indra/llinventory/llparcel.cpp +++ b/indra/llinventory/llparcel.cpp @@ -231,6 +231,9 @@ void LLParcel::init(const LLUUID &owner_id, setAllowGroupAVSounds(TRUE); setAllowAnyAVSounds(TRUE); setHaveNewParcelLimitData(FALSE); + + setRegionAllowEnvironmentOverride(FALSE); + setParcelEnvironmentVersion(-1); } void LLParcel::overrideOwner(const LLUUID& owner_id, BOOL is_group_owned) diff --git a/indra/llinventory/llparcel.h b/indra/llinventory/llparcel.h index 6ef389d246..2497a069d7 100644 --- a/indra/llinventory/llparcel.h +++ b/indra/llinventory/llparcel.h @@ -511,6 +511,10 @@ public: { return mRegionDenyAgeUnverifiedOverride; } BOOL getRegionAllowAccessOverride() const { return mRegionAllowAccessoverride; } + BOOL getRegionAllowEnvironmentOverride() const + { return mRegionAllowEnvironmentOverride; } + S32 getParcelEnvironmentVersion() const + { return mCurrentEnvironmentVersion; } BOOL getAllowGroupAVSounds() const { return mAllowGroupAVSounds; } @@ -581,6 +585,9 @@ public: void setRegionDenyAnonymousOverride(BOOL override) { mRegionDenyAnonymousOverride = override; } void setRegionDenyAgeUnverifiedOverride(BOOL override) { mRegionDenyAgeUnverifiedOverride = override; } void setRegionAllowAccessOverride(BOOL override) { mRegionAllowAccessoverride = override; } + void setRegionAllowEnvironmentOverride(BOOL override) { mRegionAllowEnvironmentOverride = override; } + + void setParcelEnvironmentVersion(S32 version) { mCurrentEnvironmentVersion = version; } // Accessors for parcel sellWithObjects void setPreviousOwnerID(LLUUID prev_owner) { mPreviousOwnerID = prev_owner; } @@ -662,8 +669,10 @@ protected: BOOL mRegionDenyAnonymousOverride; BOOL mRegionDenyAgeUnverifiedOverride; BOOL mRegionAllowAccessoverride; + BOOL mRegionAllowEnvironmentOverride; BOOL mAllowGroupAVSounds; BOOL mAllowAnyAVSounds; + S32 mCurrentEnvironmentVersion; bool mIsDefaultDayCycle; diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 8bcf8a4973..e00dd2199c 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -300,7 +300,6 @@ bool LLSettingsBase::validate() { LL_WARNS("SETTINGS") << "Validation warnings: " << result["warnings"] << LL_ENDL; } - LL_WARNS("SETTINGS") << "Validation success is " << result["success"] << LL_ENDL; return result["success"].asBoolean(); } diff --git a/indra/llmessage/message_prehash.cpp b/indra/llmessage/message_prehash.cpp index 1ae8a6ac15..6e5923862b 100644 --- a/indra/llmessage/message_prehash.cpp +++ b/indra/llmessage/message_prehash.cpp @@ -1375,7 +1375,9 @@ char const* const _PREHASH_RegionDenyAgeUnverified = LLMessageStringTable::getIn char const* const _PREHASH_AgeVerificationBlock = LLMessageStringTable::getInstance()->getString("AgeVerificationBlock"); char const* const _PREHASH_RegionAllowAccessBlock = LLMessageStringTable::getInstance()->getString("RegionAllowAccessBlock"); char const* const _PREHASH_RegionAllowAccessOverride = LLMessageStringTable::getInstance()->getString("RegionAllowAccessOverride"); - +char const* const _PREHASH_ParcelEnvironmentBlock = LLMessageStringTable::getInstance()->getString("ParcelEnvironmentBlock"); +char const* const _PREHASH_ParcelEnvironmentVersion = LLMessageStringTable::getInstance()->getString("ParcelEnvironmentVersion"); +char const* const _PREHASH_RegionAllowEnvironmentOverride = LLMessageStringTable::getInstance()->getString("RegionAllowEnvironmentOverride"); char const* const _PREHASH_UCoord = LLMessageStringTable::getInstance()->getString("UCoord"); char const* const _PREHASH_VCoord = LLMessageStringTable::getInstance()->getString("VCoord"); char const* const _PREHASH_FaceIndex = LLMessageStringTable::getInstance()->getString("FaceIndex"); diff --git a/indra/llmessage/message_prehash.h b/indra/llmessage/message_prehash.h index 7910fde305..30763d426e 100644 --- a/indra/llmessage/message_prehash.h +++ b/indra/llmessage/message_prehash.h @@ -1375,6 +1375,9 @@ extern char const* const _PREHASH_RegionDenyAgeUnverified; extern char const* const _PREHASH_AgeVerificationBlock; extern char const* const _PREHASH_RegionAllowAccessBlock; extern char const* const _PREHASH_RegionAllowAccessOverride; +extern char const* const _PREHASH_ParcelEnvironmentBlock; +extern char const* const _PREHASH_ParcelEnvironmentVersion; +extern char const* const _PREHASH_RegionAllowEnvironmentOverride; extern char const* const _PREHASH_UCoord; extern char const* const _PREHASH_VCoord; extern char const* const _PREHASH_FaceIndex; diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index f4dedbc848..3bcdf345f1 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -61,6 +61,18 @@ //========================================================================= namespace { + const std::string KEY_ENVIRONMENT("environment"); + const std::string KEY_DAYASSET("day_asset"); + const std::string KEY_DAYCYCLE("day_cycle"); + const std::string KEY_DAYHASH("day_hash"); + const std::string KEY_DAYLENGTH("day_length"); + const std::string KEY_DAYOFFSET("day_offset"); + const std::string KEY_ISDEFAULT("is_default"); + const std::string KEY_PARCELID("parcel_id"); + const std::string KEY_REGIONID("region_id"); + const std::string KEY_TRACKALTS("track_altitudes"); + + //--------------------------------------------------------------------- LLTrace::BlockTimerStatHandle FTM_ENVIRONMENT_UPDATE("Update Environment Tick"); LLTrace::BlockTimerStatHandle FTM_SHADER_PARAM_UPDATE("Update Shader Parameters"); @@ -254,6 +266,8 @@ const LLUUID LLEnvironment::KNOWN_SKY_MIDDAY("07589e0e-8e2e-4864-8e58-07b516efd9 const LLUUID LLEnvironment::KNOWN_SKY_SUNSET("8113ba47-3223-46ba-bae6-12c875091b32"); const LLUUID LLEnvironment::KNOWN_SKY_MIDNIGHT("90187088-d7f3-4656-8c27-8ba0e19e21e9"); +const S32 LLEnvironment::NO_TRACK(-1); + const F32 LLEnvironment::SUN_DELTA_YAW(F_PI); // 180deg //------------------------------------------------------------------------- @@ -269,6 +283,7 @@ LLEnvironment::LLEnvironment(): { } +#pragma optimize ("", off) void LLEnvironment::initSingleton() { LLSettingsSky::ptr_t p_default_sky = LLSettingsVOSky::buildDefaultSky(); @@ -280,16 +295,17 @@ void LLEnvironment::initSingleton() mEnvironments[ENV_DEFAULT] = mCurrentEnvironment; - requestRegionEnvironment(); + requestRegion(); - LLRegionInfoModel::instance().setUpdateCallback([this]() { onParcelChange(); }); gAgent.addParcelChangedCallback([this]() { onParcelChange(); }); //TODO: This frequently results in one more request than we need. It isn't breaking, but should be nicer. - gAgent.addRegionChangedCallback([this]() { requestRegionEnvironment(); }); + LLRegionInfoModel::instance().setUpdateCallback([this]() { requestRegion(); }); + gAgent.addRegionChangedCallback([this]() { requestRegion(); }); gAgent.whenPositionChanged([this](const LLVector3 &localpos, const LLVector3d &) { onAgentPositionHasChanged(localpos); }); } +#pragma optimize ("", on) LLEnvironment::~LLEnvironment() { @@ -391,6 +407,7 @@ bool LLEnvironment::isInventoryEnabled() const !gAgent.getRegionCapability("UpdateSettingsTaskInventory").empty()); } +#pragma optimize ("", off) void LLEnvironment::onParcelChange() { S32 parcel_id(INVALID_PARCEL_ID); @@ -403,11 +420,7 @@ void LLEnvironment::onParcelChange() requestParcel(parcel_id); } - -void LLEnvironment::requestRegionEnvironment() -{ - requestRegion(); -} +#pragma optimize ("", on) void LLEnvironment::onLegacyRegionSettings(LLSD data) { @@ -950,22 +963,10 @@ void LLEnvironment::updateShaderUniforms(LLGLSLShader *shader) void LLEnvironment::recordEnvironment(S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envinfo) { - LL_WARNS("ENVIRONMENT") << "Have environment" << LL_ENDL; - - LLSettingsDay::ptr_t pday = LLSettingsVODay::buildFromEnvironmentMessage(envinfo->mDaycycleData); - - LL_WARNS("ENVIRONMENT") << "serverhash=" << envinfo->mDayHash << " viewerhash=" << pday->getHash() << LL_ENDL; - if (envinfo->mParcelId == INVALID_PARCEL_ID) { // the returned info applies to an entire region. LL_WARNS("LAPRAS") << "Setting Region environment" << LL_ENDL; - setEnvironment(ENV_REGION, pday, envinfo->mDayLength, envinfo->mDayOffset); - if (parcel_id != INVALID_PARCEL_ID) - { - LL_WARNS("LAPRAS") << "Had requested parcel environment #" << parcel_id << " but got region." << LL_ENDL; - clearEnvironment(ENV_PARCEL); - } - + setEnvironment(ENV_REGION, envinfo->mDayCycle, envinfo->mDayLength, envinfo->mDayOffset); mTrackAltitudes = envinfo->mAltitudes; LL_WARNS("LAPRAS") << "Altitudes set to {" << mTrackAltitudes[0] << ", "<< mTrackAltitudes[1] << ", " << mTrackAltitudes[2] << ", " << mTrackAltitudes[3] << LL_ENDL; @@ -973,7 +974,6 @@ void LLEnvironment::recordEnvironment(S32 parcel_id, LLEnvironment::EnvironmentI else { LLParcel *parcel = LLViewerParcelMgr::instance().getAgentParcel(); - LL_WARNS("LAPRAS") << "Have parcel environment #" << envinfo->mParcelId << LL_ENDL; if (parcel && (parcel->getLocalID() != parcel_id)) { @@ -981,23 +981,33 @@ void LLEnvironment::recordEnvironment(S32 parcel_id, LLEnvironment::EnvironmentI return; } - setEnvironment(ENV_PARCEL, pday, envinfo->mDayLength, envinfo->mDayOffset); + if (!envinfo->mDayCycle) + { + LL_WARNS("LAPRAS") << "Clearing environment on parcel #" << parcel_id << LL_ENDL; + clearEnvironment(ENV_PARCEL); + } + else + { + setEnvironment(ENV_PARCEL, envinfo->mDayCycle, envinfo->mDayLength, envinfo->mDayOffset); + } } updateEnvironment(); } //========================================================================= +#pragma optimize ("", off) void LLEnvironment::requestRegion() { if (!isExtendedEnvironmentEnabled()) - { + { /*TODO: When EEP is live on the entire grid, this can go away. */ LLEnvironmentRequest::initiate(); return; } requestParcel(INVALID_PARCEL_ID); } +#pragma optimize ("", on) void LLEnvironment::updateRegion(const LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset) { @@ -1048,8 +1058,14 @@ void LLEnvironment::requestParcel(S32 parcel_id) void LLEnvironment::updateParcel(S32 parcel_id, const LLUUID &asset_id, S32 day_length, S32 day_offset) { - LLSettingsVOBase::getSettingsAsset(asset_id, - [this, parcel_id, day_length, day_offset](LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { onUpdateParcelAssetLoaded(asset_id, settings, status, parcel_id, day_length, day_offset); }); + std::string coroname = + LLCoros::instance().launch("LLEnvironment::coroUpdateEnvironment", + [this, parcel_id, asset_id, day_length, day_offset]() { coroUpdateEnvironment(parcel_id, NO_TRACK, + LLSettingsDay::ptr_t(), asset_id, day_length, day_offset, environment_apply_fn()); }); +// [this](S32 pid, EnvironmentInfo::ptr_t envinfo) { recordEnvironment(pid, envinfo); }); }); + +// LLSettingsVOBase::getSettingsAsset(asset_id, +// [this, parcel_id, day_length, day_offset](LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { onUpdateParcelAssetLoaded(asset_id, settings, status, parcel_id, day_length, day_offset); }); } void LLEnvironment::onUpdateParcelAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, S32 parcel_id, S32 day_length, S32 day_offset) @@ -1096,17 +1112,19 @@ void LLEnvironment::updateParcel(S32 parcel_id, const LLSettingsDay::ptr_t &pday { std::string coroname = LLCoros::instance().launch("LLEnvironment::coroUpdateEnvironment", - boost::bind(&LLEnvironment::coroUpdateEnvironment, this, parcel_id, - pday, day_length, day_offset, - [this](S32 pid, EnvironmentInfo::ptr_t envinfo) { recordEnvironment(pid, envinfo); })); + [this, parcel_id, pday, day_length, day_offset]() { coroUpdateEnvironment(parcel_id, NO_TRACK, + pday, LLUUID::null, day_length, day_offset, environment_apply_fn()); }); +// [this](S32 pid, EnvironmentInfo::ptr_t envinfo) { recordEnvironment(pid, envinfo); }); }); } + + void LLEnvironment::resetParcel(S32 parcel_id) { std::string coroname = LLCoros::instance().launch("LLEnvironment::coroResetEnvironment", - boost::bind(&LLEnvironment::coroResetEnvironment, this, parcel_id, - [this](S32 pid, EnvironmentInfo::ptr_t envinfo) { recordEnvironment(pid, envinfo); })); + [this, parcel_id]() { coroResetEnvironment(parcel_id, NO_TRACK, environment_apply_fn()); }); +// [this](S32 pid, EnvironmentInfo::ptr_t envinfo) { recordEnvironment(pid, envinfo); }); }); } void LLEnvironment::coroRequestEnvironment(S32 parcel_id, LLEnvironment::environment_apply_fn apply) @@ -1151,7 +1169,7 @@ void LLEnvironment::coroRequestEnvironment(S32 parcel_id, LLEnvironment::environ } else { - LLSD environment = result["environment"]; + LLSD environment = result[KEY_ENVIRONMENT]; if (environment.isDefined() && apply) { EnvironmentInfo::ptr_t envinfo = LLEnvironment::EnvironmentInfo::extract(environment); @@ -1166,7 +1184,7 @@ void LLEnvironment::coroRequestEnvironment(S32 parcel_id, LLEnvironment::environ } } -void LLEnvironment::coroUpdateEnvironment(S32 parcel_id, LLSettingsDay::ptr_t pday, S32 day_length, S32 day_offset, LLEnvironment::environment_apply_fn apply) +void LLEnvironment::coroUpdateEnvironment(S32 parcel_id, S32 track_no, LLSettingsDay::ptr_t pday, LLUUID settings_asset, S32 day_length, S32 day_offset, LLEnvironment::environment_apply_fn apply) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -1192,22 +1210,39 @@ void LLEnvironment::coroUpdateEnvironment(S32 parcel_id, LLSettingsDay::ptr_t pd } LLSD body(LLSD::emptyMap()); - body["environment"] = LLSD::emptyMap(); + body[KEY_ENVIRONMENT] = LLSD::emptyMap(); - if (day_length >= 0) - body["environment"]["day_length"] = day_length; - if (day_offset >= 0) - body["environment"]["day_offset"] = day_offset; + if (track_no == NO_TRACK) + { // day length and offset are only applicable if we are addressing the entire day cycle. + if (day_length >= 0) + body[KEY_ENVIRONMENT][KEY_DAYLENGTH] = day_length; + if (day_offset >= 0) + body[KEY_ENVIRONMENT][KEY_DAYOFFSET] = day_offset; + } if (pday) - body["environment"]["day_cycle"] = pday->getSettings(); + body[KEY_ENVIRONMENT][KEY_DAYCYCLE] = pday->getSettings(); + else if (!settings_asset.isNull()) + body[KEY_ENVIRONMENT][KEY_DAYASSET] = settings_asset; + LL_WARNS("LAPRAS") << "Body = " << body << LL_ENDL; - if (parcel_id != INVALID_PARCEL_ID) + if ((parcel_id != INVALID_PARCEL_ID) || (track_no != NO_TRACK)) { std::stringstream query; + query << "?"; - query << "?parcelid=" << parcel_id; + if (parcel_id != INVALID_PARCEL_ID) + { + query << "parcelid=" << parcel_id; + + if (track_no != NO_TRACK) + query << "&"; + } + if (track_no != NO_TRACK) + { + query << "trackno=" << track_no; + } url += query.str(); } @@ -1228,7 +1263,7 @@ void LLEnvironment::coroUpdateEnvironment(S32 parcel_id, LLSettingsDay::ptr_t pd } else { - LLSD environment = result["environment"]; + LLSD environment = result[KEY_ENVIRONMENT]; if (environment.isDefined() && apply) { EnvironmentInfo::ptr_t envinfo = LLEnvironment::EnvironmentInfo::extract(environment); @@ -1243,7 +1278,7 @@ void LLEnvironment::coroUpdateEnvironment(S32 parcel_id, LLSettingsDay::ptr_t pd } } -void LLEnvironment::coroResetEnvironment(S32 parcel_id, environment_apply_fn apply) +void LLEnvironment::coroResetEnvironment(S32 parcel_id, S32 track_no, environment_apply_fn apply) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -1254,11 +1289,22 @@ void LLEnvironment::coroResetEnvironment(S32 parcel_id, environment_apply_fn app if (url.empty()) return; - if (parcel_id != INVALID_PARCEL_ID) + if ((parcel_id != INVALID_PARCEL_ID) || (track_no != NO_TRACK)) { std::stringstream query; + query << "?"; - query << "?parcelid=" << parcel_id; + if (parcel_id != INVALID_PARCEL_ID) + { + query << "parcelid=" << parcel_id; + + if (track_no != NO_TRACK) + query << "&"; + } + if (track_no != NO_TRACK) + { + query << "trackno=" << track_no; + } url += query.str(); } @@ -1279,7 +1325,7 @@ void LLEnvironment::coroResetEnvironment(S32 parcel_id, environment_apply_fn app } else { - LLSD environment = result["environment"]; + LLSD environment = result[KEY_ENVIRONMENT]; if (environment.isDefined() && apply) { EnvironmentInfo::ptr_t envinfo = LLEnvironment::EnvironmentInfo::extract(environment); @@ -1339,10 +1385,9 @@ LLEnvironment::EnvironmentInfo::EnvironmentInfo(): mDayLength(0), mDayOffset(0), mDayHash(0), - mDaycycleData(), + mDayCycle(), mAltitudes({ { 0.0, 0.0, 0.0, 0.0 } }), - mIsDefault(false), - mIsRegion(false) + mIsDefault(false) { } @@ -1350,32 +1395,28 @@ LLEnvironment::EnvironmentInfo::ptr_t LLEnvironment::EnvironmentInfo::extract(LL { ptr_t pinfo = std::make_shared(); - if (environment.has("parcel_id")) - pinfo->mParcelId = environment["parcel_id"].asInteger(); - if (environment.has("region_id")) - pinfo->mRegionId = environment["region_id"].asUUID(); - if (environment.has("day_length")) - pinfo->mDayLength = LLSettingsDay::Seconds(environment["day_length"].asInteger()); - if (environment.has("day_offset")) - pinfo->mDayOffset = LLSettingsDay::Seconds(environment["day_offset"].asInteger()); - if (environment.has("day_hash")) - pinfo->mDayHash = environment["day_hash"].asInteger(); - if (environment.has("day_cycle")) - pinfo->mDaycycleData = environment["day_cycle"]; - if (environment.has("is_default")) - pinfo->mIsDefault = environment["is_default"].asBoolean(); - if (environment.has("track_altitudes")) - { - LL_WARNS("LAPRAS") << "track_altitudes=" << environment["track_altitudes"] << LL_ENDL; - - /*LAPRAS: TODO: Fix the simulator message. Shouldn't be 5, just 4*/ - int idx = 1; - for (F32 &altitude : pinfo->mAltitudes) + pinfo->mIsDefault = environment.has(KEY_ISDEFAULT) ? environment[KEY_ISDEFAULT].asBoolean() : true; + pinfo->mParcelId = environment.has(KEY_PARCELID) ? environment[KEY_PARCELID].asInteger() : INVALID_PARCEL_ID; + pinfo->mRegionId = environment.has(KEY_REGIONID) ? environment[KEY_REGIONID].asUUID() : LLUUID::null; + + if (environment.has(KEY_TRACKALTS)) + { + for (int idx = 0; idx < 3; idx++) { - altitude = environment["track_altitudes"][idx++].asReal(); + pinfo->mAltitudes[idx+1] = environment[KEY_TRACKALTS][idx].asReal(); } + pinfo->mAltitudes[0] = 0; + } + + if (environment.has(KEY_DAYCYCLE)) + { + pinfo->mDayCycle = LLSettingsVODay::buildFromEnvironmentMessage(environment[KEY_DAYCYCLE]); + pinfo->mDayLength = LLSettingsDay::Seconds(environment.has(KEY_DAYLENGTH) ? environment[KEY_DAYLENGTH].asInteger() : -1); + pinfo->mDayOffset = LLSettingsDay::Seconds(environment.has(KEY_DAYOFFSET) ? environment[KEY_DAYOFFSET].asInteger() : -1); + pinfo->mDayHash = environment.has(KEY_DAYHASH) ? environment[KEY_DAYHASH].asInteger() : 0; } + return pinfo; } diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h index 6f8d4b5203..80d186c9e6 100644 --- a/indra/newview/llenvironment.h +++ b/indra/newview/llenvironment.h @@ -65,25 +65,24 @@ public: static const LLUUID KNOWN_SKY_SUNSET; static const LLUUID KNOWN_SKY_MIDNIGHT; + static const S32 NO_TRACK; + struct EnvironmentInfo { EnvironmentInfo(); typedef std::shared_ptr ptr_t; - S32 mParcelId; - LLUUID mRegionId; - S64Seconds mDayLength; - S64Seconds mDayOffset; - size_t mDayHash; - LLSD mDaycycleData; - std::array mAltitudes; - bool mIsDefault; - bool mIsRegion; - - - static ptr_t extract(LLSD); + S32 mParcelId; + LLUUID mRegionId; + S64Seconds mDayLength; + S64Seconds mDayOffset; + size_t mDayHash; + LLSettingsDay::ptr_t mDayCycle; + std::array mAltitudes; + bool mIsDefault; + static ptr_t extract(LLSD); }; enum EnvSelection_t @@ -226,8 +225,6 @@ public: //------------------------------------------- connection_t setEnvironmentChanged(environment_changed_fn cb); - void requestRegionEnvironment(); - void onLegacyRegionSettings(LLSD data); void requestRegion(); @@ -359,21 +356,20 @@ private: DayInstance::ptr_t getSelectedEnvironmentInstance(); - void updateCloudScroll(); - - void onParcelChange(); + void updateCloudScroll(); - void coroRequestEnvironment(S32 parcel_id, environment_apply_fn apply); - void coroUpdateEnvironment(S32 parcel_id, LLSettingsDay::ptr_t pday, S32 day_length, S32 day_offset, environment_apply_fn apply); - void coroResetEnvironment(S32 parcel_id, environment_apply_fn apply); + void onParcelChange(); - void recordEnvironment(S32 parcel_id, EnvironmentInfo::ptr_t environment); + void coroRequestEnvironment(S32 parcel_id, environment_apply_fn apply); + void coroUpdateEnvironment(S32 parcel_id, S32 track_no, LLSettingsDay::ptr_t pday, LLUUID settings_asset, S32 day_length, S32 day_offset, environment_apply_fn apply); + void coroResetEnvironment(S32 parcel_id, S32 track_no, environment_apply_fn apply); - void onAgentPositionHasChanged(const LLVector3 &localpos); + void recordEnvironment(S32 parcel_id, EnvironmentInfo::ptr_t environment); - void onSetEnvAssetLoaded(EnvSelection_t env, LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status); - void onUpdateParcelAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, S32 parcel_id, S32 day_length, S32 day_offset); + void onAgentPositionHasChanged(const LLVector3 &localpos); + void onSetEnvAssetLoaded(EnvSelection_t env, LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status); + void onUpdateParcelAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, S32 parcel_id, S32 day_length, S32 day_offset); }; diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index 010b5dec36..e464f3f8ef 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -269,7 +269,7 @@ void LLSettingsVOBase::onAssetDownloadComplete(LLVFS *vfs, const LLUUID &asset_i if (!settings) { status = 1; - LL_WARNS("SETTINGS") << "Unable to creat settings object." << LL_ENDL; + LL_WARNS("SETTINGS") << "Unable to create settings object." << LL_ENDL; } else { diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index ed529975d2..d263e15a10 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -1483,6 +1483,8 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use BOOL region_deny_transacted_override = false; // Deprecated BOOL region_deny_age_unverified_override = false; BOOL region_allow_access_override = true; + BOOL region_allow_environment_override = true; + S32 parcel_environment_version = 0; BOOL agent_parcel_update = false; // updating previous(existing) agent parcel S32 other_clean_time = 0; @@ -1573,6 +1575,12 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use msg->getBOOLFast(_PREHASH_RegionAllowAccessBlock, _PREHASH_RegionAllowAccessOverride, region_allow_access_override); } + if (msg->getNumberOfBlocks(_PREHASH_ParcelEnvironmentBlock)) + { + msg->getS32Fast(_PREHASH_ParcelEnvironmentBlock, _PREHASH_ParcelEnvironmentVersion, parcel_environment_version); + msg->getBOOLFast(_PREHASH_ParcelEnvironmentBlock, _PREHASH_RegionAllowEnvironmentOverride, region_allow_environment_override); + } + msg->getS32("ParcelData", "OtherCleanTime", other_clean_time ); // Actually extract the data. @@ -1590,6 +1598,8 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use } } + bool environment_changed = (parcel->getParcelEnvironmentVersion() != parcel_environment_version); + parcel->init(owner_id, FALSE, FALSE, FALSE, claim_date, claim_price_per_meter, rent_price_per_meter, @@ -1615,6 +1625,10 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use parcel->setRegionDenyAnonymousOverride(region_deny_anonymous_override); parcel->setRegionDenyAgeUnverifiedOverride(region_deny_age_unverified_override); parcel->setRegionAllowAccessOverride(region_allow_access_override); + + parcel->setParcelEnvironmentVersion(parcel_environment_version); + parcel->setRegionAllowEnvironmentOverride(region_allow_environment_override); + parcel->unpackMessage(msg); if (parcel == parcel_mgr.mAgentParcel) @@ -1632,9 +1646,6 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use // Let interesting parties know about agent parcel change. LLViewerParcelMgr* instance = LLViewerParcelMgr::getInstance(); - // Notify anything that wants to know when the agent changes parcels - gAgent.changeParcels(); - if (instance->mTeleportInProgress) { instance->mTeleportInProgress = FALSE; @@ -1648,12 +1659,21 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use instance->mTeleportFinishedSignal(instance->mTeleportInProgressPosition, false); } } - } - else if (agent_parcel_update) - { - // updated agent parcel - parcel_mgr.mAgentParcel->unpackMessage(msg); - } + + LL_WARNS("LAPRAS") << "Parcel environment version is " << parcel->getParcelEnvironmentVersion() << LL_ENDL; + // Notify anything that wants to know when the agent changes parcels + gAgent.changeParcels(); + } + else if (agent_parcel_update) + { + // updated agent parcel + parcel_mgr.mAgentParcel->unpackMessage(msg); + if ((LLEnvironment::instance().isExtendedEnvironmentEnabled() && environment_changed)) + { + LL_WARNS("LAPRAS") << "Parcel environment version is " << parcel->getParcelEnvironmentVersion() << LL_ENDL; + LLEnvironment::instance().requestParcel(local_id); + } + } } // Handle updating selections, if necessary. @@ -1835,26 +1855,6 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use }//if gAudiop }; - if (LLEnvironment::instance().isExtendedEnvironmentEnabled()) - { - LL_WARNS("LAPRAS") << "TODO: Hey Rider! Fix this. 1) don't rerequest parcel information. 2) if sequent_id == -1 we are selecting a parcel. Deal with that correctly." << LL_ENDL; - - if (sequence_id == SELECTED_PARCEL_SEQ_ID) - { - LL_WARNS("LAPRAS") << "TODO: Hay Rider! Fix this. Get environment for selected parcel." << LL_ENDL; - } - else if ((sequence_id == HOVERED_PARCEL_SEQ_ID) || - (sequence_id == COLLISION_NOT_IN_GROUP_PARCEL_SEQ_ID) || - (sequence_id == COLLISION_NOT_ON_LIST_PARCEL_SEQ_ID) || - (sequence_id == COLLISION_BANNED_PARCEL_SEQ_ID)) - { - /*NoOp*/ - } - else - { - LLEnvironment::instance().requestParcel(local_id); - } - } } void LLViewerParcelMgr::optionally_start_music(const std::string& music_url) diff --git a/scripts/messages/message_template.msg b/scripts/messages/message_template.msg index c56eaae6fe..01397181e4 100755 --- a/scripts/messages/message_template.msg +++ b/scripts/messages/message_template.msg @@ -4503,6 +4503,11 @@ version 2.0 RegionAllowAccessBlock Single { RegionAllowAccessOverride BOOL } } + { + ParcelEnvironmentBlock Single + { ParcelEnvironmentVersion S32 } + { RegionAllowEnvironmentOverride BOOL } + } } // ParcelPropertiesUpdate diff --git a/scripts/messages/message_template.msg.sha1 b/scripts/messages/message_template.msg.sha1 index 5bc06ec042..ae8937f461 100755 --- a/scripts/messages/message_template.msg.sha1 +++ b/scripts/messages/message_template.msg.sha1 @@ -1 +1 @@ -337f351910b0c8821cb3d447bc6578516a043c80 \ No newline at end of file +4c5ec7187d1af05b52b5c1bbac68d46fbc65da05 \ No newline at end of file -- cgit v1.3 From cd5f7b2c03e87cc5d236eaa5b8c025530571376a Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 6 Aug 2018 15:37:09 -0700 Subject: MAINT-7703: Estate and region flags for parcel environmests (not written to DB yet) --- indra/llmessage/llregionflags.h | 3 ++ indra/newview/llestateinfomodel.cpp | 4 ++ indra/newview/llestateinfomodel.h | 2 + indra/newview/llfloaterregioninfo.cpp | 48 +++++++++++++++++++--- .../default/xui/en/panel_region_environment.xml | 1 - 5 files changed, 51 insertions(+), 7 deletions(-) (limited to 'indra/llmessage') diff --git a/indra/llmessage/llregionflags.h b/indra/llmessage/llregionflags.h index d3791ef4d1..a0c87b65cc 100644 --- a/indra/llmessage/llregionflags.h +++ b/indra/llmessage/llregionflags.h @@ -54,6 +54,9 @@ const U64 REGION_FLAGS_BLOCK_LAND_RESELL = (1 << 7); // All content wiped once per night const U64 REGION_FLAGS_SANDBOX = (1 << 8); + +const U64 REGION_FLAGS_ALLOW_ENVIRONMENT_OVERRIDE = (1 << 9); + const U64 REGION_FLAGS_SKIP_COLLISIONS = (1 << 12); // Pin all non agent rigid bodies const U64 REGION_FLAGS_SKIP_SCRIPTS = (1 << 13); const U64 REGION_FLAGS_SKIP_PHYSICS = (1 << 14); // Skip all physics diff --git a/indra/newview/llestateinfomodel.cpp b/indra/newview/llestateinfomodel.cpp index e56a67f8d1..4ac9c974c1 100644 --- a/indra/newview/llestateinfomodel.cpp +++ b/indra/newview/llestateinfomodel.cpp @@ -73,6 +73,7 @@ bool LLEstateInfoModel::getDenyAnonymous() const { return getFlag(REGION_FLAGS bool LLEstateInfoModel::getDenyAgeUnverified() const { return getFlag(REGION_FLAGS_DENY_AGEUNVERIFIED); } bool LLEstateInfoModel::getAllowVoiceChat() const { return getFlag(REGION_FLAGS_ALLOW_VOICE); } bool LLEstateInfoModel::getAllowAccessOverride() const { return getFlag(REGION_FLAGS_ALLOW_ACCESS_OVERRIDE); } +bool LLEstateInfoModel::getAllowEnvironmentOverride() const { return getFlag(REGION_FLAGS_ALLOW_ENVIRONMENT_OVERRIDE); } void LLEstateInfoModel::setUseFixedSun(bool val) { setFlag(REGION_FLAGS_SUN_FIXED, val); } void LLEstateInfoModel::setIsExternallyVisible(bool val) { setFlag(REGION_FLAGS_EXTERNALLY_VISIBLE, val); } @@ -81,6 +82,7 @@ void LLEstateInfoModel::setDenyAnonymous(bool val) { setFlag(REGION_FLAGS_DENY void LLEstateInfoModel::setDenyAgeUnverified(bool val) { setFlag(REGION_FLAGS_DENY_AGEUNVERIFIED, val); } void LLEstateInfoModel::setAllowVoiceChat(bool val) { setFlag(REGION_FLAGS_ALLOW_VOICE, val); } void LLEstateInfoModel::setAllowAccessOverride(bool val) { setFlag(REGION_FLAGS_ALLOW_ACCESS_OVERRIDE, val); } +void LLEstateInfoModel::setAllowEnvironmentOverride(bool val) { setFlag(REGION_FLAGS_ALLOW_ENVIRONMENT_OVERRIDE, val); } void LLEstateInfoModel::update(const strings_t& strings) { @@ -148,6 +150,7 @@ void LLEstateInfoModel::commitEstateInfoCapsCoro(std::string url) body["deny_age_unverified"] = getDenyAgeUnverified(); body["allow_voice_chat"] = getAllowVoiceChat(); body["override_public_access"] = getAllowAccessOverride(); + body["override_environment"] = getAllowEnvironmentOverride(); body["invoice"] = LLFloaterRegionInfo::getLastInvoice(); @@ -222,6 +225,7 @@ std::string LLEstateInfoModel::getInfoDump() dump["deny_age_unverified" ] = getDenyAgeUnverified(); dump["allow_voice_chat" ] = getAllowVoiceChat(); dump["override_public_access"] = getAllowAccessOverride(); + dump["override_environment"] = getAllowEnvironmentOverride(); std::stringstream dump_str; dump_str << dump; diff --git a/indra/newview/llestateinfomodel.h b/indra/newview/llestateinfomodel.h index 0082b5b1f4..d6f00c573c 100644 --- a/indra/newview/llestateinfomodel.h +++ b/indra/newview/llestateinfomodel.h @@ -56,6 +56,7 @@ public: bool getDenyAgeUnverified() const; bool getAllowVoiceChat() const; bool getAllowAccessOverride() const; + bool getAllowEnvironmentOverride() const; const std::string& getName() const { return mName; } const LLUUID& getOwnerID() const { return mOwnerID; } @@ -70,6 +71,7 @@ public: void setDenyAgeUnverified(bool val); void setAllowVoiceChat(bool val); void setAllowAccessOverride(bool val); + void setAllowEnvironmentOverride(bool val); void setSunHour(F32 sun_hour) { mSunHour = sun_hour; } diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 6719e6ed3b..5112ff11bf 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -184,6 +184,7 @@ public: void refresh(); bool refreshFromRegion(LLViewerRegion* region); + void refreshFromEstate(); virtual BOOL postBuild(); @@ -191,6 +192,7 @@ protected: virtual void doApply(); virtual void doEditCommited(LLSettingsDay::ptr_t &newday); + BOOL sendUpdate(); private: LLViewerRegion * mLastRegion; @@ -2388,8 +2390,6 @@ bool LLPanelEstateInfo::callbackChangeLindenEstate(const LLSD& notification, con estate_info.setDenyAgeUnverified(getChild("limit_age_verified")->getValue().asBoolean()); estate_info.setAllowVoiceChat(getChild("voice_chat_check")->getValue().asBoolean()); estate_info.setAllowAccessOverride(getChild("parcel_access_override")->getValue().asBoolean()); - // JIGGLYPUFF - //estate_info.setAllowAccessOverride(getChild("")->getValue().asBoolean()); // send the update to sim estate_info.sendEstateInfo(); } @@ -3370,6 +3370,9 @@ LLPanelRegionEnvironment::LLPanelRegionEnvironment(): LLPanelEnvironmentInfo(), mLastRegion(NULL) { + LLEstateInfoModel& estate_info = LLEstateInfoModel::instance(); + estate_info.setCommitCallback(boost::bind(&LLPanelRegionEnvironment::refreshFromEstate, this)); + estate_info.setUpdateCallback(boost::bind(&LLPanelRegionEnvironment::refreshFromEstate, this)); } @@ -3385,6 +3388,7 @@ BOOL LLPanelRegionEnvironment::postBuild() void LLPanelRegionEnvironment::refresh() { refreshFromRegion(mLastRegion); + refreshFromEstate(); } bool LLPanelRegionEnvironment::refreshFromRegion(LLViewerRegion* region) @@ -3403,9 +3407,6 @@ bool LLPanelRegionEnvironment::refreshFromRegion(LLViewerRegion* region) mDayLengthSlider->setValue(daylength.value()); mDayOffsetSlider->setValue(dayoffset.value()); - - //mRegionSettingsRadioGroup->setSelectedIndex(region->getIsDefaultDayCycle() ? 0 : 1); - mRegionSettingsRadioGroup->setSelectedIndex(1); setControlsEnabled(owner_or_god_or_manager); mLastRegion = region; @@ -3413,11 +3414,26 @@ bool LLPanelRegionEnvironment::refreshFromRegion(LLViewerRegion* region) LLSettingsDay::ptr_t pday = LLEnvironment::instance().getEnvironmentDay(LLEnvironment::ENV_REGION); if (pday) - mEditingDayCycle = pday->buildClone(); + { + mRegionSettingsRadioGroup->setSelectedIndex((pday->getAssetId() == LLSettingsDay::GetDefaultAssetId()) ? 0 : 1); + mEditingDayCycle = std::static_pointer_cast(pday->buildDerivedClone()); + } + else + { + mRegionSettingsRadioGroup->setSelectedIndex(1); + } return true; } +void LLPanelRegionEnvironment::refreshFromEstate() +{ + const LLEstateInfoModel& estate_info = LLEstateInfoModel::instance(); + + getChild("allow_override_chk")->setValue(estate_info.getAllowEnvironmentOverride()); + +} + void LLPanelRegionEnvironment::doApply() { if (mRegionSettingsRadioGroup->getSelectedIndex() == 0) @@ -3447,3 +3463,23 @@ void LLPanelRegionEnvironment::doEditCommited(LLSettingsDay::ptr_t &newday) { mEditingDayCycle = newday; } + +BOOL LLPanelRegionEnvironment::sendUpdate() +{ +// LL_INFOS() << "LLPanelEsateInfo::sendUpdate()" << LL_ENDL; +// +// LLNotification::Params params("ChangeLindenEstate"); +// params.functor.function(boost::bind(&LLPanelEstateInfo::callbackChangeLindenEstate, this, _1, _2)); +// +// if (isLindenEstate()) +// { +// // trying to change reserved estate, warn +// LLNotifications::instance().add(params); +// } +// else +// { +// // for normal estates, just make the change +// LLNotifications::instance().forceResponse(params, 0); +// } + return TRUE; +} diff --git a/indra/newview/skins/default/xui/en/panel_region_environment.xml b/indra/newview/skins/default/xui/en/panel_region_environment.xml index e469143e41..41f58eef01 100644 --- a/indra/newview/skins/default/xui/en/panel_region_environment.xml +++ b/indra/newview/skins/default/xui/en/panel_region_environment.xml @@ -150,7 +150,6 @@ min_height="0" background_visible="false"> Date: Wed, 12 Dec 2018 14:07:23 -0800 Subject: SL-10238: Viewer spport for push notifications from the simulator contaiting partial groups of settings. Blend these settings into the current environment. --- indra/llinventory/llsettingsbase.cpp | 44 ++-- indra/llinventory/llsettingsbase.h | 19 +- indra/llinventory/llsettingsdaycycle.cpp | 1 - indra/llinventory/llsettingssky.cpp | 12 ++ indra/llinventory/llsettingssky.h | 1 + indra/llinventory/llsettingswater.cpp | 8 + indra/llinventory/llsettingswater.h | 1 + indra/llmessage/lldispatcher.cpp | 106 +++++---- indra/llmessage/lldispatcher.h | 6 + indra/llmessage/message_prehash.cpp | 1 + indra/llmessage/message_prehash.h | 2 + indra/newview/llenvironment.cpp | 336 +++++++++++++++++++++++++---- indra/newview/llenvironment.h | 89 ++++++-- indra/newview/lleventpoll.cpp | 5 +- indra/newview/llstartup.cpp | 3 +- indra/newview/llviewergenericmessage.cpp | 24 ++- indra/newview/llviewergenericmessage.h | 1 + scripts/messages/message_template.msg | 24 ++- scripts/messages/message_template.msg.sha1 | 2 +- 19 files changed, 556 insertions(+), 129 deletions(-) (limited to 'indra/llmessage') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 7917fa96f1..5adb787048 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -60,6 +60,8 @@ const U32 LLSettingsBase::FLAG_NOCOPY(0x01 << 0); const U32 LLSettingsBase::FLAG_NOMOD(0x01 << 1); const U32 LLSettingsBase::FLAG_NOTRANS(0x01 << 2); +const U32 LLSettingsBase::Validator::VALIDATION_PARTIAL(0x01 << 0); + //========================================================================= LLSettingsBase::LLSettingsBase(): mSettings(LLSD::emptyMap()), @@ -385,7 +387,7 @@ bool LLSettingsBase::validate() return result["success"].asBoolean(); } -LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &validations) +LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &validations, bool partial) { static Validator validateName(SETTING_NAME, false, LLSD::TypeString, boost::bind(&Validator::verifyStringLength, _1, 32)); static Validator validateId(SETTING_ID, false, LLSD::TypeUUID); @@ -398,44 +400,48 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &valida bool isValid(true); LLSD errors(LLSD::emptyArray()); LLSD warnings(LLSD::emptyArray()); + U32 flags(0); + + if (partial) + flags |= Validator::VALIDATION_PARTIAL; // Fields common to all settings. - if (!validateName.verify(settings)) + if (!validateName.verify(settings, flags)) { errors.append( LLSD::String("Unable to validate 'name'.") ); isValid = false; } validated.insert(validateName.getName()); - if (!validateId.verify(settings)) + if (!validateId.verify(settings, flags)) { errors.append( LLSD::String("Unable to validate 'id'.") ); isValid = false; } validated.insert(validateId.getName()); - if (!validateHash.verify(settings)) + if (!validateHash.verify(settings, flags)) { errors.append( LLSD::String("Unable to validate 'hash'.") ); isValid = false; } validated.insert(validateHash.getName()); - if (!validateAssetId.verify(settings)) + if (!validateAssetId.verify(settings, flags)) { errors.append(LLSD::String("Invalid asset Id")); isValid = false; } validated.insert(validateAssetId.getName()); - if (!validateType.verify(settings)) + if (!validateType.verify(settings, flags)) { errors.append( LLSD::String("Unable to validate 'type'.") ); isValid = false; } validated.insert(validateType.getName()); - if (!validateFlags.verify(settings)) + if (!validateFlags.verify(settings, flags)) { errors.append(LLSD::String("Unable to validate 'flags'.")); isValid = false; @@ -453,7 +459,7 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &valida } #endif - if (!(*itv).verify(settings)) + if (!(*itv).verify(settings, flags)) { std::stringstream errtext; @@ -498,10 +504,14 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &valida } //========================================================================= -bool LLSettingsBase::Validator::verify(LLSD &data) + +bool LLSettingsBase::Validator::verify(LLSD &data, U32 flags) { if (!data.has(mName) || (data.has(mName) && data[mName].isUndefined())) { + if ((flags & VALIDATION_PARTIAL) != 0) // we are doing a partial validation. Do no attempt to set a default if missing (or fail even if required) + return true; + if (!mDefault.isUndefined()) { data[mName] = mDefault; @@ -667,7 +677,10 @@ bool LLSettingsBase::Validator::verifyStringLength(LLSD &value, S32 length) //========================================================================= void LLSettingsBlender::update(const LLSettingsBase::BlendFactor& blendf) { - setBlendFactor(blendf); + F64 res = setBlendFactor(blendf); + + if ((res >= 0.0001) && (res < 1.0)) + mTarget->update(); } F64 LLSettingsBlender::setBlendFactor(const LLSettingsBase::BlendFactor& blendf_in) @@ -688,7 +701,6 @@ F64 LLSettingsBlender::setBlendFactor(const LLSettingsBase::BlendFactor& blendf_ return blendf; } mTarget->blend(mFinal, blendf); - mTarget->update(); } else { @@ -715,7 +727,7 @@ LLSettingsBase::BlendFactor LLSettingsBlenderTimeDelta::calculateBlend(const LLS return LLSettingsBase::BlendFactor(fmod((F64)spanpos, (F64)spanlen) / (F64)spanlen); } -void LLSettingsBlenderTimeDelta::applyTimeDelta(const LLSettingsBase::Seconds& timedelta) +bool LLSettingsBlenderTimeDelta::applyTimeDelta(const LLSettingsBase::Seconds& timedelta) { mTimeSpent += timedelta; mTimeDeltaPassed += timedelta; @@ -724,12 +736,12 @@ void LLSettingsBlenderTimeDelta::applyTimeDelta(const LLSettingsBase::Seconds& t { mIgnoreTimeDelta = false; triggerComplete(); - return; + return false; } if ((mTimeDeltaPassed < mTimeDeltaThreshold) && (!mIgnoreTimeDelta)) { - return; + return false; } LLSettingsBase::BlendFactor blendf = calculateBlend(mTimeSpent, mBlendSpan); @@ -737,10 +749,10 @@ void LLSettingsBlenderTimeDelta::applyTimeDelta(const LLSettingsBase::Seconds& t if (fabs(mLastBlendF - blendf) < mBlendFMinDelta) { - return; + return false; } mLastBlendF = blendf; - update(blendf); + return true; } diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index c7b685c6d5..87466e6570 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -266,6 +266,8 @@ public: class Validator { public: + static const U32 VALIDATION_PARTIAL; + typedef boost::function verify_pr; Validator(std::string name, bool required, LLSD::Type type, verify_pr verify = verify_pr(), LLSD defval = LLSD()) : @@ -280,7 +282,7 @@ public: bool isRequired() const { return mRequired; } LLSD::Type getType() const { return mType; } - bool verify(LLSD &data); + bool verify(LLSD &data, U32 flags); // Some basic verifications static bool verifyColor(LLSD &value); @@ -302,7 +304,7 @@ public: }; typedef std::vector validation_list_t; - static LLSD settingValidation(LLSD &settings, validation_list_t &validations); + static LLSD settingValidation(LLSD &settings, validation_list_t &validations, bool partial = false); inline void setAssetId(LLUUID value) { // note that this skips setLLSD @@ -346,7 +348,7 @@ protected: virtual stringset_t getSlerpKeys() const { return stringset_t(); } // Calculate any custom settings that may need to be cached. - virtual void updateSettings() { mDirty = false; mReplaced = false; }; + virtual void updateSettings() { mDirty = false; mReplaced = false; } virtual validation_list_t getValidationList() const = 0; @@ -366,6 +368,12 @@ protected: mBlendedFactor = blendfactor; } + void replaceWith(LLSettingsBase::ptr_t other) + { + replaceSettings(other->cloneSettings()); + setBlendFactor(other->getBlendFactor()); + } + private: bool mDirty; bool mReplaced; // super dirty! @@ -437,10 +445,11 @@ public: } virtual void update(const LLSettingsBase::BlendFactor& blendf); - virtual void applyTimeDelta(const LLSettingsBase::Seconds& delta) + virtual bool applyTimeDelta(const LLSettingsBase::Seconds& timedelta) { llassert(false); // your derived class needs to implement an override of this func + return false; } virtual F64 setBlendFactor(const LLSettingsBase::BlendFactor& position); @@ -495,7 +504,7 @@ public: mLastBlendF = LLSettingsBase::BlendFactor(-1.0f); } - virtual void applyTimeDelta(const LLSettingsBase::Seconds& timedelta) SETTINGS_OVERRIDE; + virtual bool applyTimeDelta(const LLSettingsBase::Seconds& timedelta) SETTINGS_OVERRIDE; inline void setTimeDeltaThreshold(const LLSettingsBase::Seconds time) { diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index ec497b4021..188e205176 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -203,7 +203,6 @@ bool LLSettingsDay::initialize(bool validate_frames) if (mSettings.has(SETTING_ASSETID)) { assetid = mSettings[SETTING_ASSETID].asUUID(); - LL_WARNS("LAPRAS") << "initializing daycycle with asset id " << assetid << LL_ENDL; } std::map used; diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index ace530ae54..37882b91ec 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -431,6 +431,18 @@ void LLSettingsSky::replaceSettings(LLSD settings) mNextHaloTextureId.setNull(); } +void LLSettingsSky::replaceWithSky(LLSettingsSky::ptr_t pother) +{ + replaceWith(pother); + + mNextSunTextureId = pother->mNextSunTextureId; + mNextMoonTextureId = pother->mNextMoonTextureId; + mNextCloudTextureId = pother->mNextCloudTextureId; + mNextBloomTextureId = pother->mNextBloomTextureId; + mNextRainbowTextureId = pother->mNextRainbowTextureId; + mNextHaloTextureId = pother->mNextHaloTextureId; +} + void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) { llassert(getSettingsType() == end->getSettingsType()); diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 796120ba03..dc652dc182 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -118,6 +118,7 @@ public: virtual void replaceSettings(LLSD settings) SETTINGS_OVERRIDE; + void replaceWithSky(LLSettingsSky::ptr_t pother); static LLSD defaults(const LLSettingsBase::TrackPosition& position = 0.0f); F32 getPlanetRadius() const; diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index 7cfff954a0..1780948f0a 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -197,6 +197,14 @@ void LLSettingsWater::replaceSettings(LLSD settings) mNextTransparentTextureID.setNull(); } +void LLSettingsWater::replaceWithWater(LLSettingsWater::ptr_t other) +{ + replaceWith(other); + + mNextNormalMapID = other->mNextNormalMapID; + mNextTransparentTextureID = other->mNextTransparentTextureID; +} + LLSettingsWater::validation_list_t LLSettingsWater::getValidationList() const { return LLSettingsWater::validationList(); diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h index 009a72eb24..118c515743 100644 --- a/indra/llinventory/llsettingswater.h +++ b/indra/llinventory/llsettingswater.h @@ -65,6 +65,7 @@ public: virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf) SETTINGS_OVERRIDE; virtual void replaceSettings(LLSD settings) SETTINGS_OVERRIDE; + void replaceWithWater(LLSettingsWater::ptr_t other); static LLSD defaults(const LLSettingsBase::TrackPosition& position = 0.0f); diff --git a/indra/llmessage/lldispatcher.cpp b/indra/llmessage/lldispatcher.cpp index c40fe0d389..717ef10f70 100644 --- a/indra/llmessage/lldispatcher.cpp +++ b/indra/llmessage/lldispatcher.cpp @@ -101,48 +101,70 @@ LLDispatchHandler* LLDispatcher::addHandler( // static bool LLDispatcher::unpackMessage( - LLMessageSystem* msg, - LLDispatcher::key_t& method, - LLUUID& invoice, - LLDispatcher::sparam_t& parameters) + LLMessageSystem* msg, + LLDispatcher::key_t& method, + LLUUID& invoice, + LLDispatcher::sparam_t& parameters) { - char buf[MAX_STRING]; /*Flawfinder: ignore*/ - msg->getStringFast(_PREHASH_MethodData, _PREHASH_Method, method); - msg->getUUIDFast(_PREHASH_MethodData, _PREHASH_Invoice, invoice); - S32 size; - S32 count = msg->getNumberOfBlocksFast(_PREHASH_ParamList); - for (S32 i = 0; i < count; ++i) - { - // we treat the SParam as binary data (since it might be an - // LLUUID in compressed form which may have embedded \0's,) - size = msg->getSizeFast(_PREHASH_ParamList, i, _PREHASH_Parameter); - if (size >= 0) - { - msg->getBinaryDataFast( - _PREHASH_ParamList, _PREHASH_Parameter, - buf, size, i, MAX_STRING-1); + char buf[MAX_STRING]; /*Flawfinder: ignore*/ + msg->getStringFast(_PREHASH_MethodData, _PREHASH_Method, method); + msg->getUUIDFast(_PREHASH_MethodData, _PREHASH_Invoice, invoice); + S32 size; + S32 count = msg->getNumberOfBlocksFast(_PREHASH_ParamList); + for (S32 i = 0; i < count; ++i) + { + // we treat the SParam as binary data (since it might be an + // LLUUID in compressed form which may have embedded \0's,) + size = msg->getSizeFast(_PREHASH_ParamList, i, _PREHASH_Parameter); + if (size >= 0) + { + msg->getBinaryDataFast( + _PREHASH_ParamList, _PREHASH_Parameter, + buf, size, i, MAX_STRING - 1); - // If the last byte of the data is 0x0, this is either a normally - // packed string, or a binary packed UUID (which for these messages - // are packed with a 17th byte 0x0). Unpack into a std::string - // without the trailing \0, so "abc\0" becomes std::string("abc", 3) - // which matches const char* "abc". - if (size > 0 - && buf[size-1] == 0x0) - { - // special char*/size constructor because UUIDs may have embedded - // 0x0 bytes. - std::string binary_data(buf, size-1); - parameters.push_back(binary_data); - } - else - { - // This is either a NULL string, or a string that was packed - // incorrectly as binary data, without the usual trailing '\0'. - std::string string_data(buf, size); - parameters.push_back(string_data); - } - } - } - return true; + // If the last byte of the data is 0x0, this is either a normally + // packed string, or a binary packed UUID (which for these messages + // are packed with a 17th byte 0x0). Unpack into a std::string + // without the trailing \0, so "abc\0" becomes std::string("abc", 3) + // which matches const char* "abc". + if (size > 0 + && buf[size - 1] == 0x0) + { + // special char*/size constructor because UUIDs may have embedded + // 0x0 bytes. + std::string binary_data(buf, size - 1); + parameters.push_back(binary_data); + } + else + { + // This is either a NULL string, or a string that was packed + // incorrectly as binary data, without the usual trailing '\0'. + std::string string_data(buf, size); + parameters.push_back(string_data); + } + } + } + return true; +} + +// static +bool LLDispatcher::unpackLargeMessage( + LLMessageSystem* msg, + LLDispatcher::key_t& method, + LLUUID& invoice, + LLDispatcher::sparam_t& parameters) +{ + msg->getStringFast(_PREHASH_MethodData, _PREHASH_Method, method); + msg->getUUIDFast(_PREHASH_MethodData, _PREHASH_Invoice, invoice); + S32 count = msg->getNumberOfBlocksFast(_PREHASH_ParamList); + for (S32 i = 0; i < count; ++i) + { + // This method treats all Parameter List params as strings and unpacks + // them regardless of length. If there is binary data it is the callers + // responsibility to decode it. + std::string param; + msg->getStringFast(_PREHASH_ParamList, _PREHASH_Parameter, param, i); + parameters.push_back(param); + } + return true; } diff --git a/indra/llmessage/lldispatcher.h b/indra/llmessage/lldispatcher.h index 9d1751f588..43c63ac4df 100644 --- a/indra/llmessage/lldispatcher.h +++ b/indra/llmessage/lldispatcher.h @@ -105,6 +105,12 @@ public: LLUUID& invoice, sparam_t& parameters); + static bool unpackLargeMessage( + LLMessageSystem* msg, + key_t& method, + LLUUID& invoice, + sparam_t& parameters); + protected: typedef std::map dispatch_map_t; dispatch_map_t mHandlers; diff --git a/indra/llmessage/message_prehash.cpp b/indra/llmessage/message_prehash.cpp index ed2d580d48..fba5b7453d 100644 --- a/indra/llmessage/message_prehash.cpp +++ b/indra/llmessage/message_prehash.cpp @@ -1394,3 +1394,4 @@ char const* const _PREHASH_AppearanceHover = LLMessageStringTable::getInstance() char const* const _PREHASH_HoverHeight = LLMessageStringTable::getInstance()->getString("HoverHeight"); char const* const _PREHASH_Experience = LLMessageStringTable::getInstance()->getString("Experience"); char const* const _PREHASH_ExperienceID = LLMessageStringTable::getInstance()->getString("ExperienceID"); +char const* const _PREHASH_LargeGenericMessage = LLMessageStringTable::getInstance()->getString("LargeGenericMessage"); diff --git a/indra/llmessage/message_prehash.h b/indra/llmessage/message_prehash.h index d7eb04df57..4f72c01ddf 100644 --- a/indra/llmessage/message_prehash.h +++ b/indra/llmessage/message_prehash.h @@ -1394,4 +1394,6 @@ extern char const* const _PREHASH_AppearanceHover; extern char const* const _PREHASH_HoverHeight; extern char const* const _PREHASH_Experience; extern char const* const _PREHASH_ExperienceID; +extern char const* const _PREHASH_LargeGenericMessage; + #endif diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index 3a030bb09d..fa3afa74ca 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -280,7 +280,6 @@ namespace virtual bool operator()(const LLDispatcher *, const std::string& key, const LLUUID& invoice, const sparam_t& strings) override { LLSD message; - sparam_t::const_iterator it = strings.begin(); if (it != strings.end()) @@ -292,8 +291,8 @@ namespace LL_WARNS() << "LLExperienceLogDispatchHandler: Attempted to read parameter data into LLSD but failed:" << llsdRaw << LL_ENDL; } } - message[KEY_EXPERIENCEID] = invoice; + message[KEY_EXPERIENCEID] = invoice; // Object Name if (it != strings.end()) { @@ -349,7 +348,7 @@ void LLEnvironment::initSingleton() LLSettingsSky::ptr_t p_default_sky = LLSettingsVOSky::buildDefaultSky(); LLSettingsWater::ptr_t p_default_water = LLSettingsVOWater::buildDefaultWater(); - mCurrentEnvironment = std::make_shared(); + mCurrentEnvironment = std::make_shared(ENV_DEFAULT); mCurrentEnvironment->setSky(p_default_sky); mCurrentEnvironment->setWater(p_default_water); @@ -381,6 +380,43 @@ bool LLEnvironment::canEdit() const return true; } +LLSettingsSky::ptr_t LLEnvironment::getCurrentSky() const +{ + LLSettingsSky::ptr_t psky = mCurrentEnvironment->getSky(); + + if (!psky && mCurrentEnvironment->getEnvironmentSelection() >= ENV_EDIT) + { + for (int idx = 0; idx < ENV_END; ++idx) + { + if (mEnvironments[idx]->getSky()) + { + psky = mEnvironments[idx]->getSky(); + break; + } + } + } + return psky; +} + +LLSettingsWater::ptr_t LLEnvironment::getCurrentWater() const +{ + LLSettingsWater::ptr_t pwater = mCurrentEnvironment->getWater(); + + if (!pwater && mCurrentEnvironment->getEnvironmentSelection() >= ENV_EDIT) + { + for (int idx = 0; idx < ENV_END; ++idx) + { + if (mEnvironments[idx]->getWater()) + { + pwater = mEnvironments[idx]->getWater(); + break; + } + } + } + return pwater; +} + + void LLEnvironment::getAtmosphericModelSettings(AtmosphericModelSettings& settingsOut, const LLSettingsSky::ptr_t &psky) { settingsOut.m_skyBottomRadius = psky->getSkyBottomRadius(); @@ -478,7 +514,7 @@ bool LLEnvironment::isInventoryEnabled() const void LLEnvironment::onRegionChange() { - clearEnvironment(ENV_PUSH); + clearExperienceEnvironment(LLUUID::null, TRANSITION_DEFAULT); requestRegion(); } @@ -540,10 +576,16 @@ bool LLEnvironment::hasEnvironment(LLEnvironment::EnvSelection_t env) LLEnvironment::DayInstance::ptr_t LLEnvironment::getEnvironmentInstance(LLEnvironment::EnvSelection_t env, bool create /*= false*/) { DayInstance::ptr_t environment = mEnvironments[env]; -// if (!environment && create) if (create) { - environment = std::make_shared(); + if (environment) + environment = environment->clone(); + else + { + environment = std::make_shared(env); + if (mMakeBackups && env > ENV_PUSH) + environment->setBackup(true); + } mEnvironments[env] = environment; } @@ -581,17 +623,27 @@ void LLEnvironment::setEnvironment(LLEnvironment::EnvSelection_t env, LLEnvironm DayInstance::ptr_t environment = getEnvironmentInstance(env, true); - LLSettingsSky::ptr_t prev_sky = mEnvironments[ENV_DEFAULT]->getSky(); - LLSettingsWater::ptr_t prev_water = mEnvironments[ENV_DEFAULT]->getWater(); - if (mCurrentEnvironment && (ENV_EDIT == env)) - { - prev_sky = mCurrentEnvironment->getSky() ? mCurrentEnvironment->getSky() : prev_sky; - prev_water = mCurrentEnvironment->getWater() ? mCurrentEnvironment->getWater() : prev_water; - } +// LLSettingsSky::ptr_t prev_sky = mEnvironments[ENV_DEFAULT]->getSky(); +// LLSettingsWater::ptr_t prev_water = mEnvironments[ENV_DEFAULT]->getWater(); +// if (mCurrentEnvironment && (ENV_EDIT == env)) +// { +// prev_sky = mCurrentEnvironment->getSky() ? mCurrentEnvironment->getSky() : prev_sky; +// prev_water = mCurrentEnvironment->getWater() ? mCurrentEnvironment->getWater() : prev_water; +// } - environment->clear(); - environment->setSky((fixed.first) ? fixed.first : prev_sky); - environment->setWater((fixed.second) ? fixed.second : prev_water); +// environment->clear(); +// environment->setSky((fixed.first) ? fixed.first : prev_sky); +// environment->setWater((fixed.second) ? fixed.second : prev_water); + if (fixed.first) + environment->setSky(fixed.first); + else if (!environment->getSky()) + environment->setSky(mCurrentEnvironment->getSky()); + + if (fixed.second) + environment->setWater(fixed.second); + else if (!environment->getWater()) + environment->setWater(mCurrentEnvironment->getWater()); + if (!mSignalEnvChanged.empty()) @@ -630,19 +682,19 @@ void LLEnvironment::setEnvironment(LLEnvironment::EnvSelection_t env, const LLSe else if (settings->getSettingsType() == "sky") { fixedEnvironment_t fixedenv(std::static_pointer_cast(settings), LLSettingsWater::ptr_t()); - if (environment) - { - fixedenv.second = environment->getWater(); - } +// if (environment) +// { +// fixedenv.second = environment->getWater(); +// } setEnvironment(env, fixedenv); } else if (settings->getSettingsType() == "water") { fixedEnvironment_t fixedenv(LLSettingsSky::ptr_t(), std::static_pointer_cast(settings)); - if (environment) - { - fixedenv.first = environment->getSky(); - } +// if (environment) +// { +// fixedenv.first = environment->getSky(); +// } setEnvironment(env, fixedenv); } } @@ -794,6 +846,17 @@ LLEnvironment::DayInstance::ptr_t LLEnvironment::getSelectedEnvironmentInstance( return mEnvironments[ENV_DEFAULT]; } +LLEnvironment::DayInstance::ptr_t LLEnvironment::getSharedEnvironmentInstance() +{ + for (S32 idx = ENV_PARCEL; idx < ENV_DEFAULT; ++idx) + { + if (mEnvironments[idx]) + return mEnvironments[idx]; + } + + return mEnvironments[ENV_DEFAULT]; +} + void LLEnvironment::updateEnvironment(LLSettingsBase::Seconds transition, bool forced) { DayInstance::ptr_t pinstance = getSelectedEnvironmentInstance(); @@ -920,6 +983,11 @@ void LLEnvironment::update(const LLViewerCamera * cam) mCurrentEnvironment->applyTimeDelta(delta); + if (mCurrentEnvironment->getEnvironmentSelection() != ENV_LOCAL) + { + applyInjectedSettings(mCurrentEnvironment, delta); + } + // update clouds, sun, and general updateCloudScroll(); @@ -1703,32 +1771,37 @@ void LLEnvironment::handleEnvironmentPushFull(LLUUID experience_id, LLSD &messag void LLEnvironment::handleEnvironmentPushPartial(LLUUID experience_id, LLSD &message, F32 transition) { + LLSD settings(message["settings"]); + + if (settings.isUndefined()) + return; + setExperienceEnvironment(experience_id, settings, LLSettingsBase::Seconds(transition)); } void LLEnvironment::clearExperienceEnvironment(LLUUID experience_id, F32 transition_time) { bool update_env(false); - if (mPushEnvironmentExpId == experience_id) + if (hasEnvironment(ENV_PUSH)) { - mPushEnvironmentExpId.setNull(); - - if (hasEnvironment(ENV_PUSH)) - { - update_env |= true; - clearEnvironment(ENV_PUSH); - updateEnvironment(LLSettingsBase::Seconds(transition_time)); - } - + update_env |= true; + clearEnvironment(ENV_PUSH); + updateEnvironment(LLSettingsBase::Seconds(transition_time)); } - // clear the override queue too. - // update |= true; + setInstanceBackup(false); + /*TODO blend these back out*/ + mSkyExperienceBlends.clear(); + mWaterExperienceBlends.clear(); + mCurrentEnvironment->getSky(); - if (update_env) - updateEnvironment(LLSettingsBase::Seconds(transition_time)); + injectSettings(experience_id, mSkyExperienceBlends, mSkyOverrides, LLSettingsBase::Seconds(transition_time), false); + injectSettings(experience_id, mWaterExperienceBlends, mWaterOverrides, LLSettingsBase::Seconds(transition_time), false); + + mSkyOverrides = LLSD::emptyMap(); + mWaterOverrides = LLSD::emptyMap(); } void LLEnvironment::setSharedEnvironment() @@ -1754,10 +1827,110 @@ void LLEnvironment::setExperienceEnvironment(LLUUID experience_id, LLUUID asset_ void LLEnvironment::setExperienceEnvironment(LLUUID experience_id, LLSD data, F32 transition_time) { + LLSD sky(data["sky"]); + LLSD water(data["water"]); + + if (sky.isUndefined() && water.isUndefined()) + { + clearExperienceEnvironment(experience_id, transition_time); + return; + } + + setInstanceBackup(true); + + if (!sky.isUndefined()) + injectSettings(experience_id, mSkyExperienceBlends, sky, LLSettingsBase::Seconds(transition_time), true); + if (!water.isUndefined()) + injectSettings(experience_id, mWaterExperienceBlends, water, LLSettingsBase::Seconds(transition_time), true); + +} + + +void LLEnvironment::setInstanceBackup(bool dobackup) +{ + mMakeBackups = dobackup; + for (S32 idx = ENV_PARCEL; idx < ENV_DEFAULT; ++idx) + { + if (mEnvironments[idx]) + mEnvironments[idx]->setBackup(dobackup); + } +} + +void LLEnvironment::injectSettings(LLUUID experience_id, exerienceBlendValues_t &blends, LLSD injections, LLSettingsBase::Seconds transition, bool blendin) +{ + for (LLSD::map_iterator it = injections.beginMap(); it != injections.endMap(); ++it) + { + blends.push_back(ExpBlendValue(transition, (*it).first, (*it).second, blendin, -1)); + } + + std::stable_sort(blends.begin(), blends.end(), [](const ExpBlendValue &a, const ExpBlendValue &b) { return a.mTimeRemaining < b.mTimeRemaining; }); +} + +void LLEnvironment::applyInjectedSettings(DayInstance::ptr_t environment, F32Seconds delta) +{ + if ((mSkyOverrides.size() > 0) || (mSkyExperienceBlends.size() > 0)) + { + LLSettingsSky::ptr_t psky = environment->getSky(); + applyInjectedValues(psky, mSkyOverrides); + blendInjectedValues(psky, mSkyExperienceBlends, mSkyOverrides, delta); + } + if ((mWaterOverrides.size() > 0) || (mWaterExperienceBlends.size() > 0)) + { + LLSettingsWater::ptr_t pwater = environment->getWater(); + applyInjectedValues(pwater, mWaterOverrides); + blendInjectedValues(pwater, mWaterExperienceBlends, mWaterOverrides, delta); + } +} + + +void LLEnvironment::applyInjectedValues(LLSettingsBase::ptr_t psetting, LLSD injection) +{ + for (LLSD::map_iterator it = injection.beginMap(); it != injection.endMap(); ++it) + { + psetting->setValue((*it).first, (*it).second); + } +} + +void LLEnvironment::blendInjectedValues(LLSettingsBase::ptr_t psetting, exerienceBlendValues_t &blends, LLSD &overrides, F32Seconds delta) +{ + LLSD settings = psetting->getSettings(); + LLSettingsBase::parammapping_t mappings = psetting->getParameterMap(); + LLSettingsBase::stringset_t slerps = psetting->getSlerpKeys(); + + if (blends.empty()) + return; + + for (auto &blend : blends) + { + blend.mTimeRemaining -= delta; + LLSettingsBase::BlendFactor mix = std::max(blend.mTimeRemaining / blend.mTransition, 0.0f); + if (blend.mBlendIn) + mix = 1.0 - mix; + mix = std::max(0.0, std::min(mix, 1.0)); + + if (blend.mValueInitial.isUndefined()) + blend.mValueInitial = psetting->getValue(blend.mKeyName); + LLSD newvalue = psetting->interpolateSDValue(blend.mKeyName, blend.mValueInitial, blend.mValue, mappings, mix, slerps); + + psetting->setValue(blend.mKeyName, newvalue); + } + + auto it = blends.begin(); + for (; it != blends.end(); ++it) + { + if ((*it).mTimeRemaining > F32Seconds(0.0f)) + break; + if ((*it).mBlendIn) + overrides[(*it).mKeyName] = (*it).mValue; + } + if (it != blends.begin()) + { + blends.erase(blends.begin(), it); + } } //========================================================================= -LLEnvironment::DayInstance::DayInstance() : +LLEnvironment::DayInstance::DayInstance(EnvSelection_t env) : mDayCycle(), mSky(), mWater(), @@ -1767,18 +1940,42 @@ LLEnvironment::DayInstance::DayInstance() : mBlenderWater(), mInitialized(false), mType(TYPE_INVALID), - mSkyTrack(1) + mSkyTrack(1), + mEnv(env), + mBackup(false) { } + +LLEnvironment::DayInstance::ptr_t LLEnvironment::DayInstance::clone() const +{ + ptr_t environment = std::make_shared(mEnv); + + environment->mDayCycle = mDayCycle; + environment->mSky = mSky; + environment->mWater = mWater; + environment->mDayLength = mDayLength; + environment->mDayOffset = mDayOffset; + environment->mBlenderSky = mBlenderSky; + environment->mBlenderWater = mBlenderWater; + environment->mInitialized = mInitialized; + environment->mType = mType; + environment->mSkyTrack = mSkyTrack; + + return environment; +} + void LLEnvironment::DayInstance::applyTimeDelta(const LLSettingsBase::Seconds& delta) { + bool changed(false); if (!mInitialized) initialize(); if (mBlenderSky) - mBlenderSky->applyTimeDelta(delta); + changed |= mBlenderSky->applyTimeDelta(delta); if (mBlenderWater) - mBlenderWater->applyTimeDelta(delta); + changed |= mBlenderWater->applyTimeDelta(delta); + if (mBackup && changed) + backup(); } void LLEnvironment::DayInstance::setDay(const LLSettingsDay::ptr_t &pday, LLSettingsDay::Seconds daylength, LLSettingsDay::Seconds dayoffset) @@ -1815,6 +2012,8 @@ void LLEnvironment::DayInstance::setSky(const LLSettingsSky::ptr_t &psky) mSky->mReplaced |= different_sky; mSky->update(); mBlenderSky.reset(); + if (mBackup) + backup(); if (gAtmosphere) { @@ -1834,6 +2033,8 @@ void LLEnvironment::DayInstance::setWater(const LLSettingsWater::ptr_t &pwater) mWater = pwater; mWater->update(); mBlenderWater.reset(); + if (mBackup) + backup(); } void LLEnvironment::DayInstance::initialize() @@ -1875,6 +2076,53 @@ void LLEnvironment::DayInstance::setBlenders(const LLSettingsBlender::ptr_t &sky mBlenderWater = waterblend; } + +void LLEnvironment::DayInstance::setBackup(bool backupval) +{ + if (backupval == mBackup) + return; + + mBackup = backupval; + LLSettingsSky::ptr_t psky = getSky(); + if (mBackup) + { + backup(); + } + else + { + restore(); + mBackupSky = LLSD(); + mBackupWater = LLSD(); + } +} + +void LLEnvironment::DayInstance::backup() +{ + if (!mBackup) + return; + + if (mSky) + { + mBackupSky = mSky->cloneSettings(); + } + if (mWater) + { + mBackupWater = mWater->cloneSettings(); + } +} + +void LLEnvironment::DayInstance::restore() +{ + if (!mBackupSky.isUndefined() && mSky) + { + mSky->replaceSettings(mBackupSky); + } + if (!mBackupWater.isUndefined() && mWater) + { + mWater->replaceSettings(mBackupWater); + } +} + LLSettingsBase::TrackPosition LLEnvironment::DayInstance::secondsToKeyframe(LLSettingsDay::Seconds seconds) { return convert_time_to_position(seconds, mDayLength); @@ -1923,7 +2171,7 @@ void LLEnvironment::DayInstance::animate() //------------------------------------------------------------------------- LLEnvironment::DayTransition::DayTransition(const LLSettingsSky::ptr_t &skystart, const LLSettingsWater::ptr_t &waterstart, LLEnvironment::DayInstance::ptr_t &end, LLSettingsDay::Seconds time) : - DayInstance(), + DayInstance(ENV_NONE), mStartSky(skystart), mStartWater(waterstart), mNextInstance(end), @@ -2038,3 +2286,5 @@ F64 LLTrackBlenderLoopingManual::getSpanLength(const LLSettingsDay::TrackBound_t { return get_wrapping_distance((*bounds.first).first, (*bounds.second).first); } + +//========================================================================= diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h index 7e35fdcfac..613bcdb4f8 100644 --- a/indra/newview/llenvironment.h +++ b/indra/newview/llenvironment.h @@ -121,8 +121,8 @@ public: bool canAgentUpdateRegionEnvironment() const; LLSettingsDay::ptr_t getCurrentDay() const { return mCurrentEnvironment->getDayCycle(); } - LLSettingsSky::ptr_t getCurrentSky() const { return mCurrentEnvironment->getSky(); } - LLSettingsWater::ptr_t getCurrentWater() const { return mCurrentEnvironment->getWater(); } + LLSettingsSky::ptr_t getCurrentSky() const; + LLSettingsWater::ptr_t getCurrentWater() const; static void getAtmosphericModelSettings(AtmosphericModelSettings& settingsOut, const LLSettingsSky::ptr_t &psky); @@ -218,13 +218,6 @@ public: void handleEnvironmentPush(LLSD &message); -protected: - virtual void initSingleton(); - -private: - LLVector4 toCFR(const LLVector3 vec) const; - LLVector4 toLightNorm(const LLVector3 vec) const; - class DayInstance { public: @@ -236,14 +229,16 @@ private: }; typedef std::shared_ptr ptr_t; - DayInstance(); + DayInstance(EnvSelection_t env); virtual ~DayInstance() { }; + ptr_t clone() const; + virtual void applyTimeDelta(const LLSettingsBase::Seconds& delta); - void setDay(const LLSettingsDay::ptr_t &pday, LLSettingsDay::Seconds daylength, LLSettingsDay::Seconds dayoffset); - void setSky(const LLSettingsSky::ptr_t &psky); - void setWater(const LLSettingsWater::ptr_t &pwater); + virtual void setDay(const LLSettingsDay::ptr_t &pday, LLSettingsDay::Seconds daylength, LLSettingsDay::Seconds dayoffset); + virtual void setSky(const LLSettingsSky::ptr_t &psky); + virtual void setWater(const LLSettingsWater::ptr_t &pwater); void initialize(); bool isInitialized(); @@ -263,12 +258,24 @@ private: void setBlenders(const LLSettingsBlender::ptr_t &skyblend, const LLSettingsBlender::ptr_t &waterblend); + EnvSelection_t getEnvironmentSelection() const { return mEnv; } + + void setBackup(bool backup); + bool getBackup() const { return mBackup; } + bool hasBackupSky() const { return !mBackupSky.isUndefined() || !mBackupWater.isUndefined(); } + void backup(); + void restore(); + protected: LLSettingsDay::ptr_t mDayCycle; LLSettingsSky::ptr_t mSky; LLSettingsWater::ptr_t mWater; S32 mSkyTrack; + bool mBackup; + LLSD mBackupSky; + LLSD mBackupWater; + InstanceType_t mType; bool mInitialized; @@ -279,8 +286,21 @@ private: LLSettingsBlender::ptr_t mBlenderSky; LLSettingsBlender::ptr_t mBlenderWater; + EnvSelection_t mEnv; + LLSettingsBase::TrackPosition secondsToKeyframe(LLSettingsDay::Seconds seconds); }; + + DayInstance::ptr_t getSelectedEnvironmentInstance(); + DayInstance::ptr_t getSharedEnvironmentInstance(); + +protected: + virtual void initSingleton(); + +private: + LLVector4 toCFR(const LLVector3 vec) const; + LLVector4 toLightNorm(const LLVector3 vec) const; + typedef std::array InstanceArray_t; struct ExpEnvironmentEntry @@ -334,9 +354,12 @@ private: S32 mCurrentTrack; altitude_list_t mTrackAltitudes; - DayInstance::ptr_t getEnvironmentInstance(EnvSelection_t env, bool create = false); + LLSD mSkyOverrides; + LLSD mWaterOverrides; + LLSD mSkyOverrideBlends; + LLSD mWaterOverrideBlends; - DayInstance::ptr_t getSelectedEnvironmentInstance(); + DayInstance::ptr_t getEnvironmentInstance(EnvSelection_t env, bool create = false); void updateCloudScroll(); @@ -373,6 +396,31 @@ private: std::string mDayName; }; + struct ExpBlendValue + { + ExpBlendValue(F32Seconds transition, const std::string &keyname, LLSD value, bool blendin, S32 index = -1) : + mTransition(transition), + mTimeRemaining(transition), + mKeyName(keyname), + mValue(value), + mValueInitial(), + mIndex(index), + mBlendIn(blendin) + {} + + F32Seconds mTransition; + F32Seconds mTimeRemaining; + std::string mKeyName; + LLSD mValue; + LLSD mValueInitial; + S32 mIndex; + bool mBlendIn; + + typedef std::shared_ptr ptr_t; + }; + + typedef std::deque exerienceBlendValues_t; + void coroRequestEnvironment(S32 parcel_id, environment_apply_fn apply); void coroUpdateEnvironment(S32 parcel_id, S32 track_no, UpdateInfo::ptr_t updates, environment_apply_fn apply); void coroResetEnvironment(S32 parcel_id, S32 track_no, environment_apply_fn apply); @@ -391,6 +439,17 @@ private: void clearExperienceEnvironment(LLUUID experience_id, F32 transition_time); void setExperienceEnvironment(LLUUID experience_id, LLUUID asset_id, F32 transition_time); void setExperienceEnvironment(LLUUID experience_id, LLSD environment, F32 transition_time); + void setInstanceBackup(bool dobackup); + + void injectSettings(LLUUID experience_id, exerienceBlendValues_t &blends, LLSD injections, LLSettingsBase::Seconds transition, bool blendin); + + void applyInjectedSettings(DayInstance::ptr_t environment, F32Seconds delta); + void applyInjectedValues(LLSettingsBase::ptr_t psetting, LLSD injection); + void blendInjectedValues(LLSettingsBase::ptr_t psetting, exerienceBlendValues_t &blends, LLSD &overrides, F32Seconds delta); + + exerienceBlendValues_t mSkyExperienceBlends; + exerienceBlendValues_t mWaterExperienceBlends; + bool mMakeBackups; }; class LLTrackBlenderLoopingManual : public LLSettingsBlender diff --git a/indra/newview/lleventpoll.cpp b/indra/newview/lleventpoll.cpp index 5e0f3ab7f9..299fffd9ab 100644 --- a/indra/newview/lleventpoll.cpp +++ b/indra/newview/lleventpoll.cpp @@ -106,6 +106,7 @@ namespace Details LLSD message; message["sender"] = mSenderIp; message["body"] = content["body"]; + LLMessageSystem::dispatch(msg_name, message); } @@ -241,7 +242,7 @@ namespace Details !result.get("events") || !result.get("id")) { - LL_WARNS("LLEventPollImpl") << " <" << counter << "> received event poll with no events or id key: " << LLSDXMLStreamer(result) << LL_ENDL; + LL_WARNS("LLEventPollImpl") << " <" << counter << "> received event poll with no events or id key: " << result << LL_ENDL; continue; } @@ -254,7 +255,7 @@ namespace Details } // was LL_INFOS() but now that CoarseRegionUpdate is TCP @ 1/second, it'd be too verbose for viewer logs. -MG - LL_DEBUGS("LLEventPollImpl") << " <" << counter << "> " << events.size() << "events (id " << LLSDXMLStreamer(acknowledge) << ")" << LL_ENDL; + LL_DEBUGS("LLEventPollImpl") << " <" << counter << "> " << events.size() << "events (id " << acknowledge << ")" << LL_ENDL; LLSD::array_const_iterator i = events.beginArray(); LLSD::array_const_iterator end = events.endArray(); diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index a9a0b89078..9c0e842c30 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -2532,7 +2532,8 @@ void register_viewer_callbacks(LLMessageSystem* msg) msg->setHandlerFunc("InitiateDownload", process_initiate_download); msg->setHandlerFunc("LandStatReply", LLFloaterTopObjects::handle_land_reply); - msg->setHandlerFunc("GenericMessage", process_generic_message); + msg->setHandlerFunc("GenericMessage", process_generic_message); + msg->setHandlerFunc("LargeGenericMessage", process_large_generic_message); msg->setHandlerFuncFast(_PREHASH_FeatureDisabled, process_feature_disabled_message); } diff --git a/indra/newview/llviewergenericmessage.cpp b/indra/newview/llviewergenericmessage.cpp index 3df53a4a30..d3de9d72bf 100644 --- a/indra/newview/llviewergenericmessage.cpp +++ b/indra/newview/llviewergenericmessage.cpp @@ -70,8 +70,6 @@ void send_generic_message(const std::string& method, gAgent.sendReliableMessage(); } - - void process_generic_message(LLMessageSystem* msg, void**) { LLUUID agent_id; @@ -93,3 +91,25 @@ void process_generic_message(LLMessageSystem* msg, void**) << LL_ENDL; } } + +void process_large_generic_message(LLMessageSystem* msg, void**) +{ + LLUUID agent_id; + msg->getUUID("AgentData", "AgentID", agent_id); + if (agent_id != gAgent.getID()) + { + LL_WARNS() << "GenericMessage for wrong agent" << LL_ENDL; + return; + } + + std::string request; + LLUUID invoice; + LLDispatcher::sparam_t strings; + LLDispatcher::unpackLargeMessage(msg, request, invoice, strings); + + if (!gGenericDispatcher.dispatch(request, invoice, strings)) + { + LL_WARNS() << "GenericMessage " << request << " failed to dispatch" + << LL_ENDL; + } +} diff --git a/indra/newview/llviewergenericmessage.h b/indra/newview/llviewergenericmessage.h index 9d451ec0bc..170f38a485 100644 --- a/indra/newview/llviewergenericmessage.h +++ b/indra/newview/llviewergenericmessage.h @@ -38,6 +38,7 @@ void send_generic_message(const std::string& method, const LLUUID& invoice = LLUUID::null); void process_generic_message(LLMessageSystem* msg, void**); +void process_large_generic_message(LLMessageSystem* msg, void**); extern LLDispatcher gGenericDispatcher; diff --git a/scripts/messages/message_template.msg b/scripts/messages/message_template.msg index ed32804bef..635227ccf3 100755 --- a/scripts/messages/message_template.msg +++ b/scripts/messages/message_template.msg @@ -6,7 +6,7 @@ version 2.0 // numbers. Each message must be numbered relative to the // other messages of that type. The current highest number // for each type is listed below: -// Low: 423 +// Low: 430 // Medium: 18 // High: 30 // PLEASE UPDATE THIS WHEN YOU ADD A NEW MESSAGE! @@ -5780,6 +5780,28 @@ version 2.0 } } +// LargeGenericMessage +// Similar to the above messages, but can handle larger payloads and serialized +// LLSD. Uses HTTP transport +{ + LargeGenericMessage Low 430 NotTrusted Unencoded UDPDeprecated + { + AgentData Single + { AgentID LLUUID } + { SessionID LLUUID } + { TransactionID LLUUID } + } + { + MethodData Single + { Method Variable 1 } + { Invoice LLUUID } + } + { + ParamList Variable + { Parameter Variable 2 } + } +} + // *************************************************************************** // Requests for possessions, acquisition, money, etc // *************************************************************************** diff --git a/scripts/messages/message_template.msg.sha1 b/scripts/messages/message_template.msg.sha1 index c9ef0217f3..bf45b08f93 100755 --- a/scripts/messages/message_template.msg.sha1 +++ b/scripts/messages/message_template.msg.sha1 @@ -1 +1 @@ -e492dec0fcdb4e234f94ddc32f4d7af0290ca72b \ No newline at end of file +be964beb7a2cd060a438c89fd5cb25e2f687d45e \ No newline at end of file -- cgit v1.3 From 2401712d1073e85b4b9183d20c6e9274bc874f64 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 20 Feb 2019 15:20:30 -0800 Subject: SL-9660: Next pass cleanup. Removed and downgraded a number of logs. Removed refs to LAPAS. Better sync with legacy regions. --- indra/llinventory/llsettingsbase.cpp | 2 +- indra/llinventory/llsettingsdaycycle.cpp | 2 - indra/llinventory/llsettingssky.cpp | 3 - indra/llmessage/llassetstorage.cpp | 4 - indra/newview/lldaycyclemanager.cpp | 233 ---------------------------- indra/newview/lldaycyclemanager.h | 83 ---------- indra/newview/llenvironment.cpp | 76 +++++---- indra/newview/llenvironment.h | 51 +++--- indra/newview/llfloatereditextdaycycle.cpp | 2 +- indra/newview/llfloaterfixedenvironment.cpp | 8 +- indra/newview/llinventorybridge.cpp | 3 +- indra/newview/llpaneleditwater.cpp | 3 - indra/newview/llsettingsvo.cpp | 7 - indra/newview/llstartup.cpp | 15 -- indra/newview/llviewermenu.cpp | 1 - indra/newview/llviewermessage.cpp | 21 ++- indra/newview/llviewerparcelmgr.cpp | 4 +- 17 files changed, 99 insertions(+), 419 deletions(-) delete mode 100644 indra/newview/lldaycyclemanager.cpp delete mode 100644 indra/newview/lldaycyclemanager.h (limited to 'indra/llmessage') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 5adb787048..7d7547ecb1 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -381,7 +381,7 @@ bool LLSettingsBase::validate() } if (result["warnings"].size() > 0) { - LL_WARNS("SETTINGS") << "Validation warnings: " << result["warnings"] << LL_ENDL; + LL_DEBUGS("SETTINGS") << "Validation warnings: " << result["warnings"] << LL_ENDL; } return result["success"].asBoolean(); diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 188e205176..feb734f64e 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -863,8 +863,6 @@ LLSettingsDay::CycleTrack_t::value_type LLSettingsDay::getSettingsNearKeyframe(c F32 dist = get_wrapping_distance(startframe, (*it).first); - //LL_DEBUGS("LAPRAS") << "[" << startframe << " ... " << keyframe << " -> " << (*it).first << "@" << dist << LL_ENDL; - if (dist <= (fudge * 2.0f)) return (*it); diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index af7425cca0..744c5853e4 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -997,9 +997,6 @@ void LLSettingsSky::calculateHeavenlyBodyPositions() const mSunDirection.normalize(); mMoonDirection.normalize(); - //LL_WARNS("LAPRAS") << "Sun info: Rotation=" << sunq << " Vector=" << mSunDirection << LL_ENDL; - //LL_WARNS("LAPRAS") << "Moon info: Rotation=" << moonq << " Vector=" << mMoonDirection << LL_ENDL; - if (mSunDirection.lengthSquared() < 0.01f) LL_WARNS("SETTINGS") << "Zero length sun direction. Wailing and gnashing of teeth may follow... or not." << LL_ENDL; if (mMoonDirection.lengthSquared() < 0.01f) diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp index 2b12a062c3..18b2b124e1 100644 --- a/indra/llmessage/llassetstorage.cpp +++ b/indra/llmessage/llassetstorage.cpp @@ -533,10 +533,6 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLVFile file(mVFS, uuid, type); U32 size = exists ? file.getSize() : 0; -// LAPRAS TESTING -// if (type == LLAssetType::AT_SETTINGS) -// size = 0; - if (size > 0) { // we've already got the file diff --git a/indra/newview/lldaycyclemanager.cpp b/indra/newview/lldaycyclemanager.cpp deleted file mode 100644 index 23d442f3b6..0000000000 --- a/indra/newview/lldaycyclemanager.cpp +++ /dev/null @@ -1,233 +0,0 @@ -/** - * @file lldaycyclemanager.cpp - * @brief Implementation for the LLDayCycleManager class. - * - * $LicenseInfo:firstyear=2011&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2011, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "lldaycyclemanager.h" - -#include "lldiriterator.h" - -#include "llenvironment.h" -#include "llsettingsdaycycle.h" - -void LLDayCycleManager::getPresetNames(preset_name_list_t& names) const -{ - names.clear(); - - for (dc_map_t::const_iterator it = mDayCycleMap.begin(); it != mDayCycleMap.end(); ++it) - { - names.push_back(it->first); - } -} - -void LLDayCycleManager::getPresetNames(preset_name_list_t& user, preset_name_list_t& sys) const -{ - user.clear(); - sys.clear(); - - for (dc_map_t::const_iterator it = mDayCycleMap.begin(); it != mDayCycleMap.end(); ++it) - { - const std::string& name = it->first; - - if (isSystemPreset(name)) - { - sys.push_back(name); - } - else - { - user.push_back(name); - } - } -} - -void LLDayCycleManager::getUserPresetNames(preset_name_list_t& user) const -{ - preset_name_list_t sys; // unused - getPresetNames(user, sys); -} - -bool LLDayCycleManager::getPreset(const std::string name, LLWLDayCycle& day_cycle) const -{ - dc_map_t::const_iterator it = mDayCycleMap.find(name); - if (it == mDayCycleMap.end()) - { - return false; - } - - day_cycle = it->second; - return true; -} - -bool LLDayCycleManager::getPreset(const std::string name, LLSD& day_cycle) const -{ - LLWLDayCycle dc; - if (!getPreset(name, dc)) - { - return false; - } - - day_cycle = dc.asLLSD(); - return true; -} - -bool LLDayCycleManager::presetExists(const std::string name) const -{ - LLWLDayCycle dummy; - return getPreset(name, dummy); -} - -bool LLDayCycleManager::isSystemPreset(const std::string& name) const -{ - return gDirUtilp->fileExists(getSysDir() + LLURI::escape(name) + ".xml"); -} - -bool LLDayCycleManager::savePreset(const std::string& name, const LLSD& data) -{ - // Save given preset. - LLWLDayCycle day; - day.loadDayCycle(data, LLEnvKey::SCOPE_LOCAL); - day.save(getUserDir() + LLURI::escape(name) + ".xml"); - - // Add it to our map. - addPreset(name, data); - mModifySignal(); - return true; -} - -bool LLDayCycleManager::deletePreset(const std::string& name) -{ - // Remove it from the map. - dc_map_t::iterator it = mDayCycleMap.find(name); - if (it == mDayCycleMap.end()) - { - LL_WARNS("Windlight") << "No day cycle named " << name << LL_ENDL; - return false; - } - mDayCycleMap.erase(it); - - // Remove from the filesystem. - std::string filename = LLURI::escape(name) + ".xml"; - if (gDirUtilp->fileExists(getUserDir() + filename)) - { - gDirUtilp->deleteFilesInDir(getUserDir(), filename); - } - - // Signal interested parties. - mModifySignal(); - return true; -} - -bool LLDayCycleManager::isSkyPresetReferenced(const std::string& preset_name) const -{ - // We're traversing local day cycles, they can only reference local skies. - LLWLParamKey key(preset_name, LLEnvKey::SCOPE_LOCAL); - - for (dc_map_t::const_iterator it = mDayCycleMap.begin(); it != mDayCycleMap.end(); ++it) - { - if (it->second.hasReferencesTo(key)) - { - return true; - } - } - - return false; -} - -boost::signals2::connection LLDayCycleManager::setModifyCallback(const modify_signal_t::slot_type& cb) -{ - return mModifySignal.connect(cb); -} - -// virtual -void LLDayCycleManager::initSingleton() -{ - LL_DEBUGS("Windlight") << "Loading all day cycles" << LL_ENDL; - loadAllPresets(); -} - -void LLDayCycleManager::loadAllPresets() -{ - mDayCycleMap.clear(); - - // First, load system (coming out of the box) day cycles. - loadPresets(getSysDir()); - - // Then load user presets. Note that user day cycles will modify any system ones already loaded. - loadPresets(getUserDir()); -} - -void LLDayCycleManager::loadPresets(const std::string& dir) -{ - LLDirIterator dir_iter(dir, "*.xml"); - - while (1) - { - std::string file; - if (!dir_iter.next(file)) break; // no more files - loadPreset(gDirUtilp->add(dir, file)); - } -} - -bool LLDayCycleManager::loadPreset(const std::string& path) -{ - LLSD data = LLWLDayCycle::loadDayCycleFromPath(path); - if (data.isUndefined()) - { - LL_WARNS() << "Error loading day cycle from " << path << LL_ENDL; - return false; - } - - std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(path), /*strip_exten = */ true)); - addPreset(name, data); - - return true; -} - -bool LLDayCycleManager::addPreset(const std::string& name, const LLSD& data) -{ - if (name.empty()) - { - //llassert(name.empty()); - return false; - } - - LLWLDayCycle day; - day.loadDayCycle(data, LLEnvKey::SCOPE_LOCAL); - mDayCycleMap[name] = day; - return true; -} - -// static -std::string LLDayCycleManager::getSysDir() -{ - return gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/days", ""); -} - -// static -std::string LLDayCycleManager::getUserDir() -{ - return gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS , "windlight/days", ""); -} diff --git a/indra/newview/lldaycyclemanager.h b/indra/newview/lldaycyclemanager.h deleted file mode 100644 index 810212c92a..0000000000 --- a/indra/newview/lldaycyclemanager.h +++ /dev/null @@ -1,83 +0,0 @@ -/** - * @file lldaycyclemanager.h - * @brief Implementation for the LLDayCycleManager class. - * - * $LicenseInfo:firstyear=2011&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2011, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLDAYCYCLEMANAGER_H -#define LL_LLDAYCYCLEMANAGER_H - -#include -#include - -#include "llwlparammanager.h" - -/** - * WindLight day cycles manager class - * - * Provides interface for accessing, loading and saving day cycles. - */ -class LLDayCycleManager : public LLSingleton -{ - LLSINGLETON_EMPTY_CTOR(LLDayCycleManager); - LOG_CLASS(LLDayCycleManager); - -public: - typedef std::list preset_name_list_t; - -// typedef std::map dc_map_t; - typedef boost::signals2::signal modify_signal_t; - - void getPresetNames(preset_name_list_t& names) const; - void getPresetNames(preset_name_list_t& user, preset_name_list_t& sys) const; - void getUserPresetNames(preset_name_list_t& user) const; - -// bool getPreset(const std::string name, LLWLDayCycle& day_cycle) const; - bool getPreset(const std::string name, LLSD& day_cycle) const; - bool presetExists(const std::string name) const; - bool isSystemPreset(const std::string& name) const; - bool savePreset(const std::string& name, const LLSD& data); - bool deletePreset(const std::string& name); - - /// @return true if there is a day cycle that refers to the sky preset. - bool isSkyPresetReferenced(const std::string& preset_name) const; - - /// Emitted when a preset gets added or deleted. - boost::signals2::connection setModifyCallback(const modify_signal_t::slot_type& cb); - -private: - /*virtual*/ void initSingleton(); - - void loadAllPresets(); - void loadPresets(const std::string& dir); - bool loadPreset(const std::string& path); - bool addPreset(const std::string& name, const LLSD& data); - - static std::string getSysDir(); - static std::string getUserDir(); - - dc_map_t mDayCycleMap; - modify_signal_t mModifySignal; -}; - -#endif // LL_LLDAYCYCLEMANAGER_H diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index 4bf7a630a5..f021c4a8c3 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -470,7 +470,6 @@ namespace { if ((*it)->mBlendIn) { - //_WARNS("LAPRAS") << "Done blending '" << key_name << "' after " << (*it)->mTransition.value() - (*it)->mTimeRemaining.value() << " value now=" << target << LL_ENDL; mOverrideValues[key_name] = target; mOverrideExps[key_name] = (*it)->mExperience; this->mSettings[key_name] = target; @@ -1621,39 +1620,38 @@ void LLEnvironment::recordEnvironment(S32 parcel_id, LLEnvironment::EnvironmentI else if (envinfo->mDayCycle->isTrackEmpty(LLSettingsDay::TRACK_WATER) || envinfo->mDayCycle->isTrackEmpty(LLSettingsDay::TRACK_GROUND_LEVEL)) { - LL_WARNS("LAPRAS") << "Invalid day cycle for region" << LL_ENDL; + LL_WARNS("ENVIRONMENT") << "Invalid day cycle for region" << LL_ENDL; clearEnvironment(ENV_PARCEL); setEnvironment(ENV_REGION, LLSettingsDay::GetDefaultAssetId(), LLSettingsDay::DEFAULT_DAYLENGTH, LLSettingsDay::DEFAULT_DAYOFFSET, envinfo->mEnvVersion); updateEnvironment(); } else { - LL_INFOS("LAPRAS") << "Setting Region environment" << LL_ENDL; setEnvironment(ENV_REGION, envinfo->mDayCycle, envinfo->mDayLength, envinfo->mDayOffset, envinfo->mEnvVersion); mTrackAltitudes = envinfo->mAltitudes; } - LL_WARNS("LAPRAS") << "Altitudes set to {" << mTrackAltitudes[0] << ", "<< mTrackAltitudes[1] << ", " << mTrackAltitudes[2] << ", " << mTrackAltitudes[3] << LL_ENDL; + LL_DEBUGS("ENVIRONMENT") << "Altitudes set to {" << mTrackAltitudes[0] << ", "<< mTrackAltitudes[1] << ", " << mTrackAltitudes[2] << ", " << mTrackAltitudes[3] << LL_ENDL; } else { LLParcel *parcel = LLViewerParcelMgr::instance().getAgentParcel(); - LL_WARNS("LAPRAS") << "Have parcel environment #" << envinfo->mParcelId << LL_ENDL; + LL_DEBUGS("ENVIRONMENT") << "Have parcel environment #" << envinfo->mParcelId << LL_ENDL; if (parcel && (parcel->getLocalID() != parcel_id)) { - LL_WARNS("ENVIRONMENT") << "Requested parcel #" << parcel_id << " agent is on " << parcel->getLocalID() << LL_ENDL; + LL_DEBUGS("ENVIRONMENT") << "Requested parcel #" << parcel_id << " agent is on " << parcel->getLocalID() << LL_ENDL; return; } if (!envinfo->mDayCycle) { - LL_WARNS("LAPRAS") << "Clearing environment on parcel #" << parcel_id << LL_ENDL; + LL_DEBUGS("ENVIRONMENT") << "Clearing environment on parcel #" << parcel_id << LL_ENDL; clearEnvironment(ENV_PARCEL); } else if (envinfo->mDayCycle->isTrackEmpty(LLSettingsDay::TRACK_WATER) || envinfo->mDayCycle->isTrackEmpty(LLSettingsDay::TRACK_GROUND_LEVEL)) { - LL_WARNS("LAPRAS") << "Invalid day cycle for parcel #" << parcel_id << LL_ENDL; + LL_WARNS("ENVIRONMENT") << "Invalid day cycle for parcel #" << parcel_id << LL_ENDL; clearEnvironment(ENV_PARCEL); } else @@ -1665,6 +1663,27 @@ void LLEnvironment::recordEnvironment(S32 parcel_id, LLEnvironment::EnvironmentI updateEnvironment(transition); } +void LLEnvironment::adjustRegionOffset(F32 adjust) +{ + if (isExtendedEnvironmentEnabled()) + { + LL_WARNS("ENVIRONMENT") << "Attempt to adjust region offset on EEP region. Legacy regions only." << LL_ENDL; + } + + if (mEnvironments[ENV_REGION]) + { + F32 day_length = mEnvironments[ENV_REGION]->getDayLength(); + F32 day_offset = mEnvironments[ENV_REGION]->getDayOffset(); + + F32 day_adjustment = adjust * day_length; + + day_offset += day_adjustment; + if (day_offset < 0.0f) + day_offset = day_length + day_offset; + mEnvironments[ENV_REGION]->setDayOffset(LLSettingsBase::Seconds(day_offset)); + } +} + //========================================================================= void LLEnvironment::requestRegion(environment_apply_fn cb) { @@ -1820,7 +1839,7 @@ void LLEnvironment::coroRequestEnvironment(S32 parcel_id, LLEnvironment::environ if (url.empty()) return; - LL_WARNS("LAPRAS") << "Requesting for parcel_id=" << parcel_id << LL_ENDL; + LL_DEBUGS("ENVIRONMENT") << "Requesting for parcel_id=" << parcel_id << LL_ENDL; if (parcel_id != INVALID_PARCEL_ID) { @@ -1830,24 +1849,14 @@ void LLEnvironment::coroRequestEnvironment(S32 parcel_id, LLEnvironment::environ url += query.str(); } - LL_WARNS("LAPRAS") << "url=" << url << LL_ENDL; - 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 environment settings for " << ((parcel_id == INVALID_PARCEL_ID) ? ("region!") : ("parcel!")) << LL_ENDL; - -// std::stringstream msg; -// msg << status.toString() << " (Code " << status.toTerseString() << ")"; -// notify = LLSD::emptyMap(); -// notify["FAIL_REASON"] = msg.str(); - + LL_WARNS("ENVIRONMENT") << "Couldn't retrieve environment settings for " << ((parcel_id == INVALID_PARCEL_ID) ? ("region!") : ("parcel!")) << LL_ENDL; } else { @@ -1859,11 +1868,6 @@ void LLEnvironment::coroRequestEnvironment(S32 parcel_id, LLEnvironment::environ } } -// if (!notify.isUndefined()) -// { -// LLNotificationsUtil::add("WLRegionApplyFail", notify); -// //LLEnvManagerNew::instance().onRegionSettingsApplyResponse(false); -// } } void LLEnvironment::coroUpdateEnvironment(S32 parcel_id, S32 track_no, UpdateInfo::ptr_t updates, environment_apply_fn apply) @@ -1906,7 +1910,7 @@ void LLEnvironment::coroUpdateEnvironment(S32 parcel_id, S32 track_no, UpdateInf body[KEY_ENVIRONMENT][KEY_DAYNAME] = updates->mDayName; } - LL_WARNS("LAPRAS") << "Body = " << body << LL_ENDL; + //_WARNS("ENVIRONMENT") << "Body = " << body << LL_ENDL; if ((parcel_id != INVALID_PARCEL_ID) || (track_no != NO_TRACK)) { @@ -1934,10 +1938,10 @@ void LLEnvironment::coroUpdateEnvironment(S32 parcel_id, S32 track_no, UpdateInf LLSD httpResults = result["http_result"]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); - LL_WARNS("LAPRAS") << "success=" << result["success"] << LL_ENDL; + if ((!status) || !result["success"].asBoolean()) { - LL_WARNS("WindlightCaps") << "Couldn't update Windlight settings for " << ((parcel_id == INVALID_PARCEL_ID) ? ("region!") : ("parcel!")) << LL_ENDL; + LL_WARNS("ENVIRONMENT") << "Couldn't update Windlight settings for " << ((parcel_id == INVALID_PARCEL_ID) ? ("region!") : ("parcel!")) << LL_ENDL; notify = LLSD::emptyMap(); notify["FAIL_REASON"] = result["message"].asString(); @@ -1996,10 +2000,10 @@ void LLEnvironment::coroResetEnvironment(S32 parcel_id, S32 track_no, environmen LLSD httpResults = result["http_result"]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); - LL_WARNS("LAPRAS") << "success=" << result["success"] << LL_ENDL; + if ((!status) || !result["success"].asBoolean()) { - LL_WARNS("WindlightCaps") << "Couldn't reset Windlight settings in " << ((parcel_id == INVALID_PARCEL_ID) ? ("region!") : ("parcel!")) << LL_ENDL; + LL_WARNS("ENVIRONMENT") << "Couldn't reset Windlight settings in " << ((parcel_id == INVALID_PARCEL_ID) ? ("region!") : ("parcel!")) << LL_ENDL; notify = LLSD::emptyMap(); notify["FAIL_REASON"] = result["message"].asString(); @@ -2416,8 +2420,6 @@ void LLEnvironment::setExperienceEnvironment(LLUUID experience_id, LLSD data, F3 void LLEnvironment::listenExperiencePump(const LLSD &message) { - LL_WARNS("LAPRAS") << "Have experience event: " << message << LL_ENDL; - LLUUID experience_id = message["experience"]; LLSD data = message[experience_id.asString()]; std::string permission(data["permission"].asString()); @@ -2564,6 +2566,16 @@ void LLEnvironment::DayInstance::setBlenders(const LLSettingsBlender::ptr_t &sky mBlenderWater = waterblend; } +LLSettingsBase::TrackPosition LLEnvironment::DayInstance::getProgress() const +{ + LLSettingsBase::Seconds now(LLDate::now().secondsSinceEpoch()); + now += mDayOffset; + + if ((mDayLength <= 0) || !mDayCycle) + return -1.0f; // no actual day cycle. + + return convert_time_to_position(now, mDayLength); +} LLSettingsBase::TrackPosition LLEnvironment::DayInstance::secondsToKeyframe(LLSettingsDay::Seconds seconds) { diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h index 6a930959bb..64350c42e8 100644 --- a/indra/newview/llenvironment.h +++ b/indra/newview/llenvironment.h @@ -197,6 +197,10 @@ public: // Construct a new day cycle based on the environment. Replacing either the water or the sky tracks. LLSettingsDay::ptr_t createDayCycleFromEnvironment(EnvSelection_t env, LLSettingsBase::ptr_t settings); + F32 getProgress() const { return (mCurrentEnvironment) ? mCurrentEnvironment->getProgress() : -1.0f; } + F32 getRegionProgress() const { return (mEnvironments[ENV_REGION]) ? mEnvironments[ENV_REGION]->getProgress() : -1.0f; } + void adjustRegionOffset(F32 adjust); // only used on legacy regions, to better sync the viewer with other agents + //------------------------------------------- connection_t setEnvironmentChanged(env_changed_fn cb) { return mSignalEnvChanged.connect(cb); } @@ -233,37 +237,42 @@ public: }; typedef std::shared_ptr ptr_t; - DayInstance(EnvSelection_t env); - virtual ~DayInstance() { }; + DayInstance(EnvSelection_t env); + virtual ~DayInstance() { }; + + virtual ptr_t clone() const; + + virtual bool applyTimeDelta(const LLSettingsBase::Seconds& delta); + + virtual void setDay(const LLSettingsDay::ptr_t &pday, LLSettingsDay::Seconds daylength, LLSettingsDay::Seconds dayoffset); + virtual void setSky(const LLSettingsSky::ptr_t &psky); + virtual void setWater(const LLSettingsWater::ptr_t &pwater); - virtual ptr_t clone() const; + void initialize(); + bool isInitialized(); - virtual bool applyTimeDelta(const LLSettingsBase::Seconds& delta); + void clear(); - virtual void setDay(const LLSettingsDay::ptr_t &pday, LLSettingsDay::Seconds daylength, LLSettingsDay::Seconds dayoffset); - virtual void setSky(const LLSettingsSky::ptr_t &psky); - virtual void setWater(const LLSettingsWater::ptr_t &pwater); + void setSkyTrack(S32 trackno); - void initialize(); - bool isInitialized(); + LLSettingsDay::ptr_t getDayCycle() const { return mDayCycle; } + LLSettingsSky::ptr_t getSky() const { return mSky; } + LLSettingsWater::ptr_t getWater() const { return mWater; } + LLSettingsDay::Seconds getDayLength() const { return mDayLength; } + LLSettingsDay::Seconds getDayOffset() const { return mDayOffset; } + S32 getSkyTrack() const { return mSkyTrack; } - void clear(); + void setDayOffset(LLSettingsBase::Seconds offset) { mDayOffset = offset; animate(); } - void setSkyTrack(S32 trackno); + virtual void animate(); - LLSettingsDay::ptr_t getDayCycle() const { return mDayCycle; } - LLSettingsSky::ptr_t getSky() const { return mSky; } - LLSettingsWater::ptr_t getWater() const { return mWater; } - LLSettingsDay::Seconds getDayLength() const { return mDayLength; } - LLSettingsDay::Seconds getDayOffset() const { return mDayOffset; } - S32 getSkyTrack() const { return mSkyTrack; } + void setBlenders(const LLSettingsBlender::ptr_t &skyblend, const LLSettingsBlender::ptr_t &waterblend); - virtual void animate(); + EnvSelection_t getEnvironmentSelection() const { return mEnv; } + void setEnvironmentSelection(EnvSelection_t env) { mEnv = env; } - void setBlenders(const LLSettingsBlender::ptr_t &skyblend, const LLSettingsBlender::ptr_t &waterblend); + LLSettingsBase::TrackPosition getProgress() const; - EnvSelection_t getEnvironmentSelection() const { return mEnv; } - void setEnvironmentSelection(EnvSelection_t env) { mEnv = env; } protected: LLSettingsDay::ptr_t mDayCycle; LLSettingsSky::ptr_t mSky; diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 482caaaa85..3b148fa89e 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -1797,7 +1797,7 @@ void LLFloaterEditExtDayCycle::loadSettingFromFile(const std::vectorgetAssetUUID(); - LL_WARNS("LAPRAS") << "Locally applying asset ID " << asset_id << LL_ENDL; LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, asset_id); LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL); } @@ -6958,7 +6957,7 @@ void LLSettingsBridge::performAction(LLInventoryModel* model, std::string action } S32 parcel_id = parcel->getLocalID(); - LL_WARNS("LAPRAS") << "Applying asset ID " << asset_id << " to parcel " << parcel_id << LL_ENDL; + LL_DEBUGS("ENVIRONMENT") << "Applying asset ID " << asset_id << " to parcel " << parcel_id << LL_ENDL; LLEnvironment::instance().updateParcel(parcel_id, asset_id, name, LLEnvironment::NO_TRACK, -1, -1); LLEnvironment::instance().setSharedEnvironment(); } diff --git a/indra/newview/llpaneleditwater.cpp b/indra/newview/llpaneleditwater.cpp index f639ad0d98..1f9c79c9eb 100644 --- a/indra/newview/llpaneleditwater.cpp +++ b/indra/newview/llpaneleditwater.cpp @@ -189,7 +189,6 @@ void LLPanelSettingsWaterMainTab::onLargeWaveChanged() { LLVector2 vect(getChild(FIELD_WATER_WAVE1_XY)->getValue()); vect *= -1.0; // Flip so that north and east are - - LL_WARNS("LAPRAS") << "Changing Large Wave from " << mWaterSettings->getWave1Dir() << " -> " << vect << LL_ENDL; mWaterSettings->setWave1Dir(vect); setIsDirty(); } @@ -198,7 +197,6 @@ void LLPanelSettingsWaterMainTab::onSmallWaveChanged() { LLVector2 vect(getChild(FIELD_WATER_WAVE2_XY)->getValue()); vect *= -1.0; // Flip so that north and east are - - LL_WARNS("LAPRAS") << "Changing Small Wave from " << mWaterSettings->getWave2Dir() << " -> " << vect << LL_ENDL; mWaterSettings->setWave2Dir(vect); setIsDirty(); } @@ -207,7 +205,6 @@ void LLPanelSettingsWaterMainTab::onSmallWaveChanged() void LLPanelSettingsWaterMainTab::onNormalScaleChanged() { LLVector3 vect(getChild(FIELD_WATER_NORMAL_SCALE_X)->getValue().asReal(), getChild(FIELD_WATER_NORMAL_SCALE_Y)->getValue().asReal(), getChild(FIELD_WATER_NORMAL_SCALE_Z)->getValue().asReal()); - LL_WARNS("LAPRAS") << "Changing normal scale from " << mWaterSettings->getNormalScale() << " -> " << vect << LL_ENDL; mWaterSettings->setNormalScale(vect); setIsDirty(); } diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index 3ef5e46e38..10a0527fe2 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -324,7 +324,6 @@ void LLSettingsVOBase::onAssetDownloadComplete(LLVFS *vfs, const LLUUID &asset_i } else { - //_WARNS("LAPRAS") << "Setting asset ID to " << asset_id << LL_ENDL; settings->setAssetId(asset_id); } } @@ -870,7 +869,6 @@ LLSD LLSettingsVOWater::convertToLegacy(const LLSettingsWater::ptr_t &pwater) 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; } //------------------------------------------------------------------------- @@ -1120,8 +1118,6 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyMessage(const LLUUID ®io ( SETTING_FRAMES, frames ) ( SETTING_TYPE, "daycycle" ); - //_WARNS("LAPRAS") << "newsettings=" << newsettings << LL_ENDL; - LLSettingsSky::validation_list_t validations = LLSettingsDay::validationList(); LLSD results = LLSettingsDay::settingValidation(newsettings, validations); if (!results["success"].asBoolean()) @@ -1299,7 +1295,6 @@ LLSD LLSettingsVODay::convertToLegacy(const LLSettingsVODay::ptr_t &pday) 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()); @@ -1311,8 +1306,6 @@ LLSD LLSettingsVODay::convertToLegacy(const LLSettingsVODay::ptr_t &pday) llsdskylist[(*its).first] = llsdsky; } - //_WARNS("LAPRAS") << "Sky map with " << llsdskylist.size() << " entries created: " << llsdskylist << LL_ENDL; - return LLSDArray(LLSD::emptyMap())(llsdcycle)(llsdskylist)(llsdwater); } diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 9c0e842c30..1d24df5886 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -941,21 +941,6 @@ bool idle_startup() LLFile::mkdir(gDirUtilp->getChatLogsDir()); LLFile::mkdir(gDirUtilp->getPerAccountChatLogsDir()); - - //good a place as any to create user windlight directories - std::string user_windlight_path_name(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight", "")); - LLFile::mkdir(user_windlight_path_name.c_str()); - - std::string user_windlight_skies_path_name(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/skies", "")); - LLFile::mkdir(user_windlight_skies_path_name.c_str()); - - std::string user_windlight_water_path_name(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/water", "")); - LLFile::mkdir(user_windlight_water_path_name.c_str()); - - std::string user_windlight_days_path_name(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/days", "")); - LLFile::mkdir(user_windlight_days_path_name.c_str()); - - if (show_connect_box) { LLSLURL slurl; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 1bbda04ae6..c9b13f92d3 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -8616,7 +8616,6 @@ class LLWorldEnvPreset : public view_listener_t { std::string item = userdata.asString(); -// *LAPRAS* These go away! Keep for the moment. if (item == "new_water") { LLFloaterReg::showInstance("env_fixed_environmentent_water", "new"); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 0597347ca8..e610387b37 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -3780,11 +3780,24 @@ void process_time_synch(LLMessageSystem *mesgsys, void **user_data) LLWorld::getInstance()->setSpaceTimeUSec(space_time_usec); - LL_DEBUGS("WindlightSync") << "Sun phase: " << phase << " rad = " << fmodf(phase / F_TWO_PI + 0.25, 1.f) * 24.f << " h" << LL_ENDL; + LL_DEBUGS("ENVIRONMENT") << "Sun phase: " << phase << " rad = " << fmodf(phase / F_TWO_PI + 0.25, 1.f) * 24.f << " h" << LL_ENDL; - - /* LAPRAS - We decode these parts of the message but ignore them + F32 region_phase = LLEnvironment::instance().getRegionProgress(); + if (region_phase >= 0.0) + { + F32 adjusted_phase = fmodf(phase / F_TWO_PI + 0.25, 1.f); + F32 delta_phase = adjusted_phase - region_phase; + + LL_DEBUGS("ENVIRONMENT") << "adjusted phase = " << adjusted_phase << " local phase = " << region_phase << " delta = " << delta_phase << LL_ENDL; + + if (!LLEnvironment::instance().isExtendedEnvironmentEnabled() && (fabs(delta_phase) > 0.125)) + { + LL_INFOS("ENVIRONMENT") << "Adjusting environment to match region. adjustment=" << delta_phase << LL_ENDL; + LLEnvironment::instance().adjustRegionOffset(delta_phase); + } + } + + /* We decode these parts of the message but ignore them as the real values are provided elsewhere. */ (void)sun_direction, (void)moon_direction, (void)phase; } diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index cca02544ee..e2a7c563a7 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -1670,7 +1670,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use } } parcel->setParcelEnvironmentVersion(parcel_environment_version); - LL_WARNS("LAPRAS") << "Parcel environment version is " << parcel->getParcelEnvironmentVersion() << LL_ENDL; + LL_DEBUGS("ENVIRONMENT") << "Parcel environment version is " << parcel->getParcelEnvironmentVersion() << LL_ENDL; // Notify anything that wants to know when the agent changes parcels gAgent.changeParcels(); instance->mTeleportInProgress = FALSE; @@ -1682,7 +1682,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use parcel_mgr.mAgentParcel->unpackMessage(msg); if ((LLEnvironment::instance().isExtendedEnvironmentEnabled() && environment_changed)) { - LL_WARNS("LAPRAS") << "Parcel environment version is " << parcel->getParcelEnvironmentVersion() << LL_ENDL; + LL_DEBUGS("ENVIRONMENT") << "Parcel environment version is " << parcel->getParcelEnvironmentVersion() << LL_ENDL; LLEnvironment::instance().requestParcel(local_id); } } -- cgit v1.3