summaryrefslogtreecommitdiff
path: root/indra/llinventory
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2018-08-21 15:59:18 -0700
committerRider Linden <rider@lindenlab.com>2018-08-21 15:59:18 -0700
commit4859db1adabcf84b959ff0603f1bb8401232164c (patch)
tree94772976ee3b8bae51eeb6510711da9e74b2a013 /indra/llinventory
parent477c66c890d5d87318705415315aaf9464bec2ff (diff)
MAINT-9026: Adding scale for sun and moon. Also don't allow the user to directly set the radio buttons for inventory and custom.
Diffstat (limited to 'indra/llinventory')
-rw-r--r--indra/llinventory/llsettingsbase.cpp14
-rw-r--r--indra/llinventory/llsettingsbase.h1
-rw-r--r--indra/llinventory/llsettingssky.cpp29
-rw-r--r--indra/llinventory/llsettingssky.h8
4 files changed, 50 insertions, 2 deletions
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)
{
diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h
index 9757092794..7884240ae3 100644
--- a/indra/llinventory/llsettingsbase.h
+++ b/indra/llinventory/llsettingsbase.h
@@ -230,6 +230,7 @@ public:
static bool verifyQuaternionNormal(LLSD &value);
static bool verifyFloatRange(LLSD &value, LLSD range);
static bool verifyIntegerRange(LLSD &value, LLSD range);
+ static bool verifyStringLength(LLSD &value, S32 length);
private:
std::string mName;
diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp
index 072dff4ce4..c0402f1fe4 100644
--- a/indra/llinventory/llsettingssky.cpp
+++ b/indra/llinventory/llsettingssky.cpp
@@ -93,10 +93,12 @@ const std::string LLSettingsSky::SETTING_GLOW("glow");
const std::string LLSettingsSky::SETTING_LIGHT_NORMAL("lightnorm");
const std::string LLSettingsSky::SETTING_MAX_Y("max_y");
const std::string LLSettingsSky::SETTING_MOON_ROTATION("moon_rotation");
+const std::string LLSettingsSky::SETTING_MOON_SCALE("moon_scale");
const std::string LLSettingsSky::SETTING_MOON_TEXTUREID("moon_id");
const std::string LLSettingsSky::SETTING_STAR_BRIGHTNESS("star_brightness");
const std::string LLSettingsSky::SETTING_SUNLIGHT_COLOR("sunlight_color");
const std::string LLSettingsSky::SETTING_SUN_ROTATION("sun_rotation");
+const std::string LLSettingsSky::SETTING_SUN_SCALE("sun_scale");
const std::string LLSettingsSky::SETTING_SUN_TEXTUREID("sun_id");
const std::string LLSettingsSky::SETTING_LEGACY_EAST_ANGLE("east_angle");
@@ -524,6 +526,8 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList()
validation.push_back(Validator(SETTING_MAX_Y, true, LLSD::TypeReal,
boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(4000.0f)))));
validation.push_back(Validator(SETTING_MOON_ROTATION, true, LLSD::TypeArray, &Validator::verifyQuaternionNormal));
+ validation.push_back(Validator(SETTING_MOON_SCALE, false, LLSD::TypeReal,
+ boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.25f)(20.0f))), LLSD::Real(1.0)));
validation.push_back(Validator(SETTING_MOON_TEXTUREID, false, LLSD::TypeUUID));
validation.push_back(Validator(SETTING_STAR_BRIGHTNESS, true, LLSD::TypeReal,
boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f)))));
@@ -532,7 +536,9 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList()
LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")),
LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*")))));
validation.push_back(Validator(SETTING_SUN_ROTATION, true, LLSD::TypeArray, &Validator::verifyQuaternionNormal));
- validation.push_back(Validator(SETTING_SUN_TEXTUREID, false, LLSD::TypeUUID));
+ validation.push_back(Validator(SETTING_SUN_SCALE, false, LLSD::TypeReal,
+ boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.25f)(20.0f))), LLSD::Real(1.0)));
+ validation.push_back(Validator(SETTING_SUN_TEXTUREID, false, LLSD::TypeUUID));
validation.push_back(Validator(SETTING_PLANET_RADIUS, true, LLSD::TypeReal,
boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(1000.0f)(32768.0f)))));
@@ -1310,6 +1316,16 @@ void LLSettingsSky::setMoonRotation(const LLQuaternion &val)
setValue(SETTING_MOON_ROTATION, val);
}
+F32 LLSettingsSky::getMoonScale() const
+{
+ return mSettings[SETTING_MOON_SCALE].asReal();
+}
+
+void LLSettingsSky::setMoonScale(F32 val)
+{
+ setValue(SETTING_MOON_SCALE, val);
+}
+
LLUUID LLSettingsSky::getMoonTextureId() const
{
return mSettings[SETTING_MOON_TEXTUREID].asUUID();
@@ -1350,6 +1366,17 @@ void LLSettingsSky::setSunRotation(const LLQuaternion &val)
setValue(SETTING_SUN_ROTATION, val);
}
+
+F32 LLSettingsSky::getSunScale() const
+{
+ return mSettings[SETTING_SUN_SCALE].asReal();
+}
+
+void LLSettingsSky::setSunScale(F32 val)
+{
+ setValue(SETTING_SUN_SCALE, val);
+}
+
LLUUID LLSettingsSky::getSunTextureId() const
{
return mSettings[SETTING_SUN_TEXTUREID].asUUID();
diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h
index e0ad480c0a..20b8d01879 100644
--- a/indra/llinventory/llsettingssky.h
+++ b/indra/llinventory/llsettingssky.h
@@ -62,10 +62,12 @@ public:
static const std::string SETTING_LIGHT_NORMAL;
static const std::string SETTING_MAX_Y;
static const std::string SETTING_MOON_ROTATION;
+ static const std::string SETTING_MOON_SCALE;
static const std::string SETTING_MOON_TEXTUREID;
static const std::string SETTING_STAR_BRIGHTNESS;
static const std::string SETTING_SUNLIGHT_COLOR;
static const std::string SETTING_SUN_ROTATION;
+ static const std::string SETTING_SUN_SCALE;
static const std::string SETTING_SUN_TEXTUREID;
static const std::string SETTING_PLANET_RADIUS;
@@ -165,6 +167,9 @@ public:
LLQuaternion getMoonRotation() const;
void setMoonRotation(const LLQuaternion &val);
+ F32 getMoonScale() const;
+ void setMoonScale(F32 val);
+
LLUUID getMoonTextureId() const;
void setMoonTextureId(LLUUID id);
@@ -177,6 +182,9 @@ public:
LLQuaternion getSunRotation() const;
void setSunRotation(const LLQuaternion &val) ;
+ F32 getSunScale() const;
+ void setSunScale(F32 val);
+
LLUUID getSunTextureId() const;
void setSunTextureId(LLUUID id);