diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llinventory/llsettingssky.cpp | 21 | ||||
-rw-r--r-- | indra/llinventory/llsettingswater.cpp | 15 | ||||
-rw-r--r-- | indra/newview/llenvironment.cpp | 48 | ||||
-rw-r--r-- | indra/newview/llenvironment.h | 10 | ||||
-rw-r--r-- | indra/newview/llfloatereditextdaycycle.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llfloaterfixedenvironment.cpp | 12 | ||||
-rw-r--r-- | indra/newview/llsettingsvo.cpp | 87 | ||||
-rw-r--r-- | indra/newview/llsettingsvo.h | 12 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/notifications.xml | 7 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/strings.xml | 5 |
10 files changed, 164 insertions, 59 deletions
diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 86c8393499..f3519dc7cb 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -809,6 +809,7 @@ LLSD LLSettingsSky::translateLegacyHazeSettings(const LLSD& legacy) LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) { + bool converted_something(false); LLSD newsettings(defaults()); // Move legacy haze parameters to an inner map @@ -818,23 +819,28 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) if (legacyhazesettings.size() > 0) { newsettings[SETTING_LEGACY_HAZE] = legacyhazesettings; + converted_something |= true; } if (legacy.has(SETTING_CLOUD_COLOR)) { newsettings[SETTING_CLOUD_COLOR] = LLColor3(legacy[SETTING_CLOUD_COLOR]).getValue(); + converted_something |= true; } if (legacy.has(SETTING_CLOUD_POS_DENSITY1)) { newsettings[SETTING_CLOUD_POS_DENSITY1] = LLColor3(legacy[SETTING_CLOUD_POS_DENSITY1]).getValue(); + converted_something |= true; } if (legacy.has(SETTING_CLOUD_POS_DENSITY2)) { newsettings[SETTING_CLOUD_POS_DENSITY2] = LLColor3(legacy[SETTING_CLOUD_POS_DENSITY2]).getValue(); + converted_something |= true; } if (legacy.has(SETTING_CLOUD_SCALE)) { newsettings[SETTING_CLOUD_SCALE] = LLSD::Real(legacy[SETTING_CLOUD_SCALE][0].asReal()); + converted_something |= true; } if (legacy.has(SETTING_CLOUD_SCROLL_RATE)) { @@ -851,53 +857,64 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) } newsettings[SETTING_CLOUD_SCROLL_RATE] = cloud_scroll.getValue(); + converted_something |= true; } if (legacy.has(SETTING_CLOUD_SHADOW)) { newsettings[SETTING_CLOUD_SHADOW] = LLSD::Real(legacy[SETTING_CLOUD_SHADOW][0].asReal()); + converted_something |= true; } if (legacy.has(SETTING_GAMMA)) { newsettings[SETTING_GAMMA] = legacy[SETTING_GAMMA][0].asReal(); + converted_something |= true; } if (legacy.has(SETTING_GLOW)) { newsettings[SETTING_GLOW] = LLColor3(legacy[SETTING_GLOW]).getValue(); + converted_something |= true; } if (legacy.has(SETTING_MAX_Y)) { newsettings[SETTING_MAX_Y] = LLSD::Real(legacy[SETTING_MAX_Y][0].asReal()); + converted_something |= true; } if (legacy.has(SETTING_STAR_BRIGHTNESS)) { newsettings[SETTING_STAR_BRIGHTNESS] = LLSD::Real(legacy[SETTING_STAR_BRIGHTNESS].asReal() * 250.0f); + converted_something |= true; } if (legacy.has(SETTING_SUNLIGHT_COLOR)) { newsettings[SETTING_SUNLIGHT_COLOR] = LLColor4(legacy[SETTING_SUNLIGHT_COLOR]).getValue(); + converted_something |= true; } if (legacy.has(SETTING_PLANET_RADIUS)) { newsettings[SETTING_PLANET_RADIUS] = LLSD::Real(legacy[SETTING_PLANET_RADIUS].asReal()); + converted_something |= true; } if (legacy.has(SETTING_SKY_BOTTOM_RADIUS)) { newsettings[SETTING_SKY_BOTTOM_RADIUS] = LLSD::Real(legacy[SETTING_SKY_BOTTOM_RADIUS].asReal()); + converted_something |= true; } if (legacy.has(SETTING_SKY_TOP_RADIUS)) { newsettings[SETTING_SKY_TOP_RADIUS] = LLSD::Real(legacy[SETTING_SKY_TOP_RADIUS].asReal()); + converted_something |= true; } if (legacy.has(SETTING_SUN_ARC_RADIANS)) { newsettings[SETTING_SUN_ARC_RADIANS] = LLSD::Real(legacy[SETTING_SUN_ARC_RADIANS].asReal()); + converted_something |= true; } if (legacy.has(SETTING_LEGACY_EAST_ANGLE) && legacy.has(SETTING_LEGACY_SUN_ANGLE)) @@ -912,8 +929,12 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) newsettings[SETTING_SUN_ROTATION] = sunquat.getValue(); newsettings[SETTING_MOON_ROTATION] = moonquat.getValue(); + converted_something |= true; } + if (!converted_something) + return LLSD(); + return newsettings; } diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index 1780948f0a..d160a4ae0e 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -119,57 +119,72 @@ LLSD LLSettingsWater::defaults(const LLSettingsBase::TrackPosition& position) LLSD LLSettingsWater::translateLegacySettings(LLSD legacy) { + bool converted_something(false); LLSD newsettings(defaults()); if (legacy.has(SETTING_LEGACY_BLUR_MULTIPLIER)) { newsettings[SETTING_BLUR_MULTIPLIER] = LLSD::Real(legacy[SETTING_LEGACY_BLUR_MULTIPLIER].asReal()); + converted_something |= true; } if (legacy.has(SETTING_LEGACY_FOG_COLOR)) { newsettings[SETTING_FOG_COLOR] = LLColor3(legacy[SETTING_LEGACY_FOG_COLOR]).getValue(); + converted_something |= true; } if (legacy.has(SETTING_LEGACY_FOG_DENSITY)) { newsettings[SETTING_FOG_DENSITY] = LLSD::Real(legacy[SETTING_LEGACY_FOG_DENSITY]); + converted_something |= true; } if (legacy.has(SETTING_LEGACY_FOG_MOD)) { newsettings[SETTING_FOG_MOD] = LLSD::Real(legacy[SETTING_LEGACY_FOG_MOD].asReal()); + converted_something |= true; } if (legacy.has(SETTING_LEGACY_FRESNEL_OFFSET)) { newsettings[SETTING_FRESNEL_OFFSET] = LLSD::Real(legacy[SETTING_LEGACY_FRESNEL_OFFSET].asReal()); + converted_something |= true; } if (legacy.has(SETTING_LEGACY_FRESNEL_SCALE)) { newsettings[SETTING_FRESNEL_SCALE] = LLSD::Real(legacy[SETTING_LEGACY_FRESNEL_SCALE].asReal()); + converted_something |= true; } if (legacy.has(SETTING_LEGACY_NORMAL_MAP)) { newsettings[SETTING_NORMAL_MAP] = LLSD::UUID(legacy[SETTING_LEGACY_NORMAL_MAP].asUUID()); + converted_something |= true; } if (legacy.has(SETTING_LEGACY_NORMAL_SCALE)) { newsettings[SETTING_NORMAL_SCALE] = LLVector3(legacy[SETTING_LEGACY_NORMAL_SCALE]).getValue(); + converted_something |= true; } if (legacy.has(SETTING_LEGACY_SCALE_ABOVE)) { newsettings[SETTING_SCALE_ABOVE] = LLSD::Real(legacy[SETTING_LEGACY_SCALE_ABOVE].asReal()); + converted_something |= true; } if (legacy.has(SETTING_LEGACY_SCALE_BELOW)) { newsettings[SETTING_SCALE_BELOW] = LLSD::Real(legacy[SETTING_LEGACY_SCALE_BELOW].asReal()); + converted_something |= true; } if (legacy.has(SETTING_LEGACY_WAVE1_DIR)) { newsettings[SETTING_WAVE1_DIR] = LLVector2(legacy[SETTING_LEGACY_WAVE1_DIR]).getValue(); + converted_something |= true; } if (legacy.has(SETTING_LEGACY_WAVE2_DIR)) { newsettings[SETTING_WAVE2_DIR] = LLVector2(legacy[SETTING_LEGACY_WAVE2_DIR]).getValue(); + converted_something |= true; } + if (!converted_something) + return LLSD(); return newsettings; } 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 d6c104547d..6283008a63 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -1704,15 +1704,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 ce231973c7..67c6a1bba0 100644 --- a/indra/newview/llfloaterfixedenvironment.cpp +++ b/indra/newview/llfloaterfixedenvironment.cpp @@ -729,15 +729,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; } @@ -818,14 +818,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 ®ionId, 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> |