From d7dd10b88bc3fda88f6528ecc5936e4889f019f3 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Thu, 30 Nov 2017 11:32:22 -0800 Subject: Split for viewer/simhost sync LLSD with simhost. --- indra/llinventory/llsettingsbase.cpp | 581 +++++++++++++++++++++++++++++++++++ 1 file changed, 581 insertions(+) create mode 100644 indra/llinventory/llsettingsbase.cpp (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp new file mode 100644 index 0000000000..e4291d8080 --- /dev/null +++ b/indra/llinventory/llsettingsbase.cpp @@ -0,0 +1,581 @@ +/** +* @file llsettingsbase.cpp +* @author optional +* @brief A base class for asset based settings groups. +* +* $LicenseInfo:2011&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2017, 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 "llsettingsbase.h" + +#include "llmath.h" +#include + +#include "llsdserialize.h" + +//========================================================================= +namespace +{ + const F32 BREAK_POINT = 0.5; +} + +//========================================================================= +const std::string LLSettingsBase::SETTING_ID("id"); +const std::string LLSettingsBase::SETTING_NAME("name"); +const std::string LLSettingsBase::SETTING_HASH("hash"); +const std::string LLSettingsBase::SETTING_TYPE("type"); + +const F32Seconds LLSettingsBlender::DEFAULT_THRESHOLD(0.01); + +//========================================================================= +LLSettingsBase::LLSettingsBase(): + mSettings(LLSD::emptyMap()), + mDirty(true) +{ +} + +LLSettingsBase::LLSettingsBase(const LLSD setting) : + mSettings(setting), + mDirty(true) +{ +} + +//========================================================================= +void LLSettingsBase::lerpSettings(const LLSettingsBase &other, F32 mix) +{ + mSettings = interpolateSDMap(mSettings, other.mSettings, mix); + setDirtyFlag(true); +} + +LLSD LLSettingsBase::combineSDMaps(const LLSD &settings, const LLSD &other) const +{ + LLSD newSettings; + + for (LLSD::map_const_iterator it = settings.beginMap(); it != settings.endMap(); ++it) + { + std::string key_name = (*it).first; + LLSD value = (*it).second; + + LLSD::Type setting_type = value.type(); + switch (setting_type) + { + case LLSD::TypeMap: + newSettings[key_name] = combineSDMaps(value, LLSD()); + break; + case LLSD::TypeArray: + newSettings[key_name] = LLSD::emptyArray(); + for (LLSD::array_const_iterator ita = value.beginArray(); ita != value.endArray(); ++ita) + { + newSettings[key_name].append(*ita); + } + break; + //case LLSD::TypeInteger: + //case LLSD::TypeReal: + //case LLSD::TypeBoolean: + //case LLSD::TypeString: + //case LLSD::TypeUUID: + //case LLSD::TypeURI: + //case LLSD::TypeDate: + //case LLSD::TypeBinary: + default: + newSettings[key_name] = value; + break; + } + } + + if (!other.isUndefined()) + { + for (LLSD::map_const_iterator it = other.beginMap(); it != other.endMap(); ++it) + { + std::string key_name = (*it).first; + LLSD value = (*it).second; + + LLSD::Type setting_type = value.type(); + switch (setting_type) + { + case LLSD::TypeMap: + newSettings[key_name] = combineSDMaps(value, LLSD()); + break; + case LLSD::TypeArray: + newSettings[key_name] = LLSD::emptyArray(); + for (LLSD::array_const_iterator ita = value.beginArray(); ita != value.endArray(); ++ita) + { + newSettings[key_name].append(*ita); + } + break; + //case LLSD::TypeInteger: + //case LLSD::TypeReal: + //case LLSD::TypeBoolean: + //case LLSD::TypeString: + //case LLSD::TypeUUID: + //case LLSD::TypeURI: + //case LLSD::TypeDate: + //case LLSD::TypeBinary: + default: + newSettings[key_name] = value; + break; + } + } + } + + return newSettings; +} + +LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, F32 mix) const +{ + LLSD newSettings; + + stringset_t skip = getSkipInterpolateKeys(); + stringset_t slerps = getSlerpKeys(); + + for (LLSD::map_const_iterator it = settings.beginMap(); it != settings.endMap(); ++it) + { + std::string key_name = (*it).first; + LLSD value = (*it).second; + + if (skip.find(key_name) != skip.end()) + continue; + + if (!other.has(key_name)) + { // The other does not contain this setting, keep the original value + // TODO: Should I blend this out instead? + newSettings[key_name] = value; + continue; + } + LLSD::Type setting_type = value.type(); + LLSD other_value = other[key_name]; + + if (other_value.type() != setting_type) + { + // The data type mismatched between this and other. Hard switch when we pass the break point + // but issue a warning. + LL_WARNS("SETTINGS") << "Setting lerp between mismatched types for '" << key_name << "'." << LL_ENDL; + newSettings[key_name] = (mix > BREAK_POINT) ? other_value : value; + continue; + } + + switch (setting_type) + { + case LLSD::TypeInteger: + // lerp between the two values rounding the result to the nearest integer. + newSettings[key_name] = LLSD::Integer(llroundf(lerp(value.asReal(), other_value.asReal(), mix))); + break; + case LLSD::TypeReal: + // lerp between the two values. + newSettings[key_name] = LLSD::Real(lerp(value.asReal(), other_value.asReal(), mix)); + break; + case LLSD::TypeMap: + // deep copy. + newSettings[key_name] = interpolateSDMap(value, other_value, mix); + break; + + case LLSD::TypeArray: + { + LLSD newvalue(LLSD::emptyArray()); + + if (slerps.find(key_name) != slerps.end()) + { + LLQuaternion q = slerp(mix, LLQuaternion(value), LLQuaternion(other_value)); + newvalue = q.getValue(); + } + else + { // TODO: We could expand this to inspect the type and do a deep lerp based on type. + // for now assume a heterogeneous array of reals. + size_t len = std::max(value.size(), other_value.size()); + + for (size_t i = 0; i < len; ++i) + { + + newvalue[i] = lerp(value[i].asReal(), other_value[i].asReal(), mix); + } + } + + newSettings[key_name] = newvalue; + } + + break; + +// case LLSD::TypeBoolean: +// case LLSD::TypeString: +// case LLSD::TypeUUID: +// case LLSD::TypeURI: +// case LLSD::TypeBinary: +// case LLSD::TypeDate: + default: + /* TODO: If the UUID points to an image ID, blend the images. */ + // atomic or unknown data types. Lerping between them does not make sense so switch at the break. + newSettings[key_name] = (mix > BREAK_POINT) ? other_value : value; + break; + } + } + + // Now add anything that is in other but not in the settings + for (LLSD::map_const_iterator it = other.beginMap(); it != other.endMap(); ++it) + { + // TODO: Should I blend this in instead? + if (skip.find((*it).first) == skip.end()) + continue; + + if (!settings.has((*it).first)) + continue; + + newSettings[(*it).first] = (*it).second; + } + + return newSettings; +} + +LLSD LLSettingsBase::getSettings() const +{ + return mSettings; +} + +LLSD LLSettingsBase::cloneSettings() const +{ + return combineSDMaps(mSettings, LLSD()); +} + +size_t LLSettingsBase::getHash() const +{ // get a shallow copy of the LLSD filtering out values to not include in the hash + LLSD hash_settings = llsd_shallow(getSettings(), + LLSDMap(SETTING_NAME, false)(SETTING_ID, false)(SETTING_HASH, false)("*", true)); + + return boost::hash{}(hash_settings); +} + +#ifdef VALIDATION_DEBUG +namespace +{ + bool compare_llsd(LLSD valA, LLSD valB) + { + if (valA.type() != valB.type()) + return false; + + switch (valA.type()) + { + // case LLSD::TypeMap: + // newSettings[key_name] = combineSDMaps(value, LLSD()); + // break; + case LLSD::TypeArray: + if (valA.size() != valB.size()) + return false; + + for (S32 idx = 0; idx < valA.size(); ++idx) + { + if (!compare_llsd(valA[idx], valB[idx])) + return false; + } + return true; + + case LLSD::TypeInteger: + return valA.asInteger() == valB.asInteger(); + + case LLSD::TypeReal: + return is_approx_equal(valA.asReal(), valB.asReal()); + + case LLSD::TypeBoolean: + return valA.asBoolean() == valB.asBoolean(); + + case LLSD::TypeString: + return valA.asString() == valB.asString(); + + case LLSD::TypeUUID: + return valA.asUUID() == valB.asUUID(); + + case LLSD::TypeURI: + return valA.asString() == valB.asString(); + + case LLSD::TypeDate: + return valA.asDate() == valB.asDate(); + } + + return true; + } +} +#endif + +bool LLSettingsBase::validate() +{ + static Validator validateName(SETTING_NAME, false, LLSD::TypeString); + static Validator validateId(SETTING_ID, false, LLSD::TypeUUID); + static Validator validateHash(SETTING_HASH, false, LLSD::TypeInteger); + static Validator validateType(SETTING_TYPE, false, LLSD::TypeString); + validation_list_t validations = getValidationList(); + stringset_t validated; + stringset_t strip; + + if (!mSettings.has(SETTING_TYPE)) + { + mSettings[SETTING_TYPE] = getSettingType(); + } + + // Fields common to all settings. + if (!validateName.verify(mSettings)) + { + LL_WARNS("SETTINGS") << "Unable to validate Name." << LL_ENDL; + mIsValid = false; + return false; + } + validated.insert(validateName.getName()); + + if (!validateId.verify(mSettings)) + { + LL_WARNS("SETTINGS") << "Unable to validate Id." << LL_ENDL; + mIsValid = false; + return false; + } + validated.insert(validateId.getName()); + + if (!validateHash.verify(mSettings)) + { + LL_WARNS("SETTINGS") << "Unable to validate Hash." << LL_ENDL; + mIsValid = false; + return false; + } + validated.insert(validateHash.getName()); + + if (!validateType.verify(mSettings)) + { + LL_WARNS("SETTINGS") << "Unable to validate Type." << LL_ENDL; + mIsValid = false; + return false; + } + validated.insert(validateType.getName()); + + // Fields for specific settings. + for (validation_list_t::iterator itv = validations.begin(); itv != validations.end(); ++itv) + { +#ifdef VALIDATION_DEBUG + LLSD oldvalue; + if (mSettings.has((*itv).getName())) + { + oldvalue = llsd_clone(mSettings[(*itv).getName()]); + } +#endif + + if (!(*itv).verify(mSettings)) + { + LL_WARNS("SETTINGS") << "Settings LLSD fails validation and could not be corrected for '" << (*itv).getName() << "'!" << LL_ENDL; + mIsValid = false; + return false; + } + validated.insert((*itv).getName()); + +#ifdef VALIDATION_DEBUG + if (!oldvalue.isUndefined()) + { + if (!compare_llsd(mSettings[(*itv).getName()], oldvalue)) + { + LL_WARNS("SETTINGS") << "Setting '" << (*itv).getName() << "' was changed: " << oldvalue << " -> " << mSettings[(*itv).getName()] << LL_ENDL; + } + } +#endif + } + + // strip extra entries + for (LLSD::map_iterator itm = mSettings.beginMap(); itm != mSettings.endMap(); ++itm) + { + if (validated.find((*itm).first) == validated.end()) + { + LL_WARNS("SETTINGS") << "Stripping setting '" << (*itm).first << "'" << LL_ENDL; + strip.insert((*itm).first); + } + } + + for (stringset_t::iterator its = strip.begin(); its != strip.end(); ++its) + { + mSettings.erase(*its); + } + + return true; +} + +//========================================================================= +bool LLSettingsBase::Validator::verify(LLSD &data) +{ + if (!data.has(mName) || (data.has(mName) && data[mName].isUndefined())) + { + if (mRequired) + LL_WARNS("SETTINGS") << "Missing required setting '" << mName << "'" << LL_ENDL; + return !mRequired; + } + + if (data[mName].type() != mType) + { + LL_WARNS("SETTINGS") << "Setting '" << mName << "' is incorrect type." << LL_ENDL; + return false; + } + + if (!mVerify.empty() && !mVerify(data[mName])) + { + LL_WARNS("SETTINGS") << "Setting '" << mName << "' fails validation." << LL_ENDL; + return false; + } + + return true; +} + +bool LLSettingsBase::Validator::verifyColor(LLSD &value) +{ + return (value.size() == 3 || value.size() == 4); +} + +bool LLSettingsBase::Validator::verifyVector(LLSD &value, S32 length) +{ + return (value.size() == length); +} + +bool LLSettingsBase::Validator::verifyVectorNormalized(LLSD &value, S32 length) +{ + if (value.size() != length) + return false; + + LLSD newvector; + + switch (length) + { + case 2: + { + LLVector2 vect(value); + + if (is_approx_equal(vect.normalize(), 1.0f)) + return true; + newvector = vect.getValue(); + break; + } + case 3: + { + LLVector3 vect(value); + + if (is_approx_equal(vect.normalize(), 1.0f)) + return true; + newvector = vect.getValue(); + break; + } + case 4: + { + LLVector4 vect(value); + + if (is_approx_equal(vect.normalize(), 1.0f)) + return true; + newvector = vect.getValue(); + break; + } + default: + return false; + } + + return true; +} + +bool LLSettingsBase::Validator::verifyVectorMinMax(LLSD &value, LLSD minvals, LLSD maxvals) +{ + for (S32 index = 0; index < value.size(); ++index) + { + if (minvals[index].asString() != "*") + { + if (minvals[index].asReal() > value[index].asReal()) + { + value[index] = minvals[index].asReal(); + } + } + if (maxvals[index].asString() != "*") + { + if (maxvals[index].asReal() < value[index].asReal()) + { + value[index] = maxvals[index].asReal(); + } + } + } + + return true; +} + +bool LLSettingsBase::Validator::verifyQuaternion(LLSD &value) +{ + return (value.size() == 4); +} + +bool LLSettingsBase::Validator::verifyQuaternionNormal(LLSD &value) +{ + if (value.size() != 4) + return false; + + LLQuaternion quat(value); + + if (is_approx_equal(quat.normalize(), 1.0f)) + return true; + + LLSD newquat = quat.getValue(); + for (S32 index = 0; index < 4; ++index) + { + value[index] = newquat[index]; + } + return true; +} + +bool LLSettingsBase::Validator::verifyFloatRange(LLSD &value, LLSD range) +{ + F32 real = value.asReal(); + + F32 clampedval = llclamp(LLSD::Real(real), range[0].asReal(), range[1].asReal()); + + if (is_approx_equal(clampedval, real)) + return true; + + value = LLSD::Real(clampedval); + return true; +} + +bool LLSettingsBase::Validator::verifyIntegerRange(LLSD &value, LLSD range) +{ + S32 ival = value.asInteger(); + + S32 clampedval = llclamp(LLSD::Integer(ival), range[0].asInteger(), range[1].asInteger()); + + if (clampedval == ival) + return true; + + value = LLSD::Integer(clampedval); + return true; +} + +//========================================================================= + +void LLSettingsBlender::update(F32Seconds timedelta) +{ + mTimeSpent += timedelta; + + if (mTimeSpent >= mSeconds) + { + LLSettingsBlender::ptr_t hold = shared_from_this(); // prevents this from deleting too soon + mOnFinished(shared_from_this()); + mOnFinished.disconnect_all_slots(); // prevent from firing more than once. + return; + } + + F32 blendf = fmod(mTimeSpent.value(), mSeconds.value()) / mSeconds.value(); + + mTarget->replaceSettings(mInitial->getSettings()); + mTarget->blend(mFinal, blendf); +} + -- cgit v1.2.3 From 8211f57205f0008d8ffb9bfcd465ca26d906e19c Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 8 Jan 2018 15:10:25 -0800 Subject: MAINT-7699: Deliver new settings to viewer via cap --- indra/llinventory/llsettingsbase.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index e4291d8080..30b1d66634 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -35,7 +35,7 @@ //========================================================================= namespace { - const F32 BREAK_POINT = 0.5; + const F64 BREAK_POINT = 0.5; } //========================================================================= @@ -44,7 +44,7 @@ const std::string LLSettingsBase::SETTING_NAME("name"); const std::string LLSettingsBase::SETTING_HASH("hash"); const std::string LLSettingsBase::SETTING_TYPE("type"); -const F32Seconds LLSettingsBlender::DEFAULT_THRESHOLD(0.01); +const F64Seconds LLSettingsBlender::DEFAULT_THRESHOLD(0.01); //========================================================================= LLSettingsBase::LLSettingsBase(): @@ -60,7 +60,7 @@ LLSettingsBase::LLSettingsBase(const LLSD setting) : } //========================================================================= -void LLSettingsBase::lerpSettings(const LLSettingsBase &other, F32 mix) +void LLSettingsBase::lerpSettings(const LLSettingsBase &other, F64 mix) { mSettings = interpolateSDMap(mSettings, other.mSettings, mix); setDirtyFlag(true); @@ -140,7 +140,7 @@ LLSD LLSettingsBase::combineSDMaps(const LLSD &settings, const LLSD &other) cons return newSettings; } -LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, F32 mix) const +LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, F64 mix) const { LLSD newSettings; @@ -535,9 +535,9 @@ bool LLSettingsBase::Validator::verifyQuaternionNormal(LLSD &value) bool LLSettingsBase::Validator::verifyFloatRange(LLSD &value, LLSD range) { - F32 real = value.asReal(); + F64 real = value.asReal(); - F32 clampedval = llclamp(LLSD::Real(real), range[0].asReal(), range[1].asReal()); + F64 clampedval = llclamp(LLSD::Real(real), range[0].asReal(), range[1].asReal()); if (is_approx_equal(clampedval, real)) return true; @@ -561,7 +561,7 @@ bool LLSettingsBase::Validator::verifyIntegerRange(LLSD &value, LLSD range) //========================================================================= -void LLSettingsBlender::update(F32Seconds timedelta) +void LLSettingsBlender::update(F64Seconds timedelta) { mTimeSpent += timedelta; @@ -573,7 +573,7 @@ void LLSettingsBlender::update(F32Seconds timedelta) return; } - F32 blendf = fmod(mTimeSpent.value(), mSeconds.value()) / mSeconds.value(); + F64 blendf = fmod(mTimeSpent.value(), mSeconds.value()) / mSeconds.value(); mTarget->replaceSettings(mInitial->getSettings()); mTarget->blend(mFinal, blendf); -- cgit v1.2.3 From 1b8c2b5ebbe0d42f147730bc9b6528fa8c6796ce Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 23 Jan 2018 08:54:34 -0800 Subject: MAINT-8052: Initial support for new EEP cap --- indra/llinventory/llsettingsbase.cpp | 89 +++++++++++++++++++++++------------- 1 file changed, 56 insertions(+), 33 deletions(-) (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 30b1d66634..fb9d8de053 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -315,49 +315,65 @@ namespace bool LLSettingsBase::validate() { - static Validator validateName(SETTING_NAME, false, LLSD::TypeString); - static Validator validateId(SETTING_ID, false, LLSD::TypeUUID); - static Validator validateHash(SETTING_HASH, false, LLSD::TypeInteger); - static Validator validateType(SETTING_TYPE, false, LLSD::TypeString); validation_list_t validations = getValidationList(); - stringset_t validated; - stringset_t strip; if (!mSettings.has(SETTING_TYPE)) { mSettings[SETTING_TYPE] = getSettingType(); } + LLSD result = LLSettingsBase::settingValidation(mSettings, validations); + + if (result["errors"].size() > 0) + { + LL_WARNS("SETTINGS") << "Validation errors: " << result["errors"] << LL_ENDL; + } + if (result["warnings"].size() > 0) + { + LL_WARNS("SETTINGS") << "Validation warnings: " << result["errors"] << LL_ENDL; + } + + return result["success"].asBoolean(); +} + +LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &validations) +{ + static Validator validateName(SETTING_NAME, false, LLSD::TypeString); + static Validator validateId(SETTING_ID, false, LLSD::TypeUUID); + static Validator validateHash(SETTING_HASH, false, LLSD::TypeInteger); + static Validator validateType(SETTING_TYPE, false, LLSD::TypeString); + stringset_t validated; + stringset_t strip; + bool isValid(true); + LLSD errors(LLSD::emptyArray()); + LLSD warnings(LLSD::emptyArray()); + // Fields common to all settings. - if (!validateName.verify(mSettings)) + if (!validateName.verify(settings)) { - LL_WARNS("SETTINGS") << "Unable to validate Name." << LL_ENDL; - mIsValid = false; - return false; + errors.append( LLSD::String("Unable to validate 'name'.") ); + isValid = false; } validated.insert(validateName.getName()); - if (!validateId.verify(mSettings)) + if (!validateId.verify(settings)) { - LL_WARNS("SETTINGS") << "Unable to validate Id." << LL_ENDL; - mIsValid = false; - return false; + errors.append( LLSD::String("Unable to validate 'id'.") ); + isValid = false; } validated.insert(validateId.getName()); - if (!validateHash.verify(mSettings)) + if (!validateHash.verify(settings)) { - LL_WARNS("SETTINGS") << "Unable to validate Hash." << LL_ENDL; - mIsValid = false; - return false; + errors.append( LLSD::String("Unable to validate 'hash'.") ); + isValid = false; } validated.insert(validateHash.getName()); - if (!validateType.verify(mSettings)) + if (!validateType.verify(settings)) { - LL_WARNS("SETTINGS") << "Unable to validate Type." << LL_ENDL; - mIsValid = false; - return false; + errors.append( LLSD::String("Unable to validate 'type'.") ); + isValid = false; } validated.insert(validateType.getName()); @@ -366,47 +382,54 @@ bool LLSettingsBase::validate() { #ifdef VALIDATION_DEBUG LLSD oldvalue; - if (mSettings.has((*itv).getName())) + if (settings.has((*itv).getName())) { oldvalue = llsd_clone(mSettings[(*itv).getName()]); } #endif - if (!(*itv).verify(mSettings)) + if (!(*itv).verify(settings)) { - LL_WARNS("SETTINGS") << "Settings LLSD fails validation and could not be corrected for '" << (*itv).getName() << "'!" << LL_ENDL; - mIsValid = false; - return false; + std::stringstream errtext; + + errtext << "Settings LLSD fails validation and could not be corrected for '" << (*itv).getName() << "'!"; + errors.append( errtext.str() ); + isValid = false; } validated.insert((*itv).getName()); #ifdef VALIDATION_DEBUG if (!oldvalue.isUndefined()) { - if (!compare_llsd(mSettings[(*itv).getName()], oldvalue)) + if (!compare_llsd(settings[(*itv).getName()], oldvalue)) { - LL_WARNS("SETTINGS") << "Setting '" << (*itv).getName() << "' was changed: " << oldvalue << " -> " << mSettings[(*itv).getName()] << LL_ENDL; + LL_WARNS("SETTINGS") << "Setting '" << (*itv).getName() << "' was changed: " << oldvalue << " -> " << settings[(*itv).getName()] << LL_ENDL; } } #endif } // strip extra entries - for (LLSD::map_iterator itm = mSettings.beginMap(); itm != mSettings.endMap(); ++itm) + for (LLSD::map_const_iterator itm = settings.beginMap(); itm != settings.endMap(); ++itm) { if (validated.find((*itm).first) == validated.end()) { - LL_WARNS("SETTINGS") << "Stripping setting '" << (*itm).first << "'" << LL_ENDL; + std::stringstream warntext; + + warntext << "Stripping setting '" << (*itm).first << "'"; + warnings.append( warntext.str() ); strip.insert((*itm).first); } } for (stringset_t::iterator its = strip.begin(); its != strip.end(); ++its) { - mSettings.erase(*its); + settings.erase(*its); } - return true; + return LLSDMap("success", LLSD::Boolean(isValid)) + ("errors", errors) + ("warnings", warnings); } //========================================================================= -- cgit v1.2.3 From 536aeb54a6130f3d1e20405c8f6cbd29201de26d Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 23 Jan 2018 17:34:25 -0800 Subject: MAINT-8052: One more step towards parcel environments. --- indra/llinventory/llsettingsbase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index fb9d8de053..a35504e0e6 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -251,7 +251,7 @@ LLSD LLSettingsBase::getSettings() const LLSD LLSettingsBase::cloneSettings() const { - return combineSDMaps(mSettings, LLSD()); + return combineSDMaps(getSettings(), LLSD()); } size_t LLSettingsBase::getHash() const -- cgit v1.2.3 From 0bf50e2f8cfa5f3ccd6165ce935cf0fd9c174ced Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 30 Jan 2018 16:42:34 -0800 Subject: Cleanup on daycyle selection and stack. Move blenders into environment. (Transition bronken, instant only. Shaddows moved based on region, not parcel) --- indra/llinventory/llsettingsbase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index a35504e0e6..ffeae8677f 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -592,12 +592,12 @@ void LLSettingsBlender::update(F64Seconds timedelta) { LLSettingsBlender::ptr_t hold = shared_from_this(); // prevents this from deleting too soon mOnFinished(shared_from_this()); - mOnFinished.disconnect_all_slots(); // prevent from firing more than once. return; } F64 blendf = fmod(mTimeSpent.value(), mSeconds.value()) / mSeconds.value(); + //_WARNS("LAPRAS") << "blending at " << (blendf * 100.0f) << "%" << LL_ENDL; mTarget->replaceSettings(mInitial->getSettings()); mTarget->blend(mFinal, blendf); } -- cgit v1.2.3 From e9edd37cdb39639e1ab24e2e63d4f83432282c88 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 9 Feb 2018 10:10:13 -0800 Subject: Update a couple constructs --- indra/llinventory/llsettingsbase.cpp | 81 +++--------------------------------- 1 file changed, 6 insertions(+), 75 deletions(-) (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index ffeae8677f..7ade345168 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -262,57 +262,6 @@ size_t LLSettingsBase::getHash() const return boost::hash{}(hash_settings); } -#ifdef VALIDATION_DEBUG -namespace -{ - bool compare_llsd(LLSD valA, LLSD valB) - { - if (valA.type() != valB.type()) - return false; - - switch (valA.type()) - { - // case LLSD::TypeMap: - // newSettings[key_name] = combineSDMaps(value, LLSD()); - // break; - case LLSD::TypeArray: - if (valA.size() != valB.size()) - return false; - - for (S32 idx = 0; idx < valA.size(); ++idx) - { - if (!compare_llsd(valA[idx], valB[idx])) - return false; - } - return true; - - case LLSD::TypeInteger: - return valA.asInteger() == valB.asInteger(); - - case LLSD::TypeReal: - return is_approx_equal(valA.asReal(), valB.asReal()); - - case LLSD::TypeBoolean: - return valA.asBoolean() == valB.asBoolean(); - - case LLSD::TypeString: - return valA.asString() == valB.asString(); - - case LLSD::TypeUUID: - return valA.asUUID() == valB.asUUID(); - - case LLSD::TypeURI: - return valA.asString() == valB.asString(); - - case LLSD::TypeDate: - return valA.asDate() == valB.asDate(); - } - - return true; - } -} -#endif - bool LLSettingsBase::validate() { validation_list_t validations = getValidationList(); @@ -378,35 +327,17 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &valida validated.insert(validateType.getName()); // Fields for specific settings. - for (validation_list_t::iterator itv = validations.begin(); itv != validations.end(); ++itv) + for (auto &test: validations) { -#ifdef VALIDATION_DEBUG - LLSD oldvalue; - if (settings.has((*itv).getName())) - { - oldvalue = llsd_clone(mSettings[(*itv).getName()]); - } -#endif - - if (!(*itv).verify(settings)) + if (!test.verify(settings)) { std::stringstream errtext; - errtext << "Settings LLSD fails validation and could not be corrected for '" << (*itv).getName() << "'!"; + errtext << "Settings LLSD fails validation and could not be corrected for '" << test.getName() << "'!"; errors.append( errtext.str() ); isValid = false; } - 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 + validated.insert(test.getName()); } // strip extra entries @@ -422,9 +353,9 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &valida } } - for (stringset_t::iterator its = strip.begin(); its != strip.end(); ++its) + for (const std::string &its: strip) { - settings.erase(*its); + settings.erase(its); } return LLSDMap("success", LLSD::Boolean(isValid)) -- cgit v1.2.3 From 6cc4a091b3ba4dd4842cc06e3b34af3d04dc5796 Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Thu, 22 Feb 2018 00:35:24 +0000 Subject: Add settings/validations for new advanced atmo settings. --- indra/llinventory/llsettingsbase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 7ade345168..0918252fa0 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -333,7 +333,7 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &valida { std::stringstream errtext; - errtext << "Settings LLSD fails validation and could not be corrected for '" << test.getName() << "'!"; + errtext << "Settings LLSD fails validation and could not be corrected for '" << test.getName() << "'!\n"; errors.append( errtext.str() ); isValid = false; } -- cgit v1.2.3 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/llinventory/llsettingsbase.cpp | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 7ade345168..3382716577 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -38,6 +38,14 @@ namespace const F64 BREAK_POINT = 0.5; } +//========================================================================= +std::ostream &::operator <<(std::ostream& os, LLSettingsBase &settings) +{ + LLSDSerialize::serialize(settings.getSettings(), os, LLSDSerialize::LLSD_NOTATION); + + return os; +} + //========================================================================= const std::string LLSettingsBase::SETTING_ID("id"); const std::string LLSettingsBase::SETTING_NAME("name"); @@ -49,13 +57,15 @@ const F64Seconds LLSettingsBlender::DEFAULT_THRESHOLD(0.01); //========================================================================= LLSettingsBase::LLSettingsBase(): mSettings(LLSD::emptyMap()), - mDirty(true) + mDirty(true), + mAssetID() { } LLSettingsBase::LLSettingsBase(const LLSD setting) : mSettings(setting), - mDirty(true) + mDirty(true), + mAssetID() { } @@ -368,8 +378,14 @@ bool LLSettingsBase::Validator::verify(LLSD &data) { if (!data.has(mName) || (data.has(mName) && data[mName].isUndefined())) { + if (!mDefault.isUndefined()) + { + LL_INFOS("SETTINGS") << "Inserting missing default for '" << mName << "'." << LL_ENDL; + data[mName] = mDefault; + return true; + } if (mRequired) - LL_WARNS("SETTINGS") << "Missing required setting '" << mName << "'" << LL_ENDL; + LL_WARNS("SETTINGS") << "Missing required setting '" << mName << "' with no default." << LL_ENDL; return !mRequired; } @@ -514,7 +530,6 @@ bool LLSettingsBase::Validator::verifyIntegerRange(LLSD &value, LLSD range) } //========================================================================= - void LLSettingsBlender::update(F64Seconds timedelta) { mTimeSpent += timedelta; -- cgit v1.2.3 From 09a8b0e501bd0b204eceb43b7103bd1324302806 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 27 Feb 2018 12:27:21 -0800 Subject: Need to bring the mac in... --- indra/llinventory/llsettingsbase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 3382716577..901c8dbe8e 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -39,7 +39,7 @@ namespace } //========================================================================= -std::ostream &::operator <<(std::ostream& os, LLSettingsBase &settings) +std::ostream &operator <<(std::ostream& os, LLSettingsBase &settings) { LLSDSerialize::serialize(settings.getSettings(), os, LLSDSerialize::LLSD_NOTATION); -- cgit v1.2.3 From 3925e37532476c526375fd76143b2b5e1dcce9b9 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 15 May 2018 17:17:51 -0700 Subject: Fix the blend code to record the amount of the blend and to store what is being blended towards. --- indra/llinventory/llsettingsbase.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index abe1a1a04a..f2dfeaf154 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -58,14 +58,16 @@ const F64Seconds LLSettingsBlender::DEFAULT_THRESHOLD(0.01); LLSettingsBase::LLSettingsBase(): mSettings(LLSD::emptyMap()), mDirty(true), - mAssetID() + mAssetID(), + mBlendedFactor(0.0) { } LLSettingsBase::LLSettingsBase(const LLSD setting) : mSettings(setting), mDirty(true), - mAssetID() + mAssetID(), + mBlendedFactor(0.0) { } @@ -224,9 +226,12 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, F break; + case LLSD::TypeUUID: + newSettings[key_name] = value.asUUID(); + break; + // case LLSD::TypeBoolean: // case LLSD::TypeString: -// case LLSD::TypeUUID: // case LLSD::TypeURI: // case LLSD::TypeBinary: // case LLSD::TypeDate: -- cgit v1.2.3 From 4975bd03c12673778616e1cca1811bf906bb42a6 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 16 May 2018 13:42:48 -0700 Subject: Splitting the blender up to support manual positioning as well as time. Phase1 --- indra/llinventory/llsettingsbase.cpp | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index f2dfeaf154..daf42fc073 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -52,8 +52,6 @@ const std::string LLSettingsBase::SETTING_NAME("name"); const std::string LLSettingsBase::SETTING_HASH("hash"); const std::string LLSettingsBase::SETTING_TYPE("type"); -const F64Seconds LLSettingsBlender::DEFAULT_THRESHOLD(0.01); - //========================================================================= LLSettingsBase::LLSettingsBase(): mSettings(LLSD::emptyMap()), @@ -535,21 +533,37 @@ bool LLSettingsBase::Validator::verifyIntegerRange(LLSD &value, LLSD range) } //========================================================================= -void LLSettingsBlender::update(F64Seconds timedelta) +void LLSettingsBlender::update(F64 blendf) { - mTimeSpent += timedelta; - if (mTimeSpent >= mSeconds) +} + +F64 LLSettingsBlender::setPosition(F64 blendf) +{ + if (blendf >= 1.0) { + mTarget->replaceSettings(mFinal->getSettings()); LLSettingsBlender::ptr_t hold = shared_from_this(); // prevents this from deleting too soon mOnFinished(shared_from_this()); - return; + return 1.0; } - - F64 blendf = fmod(mTimeSpent.value(), mSeconds.value()) / mSeconds.value(); + blendf = llclamp(blendf, 0.0, 1.0); //_WARNS("LAPRAS") << "blending at " << (blendf * 100.0f) << "%" << LL_ENDL; mTarget->replaceSettings(mInitial->getSettings()); mTarget->blend(mFinal, blendf); + + return blendf; } +//------------------------------------------------------------------------- +void LLSettingsBlenderTimeDelta::update(F64 timedelta) +{ + mTimeSpent += F64Seconds(timedelta); + + F64 blendf = fmod(mTimeSpent.value(), mBlendSpan.value()) / mBlendSpan.value(); + + // Note no clamp here. + + setPosition(blendf); +} -- cgit v1.2.3 From b117a9ea197a084eeec1e8330dbe7c562423e248 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Thu, 17 May 2018 12:05:31 -0700 Subject: Fix end of cycle trigger for time blender. --- indra/llinventory/llsettingsbase.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index daf42fc073..a6a7a9acf9 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -542,9 +542,7 @@ F64 LLSettingsBlender::setPosition(F64 blendf) { if (blendf >= 1.0) { - mTarget->replaceSettings(mFinal->getSettings()); - LLSettingsBlender::ptr_t hold = shared_from_this(); // prevents this from deleting too soon - mOnFinished(shared_from_this()); + triggerComplete(); return 1.0; } blendf = llclamp(blendf, 0.0, 1.0); @@ -556,11 +554,24 @@ F64 LLSettingsBlender::setPosition(F64 blendf) return blendf; } +void LLSettingsBlender::triggerComplete() +{ + mTarget->replaceSettings(mFinal->getSettings()); + LLSettingsBlender::ptr_t hold = shared_from_this(); // prevents this from deleting too soon + mOnFinished(shared_from_this()); +} + //------------------------------------------------------------------------- void LLSettingsBlenderTimeDelta::update(F64 timedelta) { mTimeSpent += F64Seconds(timedelta); + if (mTimeSpent > mBlendSpan) + { + triggerComplete(); + return; + } + F64 blendf = fmod(mTimeSpent.value(), mBlendSpan.value()) / mBlendSpan.value(); // Note no clamp here. -- cgit v1.2.3 From 044b80e4e1a7b55f46e6f3b52c9cae6d9c6df3eb Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 22 May 2018 10:49:55 -0700 Subject: Manual blender for use in day editing dialog. --- indra/llinventory/llsettingsbase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index a6a7a9acf9..f870ec8904 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -535,7 +535,7 @@ bool LLSettingsBase::Validator::verifyIntegerRange(LLSD &value, LLSD range) //========================================================================= void LLSettingsBlender::update(F64 blendf) { - + setPosition(blendf); } F64 LLSettingsBlender::setPosition(F64 blendf) -- cgit v1.2.3 From fa4ac065cb332c8c90fb59eeff0b983a1fd56691 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Thu, 24 May 2018 13:11:33 -0700 Subject: Enable sky changes with altitude. --- indra/llinventory/llsettingsbase.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index f870ec8904..411eaff8e3 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -547,8 +547,11 @@ F64 LLSettingsBlender::setPosition(F64 blendf) } blendf = llclamp(blendf, 0.0, 1.0); - //_WARNS("LAPRAS") << "blending at " << (blendf * 100.0f) << "%" << LL_ENDL; mTarget->replaceSettings(mInitial->getSettings()); + if (mIsTrivial || (blendf == 0.0)) + { // this is a trivial blend. Results will be identical to the initial. + return blendf; + } mTarget->blend(mFinal, blendf); return blendf; @@ -562,6 +565,11 @@ void LLSettingsBlender::triggerComplete() } //------------------------------------------------------------------------- +F64 LLSettingsBlenderTimeDelta::calculateBlend(F64 spanpos, F64 spanlen) const +{ + return fmod(spanpos, spanlen) / spanlen; +} + void LLSettingsBlenderTimeDelta::update(F64 timedelta) { mTimeSpent += F64Seconds(timedelta); @@ -572,8 +580,7 @@ void LLSettingsBlenderTimeDelta::update(F64 timedelta) return; } - F64 blendf = fmod(mTimeSpent.value(), mBlendSpan.value()) / mBlendSpan.value(); - + F64 blendf = calculateBlend(mTimeSpent.value(), mBlendSpan.value()); // Note no clamp here. setPosition(blendf); -- cgit v1.2.3 From acaf57100eade61262d73cf5b318c4545e921bd5 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Thu, 24 May 2018 17:09:01 -0700 Subject: switch track based on altitudes sent from region. --- indra/llinventory/llsettingsbase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 411eaff8e3..d8e337e231 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -548,7 +548,7 @@ F64 LLSettingsBlender::setPosition(F64 blendf) blendf = llclamp(blendf, 0.0, 1.0); mTarget->replaceSettings(mInitial->getSettings()); - if (mIsTrivial || (blendf == 0.0)) + if (!mFinal || (mInitial == mFinal) || (blendf == 0.0)) { // this is a trivial blend. Results will be identical to the initial. return blendf; } -- cgit v1.2.3 From 8cfdc07e790a557e881fadaa1b6258e5b16751f4 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 1 Jun 2018 23:32:30 +0100 Subject: Code cleanup and move to using typedefs of S64Seconds/F64Seconds for ease in sync w/ sim side which has not llunits types. --- indra/llinventory/llsettingsbase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index d8e337e231..a661d52b7f 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -572,7 +572,7 @@ F64 LLSettingsBlenderTimeDelta::calculateBlend(F64 spanpos, F64 spanlen) const void LLSettingsBlenderTimeDelta::update(F64 timedelta) { - mTimeSpent += F64Seconds(timedelta); + mTimeSpent += LLSettingsBase::Seconds(timedelta); if (mTimeSpent > mBlendSpan) { -- cgit v1.2.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/llinventory/llsettingsbase.cpp | 51 +++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 16 deletions(-) (limited to 'indra/llinventory/llsettingsbase.cpp') 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); } -- cgit v1.2.3 From cd8f0da2d187df69a99a665ea11faaa4e13b7a12 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 4 Jun 2018 23:12:21 +0100 Subject: Fix use of new typedefs in inventory settings code in llenvironment. --- indra/llinventory/llsettingsbase.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 23afbdfa3a..76b1e0b2a6 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -35,7 +35,7 @@ //========================================================================= namespace { - const LLSettingsBase::BlendFactor BREAK_POINT = 0.5; + const LLSettingsBase::TrackPosition BREAK_POINT = 0.5; } //========================================================================= @@ -554,10 +554,10 @@ bool LLSettingsBase::Validator::verifyIntegerRange(LLSD &value, LLSD range) //========================================================================= void LLSettingsBlender::update(const LLSettingsBase::BlendFactor& blendf) { - setPosition(blendf); + setBlendFactor(blendf); } -F64 LLSettingsBlender::setPosition(const LLSettingsBase::TrackPosition& blendf_in) +F64 LLSettingsBlender::setBlendFactor(const LLSettingsBase::BlendFactor& blendf_in) { LLSettingsBase::TrackPosition blendf = blendf_in; if (blendf >= 1.0) @@ -565,7 +565,7 @@ F64 LLSettingsBlender::setPosition(const LLSettingsBase::TrackPosition& blendf_i triggerComplete(); return 1.0; } - blendf = llclamp(blendf, 0.0, 1.0); + blendf = llclamp(blendf, 0.0f, 1.0f); mTarget->replaceSettings(mInitial->getSettings()); if (!mFinal || (mInitial == mFinal) || (blendf == 0.0)) @@ -590,7 +590,7 @@ LLSettingsBase::BlendFactor LLSettingsBlenderTimeDelta::calculateBlend(const LLS return LLSettingsBase::BlendFactor(fmod((F64)spanpos, (F64)spanlen) / (F64)spanlen); } -void LLSettingsBlenderTimeDelta::advance(const LLSettingsBase::Seconds& timedelta) +void LLSettingsBlenderTimeDelta::applyTimeDelta(const LLSettingsBase::Seconds& timedelta) { mTimeSpent += timedelta; @@ -602,5 +602,5 @@ void LLSettingsBlenderTimeDelta::advance(const LLSettingsBase::Seconds& timedelt LLSettingsBase::BlendFactor blendf = calculateBlend(mTimeSpent, mBlendSpan); - setPosition(blendf); + update(blendf); } -- cgit v1.2.3 From bff5049b9262e703c3ae583962552ea416212e8b Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 6 Jun 2018 17:10:58 -0700 Subject: Various editor fixes. Start adding a settings picker. --- indra/llinventory/llsettingsbase.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 76b1e0b2a6..b677eb36df 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -38,6 +38,8 @@ namespace const LLSettingsBase::TrackPosition BREAK_POINT = 0.5; } +const LLSettingsBase::TrackPosition LLSettingsBase::INVALID_TRACKPOS(-1.0); + //========================================================================= std::ostream &operator <<(std::ostream& os, LLSettingsBase &settings) { -- cgit v1.2.3 From 1f9b8f59afceeb8201780b679659f64845dcd7c1 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 19 Jun 2018 16:46:12 -0700 Subject: Don't recalculate lighting every frame. Fix altitude transitions. On track switch ignore time threshold on blender. --- indra/llinventory/llsettingsbase.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 24e808c92a..db30a25a4c 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -610,10 +610,12 @@ void LLSettingsBlenderTimeDelta::applyTimeDelta(const LLSettingsBase::Seconds& t if (mTimeSpent > mBlendSpan) { + mIgnoreTimeDelta = false; triggerComplete(); return; } - if (mTimeDeltaPassed < mTimeDeltaThreshold) + + if ((mTimeDeltaPassed < mTimeDeltaThreshold) && (!mIgnoreTimeDelta)) { return; } -- cgit v1.2.3 From 8365945f8af6e27e7180b40aae79f210f99bb7c8 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 8 Jun 2018 16:40:01 -0700 Subject: Settings inventory picker. --- indra/llinventory/llsettingsbase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index b677eb36df..1b3b5d2576 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -284,7 +284,7 @@ bool LLSettingsBase::validate() if (!mSettings.has(SETTING_TYPE)) { - mSettings[SETTING_TYPE] = getSettingType(); + mSettings[SETTING_TYPE] = getSettingsType(); } LLSD result = LLSettingsBase::settingValidation(mSettings, validations); -- cgit v1.2.3 From 67ab0084f87c40bf31d7fadded55cc9ea6299ca2 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 12 Jun 2018 18:42:07 +0100 Subject: Fix env panel forward action. Make env panel update environment when jumping frame to frame. Add separate funcs for sun/moon vectors in various coord systems. Make haze glow only pay attention to sun (i.e. fix sun glow when moon is near horizon in daytime). --- indra/llinventory/llsettingsbase.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 1b3b5d2576..a261c98bb1 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -206,7 +206,9 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, F if (slerps.find(key_name) != slerps.end()) { - LLQuaternion q = slerp(mix, LLQuaternion(value), LLQuaternion(other_value)); + LLQuaternion a(value); + LLQuaternion b(other_value); + LLQuaternion q = slerp(mix, a, b); newvalue = q.getValue(); } else -- cgit v1.2.3 From 2add1e7abdf536b32bfbfa4b353189782df8cb19 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 12 Jun 2018 12:39:59 -0700 Subject: Time threshold on timer based updates. Editor can replace frame with one from inventory. Extra check on adding a frame type. --- indra/llinventory/llsettingsbase.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 1b3b5d2576..f28d90cb62 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -53,6 +53,7 @@ const std::string LLSettingsBase::SETTING_ID("id"); const std::string LLSettingsBase::SETTING_NAME("name"); const std::string LLSettingsBase::SETTING_HASH("hash"); const std::string LLSettingsBase::SETTING_TYPE("type"); +const std::string LLSettingsBase::SETTING_ASSETID("asset_id"); //========================================================================= LLSettingsBase::LLSettingsBase(): @@ -307,6 +308,7 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &valida static Validator validateId(SETTING_ID, false, LLSD::TypeUUID); static Validator validateHash(SETTING_HASH, false, LLSD::TypeInteger); static Validator validateType(SETTING_TYPE, false, LLSD::TypeString); + static Validator validateAssetId(SETTING_ASSETID, false, LLSD::TypeUUID); stringset_t validated; stringset_t strip; bool isValid(true); @@ -335,6 +337,13 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &valida } validated.insert(validateHash.getName()); + if (!validateAssetId.verify(settings)) + { + errors.append(LLSD::String("Invalid asset Id")); + isValid = false; + } + validated.insert(validateAssetId.getName()); + if (!validateType.verify(settings)) { errors.append( LLSD::String("Unable to validate 'type'.") ); @@ -595,12 +604,19 @@ LLSettingsBase::BlendFactor LLSettingsBlenderTimeDelta::calculateBlend(const LLS void LLSettingsBlenderTimeDelta::applyTimeDelta(const LLSettingsBase::Seconds& timedelta) { mTimeSpent += timedelta; + mTimeDeltaPassed += timedelta; if (mTimeSpent > mBlendSpan) { triggerComplete(); return; } + if (mTimeDeltaPassed < mTimeDeltaThreshold) + { + return; + } + + mTimeDeltaPassed = LLSettingsBase::Seconds(0.0); LLSettingsBase::BlendFactor blendf = calculateBlend(mTimeSpent, mBlendSpan); -- cgit v1.2.3 From 66d78ce1c73d5da3bc5bc39fe0196a9f82040105 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 15 Jun 2018 21:15:02 +0100 Subject: Make water and sky defaults take a position value to allow for default daycycle w/ multiple frames. Make default daycycle add 8 frames at 0, 0.125, 0.25 etc Merge over server-side bugfixes. Eliminate extraneous dirty bits in sky settings. --- indra/llinventory/llsettingsbase.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 24e808c92a..fb4f5cdd60 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -580,10 +580,18 @@ F64 LLSettingsBlender::setBlendFactor(const LLSettingsBase::BlendFactor& blendf_ } blendf = llclamp(blendf, 0.0f, 1.0f); - mTarget->replaceSettings(mInitial->getSettings()); - if (!mFinal || (mInitial == mFinal) || (blendf == 0.0)) - { // this is a trivial blend. Results will be identical to the initial. - return blendf; + if (mTarget) + { + mTarget->replaceSettings(mInitial->getSettings()); + if (!mFinal || (mInitial == mFinal) || (blendf == 0.0)) + { // this is a trivial blend. Results will be identical to the initial. + return blendf; + } + mTarget->blend(mFinal, blendf); + } + else + { + LL_WARNS("SETTINGS") << "No target for settings blender." << LL_ENDL; } mTarget->blend(mFinal, blendf); @@ -592,7 +600,8 @@ F64 LLSettingsBlender::setBlendFactor(const LLSettingsBase::BlendFactor& blendf_ void LLSettingsBlender::triggerComplete() { - mTarget->replaceSettings(mFinal->getSettings()); + if (mTarget) + mTarget->replaceSettings(mFinal->getSettings()); LLSettingsBlender::ptr_t hold = shared_from_this(); // prevents this from deleting too soon mOnFinished(shared_from_this()); } -- cgit v1.2.3 From 02ffb06463e8b2ae3654c0de35d7f0fbab72025c Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 22 Jun 2018 01:00:23 +0100 Subject: Fix double blend and warnings reported as errors. --- indra/llinventory/llsettingsbase.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 7bcafabb8a..f282f0c7dc 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -298,8 +298,9 @@ bool LLSettingsBase::validate() } if (result["warnings"].size() > 0) { - LL_WARNS("SETTINGS") << "Validation warnings: " << result["errors"] << LL_ENDL; + LL_WARNS("SETTINGS") << "Validation warnings: " << result["warnings"] << LL_ENDL; } + LL_WARNS("SETTINGS") << "Validation success is " << result["success"] << LL_ENDL; return result["success"].asBoolean(); } @@ -593,7 +594,6 @@ F64 LLSettingsBlender::setBlendFactor(const LLSettingsBase::BlendFactor& blendf_ { LL_WARNS("SETTINGS") << "No target for settings blender." << LL_ENDL; } - mTarget->blend(mFinal, blendf); return blendf; } -- cgit v1.2.3 From ca5d5be4fb51fa1ee7ffda24a0aa58c71facd7dd Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 11 Jul 2018 16:46:14 -0700 Subject: Minor change from the simulator to throttle the minimum blend in a time based blend. --- indra/llinventory/llsettingsbase.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index f282f0c7dc..8bcf8a4973 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -607,6 +607,8 @@ void LLSettingsBlender::triggerComplete() } //------------------------------------------------------------------------- +const LLSettingsBase::BlendFactor LLSettingsBlenderTimeDelta::MIN_BLEND_DELTA(0.001); + LLSettingsBase::BlendFactor LLSettingsBlenderTimeDelta::calculateBlend(const LLSettingsBase::TrackPosition& spanpos, const LLSettingsBase::TrackPosition& spanlen) const { return LLSettingsBase::BlendFactor(fmod((F64)spanpos, (F64)spanlen) / (F64)spanlen); @@ -629,9 +631,15 @@ void LLSettingsBlenderTimeDelta::applyTimeDelta(const LLSettingsBase::Seconds& t return; } + LLSettingsBase::BlendFactor blendf = calculateBlend(mTimeSpent, mBlendSpan); mTimeDeltaPassed = LLSettingsBase::Seconds(0.0); - LLSettingsBase::BlendFactor blendf = calculateBlend(mTimeSpent, mBlendSpan); + if (fabs(mLastBlendF - blendf) < mBlendFMinDelta) + { + return; + } + + mLastBlendF = blendf; update(blendf); } -- cgit v1.2.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/llsettingsbase.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/llinventory/llsettingsbase.cpp') 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(); } -- cgit v1.2.3 From 4859db1adabcf84b959ff0603f1bb8401232164c Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 21 Aug 2018 15:59:18 -0700 Subject: MAINT-9026: Adding scale for sun and moon. Also don't allow the user to directly set the radio buttons for inventory and custom. --- indra/llinventory/llsettingsbase.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index e00dd2199c..938f614fc9 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -306,7 +306,7 @@ bool LLSettingsBase::validate() LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &validations) { - static Validator validateName(SETTING_NAME, false, LLSD::TypeString); + static Validator validateName(SETTING_NAME, false, LLSD::TypeString, boost::bind(&Validator::verifyStringLength, _1, 32)); static Validator validateId(SETTING_ID, false, LLSD::TypeUUID); static Validator validateHash(SETTING_HASH, false, LLSD::TypeInteger); static Validator validateType(SETTING_TYPE, false, LLSD::TypeString); @@ -564,6 +564,18 @@ bool LLSettingsBase::Validator::verifyIntegerRange(LLSD &value, LLSD range) return true; } +bool LLSettingsBase::Validator::verifyStringLength(LLSD &value, S32 length) +{ + std::string sval = value.asString(); + + if (!sval.empty()) + { + sval = sval.substr(0, length); + value = LLSD::String(sval); + } + return true; +} + //========================================================================= void LLSettingsBlender::update(const LLSettingsBase::BlendFactor& blendf) { -- cgit v1.2.3 From 3b10414c632e73d66d2840ddcd474a79fa120540 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 31 Aug 2018 11:47:18 -0700 Subject: Adding optional flags to settings objects. --- indra/llinventory/llsettingsbase.cpp | 38 ++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 938f614fc9..5283a8dc8a 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -54,6 +54,10 @@ const std::string LLSettingsBase::SETTING_NAME("name"); const std::string LLSettingsBase::SETTING_HASH("hash"); const std::string LLSettingsBase::SETTING_TYPE("type"); const std::string LLSettingsBase::SETTING_ASSETID("asset_id"); +const std::string LLSettingsBase::SETTING_FLAGS("flags"); + +const U32 LLSettingsBase::FLAG_NOCOPY(0x01 << 0); +const U32 LLSettingsBase::FLAG_NOMOD(0x01 << 1); //========================================================================= LLSettingsBase::LLSettingsBase(): @@ -239,13 +243,23 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, F // case LLSD::TypeBinary: // case LLSD::TypeDate: default: - /* TODO: If the UUID points to an image ID, blend the images. */ // atomic or unknown data types. Lerping between them does not make sense so switch at the break. newSettings[key_name] = (mix > BREAK_POINT) ? other_value : value; break; } } + // Special handling cases + // Flags + if (settings.has(SETTING_FLAGS)) + { + U32 flags = (U32)settings[SETTING_FLAGS].asInteger(); + if (other.has(SETTING_FLAGS)) + flags |= (U32)other[SETTING_FLAGS].asInteger(); + + newSettings[SETTING_FLAGS] = LLSD::Integer(flags); + } + // Now add anything that is in other but not in the settings for (LLSD::map_const_iterator it = other.beginMap(); it != other.endMap(); ++it) { @@ -262,6 +276,19 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, F return newSettings; } +LLSettingsBase::stringset_t LLSettingsBase::getSkipInterpolateKeys() const +{ + static stringset_t skipSet; + + if (skipSet.empty()) + { + skipSet.insert(SETTING_FLAGS); + skipSet.insert(SETTING_HASH); + } + + return skipSet; +} + LLSD LLSettingsBase::getSettings() const { return mSettings; @@ -311,6 +338,7 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &valida static Validator validateHash(SETTING_HASH, false, LLSD::TypeInteger); static Validator validateType(SETTING_TYPE, false, LLSD::TypeString); static Validator validateAssetId(SETTING_ASSETID, false, LLSD::TypeUUID); + static Validator validateFlags(SETTING_FLAGS, false, LLSD::TypeInteger); stringset_t validated; stringset_t strip; bool isValid(true); @@ -353,6 +381,13 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &valida } validated.insert(validateType.getName()); + if (!validateFlags.verify(settings)) + { + errors.append(LLSD::String("Unable to validate 'flags'.")); + isValid = false; + } + validated.insert(validateFlags.getName()); + // Fields for specific settings. for (validation_list_t::iterator itv = validations.begin(); itv != validations.end(); ++itv) { @@ -415,7 +450,6 @@ bool LLSettingsBase::Validator::verify(LLSD &data) { if (!mDefault.isUndefined()) { - LL_INFOS("SETTINGS") << "Inserting missing default for '" << mName << "'." << LL_ENDL; data[mName] = mDefault; return true; } -- cgit v1.2.3 From 114e358aae80e9e3ca70de093d51e4700c46df37 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 7 Sep 2018 16:09:32 -0700 Subject: Work to make edit floaters respect no mod and no trans. Importing no-trans frame will cause day cycle to become no trans. --- indra/llinventory/llsettingsbase.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 5283a8dc8a..2adbb213e6 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -58,6 +58,7 @@ const std::string LLSettingsBase::SETTING_FLAGS("flags"); const U32 LLSettingsBase::FLAG_NOCOPY(0x01 << 0); const U32 LLSettingsBase::FLAG_NOMOD(0x01 << 1); +const U32 LLSettingsBase::FLAG_NOTRANS(0x01 << 2); //========================================================================= LLSettingsBase::LLSettingsBase(): -- cgit v1.2.3 From 659d14504f6ab4ad283efe4ecd950a4483e1498f Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 29 Oct 2018 18:18:20 +0200 Subject: SL-1476 EEP Better shader resets and transitions --- indra/llinventory/llsettingsbase.cpp | 192 ++++++++++++++++++++++------------- 1 file changed, 120 insertions(+), 72 deletions(-) (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 2adbb213e6..80680948b5 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -80,7 +80,7 @@ LLSettingsBase::LLSettingsBase(const LLSD setting) : //========================================================================= void LLSettingsBase::lerpSettings(const LLSettingsBase &other, F64 mix) { - mSettings = interpolateSDMap(mSettings, other.mSettings, mix); + mSettings = interpolateSDMap(mSettings, other.mSettings, other.getParameterMap(), mix); setDirtyFlag(true); } @@ -158,7 +158,7 @@ LLSD LLSettingsBase::combineSDMaps(const LLSD &settings, const LLSD &other) cons return newSettings; } -LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, F64 mix) const +LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, const parammapping_t& defaults, F64 mix) const { LLSD newSettings; @@ -173,81 +173,33 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, F if (skip.find(key_name) != skip.end()) continue; - if (!other.has(key_name)) - { // The other does not contain this setting, keep the original value - // TODO: Should I blend this out instead? - newSettings[key_name] = value; - continue; - } - LLSD::Type setting_type = value.type(); - LLSD other_value = other[key_name]; - - if (other_value.type() != setting_type) - { - // The data type mismatched between this and other. Hard switch when we pass the break point - // but issue a warning. - LL_WARNS("SETTINGS") << "Setting lerp between mismatched types for '" << key_name << "'." << LL_ENDL; - newSettings[key_name] = (mix > BREAK_POINT) ? other_value : value; - continue; + LLSD other_value; + if (other.has(key_name)) + { + other_value = other[key_name]; } - - switch (setting_type) + else { - case LLSD::TypeInteger: - // lerp between the two values rounding the result to the nearest integer. - newSettings[key_name] = LLSD::Integer(llroundf(lerp(value.asReal(), other_value.asReal(), mix))); - break; - case LLSD::TypeReal: - // lerp between the two values. - newSettings[key_name] = LLSD::Real(lerp(value.asReal(), other_value.asReal(), mix)); - break; - case LLSD::TypeMap: - // deep copy. - newSettings[key_name] = interpolateSDMap(value, other_value, mix); - break; - - case LLSD::TypeArray: + parammapping_t::const_iterator def_iter = defaults.find(key_name); + if (def_iter != defaults.end()) { - LLSD newvalue(LLSD::emptyArray()); - - if (slerps.find(key_name) != slerps.end()) - { - LLQuaternion a(value); - LLQuaternion b(other_value); - LLQuaternion q = slerp(mix, a, b); - newvalue = q.getValue(); - } - else - { // TODO: We could expand this to inspect the type and do a deep lerp based on type. - // for now assume a heterogeneous array of reals. - size_t len = std::max(value.size(), other_value.size()); - - for (size_t i = 0; i < len; ++i) - { - - newvalue[i] = lerp(value[i].asReal(), other_value[i].asReal(), mix); - } - } - - newSettings[key_name] = newvalue; + other_value = def_iter->second.getDefaultValue(); + } + else if (value.type() == LLSD::TypeMap) + { + // interpolate in case there are defaults inside (part of legacy) + other_value = LLSDMap(); + } + else + { + // The other or defaults does not contain this setting, keep the original value + // TODO: Should I blend this out instead? + newSettings[key_name] = value; + continue; } - - break; - - case LLSD::TypeUUID: - newSettings[key_name] = value.asUUID(); - break; - -// case LLSD::TypeBoolean: -// case LLSD::TypeString: -// case LLSD::TypeURI: -// case LLSD::TypeBinary: -// case LLSD::TypeDate: - default: - // atomic or unknown data types. Lerping between them does not make sense so switch at the break. - newSettings[key_name] = (mix > BREAK_POINT) ? other_value : value; - break; } + + newSettings[key_name] = interpolateSDValue(key_name, value, other_value, defaults, mix, slerps); } // Special handling cases @@ -263,6 +215,27 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, F // Now add anything that is in other but not in the settings for (LLSD::map_const_iterator it = other.beginMap(); it != other.endMap(); ++it) + { + std::string key_name = (*it).first; + + if (skip.find(key_name) != skip.end()) + continue; + + if (settings.has(key_name)) + continue; + + parammapping_t::const_iterator def_iter = defaults.find(key_name); + if (def_iter != defaults.end()) + { + // Blend against default value + newSettings[key_name] = interpolateSDValue(key_name, def_iter->second.getDefaultValue(), (*it).second, defaults, mix, slerps); + } + // else do nothing when no known defaults + // TODO: Should I blend this out instead? + } + + // Note: writes variables from skip list, bug? + for (LLSD::map_const_iterator it = other.beginMap(); it != other.endMap(); ++it) { // TODO: Should I blend this in instead? if (skip.find((*it).first) == skip.end()) @@ -277,6 +250,81 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, F return newSettings; } +LLSD LLSettingsBase::interpolateSDValue(const std::string& key_name, const LLSD &value, const LLSD &other_value, const parammapping_t& defaults, BlendFactor mix, const stringset_t& slerps) const +{ + LLSD new_value; + + LLSD::Type setting_type = value.type(); + + if (other_value.type() != setting_type) + { + // The data type mismatched between this and other. Hard switch when we pass the break point + // but issue a warning. + LL_WARNS("SETTINGS") << "Setting lerp between mismatched types for '" << key_name << "'." << LL_ENDL; + new_value = (mix > BREAK_POINT) ? other_value : value; + } + + switch (setting_type) + { + case LLSD::TypeInteger: + // lerp between the two values rounding the result to the nearest integer. + new_value = LLSD::Integer(llroundf(lerp(value.asReal(), other_value.asReal(), mix))); + break; + case LLSD::TypeReal: + // lerp between the two values. + new_value = LLSD::Real(lerp(value.asReal(), other_value.asReal(), mix)); + break; + case LLSD::TypeMap: + // deep copy. + new_value = interpolateSDMap(value, other_value, defaults, mix); + break; + + case LLSD::TypeArray: + { + LLSD new_array(LLSD::emptyArray()); + + if (slerps.find(key_name) != slerps.end()) + { + LLQuaternion a(value); + LLQuaternion b(other_value); + LLQuaternion q = slerp(mix, a, b); + new_array = q.getValue(); + } + else + { // TODO: We could expand this to inspect the type and do a deep lerp based on type. + // for now assume a heterogeneous array of reals. + size_t len = std::max(value.size(), other_value.size()); + + for (size_t i = 0; i < len; ++i) + { + + new_array[i] = lerp(value[i].asReal(), other_value[i].asReal(), mix); + } + } + + new_value = new_array; + } + + break; + + case LLSD::TypeUUID: + new_value = value.asUUID(); + break; + + // case LLSD::TypeBoolean: + // case LLSD::TypeString: + // case LLSD::TypeURI: + // case LLSD::TypeBinary: + // case LLSD::TypeDate: + default: + // atomic or unknown data types. Lerping between them does not make sense so switch at the break. + new_value = (mix > BREAK_POINT) ? other_value : value; + break; + } + + return new_value; +} + LLSettingsBase::stringset_t LLSettingsBase::getSkipInterpolateKeys() const { static stringset_t skipSet; -- cgit v1.2.3 From 86419eb11be50bf75c9049a80e422d7704dd7d30 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Tue, 30 Oct 2018 01:14:21 +0200 Subject: SL-1476 EEP Better shader transitions --- indra/llinventory/llsettingsbase.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 80680948b5..4b8be04355 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -230,6 +230,11 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, c // Blend against default value newSettings[key_name] = interpolateSDValue(key_name, def_iter->second.getDefaultValue(), (*it).second, defaults, mix, slerps); } + else if ((*it).second.type() == LLSD::TypeMap) + { + // interpolate in case there are defaults inside (part of legacy) + newSettings[key_name] = interpolateSDValue(key_name, LLSDMap(), (*it).second, defaults, mix, slerps); + } // else do nothing when no known defaults // TODO: Should I blend this out instead? } -- cgit v1.2.3 From c3ac4650ad825966d587c06ce9787d9ab181dac6 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 2 Nov 2018 17:23:30 +0200 Subject: SL-9870 EEP Water texture doesn't apply to observer --- indra/llinventory/llsettingsbase.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 4b8be04355..7917fa96f1 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -688,6 +688,7 @@ F64 LLSettingsBlender::setBlendFactor(const LLSettingsBase::BlendFactor& blendf_ return blendf; } mTarget->blend(mFinal, blendf); + mTarget->update(); } else { @@ -702,6 +703,7 @@ void LLSettingsBlender::triggerComplete() if (mTarget) mTarget->replaceSettings(mFinal->getSettings()); LLSettingsBlender::ptr_t hold = shared_from_this(); // prevents this from deleting too soon + mTarget->update(); mOnFinished(shared_from_this()); } -- cgit v1.2.3 From 70ac8d9fa7049891ed1b65f68f112127dfb5f5f7 Mon Sep 17 00:00:00 2001 From: Rider Linden 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 +++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 16 deletions(-) (limited to 'indra/llinventory/llsettingsbase.cpp') 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; } -- cgit v1.2.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 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingsbase.cpp') 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(); -- cgit v1.2.3 From ce910edb0ed6222ad402e4310ccef6a0d0207dd0 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Mon, 13 May 2019 16:28:33 +0300 Subject: SL-11150 FIXED [EEP] Settings names get truncated. --- indra/llinventory/llsettingsbase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 7d7547ecb1..7f2b5d4597 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -389,7 +389,7 @@ bool LLSettingsBase::validate() 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 validateName(SETTING_NAME, false, LLSD::TypeString, boost::bind(&Validator::verifyStringLength, _1, 63)); static Validator validateId(SETTING_ID, false, LLSD::TypeUUID); static Validator validateHash(SETTING_HASH, false, LLSD::TypeInteger); static Validator validateType(SETTING_TYPE, false, LLSD::TypeString); -- cgit v1.2.3 From cfdcd0fc8ce969ca7df4e88608ee6d3bc923954d Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Wed, 26 Jun 2019 13:37:07 -0700 Subject: SL-11151 Modify env settings blender to not skip. --- indra/llinventory/llsettingsbase.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 7f2b5d4597..c051563714 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -167,6 +167,8 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, c stringset_t skip = getSkipInterpolateKeys(); stringset_t slerps = getSlerpKeys(); + llassert(mix >= 0.0f && mix <= 1.0f); + for (LLSD::map_const_iterator it = settings.beginMap(); it != settings.endMap(); ++it) { std::string key_name = (*it).first; @@ -678,9 +680,9 @@ bool LLSettingsBase::Validator::verifyStringLength(LLSD &value, S32 length) void LLSettingsBlender::update(const LLSettingsBase::BlendFactor& blendf) { F64 res = setBlendFactor(blendf); - - if ((res >= 0.0001) && (res < 1.0)) - mTarget->update(); + llassert(res >= 0.0 && res <= 1.0); + (void)res; + mTarget->update(); } F64 LLSettingsBlender::setBlendFactor(const LLSettingsBase::BlendFactor& blendf_in) @@ -689,17 +691,12 @@ F64 LLSettingsBlender::setBlendFactor(const LLSettingsBase::BlendFactor& blendf_ if (blendf >= 1.0) { triggerComplete(); - return 1.0; } blendf = llclamp(blendf, 0.0f, 1.0f); if (mTarget) { mTarget->replaceSettings(mInitial->getSettings()); - if (!mFinal || (mInitial == mFinal) || (blendf == 0.0)) - { // this is a trivial blend. Results will be identical to the initial. - return blendf; - } mTarget->blend(mFinal, blendf); } else @@ -720,7 +717,7 @@ void LLSettingsBlender::triggerComplete() } //------------------------------------------------------------------------- -const LLSettingsBase::BlendFactor LLSettingsBlenderTimeDelta::MIN_BLEND_DELTA(0.001); +const LLSettingsBase::BlendFactor LLSettingsBlenderTimeDelta::MIN_BLEND_DELTA(FLT_EPSILON); LLSettingsBase::BlendFactor LLSettingsBlenderTimeDelta::calculateBlend(const LLSettingsBase::TrackPosition& spanpos, const LLSettingsBase::TrackPosition& spanlen) const { -- cgit v1.2.3 From 8ba159fed90fc221003e85c5d2d3b82ec30d81bf Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 27 Jun 2019 09:10:38 -0700 Subject: SL-11151, SL-11504 Remove update threshold logic causing hiccups and rework sky updates. Make deferred water do double transport again to match non-ALM rendering more closely. --- indra/llinventory/llsettingsbase.cpp | 8 -------- 1 file changed, 8 deletions(-) (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index c051563714..e8fdd017e3 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -727,22 +727,14 @@ LLSettingsBase::BlendFactor LLSettingsBlenderTimeDelta::calculateBlend(const LLS bool LLSettingsBlenderTimeDelta::applyTimeDelta(const LLSettingsBase::Seconds& timedelta) { mTimeSpent += timedelta; - mTimeDeltaPassed += timedelta; if (mTimeSpent > mBlendSpan) { - mIgnoreTimeDelta = false; triggerComplete(); return false; } - if ((mTimeDeltaPassed < mTimeDeltaThreshold) && (!mIgnoreTimeDelta)) - { - return false; - } - LLSettingsBase::BlendFactor blendf = calculateBlend(mTimeSpent, mBlendSpan); - mTimeDeltaPassed = LLSettingsBase::Seconds(0.0); if (fabs(mLastBlendF - blendf) < mBlendFMinDelta) { -- cgit v1.2.3 From 1f656735d339fc4d83da86efbb400af1361c27db Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 26 Aug 2019 11:43:45 -0700 Subject: SL-11705, SL-11706: New flags in llsettings base for tracking by simulator. --- indra/llinventory/llsettingsbase.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index e8fdd017e3..af3e84fd0f 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -59,6 +59,7 @@ const std::string LLSettingsBase::SETTING_FLAGS("flags"); const U32 LLSettingsBase::FLAG_NOCOPY(0x01 << 0); const U32 LLSettingsBase::FLAG_NOMOD(0x01 << 1); const U32 LLSettingsBase::FLAG_NOTRANS(0x01 << 2); +const U32 LLSettingsBase::FLAG_NOSAVE(0x01 << 3); const U32 LLSettingsBase::Validator::VALIDATION_PARTIAL(0x01 << 0); @@ -354,7 +355,11 @@ LLSD LLSettingsBase::getSettings() const LLSD LLSettingsBase::cloneSettings() const { - return combineSDMaps(getSettings(), LLSD()); + U32 flags = getFlags(); + LLSD settings (combineSDMaps(getSettings(), LLSD())); + if (flags) + settings[SETTING_FLAGS] = LLSD::Integer(flags); + return settings; } size_t LLSettingsBase::getHash() const -- cgit v1.2.3 From a7849c6ec4fa31597121e7c8601fe427e222db0b Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 26 Mar 2020 18:09:09 +0200 Subject: Removed obsolete and misleading variable --- indra/llinventory/llsettingsbase.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index af3e84fd0f..ec26959718 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -67,7 +67,6 @@ const U32 LLSettingsBase::Validator::VALIDATION_PARTIAL(0x01 << 0); LLSettingsBase::LLSettingsBase(): mSettings(LLSD::emptyMap()), mDirty(true), - mAssetID(), mBlendedFactor(0.0) { } @@ -75,7 +74,6 @@ LLSettingsBase::LLSettingsBase(): LLSettingsBase::LLSettingsBase(const LLSD setting) : mSettings(setting), mDirty(true), - mAssetID(), mBlendedFactor(0.0) { } -- cgit v1.2.3 From 6620211bff5dca7df0667cf9220da1a9e7ce079c Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 27 Mar 2020 00:13:33 +0200 Subject: SL-12911 Add Debug setting EnvironmentPersistAcrossLogin --- indra/llinventory/llsettingsbase.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llinventory/llsettingsbase.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index ec26959718..61b59e35aa 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -39,6 +39,7 @@ namespace } const LLSettingsBase::TrackPosition LLSettingsBase::INVALID_TRACKPOS(-1.0); +const std::string LLSettingsBase::DEFAULT_SETTINGS_NAME("_default_"); //========================================================================= std::ostream &operator <<(std::ostream& os, LLSettingsBase &settings) -- cgit v1.2.3