summaryrefslogtreecommitdiff
path: root/indra/llinventory
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2018-01-23 08:54:34 -0800
committerRider Linden <rider@lindenlab.com>2018-01-23 08:54:34 -0800
commit1b8c2b5ebbe0d42f147730bc9b6528fa8c6796ce (patch)
tree577e909cd6f0c620dcda1393fb572100fd4faf7e /indra/llinventory
parenta0c228d84240a80437b63e0a2cd1cee24e8004a0 (diff)
MAINT-8052: Initial support for new EEP cap
Diffstat (limited to 'indra/llinventory')
-rw-r--r--indra/llinventory/llparcel.h4
-rw-r--r--indra/llinventory/llsettingsbase.cpp89
-rw-r--r--indra/llinventory/llsettingsbase.h6
-rw-r--r--indra/llinventory/llsettingsdaycycle.cpp120
-rw-r--r--indra/llinventory/llsettingsdaycycle.h9
-rw-r--r--indra/llinventory/llsettingssky.cpp5
-rw-r--r--indra/llinventory/llsettingssky.h5
-rw-r--r--indra/llinventory/llsettingswater.cpp5
-rw-r--r--indra/llinventory/llsettingswater.h5
9 files changed, 196 insertions, 52 deletions
diff --git a/indra/llinventory/llparcel.h b/indra/llinventory/llparcel.h
index dada2cf6d8..7b4647cc5f 100644
--- a/indra/llinventory/llparcel.h
+++ b/indra/llinventory/llparcel.h
@@ -595,8 +595,8 @@ public:
void setDayLength(S64SecondsImplicit seconds) { mDayLength = seconds; }
S64Seconds getDayOffset() const { return mDayOffset; }
void setDayOffset(S64SecondsImplicit seconds) { mDayOffset = seconds; }
- bool getIsDefaultDayCycle() const { return mIsDefaultDayCycle; }
- void setIsDefaultDayCycle(bool isdefault) { mIsDefaultDayCycle = isdefault; }
+ bool getUsesDefaultDayCycle() const { return mIsDefaultDayCycle; }
+ void setUsesDefaultDayCycle(bool isdefault) { mIsDefaultDayCycle = isdefault; }
LLSettingsDay::ptr_t getParcelDayCycle() const { return mDayCycle; }
void setParcelDayCycle(const LLSettingsDay::ptr_t &pday) { mDayCycle = pday; }
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);
}
//=========================================================================
diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h
index 0a20754ffb..fa5fb7a763 100644
--- a/indra/llinventory/llsettingsbase.h
+++ b/indra/llinventory/llsettingsbase.h
@@ -155,7 +155,6 @@ public:
virtual bool validate();
-protected:
class Validator
{
public:
@@ -192,9 +191,14 @@ protected:
};
typedef std::vector<Validator> validation_list_t;
+ static LLSD settingValidation(LLSD &settings, validation_list_t &validations);
+protected:
+
LLSettingsBase();
LLSettingsBase(const LLSD setting);
+ static LLSD settingValidation(LLSD settings);
+
typedef std::set<std::string> stringset_t;
// combining settings objects. Customize for specific setting types
diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp
index 4207df0924..c7d5c35c60 100644
--- a/indra/llinventory/llsettingsdaycycle.cpp
+++ b/indra/llinventory/llsettingsdaycycle.cpp
@@ -183,7 +183,7 @@ LLSD LLSettingsDay::getSettings() const
return settings;
}
-void LLSettingsDay::initialize()
+bool LLSettingsDay::initialize()
{
LLSD tracks = mSettings[SETTING_TRACKS];
LLSD frames = mSettings[SETTING_FRAMES];
@@ -194,21 +194,32 @@ void LLSettingsDay::initialize()
{
std::string name = (*itFrame).first;
LLSD data = (*itFrame).second;
+ LLSettingsBase::ptr_t keyframe;
if (data[SETTING_TYPE].asString() == "sky")
{
- used[name] = buildSky(data);
+ keyframe = buildSky(data);
}
else if (data[SETTING_TYPE].asString() == "water")
{
- used[name] = buildWater(data);
+ keyframe = buildWater(data);
}
else
{
LL_WARNS("DAYCYCLE") << "Unknown child setting type '" << data[SETTING_TYPE].asString() << "' named '" << name << "'" << LL_ENDL;
}
+ if (!keyframe)
+ {
+ LL_WARNS("DAYCYCLE") << "Invalid frame data" << LL_ENDL;
+ continue;
+ }
+
+ used[name] = keyframe;
}
+ bool haswater(false);
+ bool hassky(false);
+
for (S32 i = 0; (i < tracks.size()) && (i < TRACK_MAX); ++i)
{
mDayTracks[i].clear();
@@ -246,15 +257,27 @@ void LLSettingsDay::initialize()
}
if (setting)
+ {
+ if (i == TRACK_WATER)
+ haswater |= true;
+ else
+ hassky |= true;
mDayTracks[i][keyframe] = setting;
+ }
}
}
+ if (!haswater || !hassky)
+ {
+ LL_WARNS("DAYCYCLE") << "Must have at least one water and one sky frame!" << LL_ENDL;
+ return false;
+ }
// these are no longer needed and just take up space now.
mSettings.erase(SETTING_TRACKS);
mSettings.erase(SETTING_FRAMES);
mInitialized = true;
+ return true;
}
@@ -288,11 +311,14 @@ namespace
value.erase(value.size() - 1);
}
+ S32 framecount(0);
+
for (LLSD::array_iterator track = value.beginArray(); track != value.endArray(); ++track)
{
S32 index = 0;
while (index < (*track).size())
{
+ ++framecount;
if (index >= LLSettingsDay::FRAME_MAX)
{
(*track).erase(index);
@@ -323,22 +349,100 @@ namespace
}
}
+
+ framecount -= value[0].size();
+
+ if (value[0].size() < 1)
+ {
+ LL_WARNS("SETTINGS") << "Missing water track" << LL_ENDL;
+ return false;
+ }
+
+ if (framecount < 1)
+ {
+ LL_WARNS("SETTINGS") << "Missing sky tracks" << LL_ENDL;
+ return false;
+ }
+ return true;
+ }
+
+ bool validateDayCycleFrames(LLSD &value)
+ {
+ bool hasSky(false);
+ bool hasWater(false);
+
+ for (LLSD::map_iterator itf = value.beginMap(); itf != value.endMap(); ++itf)
+ {
+ LLSD frame = (*itf).second;
+
+ std::string ftype = frame[LLSettingsBase::SETTING_TYPE];
+ if (ftype == "sky")
+ {
+ LLSettingsSky::validation_list_t valid_sky = LLSettingsSky::validationList();
+ LLSD res_sky = LLSettingsSky::settingValidation(frame, valid_sky);
+ LL_WARNS("SETTINGS") << "'" << (*itf).first << "' res=" << res_sky << LL_ENDL;
+ //_WARNS("SETTINGS") << "success=" << res_sky["success"].asBoolean() << "(" << res_sky["success"].asInteger() << ") res=" << res_sky << LL_ENDL;
+
+ if (res_sky["success"].asInteger() == 0)
+ {
+ LL_WARNS("SETTINGS") << "Sky setting named '" << (*itf).first << "' validation failed!: " << res_sky << LL_ENDL;
+ LL_WARNS("SETTINGS") << "Sky: " << frame << LL_ENDL;
+ continue;
+ }
+ hasSky |= true;
+ }
+ else if (ftype == "water")
+ {
+ LLSettingsWater::validation_list_t valid_h2o = LLSettingsWater::validationList();
+ LLSD res_h2o = LLSettingsWater::settingValidation(frame, valid_h2o);
+ LL_WARNS("SETTINGS") << "'" << (*itf).first << "' res=" << res_h2o << LL_ENDL;
+ //_WARNS("SETTINGS") << "success=" << res_h2o["success"].asBoolean() << LL_ENDL;
+ if (res_h2o["success"].asInteger() == 0)
+ {
+ LL_WARNS("SETTINGS") << "Water setting named '" << (*itf).first << "' validation failed!: " << res_h2o << LL_ENDL;
+ LL_WARNS("SETTINGS") << "Water: " << frame << LL_ENDL;
+ continue;
+ }
+ hasWater |= true;
+ }
+ else
+ {
+ LL_WARNS("SETTINGS") << "Unknown settings block of type '" << ftype << "' named '" << (*itf).first << "'" << LL_ENDL;
+ return false;
+ }
+ }
+
+ if (!hasSky)
+ {
+ LL_WARNS("SETTINGS") << "No skies defined." << LL_ENDL;
+ return false;
+ }
+
+ if (!hasWater)
+ {
+ LL_WARNS("SETTINGS") << "No waters defined." << LL_ENDL;
+ return false;
+ }
+
return true;
}
}
LLSettingsDay::validation_list_t LLSettingsDay::getValidationList() const
{
+ return LLSettingsDay::validationList();
+}
+
+LLSettingsDay::validation_list_t LLSettingsDay::validationList()
+{
static validation_list_t validation;
if (validation.empty())
{
- validation.push_back(Validator(SETTING_TRACKS, false, LLSD::TypeArray,
+ validation.push_back(Validator(SETTING_TRACKS, true, LLSD::TypeArray,
&validateDayCycleTrack));
- validation.push_back(Validator(SETTING_FRAMES, false, LLSD::TypeMap));
- validation.push_back(Validator(SETTING_DAYLENGTH, false, LLSD::TypeInteger,
- boost::bind(&Validator::verifyIntegerRange, _1,
- LLSD(LLSDArray(LLSD::Integer(MINIMUM_DAYLENGTH))(LLSD::Integer(MAXIMUM_DAYLENGTH))))));
+ validation.push_back(Validator(SETTING_FRAMES, true, LLSD::TypeMap,
+ &validateDayCycleFrames));
}
return validation;
diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h
index ae47a54270..b3cf53869f 100644
--- a/indra/llinventory/llsettingsdaycycle.h
+++ b/indra/llinventory/llsettingsdaycycle.h
@@ -61,7 +61,7 @@ public:
typedef std::map<F32, LLSettingsBase::ptr_t> CycleTrack_t;
typedef std::vector<CycleTrack_t> CycleList_t;
- typedef boost::shared_ptr<LLSettingsDay> ptr_t;
+ typedef boost::shared_ptr<LLSettingsDay> ptr_t;
typedef std::vector<S64Seconds> TimeList_t;
typedef std::vector<F32> KeyframeList_t;
typedef std::pair<CycleTrack_t::iterator, CycleTrack_t::iterator> TrackBound_t;
@@ -70,7 +70,7 @@ public:
LLSettingsDay(const LLSD &data);
virtual ~LLSettingsDay() { };
- void initialize();
+ bool initialize();
virtual ptr_t buildClone() = 0;
virtual LLSD getSettings() const;
@@ -136,13 +136,14 @@ public:
void setInitialized(bool value = true) { mInitialized = value; }
CycleTrack_t & getCycleTrack(S32 track);
+
+ virtual validation_list_t getValidationList() const;
+ static validation_list_t validationList();
protected:
LLSettingsDay();
virtual void updateSettings();
- virtual validation_list_t getValidationList() const;
-
bool mInitialized;
private:
diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp
index 7fc9d83cae..14024cf4f7 100644
--- a/indra/llinventory/llsettingssky.cpp
+++ b/indra/llinventory/llsettingssky.cpp
@@ -146,6 +146,11 @@ LLSettingsSky::stringset_t LLSettingsSky::getSlerpKeys() const
LLSettingsSky::validation_list_t LLSettingsSky::getValidationList() const
{
+ return LLSettingsSky::validationList();
+}
+
+LLSettingsSky::validation_list_t LLSettingsSky::validationList()
+{
static validation_list_t validation;
if (validation.empty())
diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h
index 12ea237ef3..d36de571f6 100644
--- a/indra/llinventory/llsettingssky.h
+++ b/indra/llinventory/llsettingssky.h
@@ -409,6 +409,9 @@ public:
return mTotalAmbient;
}
+ virtual validation_list_t getValidationList() const;
+ static validation_list_t validationList();
+
protected:
static const std::string SETTING_LEGACY_EAST_ANGLE;
static const std::string SETTING_LEGACY_ENABLE_CLOUD_SCROLL;
@@ -418,8 +421,6 @@ protected:
virtual stringset_t getSlerpKeys() const;
- virtual validation_list_t getValidationList() const;
-
virtual void updateSettings();
static LLSD translateLegacySettings(LLSD legacy);
diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp
index 00f870bbb0..67a9cd39cb 100644
--- a/indra/llinventory/llsettingswater.cpp
+++ b/indra/llinventory/llsettingswater.cpp
@@ -169,6 +169,11 @@ void LLSettingsWater::blend(const LLSettingsBase::ptr_t &end, F64 blendf)
LLSettingsWater::validation_list_t LLSettingsWater::getValidationList() const
{
+ return LLSettingsWater::validationList();
+}
+
+LLSettingsWater::validation_list_t LLSettingsWater::validationList()
+{
static validation_list_t validation;
if (validation.empty())
diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h
index d18caf68b1..94e5583fd7 100644
--- a/indra/llinventory/llsettingswater.h
+++ b/indra/llinventory/llsettingswater.h
@@ -198,6 +198,9 @@ public:
return mWaterFogKS;
}
+ virtual validation_list_t getValidationList() const;
+ static validation_list_t validationList();
+
protected:
static const std::string SETTING_LEGACY_BLUR_MULTIPILER;
static const std::string SETTING_LEGACY_FOG_COLOR;
@@ -214,8 +217,6 @@ protected:
LLSettingsWater();
- virtual validation_list_t getValidationList() const;
-
static LLSD translateLegacySettings(LLSD legacy);
LLVector4 mWaterPlane;