summaryrefslogtreecommitdiff
path: root/indra/llinventory
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2018-12-12 14:07:23 -0800
committerRider Linden <rider@lindenlab.com>2018-12-12 14:07:23 -0800
commit70ac8d9fa7049891ed1b65f68f112127dfb5f5f7 (patch)
tree84ff4256bc0642e9901203935cefd469b3e58634 /indra/llinventory
parentd66012f85e885679738cf8c488fd8ff460319c85 (diff)
SL-10238: Viewer spport for push notifications from the simulator contaiting partial groups of settings. Blend these settings into the current environment.
Diffstat (limited to 'indra/llinventory')
-rw-r--r--indra/llinventory/llsettingsbase.cpp44
-rw-r--r--indra/llinventory/llsettingsbase.h19
-rw-r--r--indra/llinventory/llsettingsdaycycle.cpp1
-rw-r--r--indra/llinventory/llsettingssky.cpp12
-rw-r--r--indra/llinventory/llsettingssky.h1
-rw-r--r--indra/llinventory/llsettingswater.cpp8
-rw-r--r--indra/llinventory/llsettingswater.h1
7 files changed, 64 insertions, 22 deletions
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<bool(LLSD &)> 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<Validator> 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<std::string, LLSettingsBase::ptr_t> 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);