diff options
| author | Graham Linden <graham@lindenlab.com> | 2018-09-04 23:43:39 +0100 | 
|---|---|---|
| committer | Graham Linden <graham@lindenlab.com> | 2018-09-04 23:43:39 +0100 | 
| commit | a65afc30a968c752f1e252258e6917554a78f56a (patch) | |
| tree | bb711036e634883453cd48140dd1478c761f2f71 /indra/llinventory | |
| parent | 32631f09a57548c2bbf7e09211a2053ff2e4e47d (diff) | |
| parent | 0a78e9271c524c92cb8b1965e9a6081d4f700437 (diff) | |
Merge
Diffstat (limited to 'indra/llinventory')
| -rw-r--r-- | indra/llinventory/llsettingsbase.cpp | 38 | ||||
| -rw-r--r-- | indra/llinventory/llsettingsbase.h | 48 | ||||
| -rw-r--r-- | indra/llinventory/llsettingssky.cpp | 7 | 
3 files changed, 86 insertions, 7 deletions
| 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;          } diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 7884240ae3..a90cec6323 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -70,6 +70,10 @@ public:      static const std::string SETTING_HASH;      static const std::string SETTING_TYPE;      static const std::string SETTING_ASSETID; +    static const std::string SETTING_FLAGS; + +    static const U32 FLAG_NOCOPY; +    static const U32 FLAG_NOMOD;      typedef std::map<std::string, S32>  parammapping_t; @@ -113,6 +117,48 @@ public:          return LLUUID();      } +    inline U32 getFlags() const +    { +        if (mSettings.has(SETTING_FLAGS)) +            return static_cast<U32>(mSettings[SETTING_FLAGS].asInteger()); +        return 0; +    } + +    inline void setFlags(U32 value) +    { +        setLLSD(SETTING_FLAGS, LLSD::Integer(value)); +    } + +    inline bool getFlag(U32 flag) const +    { +        if (mSettings.has(SETTING_FLAGS)) +            return ((U32)mSettings[SETTING_FLAGS].asInteger() & flag) == flag; +        return false; +    } + +    inline void setFlag(U32 flag) +    { +        U32 flags((mSettings.has(SETTING_FLAGS)) ? (U32)mSettings[SETTING_FLAGS].asInteger() : 0); + +        flags |= flag; + +        if (flags) +            mSettings[SETTING_FLAGS] = LLSD::Integer(flags); +        else +            mSettings.erase(SETTING_FLAGS); +    } + +    inline void clearFlag(U32 flag) +    { +        U32 flags((mSettings.has(SETTING_FLAGS)) ? (U32)mSettings[SETTING_FLAGS].asInteger() : 0); + +        flags &= ~flag; + +        if (flags) +            mSettings[SETTING_FLAGS] = LLSD::Integer(flags); +        else +            mSettings.erase(SETTING_FLAGS); +    }      virtual void replaceSettings(LLSD settings)      { @@ -270,7 +316,7 @@ protected:      /// when lerping between settings, some may require special handling.        /// Get a list of these key to be skipped by the default settings lerp.      /// (handling should be performed in the override of lerpSettings. -    virtual stringset_t getSkipInterpolateKeys() const { return stringset_t(); }   +    virtual stringset_t getSkipInterpolateKeys() const;       // A list of settings that represent quaternions and should be slerped       // rather than lerped. diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index cd6dfad71d..3b2e7de27d 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -32,8 +32,6 @@  #include "llfasttimer.h"  #include "v3colorutil.h" -#pragma optimize("", off) -  //=========================================================================  static const F32 NIGHTTIME_ELEVATION     = -8.0f; // degrees  static const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); @@ -437,6 +435,7 @@ LLSettingsSky::stringset_t LLSettingsSky::getSkipInterpolateKeys() const      if (skipSet.empty())      { +        skipSet = LLSettingsBase::getSkipInterpolateKeys();          skipSet.insert(SETTING_RAYLEIGH_CONFIG);          skipSet.insert(SETTING_MIE_CONFIG);          skipSet.insert(SETTING_ABSORPTION_CONFIG); @@ -656,7 +655,7 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position)          dfltsetting[SETTING_MAX_Y]              = LLSD::Real(1605);          dfltsetting[SETTING_MOON_ROTATION]      = moonquat.getValue(); -        dfltsetting[SETTING_STAR_BRIGHTNESS]    = LLSD::Real(0.0000); +        dfltsetting[SETTING_STAR_BRIGHTNESS]    = LLSD::Real(256.0000);          dfltsetting[SETTING_SUNLIGHT_COLOR]     = LLColor4(0.7342, 0.7815, 0.8999, 0.0).getValue();          dfltsetting[SETTING_SUN_ROTATION]       = sunquat.getValue(); @@ -785,7 +784,7 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy)      }      if (legacy.has(SETTING_STAR_BRIGHTNESS))      { -        newsettings[SETTING_STAR_BRIGHTNESS] = LLSD::Real(legacy[SETTING_STAR_BRIGHTNESS].asReal()); +        newsettings[SETTING_STAR_BRIGHTNESS] = LLSD::Real(legacy[SETTING_STAR_BRIGHTNESS].asReal()) * 256.0f;      }      if (legacy.has(SETTING_SUNLIGHT_COLOR))      { | 
