summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llenvironment.cpp48
-rw-r--r--indra/newview/llenvironment.h10
-rw-r--r--indra/newview/llfloatereditextdaycycle.cpp6
-rw-r--r--indra/newview/llfloaterfixedenvironment.cpp12
-rw-r--r--indra/newview/llsettingsvo.cpp87
-rw-r--r--indra/newview/llsettingsvo.h12
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml7
-rw-r--r--indra/newview/skins/default/xui/en/strings.xml5
8 files changed, 128 insertions, 59 deletions
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp
index 9ac8bccb74..a397f0f27a 100644
--- a/indra/newview/llenvironment.cpp
+++ b/indra/newview/llenvironment.cpp
@@ -615,6 +615,25 @@ namespace
typedef LLSettingsInjected<LLSettingsVOSky> LLSettingsInjectedSky;
typedef LLSettingsInjected<LLSettingsVOWater> LLSettingsInjectedWater;
+
+#if 0
+ //=====================================================================
+ class DayInjection : public LLEnvironment::DayInstance
+ {
+ public:
+ typedef std::shared_ptr<DayInjection> ptr_t;
+
+ DayInjection(LLEnvironment::EnvSelection_t env) :
+ LLEnvironment::DayInstance(env)
+ {
+ }
+
+ virtual ~DayInjection() { };
+
+ protected:
+ private:
+ };
+#endif
}
//=========================================================================
@@ -1972,31 +1991,46 @@ LLEnvironment::EnvironmentInfo::ptr_t LLEnvironment::EnvironmentInfo::extractLeg
}
//=========================================================================
-LLSettingsWater::ptr_t LLEnvironment::createWaterFromLegacyPreset(const std::string filename)
+LLSettingsWater::ptr_t LLEnvironment::createWaterFromLegacyPreset(const std::string filename, LLSD &messages)
{
std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(filename), true));
std::string path(gDirUtilp->getDirName(filename));
- LLSettingsWater::ptr_t water = LLSettingsVOWater::buildFromLegacyPresetFile(name, path);
+ LLSettingsWater::ptr_t water = LLSettingsVOWater::buildFromLegacyPresetFile(name, path, messages);
+
+ if (!water)
+ {
+ messages["NAME"] = name;
+ messages["FILE"] = filename;
+ }
return water;
}
-LLSettingsSky::ptr_t LLEnvironment::createSkyFromLegacyPreset(const std::string filename)
+LLSettingsSky::ptr_t LLEnvironment::createSkyFromLegacyPreset(const std::string filename, LLSD &messages)
{
std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(filename), true));
std::string path(gDirUtilp->getDirName(filename));
- LLSettingsSky::ptr_t sky = LLSettingsVOSky::buildFromLegacyPresetFile(name, path);
+ LLSettingsSky::ptr_t sky = LLSettingsVOSky::buildFromLegacyPresetFile(name, path, messages);
+ if (!sky)
+ {
+ messages["NAME"] = name;
+ messages["FILE"] = filename;
+ }
return sky;
-
}
-LLSettingsDay::ptr_t LLEnvironment::createDayCycleFromLegacyPreset(const std::string filename)
+LLSettingsDay::ptr_t LLEnvironment::createDayCycleFromLegacyPreset(const std::string filename, LLSD &messages)
{
std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(filename), true));
std::string path(gDirUtilp->getDirName(filename));
- LLSettingsDay::ptr_t day = LLSettingsVODay::buildFromLegacyPresetFile(name, path);
+ LLSettingsDay::ptr_t day = LLSettingsVODay::buildFromLegacyPresetFile(name, path, messages);
+ if (!day)
+ {
+ messages["NAME"] = name;
+ messages["FILE"] = filename;
+ }
return day;
}
diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h
index 415e9de6a4..09a0aea426 100644
--- a/indra/newview/llenvironment.h
+++ b/indra/newview/llenvironment.h
@@ -190,9 +190,9 @@ public:
// and rotated by last cam yaw needed by water rendering shaders
LLVector4 getRotatedLightNorm() const;
- static LLSettingsWater::ptr_t createWaterFromLegacyPreset(const std::string filename);
- static LLSettingsSky::ptr_t createSkyFromLegacyPreset(const std::string filename);
- static LLSettingsDay::ptr_t createDayCycleFromLegacyPreset(const std::string filename);
+ static LLSettingsWater::ptr_t createWaterFromLegacyPreset(const std::string filename, LLSD &messages);
+ static LLSettingsSky::ptr_t createSkyFromLegacyPreset(const std::string filename, LLSD &messages);
+ static LLSettingsDay::ptr_t createDayCycleFromLegacyPreset(const std::string filename, LLSD &messages);
// Construct a new day cycle based on the environment. Replacing either the water or the sky tracks.
LLSettingsDay::ptr_t createDayCycleFromEnvironment(EnvSelection_t env, LLSettingsBase::ptr_t settings);
@@ -327,8 +327,8 @@ private:
DayTransition(const LLSettingsSky::ptr_t &skystart, const LLSettingsWater::ptr_t &waterstart, DayInstance::ptr_t &end, LLSettingsDay::Seconds time);
virtual ~DayTransition() { };
- virtual void applyTimeDelta(const LLSettingsBase::Seconds& delta);
- virtual void animate();
+ virtual void applyTimeDelta(const LLSettingsBase::Seconds& delta) override;
+ virtual void animate() override;
protected:
LLSettingsSky::ptr_t mStartSky;
diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp
index 3fac5e2b1f..aa16747fe3 100644
--- a/indra/newview/llfloatereditextdaycycle.cpp
+++ b/indra/newview/llfloatereditextdaycycle.cpp
@@ -1749,15 +1749,15 @@ void LLFloaterEditExtDayCycle::doImportFromDisk()
void LLFloaterEditExtDayCycle::loadSettingFromFile(const std::vector<std::string>& filenames)
{
+ LLSD messages;
if (filenames.size() < 1) return;
std::string filename = filenames[0];
LL_WARNS("LAPRAS") << "Selected file: " << filename << LL_ENDL;
- LLSettingsDay::ptr_t legacyday = LLEnvironment::createDayCycleFromLegacyPreset(filename);
+ LLSettingsDay::ptr_t legacyday = LLEnvironment::createDayCycleFromLegacyPreset(filename, messages);
if (!legacyday)
{
- LLSD args(LLSDMap("FILE", filename));
- LLNotificationsUtil::add("WLImportFail", args);
+ LLNotificationsUtil::add("WLImportFail", messages);
return;
}
diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp
index 35860de7a2..5eac6b317b 100644
--- a/indra/newview/llfloaterfixedenvironment.cpp
+++ b/indra/newview/llfloaterfixedenvironment.cpp
@@ -730,15 +730,15 @@ void LLFloaterFixedEnvironmentWater::doImportFromDisk()
void LLFloaterFixedEnvironmentWater::loadWaterSettingFromFile(const std::vector<std::string>& filenames)
{
+ LLSD messages;
if (filenames.size() < 1) return;
std::string filename = filenames[0];
LL_WARNS("LAPRAS") << "Selected file: " << filename << LL_ENDL;
- LLSettingsWater::ptr_t legacywater = LLEnvironment::createWaterFromLegacyPreset(filename);
+ LLSettingsWater::ptr_t legacywater = LLEnvironment::createWaterFromLegacyPreset(filename, messages);
if (!legacywater)
{
- LLSD args(LLSDMap("FILE", filename));
- LLNotificationsUtil::add("WLImportFail", args);
+ LLNotificationsUtil::add("WLImportFail", messages);
return;
}
@@ -819,14 +819,14 @@ void LLFloaterFixedEnvironmentSky::loadSkySettingFromFile(const std::vector<std:
{
if (filenames.size() < 1) return;
std::string filename = filenames[0];
+ LLSD messages;
LL_WARNS("LAPRAS") << "Selected file: " << filename << LL_ENDL;
- LLSettingsSky::ptr_t legacysky = LLEnvironment::createSkyFromLegacyPreset(filename);
+ LLSettingsSky::ptr_t legacysky = LLEnvironment::createSkyFromLegacyPreset(filename, messages);
if (!legacysky)
{
- LLSD args(LLSDMap("FILE", filename));
- LLNotificationsUtil::add("WLImportFail", args);
+ LLNotificationsUtil::add("WLImportFail", messages);
return;
}
diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp
index e2e7aadb61..29217b3f42 100644
--- a/indra/newview/llsettingsvo.cpp
+++ b/indra/newview/llsettingsvo.cpp
@@ -64,13 +64,15 @@
#include "llinventoryobserver.h"
#include "llinventorydefines.h"
+#include "lltrans.h"
+
#undef VERIFY_LEGACY_CONVERSION
//=========================================================================
namespace
{
LLSD ensure_array_4(LLSD in, F32 fill);
- LLSD read_legacy_preset_data(const std::string &name, const std::string& path);
+ LLSD read_legacy_preset_data(const std::string &name, const std::string& path, LLSD &messages);
//-------------------------------------------------------------------------
class LLSettingsInventoryCB : public LLInventoryCallback
@@ -453,10 +455,15 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildSky(LLSD settings)
}
-LLSettingsSky::ptr_t LLSettingsVOSky::buildFromLegacyPreset(const std::string &name, const LLSD &legacy)
+LLSettingsSky::ptr_t LLSettingsVOSky::buildFromLegacyPreset(const std::string &name, const LLSD &oldsettings, LLSD &messages)
{
- LLSD newsettings = LLSettingsSky::translateLegacySettings(legacy);
+ LLSD newsettings = LLSettingsSky::translateLegacySettings(oldsettings);
+ if (newsettings.isUndefined())
+ {
+ messages["REASONS"] = LLTrans::getString("SettingTranslateError", LLSDMap("NAME", name));
+ return LLSettingsSky::ptr_t();
+ }
newsettings[SETTING_NAME] = name;
@@ -464,6 +471,7 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildFromLegacyPreset(const std::string &n
LLSD results = LLSettingsBase::settingValidation(newsettings, validations);
if (!results["success"].asBoolean())
{
+ messages["REASONS"] = LLTrans::getString("SettingValidationError", LLSDMap("NAME", name));
LL_WARNS("SETTINGS") << "Sky setting validation failed!\n" << results << LL_ENDL;
LLSettingsSky::ptr_t();
}
@@ -473,10 +481,10 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildFromLegacyPreset(const std::string &n
#ifdef VERIFY_LEGACY_CONVERSION
LLSD oldsettings = LLSettingsVOSky::convertToLegacy(skyp, isAdvanced());
- if (!llsd_equals(legacy, oldsettings))
+ if (!llsd_equals(oldsettings, oldsettings))
{
LL_WARNS("SKY") << "Conversion to/from legacy does not match!\n"
- << "Old: " << legacy
+ << "Old: " << oldsettings
<< "new: " << oldsettings << LL_ENDL;
}
@@ -485,17 +493,17 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildFromLegacyPreset(const std::string &n
return skyp;
}
-LLSettingsSky::ptr_t LLSettingsVOSky::buildFromLegacyPresetFile(const std::string &name, const std::string &path)
+LLSettingsSky::ptr_t LLSettingsVOSky::buildFromLegacyPresetFile(const std::string &name, const std::string &path, LLSD &messages)
{
- LLSD legacy_data = read_legacy_preset_data(name, path);
+ LLSD legacy_data = read_legacy_preset_data(name, path, messages);
if (!legacy_data)
- {
+ { // messages filled in by read_legacy_preset_data
LL_WARNS("SETTINGS") << "Could not load legacy Windlight \"" << name << "\" from " << path << LL_ENDL;
return ptr_t();
}
- return buildFromLegacyPreset(name, legacy_data);
+ return buildFromLegacyPreset(name, legacy_data, messages);
}
@@ -755,15 +763,21 @@ LLSettingsWater::ptr_t LLSettingsVOWater::buildWater(LLSD settings)
}
//-------------------------------------------------------------------------
-LLSettingsWater::ptr_t LLSettingsVOWater::buildFromLegacyPreset(const std::string &name, const LLSD &legacy)
+LLSettingsWater::ptr_t LLSettingsVOWater::buildFromLegacyPreset(const std::string &name, const LLSD &oldsettings, LLSD &messages)
{
- LLSD newsettings(LLSettingsWater::translateLegacySettings(legacy));
+ LLSD newsettings(LLSettingsWater::translateLegacySettings(oldsettings));
+ if (newsettings.isUndefined())
+ {
+ messages["REASONS"] = LLTrans::getString("SettingTranslateError", LLSDMap("NAME", name));
+ return LLSettingsWater::ptr_t();
+ }
newsettings[SETTING_NAME] = name;
LLSettingsWater::validation_list_t validations = LLSettingsWater::validationList();
LLSD results = LLSettingsWater::settingValidation(newsettings, validations);
if (!results["success"].asBoolean())
{
+ messages["REASONS"] = LLTrans::getString("SettingValidationError", name);
LL_WARNS("SETTINGS") << "Water setting validation failed!: " << results << LL_ENDL;
return LLSettingsWater::ptr_t();
}
@@ -773,10 +787,10 @@ LLSettingsWater::ptr_t LLSettingsVOWater::buildFromLegacyPreset(const std::strin
#ifdef VERIFY_LEGACY_CONVERSION
LLSD oldsettings = LLSettingsVOWater::convertToLegacy(waterp);
- if (!llsd_equals(legacy, oldsettings))
+ if (!llsd_equals(oldsettings, oldsettings))
{
LL_WARNS("WATER") << "Conversion to/from legacy does not match!\n"
- << "Old: " << legacy
+ << "Old: " << oldsettings
<< "new: " << oldsettings << LL_ENDL;
}
@@ -784,17 +798,17 @@ LLSettingsWater::ptr_t LLSettingsVOWater::buildFromLegacyPreset(const std::strin
return waterp;
}
-LLSettingsWater::ptr_t LLSettingsVOWater::buildFromLegacyPresetFile(const std::string &name, const std::string &path)
+LLSettingsWater::ptr_t LLSettingsVOWater::buildFromLegacyPresetFile(const std::string &name, const std::string &path, LLSD &messages)
{
- LLSD legacy_data = read_legacy_preset_data(name, path);
+ LLSD legacy_data = read_legacy_preset_data(name, path, messages);
if (!legacy_data)
- {
+ { // messages filled in by read_legacy_preset_data
LL_WARNS("SETTINGS") << "Could not load legacy Windlight \"" << name << "\" from " << path << LL_ENDL;
return ptr_t();
}
- return buildFromLegacyPreset(name, legacy_data);
+ return buildFromLegacyPreset(name, legacy_data, messages);
}
@@ -959,7 +973,7 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildDay(LLSD settings)
}
//-------------------------------------------------------------------------
-LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyPreset(const std::string &name, const std::string &path, const LLSD &oldsettings)
+LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyPreset(const std::string &name, const std::string &path, const LLSD &oldsettings, LLSD &messages)
{
LLSD newsettings(defaults());
std::set<std::string> framenames;
@@ -994,16 +1008,22 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyPreset(const std::string &n
LLSD frames(LLSD::emptyMap());
{
- LLSettingsWater::ptr_t pwater = LLSettingsVOWater::buildFromLegacyPresetFile("Default", water_path);
- if (pwater)
- frames["water:Default"] = pwater->getSettings();
+ LLSettingsWater::ptr_t pwater = LLSettingsVOWater::buildFromLegacyPresetFile("Default", water_path, messages);
+ if (!pwater)
+ { // messages filled in by buildFromLegacyPresetFile
+ return LLSettingsDay::ptr_t();
+ }
+ frames["water:Default"] = pwater->getSettings();
}
for (std::set<std::string>::iterator itn = framenames.begin(); itn != framenames.end(); ++itn)
{
- LLSettingsSky::ptr_t psky = LLSettingsVOSky::buildFromLegacyPresetFile((*itn), sky_path);
- if (psky)
- frames["sky:" + (*itn)] = psky->getSettings();
+ LLSettingsSky::ptr_t psky = LLSettingsVOSky::buildFromLegacyPresetFile((*itn), sky_path, messages);
+ if (!psky)
+ { // messages filled in by buildFromLegacyPresetFile
+ return LLSettingsDay::ptr_t();
+ }
+ frames["sky:" + (*itn)] = psky->getSettings();
}
newsettings[SETTING_FRAMES] = frames;
@@ -1012,6 +1032,7 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyPreset(const std::string &n
LLSD results = LLSettingsDay::settingValidation(newsettings, validations);
if (!results["success"].asBoolean())
{
+ messages["REASONS"] = LLTrans::getString("SettingValidationError", LLSDMap("NAME", name));
LL_WARNS("SETTINGS") << "Day setting validation failed!: " << results << LL_ENDL;
return LLSettingsDay::ptr_t();
}
@@ -1035,17 +1056,17 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyPreset(const std::string &n
return dayp;
}
-LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyPresetFile(const std::string &name, const std::string &path)
+LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyPresetFile(const std::string &name, const std::string &path, LLSD &messages)
{
- LLSD legacy_data = read_legacy_preset_data(name, path);
+ LLSD legacy_data = read_legacy_preset_data(name, path, messages);
if (!legacy_data)
- {
+ { // messages filled in by read_legacy_preset_data
LL_WARNS("SETTINGS") << "Could not load legacy Windlight \"" << name << "\" from " << path << LL_ENDL;
return ptr_t();
}
- return buildFromLegacyPreset(name, path, legacy_data);
+ return buildFromLegacyPreset(name, path, legacy_data, messages);
}
@@ -1348,7 +1369,7 @@ namespace
}
//---------------------------------------------------------------------
- LLSD read_legacy_preset_data(const std::string &name, const std::string& path)
+ LLSD read_legacy_preset_data(const std::string &name, const std::string& path, LLSD &messages)
{
llifstream xml_file;
@@ -1380,6 +1401,7 @@ namespace
xml_file.open(full_path.c_str());
if (!xml_file)
{
+ messages["REASONS"] = LLTrans::getString("SettingImportFileError", LLSDMap("FILE", bad_path));
LL_WARNS("LEGACYSETTING") << "Unable to open legacy windlight \"" << name << "\" from " << path << LL_ENDL;
return LLSD();
}
@@ -1388,7 +1410,12 @@ namespace
LLSD params_data;
LLPointer<LLSDParser> parser = new LLSDXMLParser();
- parser->parse(xml_file, params_data, LLSDSerialize::SIZE_UNLIMITED);
+ if (parser->parse(xml_file, params_data, LLSDSerialize::SIZE_UNLIMITED) == LLSDParser::PARSE_FAILURE)
+ {
+ xml_file.close();
+ messages["REASONS"] = LLTrans::getString("SettingParseFileError", LLSDMap("FILE", full_path));
+ return LLSD();
+ }
xml_file.close();
return params_data;
diff --git a/indra/newview/llsettingsvo.h b/indra/newview/llsettingsvo.h
index 1ad0091871..0f4b715e44 100644
--- a/indra/newview/llsettingsvo.h
+++ b/indra/newview/llsettingsvo.h
@@ -91,11 +91,11 @@ public:
static ptr_t buildSky(LLSD settings);
- static ptr_t buildFromLegacyPreset(const std::string &name, const LLSD &oldsettings);
+ static ptr_t buildFromLegacyPreset(const std::string &name, const LLSD &oldsettings, LLSD &messages);
static ptr_t buildDefaultSky();
virtual ptr_t buildClone() const SETTINGS_OVERRIDE;
- static ptr_t buildFromLegacyPresetFile(const std::string &name, const std::string &path);
+ static ptr_t buildFromLegacyPresetFile(const std::string &name, const std::string &path, LLSD &messages);
static LLSD convertToLegacy(const ptr_t &, bool isAdvanced);
@@ -125,11 +125,11 @@ public:
static ptr_t buildWater(LLSD settings);
- static ptr_t buildFromLegacyPreset(const std::string &name, const LLSD &oldsettings);
+ static ptr_t buildFromLegacyPreset(const std::string &name, const LLSD &oldsettings, LLSD &messages);
static ptr_t buildDefaultWater();
virtual ptr_t buildClone() const SETTINGS_OVERRIDE;
- static ptr_t buildFromLegacyPresetFile(const std::string &name, const std::string &path);
+ static ptr_t buildFromLegacyPresetFile(const std::string &name, const std::string &path, LLSD &messages);
static LLSD convertToLegacy(const ptr_t &);
protected:
@@ -156,8 +156,8 @@ public:
static ptr_t buildDay(LLSD settings);
- static ptr_t buildFromLegacyPreset(const std::string &name, const std::string &path, const LLSD &oldsettings);
- static ptr_t buildFromLegacyPresetFile(const std::string &name, const std::string &path);
+ static ptr_t buildFromLegacyPreset(const std::string &name, const std::string &path, const LLSD &oldsettings, LLSD &messages);
+ static ptr_t buildFromLegacyPresetFile(const std::string &name, const std::string &path, LLSD &messages);
static ptr_t buildFromLegacyMessage(const LLUUID &regionId, LLSD daycycle, LLSD skys, LLSD water);
static ptr_t buildDefaultDayCycle();
static ptr_t buildFromEnvironmentMessage(LLSD settings);
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 9ca9d4cd51..5ea5023c94 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -11267,7 +11267,10 @@ This Region does not support environmental settings.
name="WLImportFail"
persist="true"
type="alertmodal">
-Unable to import legacy Windlight settings from [FILE].
+Unable to import legacy Windlight settings [NAME] from
+[FILE].
+
+[REASONS]
<tag>fail</tag>
</notification>
@@ -11331,5 +11334,5 @@ You may not edit settings directly from the libary.
Please copy to your own inventory and try again.
<tag>fail</tag>
</notification>
-
+
</notifications>
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index 1879ce6f32..71133f582f 100644
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -378,6 +378,11 @@ Error in upload request. Please visit
http://secondlife.com/support for help fixing this problem.
</string>
+ <!-- Settings errors -->
+ <string name="SettingValidationError">Validation failed for importing settings [NAME]</string>
+ <string name="SettingImportFileError">Could not open file [FILE]</string>
+ <string name="SettingParseFileError">Could not open file [FILE]</string>
+ <string name="SettingTranslateError">Could not translate legacy windlight [NAME]</string>
<!-- Asset Type human readable names: these will replace variable [TYPE] in notification FailedToFindWearable* -->
<!-- Will also replace [OBJECTTYPE] in notifications: UserGiveItem, ObjectGiveItem -->
<string name="texture">texture</string>