diff options
| author | Graham Linden graham@lindenlab.com <Graham Linden graham@lindenlab.com> | 2018-02-28 21:53:34 +0000 | 
|---|---|---|
| committer | Graham Linden graham@lindenlab.com <Graham Linden graham@lindenlab.com> | 2018-02-28 21:53:34 +0000 | 
| commit | aba5777d747d67db43e03772d30cb50d18d1a5d5 (patch) | |
| tree | 10e4a3248143f709643bcc50490e982f93be30f7 /indra/llinventory | |
| parent | 72270213f5eebd019b10bdd6ec15020ba3d2ecf5 (diff) | |
| parent | e2e63598d40109d01e0311ce1444d3feedffcf66 (diff) | |
Merge
Diffstat (limited to 'indra/llinventory')
| -rw-r--r-- | indra/llinventory/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | indra/llinventory/llinventorysettings.h | 43 | ||||
| -rw-r--r-- | indra/llinventory/llsettingsbase.cpp | 23 | ||||
| -rw-r--r-- | indra/llinventory/llsettingsbase.h | 14 | ||||
| -rw-r--r-- | indra/llinventory/llsettingsdaycycle.cpp | 5 | ||||
| -rw-r--r-- | indra/llinventory/llsettingsdaycycle.h | 2 | ||||
| -rw-r--r-- | indra/llinventory/llsettingssky.h | 13 | ||||
| -rw-r--r-- | indra/llinventory/llsettingswater.h | 3 | 
8 files changed, 90 insertions, 14 deletions
diff --git a/indra/llinventory/CMakeLists.txt b/indra/llinventory/CMakeLists.txt index 3eba746614..2d40dd6443 100644 --- a/indra/llinventory/CMakeLists.txt +++ b/indra/llinventory/CMakeLists.txt @@ -45,6 +45,7 @@ set(llinventory_HEADER_FILES      llfoldertype.h      llinventory.h      llinventorydefines.h +    llinventorysettings.h      llinventorytype.h      lllandmark.h      llnotecard.h diff --git a/indra/llinventory/llinventorysettings.h b/indra/llinventory/llinventorysettings.h new file mode 100644 index 0000000000..0d15542fec --- /dev/null +++ b/indra/llinventory/llinventorysettings.h @@ -0,0 +1,43 @@ +/** +* @file llinventorysettings.h +* @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$ +*/ + +#ifndef LL_INVENTORY_SETTINGS_H +#define LL_INVENTORY_SETTINGS_H + + +enum class LLSettingsType +{ +    ST_SKY = 0, +    ST_WATER = 1, +    ST_DAYCYCLE = 2, + +    ST_INVALID = 255, +    ST_NONE = -1 +}; + + +#endif diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 0918252fa0..7cedffa507 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -39,6 +39,14 @@ namespace  }  //========================================================================= +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");  const std::string LLSettingsBase::SETTING_HASH("hash"); @@ -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; diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 4273e1d3a0..c34d365a0b 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -42,6 +42,8 @@  #include "v4color.h"  #include "v3color.h" +#include "llinventorysettings.h" +  class LLSettingsBase :       public std::enable_shared_from_this<LLSettingsBase>,      private boost::noncopyable @@ -49,6 +51,8 @@ class LLSettingsBase :      friend class LLEnvironment;      friend class LLSettingsDay; +    friend std::ostream &operator <<(std::ostream& os, LLSettingsBase &settings); +  public:      static const std::string SETTING_ID;      static const std::string SETTING_NAME; @@ -64,6 +68,8 @@ public:      //---------------------------------------------------------------------      virtual std::string getSettingType() const = 0; +    virtual LLSettingsType getSettingTypeValue() const = 0; +      //---------------------------------------------------------------------      // Settings status       inline bool hasSetting(const std::string ¶m) const { return mSettings.has(param); } @@ -159,11 +165,12 @@ public:      public:          typedef boost::function<bool(LLSD &)> verify_pr; -        Validator(std::string name, bool required, LLSD::Type type, verify_pr verify = verify_pr()) : +        Validator(std::string name, bool required, LLSD::Type type, verify_pr verify = verify_pr(), LLSD defval = LLSD())  :              mName(name),              mRequired(required),              mType(type), -            mVerify(verify) +            mVerify(verify), +            mDefault(defval)          {   }          std::string getName() const { return mName; } @@ -187,11 +194,11 @@ public:          bool        mRequired;          LLSD::Type  mType;          verify_pr   mVerify; +        LLSD        mDefault;      };      typedef std::vector<Validator> validation_list_t;      static LLSD settingValidation(LLSD &settings, validation_list_t &validations); -  protected:      LLSettingsBase(); @@ -226,6 +233,7 @@ protected:      LLSD    mSettings;      bool    mIsValid; +    LLAssetID   mAssetID;      LLSD    cloneSettings() const; diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 409fcf28e3..b437ac57bd 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -290,6 +290,8 @@ LLSD LLSettingsDay::defaults()      dfltsetting[SETTING_FRAMES] = frames; +    dfltsetting[SETTING_TYPE] = "daycycle"; +      return dfltsetting;  } @@ -298,8 +300,6 @@ void LLSettingsDay::blend(const LLSettingsBase::ptr_t &other, F64 mix)      LL_ERRS("DAYCYCLE") << "Day cycles are not blendable!" << LL_ENDL;  } -#pragma optimize("", off) -  namespace  {      bool validateDayCycleTrack(LLSD &value) @@ -431,7 +431,6 @@ namespace      }  } -#pragma optimize("", on)  LLSettingsDay::validation_list_t LLSettingsDay::getValidationList() const  {      return LLSettingsDay::validationList(); diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index 4c7ce011a1..7703f7a0b4 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -72,6 +72,8 @@ public:      virtual ptr_t               buildClone() = 0;      virtual LLSD                getSettings() const; +    virtual LLSettingsType      getSettingTypeValue() const override { return LLSettingsType::ST_DAYCYCLE; } +      //---------------------------------------------------------------------      virtual std::string         getSettingType() const { return std::string("daycycle"); } diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 3c5e271d39..5d7d3adbfe 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -36,8 +36,8 @@  class LLSettingsSky: public LLSettingsBase  {  public: -      static const std::string SETTING_AMBIENT; +    static const std::string SETTING_BLOOM_TEXTUREID;      static const std::string SETTING_BLUE_DENSITY;      static const std::string SETTING_BLUE_HORIZON;      static const std::string SETTING_DENSITY_MULTIPLIER; @@ -92,7 +92,9 @@ public:      virtual ptr_t   buildClone() = 0;      //--------------------------------------------------------------------- -    virtual std::string getSettingType() const { return std::string("sky"); } +    virtual std::string getSettingType() const override { return std::string("sky"); } +    virtual LLSettingsType getSettingTypeValue() const override { return LLSettingsType::ST_SKY; } +      // Settings status       virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf); @@ -116,6 +118,11 @@ public:          setValue(SETTING_AMBIENT, val);      } +    LLUUID getBloomTextureId() const +    { +        return mSettings[SETTING_BLOOM_TEXTUREID].asUUID(); +    } +      LLColor3 getBlueDensity() const      {          return LLColor3(mSettings[SETTING_BLUE_DENSITY]); @@ -448,7 +455,7 @@ protected:      virtual stringset_t getSlerpKeys() const; -    virtual void    updateSettings();     +    virtual void    updateSettings();  private:      // validations for structured sections of sky settings data diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h index 4d206a1be0..16d5b2353a 100644 --- a/indra/llinventory/llsettingswater.h +++ b/indra/llinventory/llsettingswater.h @@ -57,7 +57,8 @@ public:      virtual ptr_t   buildClone() = 0;      //--------------------------------------------------------------------- -    virtual std::string getSettingType() const { return std::string("water"); } +    virtual std::string     getSettingType() const override { return std::string("water"); } +    virtual LLSettingsType  getSettingTypeValue() const override { return LLSettingsType::ST_WATER; }      // Settings status       virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf);  | 
