summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2018-06-01 16:24:36 -0700
committerRider Linden <rider@lindenlab.com>2018-06-01 16:24:36 -0700
commit2a613d7363c4e91a7258d4f0ea3971db1569e788 (patch)
treef1882a8e0920bbaf2778d6fcab36df6edc3c3ab7
parentbd84cbfa11fbe2b3aa5ceba5978841310488b8e4 (diff)
Rework preset loading and context menu from inventory.
-rw-r--r--indra/llinventory/llsettingsdaycycle.cpp15
-rw-r--r--indra/llinventory/llsettingsdaycycle.h7
-rw-r--r--indra/llinventory/llsettingssky.cpp7
-rw-r--r--indra/llinventory/llsettingssky.h2
-rw-r--r--indra/llinventory/llsettingswater.cpp3
-rw-r--r--indra/llinventory/llsettingswater.h2
-rw-r--r--indra/newview/llenvironment.cpp344
-rw-r--r--indra/newview/llenvironment.h15
-rw-r--r--indra/newview/llfloatereditextdaycycle.cpp8
-rw-r--r--indra/newview/llfloaterenvironmentsettings.cpp2
-rw-r--r--indra/newview/llfloaterfixedenvironment.cpp9
-rw-r--r--indra/newview/llinventorybridge.cpp82
-rw-r--r--indra/newview/llsettingsvo.cpp208
-rw-r--r--indra/newview/llsettingsvo.h9
-rw-r--r--indra/newview/llviewermenu.cpp12
-rw-r--r--indra/newview/skins/default/xui/en/menu_inventory.xml27
-rw-r--r--indra/newview/skins/default/xui/en/menu_save_settings.xml4
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml9
18 files changed, 510 insertions, 255 deletions
diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp
index 577b12b031..e67da95a6c 100644
--- a/indra/llinventory/llsettingsdaycycle.cpp
+++ b/indra/llinventory/llsettingsdaycycle.cpp
@@ -101,6 +101,9 @@ const S32 LLSettingsDay::TRACK_WATER(0); // water track is 0
const S32 LLSettingsDay::TRACK_MAX(5); // 5 tracks, 4 skys, 1 water
const S32 LLSettingsDay::FRAME_MAX(56);
+// *LAPRAS* Change when Agni
+const LLUUID LLSettingsDay::DEFAULT_ASSET_ID("94d296c2-6e05-963c-6b62-671199121dbb");
+
//=========================================================================
LLSettingsDay::LLSettingsDay(const LLSD &data) :
LLSettingsBase(data),
@@ -218,22 +221,18 @@ bool LLSettingsDay::initialize()
if (i == TRACK_WATER)
{
setting = used[(*it)[SETTING_KEYNAME]];
- if (!setting)
- setting = getNamedWater((*it)[SETTING_KEYNAME]);
if (setting && setting->getSettingType() != "water")
{
- LL_WARNS("DAYCYCLE") << "Water track referencing " << setting->getSettingType() << " frame at " << keyframe << "." << LL_ENDL;
+ LL_WARNS("SETTINGS", "DAYCYCLE") << "Water track referencing " << setting->getSettingType() << " frame at " << keyframe << "." << LL_ENDL;
setting.reset();
}
}
else
{
setting = used[(*it)[SETTING_KEYNAME]];
- if (!setting)
- setting = getNamedSky((*it)[SETTING_KEYNAME]);
if (setting && setting->getSettingType() != "sky")
{
- LL_WARNS("DAYCYCLE") << "Sky track #" << i << " referencing " << setting->getSettingType() << " frame at " << keyframe << "." << LL_ENDL;
+ LL_WARNS("SETTINGS", "DAYCYCLE") << "Sky track #" << i << " referencing " << setting->getSettingType() << " frame at " << keyframe << "." << LL_ENDL;
setting.reset();
}
}
@@ -247,6 +246,10 @@ bool LLSettingsDay::initialize()
hassky |= true;
mDayTracks[i][keyframe] = setting;
}
+ else
+ {
+ LL_WARNS("SETTINGS", "DAYCYCLE") << "Skipping frame on track #" << i << " at time index " << keyframe << LL_ENDL;
+ }
}
}
diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h
index 5e6fc7f21d..101cacc3a2 100644
--- a/indra/llinventory/llsettingsdaycycle.h
+++ b/indra/llinventory/llsettingsdaycycle.h
@@ -60,6 +60,8 @@ public:
static const S32 TRACK_MAX;
static const S32 FRAME_MAX;
+ static const LLUUID DEFAULT_ASSET_ID;
+
typedef std::map<F32, LLSettingsBase::ptr_t> CycleTrack_t;
typedef std::vector<CycleTrack_t> CycleList_t;
typedef std::shared_ptr<LLSettingsDay> ptr_t;
@@ -105,10 +107,7 @@ public:
virtual LLSettingsSkyPtr_t buildSky(LLSD) const = 0;
virtual LLSettingsWaterPtr_t buildWater(LLSD) const = 0;
- virtual LLSettingsSkyPtr_t getNamedSky(const std::string &) const = 0;
- virtual LLSettingsWaterPtr_t getNamedWater(const std::string &) const = 0;
-
- void setInitialized(bool value = true) { mInitialized = value; }
+ void setInitialized(bool value = true) { mInitialized = value; }
CycleTrack_t & getCycleTrack(S32 track);
virtual validation_list_t getValidationList() const override;
diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp
index 45c1ca1d7f..f578660095 100644
--- a/indra/llinventory/llsettingssky.cpp
+++ b/indra/llinventory/llsettingssky.cpp
@@ -110,6 +110,9 @@ const LLUUID LLSettingsSky::DEFAULT_SUN_ID("cce0f112-878f-4586-a2e2-a8f104bba271
const LLUUID LLSettingsSky::DEFAULT_MOON_ID("d07f6eed-b96a-47cd-b51d-400ad4a1c428"); // dataserver
const LLUUID LLSettingsSky::DEFAULT_CLOUD_ID("1dc1368f-e8fe-f02d-a08d-9d9f11c1af6b");
+// *LAPRAS* Change when Agni!
+const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("cec9af47-90d4-9093-5245-397e5c9e7749");
+
namespace
{
@@ -572,8 +575,8 @@ LLSD LLSettingsSky::defaults()
dfltsetting[SETTING_BLOOM_TEXTUREID] = IMG_BLOOM1;
dfltsetting[SETTING_CLOUD_TEXTUREID] = DEFAULT_CLOUD_ID;
- dfltsetting[SETTING_MOON_TEXTUREID] = DEFAULT_MOON_ID; // gMoonTextureID; // These two are returned by the login... wow!
- dfltsetting[SETTING_SUN_TEXTUREID] = DEFAULT_SUN_ID; // gSunTextureID;
+ dfltsetting[SETTING_MOON_TEXTUREID] = DEFAULT_MOON_ID;
+ dfltsetting[SETTING_SUN_TEXTUREID] = LLUUID::null; // DEFAULT_SUN_ID;
dfltsetting[SETTING_TYPE] = "sky";
diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h
index 9379cd37c3..82c2d6a804 100644
--- a/indra/llinventory/llsettingssky.h
+++ b/indra/llinventory/llsettingssky.h
@@ -83,6 +83,8 @@ public:
static const LLUUID DEFAULT_MOON_ID;
static const LLUUID DEFAULT_CLOUD_ID;
+ static const LLUUID DEFAULT_ASSET_ID;
+
typedef std::shared_ptr<LLSettingsSky> ptr_t;
typedef std::pair<F32, F32> azimalt_t;
diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp
index c6798945a3..aa1f0f1935 100644
--- a/indra/llinventory/llsettingswater.cpp
+++ b/indra/llinventory/llsettingswater.cpp
@@ -69,6 +69,9 @@ const std::string LLSettingsWater::SETTING_LEGACY_WAVE2_DIR("wave2Dir");
const LLUUID LLSettingsWater::DEFAULT_WATER_NORMAL_ID(DEFAULT_WATER_NORMAL);
+// *LAPRAS* Change when Agni
+const LLUUID LLSettingsWater::DEFAULT_ASSET_ID("ce4cfe94-700a-292c-7c22-a2d9201bd661");
+
//=========================================================================
LLSettingsWater::LLSettingsWater(const LLSD &data) :
diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h
index acae903e92..ca32a46430 100644
--- a/indra/llinventory/llsettingswater.h
+++ b/indra/llinventory/llsettingswater.h
@@ -48,6 +48,8 @@ public:
static const LLUUID DEFAULT_WATER_NORMAL_ID;
+ static const LLUUID DEFAULT_ASSET_ID;
+
typedef std::shared_ptr<LLSettingsWater> ptr_t;
//---------------------------------------------------------------------
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp
index 21ecf7741b..228a396c0d 100644
--- a/indra/newview/llenvironment.cpp
+++ b/indra/newview/llenvironment.cpp
@@ -238,6 +238,16 @@ const F32Seconds LLEnvironment::TRANSITION_DEFAULT(5.0f);
const F32Seconds LLEnvironment::TRANSITION_SLOW(10.0f);
const F32Seconds LLEnvironment::TRANSITION_ALTITUDE(5.0f);
+//*TODO* Change these when available on Agni (these are Damballah asset IDs).
+const LLUUID LLEnvironment::KNOWN_SKY_DEFAULT(LLSettingsSky::DEFAULT_ASSET_ID);
+const LLUUID LLEnvironment::KNOWN_WATER_DEFAULT(LLSettingsWater::DEFAULT_ASSET_ID);
+const LLUUID LLEnvironment::KNOWN_DAY_DEFAULT(LLSettingsDay::DEFAULT_ASSET_ID);
+
+const LLUUID LLEnvironment::KNOWN_SKY_SUNRISE("645d7475-19d6-d05c-6eb2-29eeacf76e06");
+const LLUUID LLEnvironment::KNOWN_SKY_MIDDAY("68f5a7ec-2785-d9d8-be7c-cca93976759a");
+const LLUUID LLEnvironment::KNOWN_SKY_SUNSET("06420773-757b-4b7c-a1f9-85fceb2f7bd4");
+const LLUUID LLEnvironment::KNOWN_SKY_MIDNIGHT("c13658f3-91b8-d559-3a12-b11ce3940c4c");
+
const F32 LLEnvironment::SUN_DELTA_YAW(F_PI); // 180deg
const F32 LLEnvironment::NIGHTTIME_ELEVATION_COS(LLSky::NIGHTTIME_ELEVATION_COS);
@@ -498,6 +508,25 @@ void LLEnvironment::setEnvironment(LLEnvironment::EnvSelection_t env, const LLSe
}
}
+void LLEnvironment::setEnvironment(EnvSelection_t env, const LLUUID &assetId)
+{
+ LLSettingsVOBase::getSettingsAsset(assetId,
+ [this, env](LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { onSetEnvAssetLoaded(env, asset_id, settings, status); });
+
+}
+
+void LLEnvironment::onSetEnvAssetLoaded(EnvSelection_t env, LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status)
+{
+ if (!settings || status)
+ {
+ LLSD args;
+ args["DESC"] = asset_id.asString();
+ LLNotificationsUtil::add("FailedToFindSettings", args);
+ return;
+ }
+
+ setEnvironment(env, settings);
+}
void LLEnvironment::clearEnvironment(LLEnvironment::EnvSelection_t env)
{
@@ -1311,196 +1340,172 @@ std::string LLEnvironment::getUserDir(const std::string &subdir)
LLSettingsWater::ptr_t LLEnvironment::createWaterFromLegacyPreset(const std::string filename)
{
- LLSD data = legacyLoadPreset(filename);
- if (!data)
- return LLSettingsWater::ptr_t();
-
std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(filename), true));
- LLSettingsWater::ptr_t water = LLSettingsVOWater::buildFromLegacyPreset(name, data);
+ std::string path(gDirUtilp->getDirName(filename));
+ LLSettingsWater::ptr_t water = LLSettingsVOWater::buildFromLegacyPresetFile(name, path);
return water;
}
LLSettingsSky::ptr_t LLEnvironment::createSkyFromLegacyPreset(const std::string filename)
{
- LLSD data = legacyLoadPreset(filename);
- if (!data)
- return LLSettingsSky::ptr_t();
-
std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(filename), true));
- LLSettingsSky::ptr_t sky = LLSettingsVOSky::buildFromLegacyPreset(name, data);
+ std::string path(gDirUtilp->getDirName(filename));
+ LLSettingsSky::ptr_t sky = LLSettingsVOSky::buildFromLegacyPresetFile(name, path);
return sky;
+
}
LLSettingsDay::ptr_t LLEnvironment::createDayCycleFromLegacyPreset(const std::string filename)
{
- // for the moment just look it up from the preloaded.
std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(filename), true));
+ std::string path(gDirUtilp->getDirName(filename));
- LLSettingsDay::ptr_t day = instance().findDayCycleByName(name);
+ LLSettingsDay::ptr_t day = LLSettingsVODay::buildFromLegacyPresetFile(name, path);
return day;
}
-LLSD LLEnvironment::legacyLoadPreset(const std::string& path)
-{
- llifstream xml_file;
- std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(path), /*strip_exten = */ true));
-
- xml_file.open(path.c_str());
- if (!xml_file)
- {
- return LLSD();
- }
-
- LLSD params_data;
- LLPointer<LLSDParser> parser = new LLSDXMLParser();
- parser->parse(xml_file, params_data, LLSDSerialize::SIZE_UNLIMITED);
- xml_file.close();
-
- return params_data;
-}
-
void LLEnvironment::legacyLoadAllPresets()
{
- std::string dir;
- std::string file;
-
- // System skies
- {
- dir = getSysDir("skies");
- LLDirIterator dir_iter(dir, "*.xml");
- while (dir_iter.next(file))
- {
- std::string path = gDirUtilp->add(dir, file);
-
- LLSD data = legacyLoadPreset(path);
- if (data)
- {
- std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(path), true));
-
- LLSettingsSky::ptr_t sky = LLSettingsVOSky::buildFromLegacyPreset(name, data);
- LLEnvironment::instance().addSky(sky);
- }
- }
- }
-
- // User skies
- {
- dir = getUserDir("skies");
- LLDirIterator dir_iter(dir, "*.xml");
- while (dir_iter.next(file))
- {
- std::string path = gDirUtilp->add(dir, file);
-
- LLSD data = legacyLoadPreset(path);
- if (data)
- {
- std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(path), true));
-
- LLSettingsSky::ptr_t sky = LLSettingsVOSky::buildFromLegacyPreset(name, data);
- LLEnvironment::instance().addSky(sky);
- }
- }
- }
-
- // System water
- {
- dir = getSysDir("water");
- LLDirIterator dir_iter(dir, "*.xml");
- while (dir_iter.next(file))
- {
- std::string path = gDirUtilp->add(dir, file);
-
- LLSD data = legacyLoadPreset(path);
- if (data)
- {
- std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(path), true));
-
- LLSettingsWater::ptr_t water = LLSettingsVOWater::buildFromLegacyPreset(name, data);
- LLEnvironment::instance().addWater(water);
- }
- }
- }
-
- // User water
- {
- dir = getUserDir("water");
- LLDirIterator dir_iter(dir, "*.xml");
- while (dir_iter.next(file))
- {
- std::string path = gDirUtilp->add(dir, file);
-
- LLSD data = legacyLoadPreset(path);
- if (data)
- {
- std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(path), true));
-
- LLSettingsWater::ptr_t water = LLSettingsVOWater::buildFromLegacyPreset(name, data);
- LLEnvironment::instance().addWater(water);
- }
- }
- }
-
- // System Days
- {
- dir = getSysDir("days");
- LLDirIterator dir_iter(dir, "*.xml");
- while (dir_iter.next(file))
- {
- std::string path = gDirUtilp->add(dir, file);
-
- LLSD data = legacyLoadPreset(path);
- if (data)
- {
- std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(path), true));
-
- LLSettingsDay::ptr_t day = LLSettingsVODay::buildFromLegacyPreset(name, data);
- /*if (day->validate())
- {
- LL_INFOS() << "Adding Day Cycle " << name << "." << LL_ENDL;
- LLEnvironment::instance().addDayCycle(day);
- }
- else
- {
- LL_WARNS() << "Day Cycle " << name << " was not valid. Ignoring." << LL_ENDL;
- }*/
- LL_INFOS() << "Adding Day Cycle " << name << "." << LL_ENDL;
- LLEnvironment::instance().addDayCycle(day);
-#ifdef EXPORT_PRESETS
- std::string exportfile = LLURI::escape(name) + "(new).xml";
- std::string exportpath = gDirUtilp->add(getSysDir("new"), exportfile);
-
- LLSD settings = day->getSettings();
-
- std::ofstream daycyclefile(exportpath);
- LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter();
- formatter->format(settings, daycyclefile, LLSDFormatter::OPTIONS_PRETTY);
- daycyclefile.close();
-#endif
- }
- }
- }
-
- // User Days
- {
- dir = getUserDir("days");
- LLDirIterator dir_iter(dir, "*.xml");
- while (dir_iter.next(file))
- {
- std::string path = gDirUtilp->add(dir, file);
-
- LLSD data = legacyLoadPreset(path);
- if (data)
- {
- std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(path), true));
-
- LLSettingsDay::ptr_t day = LLSettingsVODay::buildFromLegacyPreset(name, data);
- LLEnvironment::instance().addDayCycle(day);
- }
- }
- }
+// std::string dir;
+// std::string file;
+//
+// // System skies
+// {
+// dir = getSysDir("skies");
+// LLDirIterator dir_iter(dir, "*.xml");
+// while (dir_iter.next(file))
+// {
+// std::string path = gDirUtilp->add(dir, file);
+//
+// LLSD data = legacyLoadPreset(path);
+// if (data)
+// {
+// std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(path), true));
+//
+// LLSettingsSky::ptr_t sky = LLSettingsVOSky::buildFromLegacyPreset(name, data);
+// LLEnvironment::instance().addSky(sky);
+// }
+// }
+// }
+//
+// // User skies
+// {
+// dir = getUserDir("skies");
+// LLDirIterator dir_iter(dir, "*.xml");
+// while (dir_iter.next(file))
+// {
+// std::string path = gDirUtilp->add(dir, file);
+//
+// LLSD data = legacyLoadPreset(path);
+// if (data)
+// {
+// std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(path), true));
+//
+// LLSettingsSky::ptr_t sky = LLSettingsVOSky::buildFromLegacyPreset(name, data);
+// LLEnvironment::instance().addSky(sky);
+// }
+// }
+// }
+//
+// // System water
+// {
+// dir = getSysDir("water");
+// LLDirIterator dir_iter(dir, "*.xml");
+// while (dir_iter.next(file))
+// {
+// std::string path = gDirUtilp->add(dir, file);
+//
+// LLSD data = legacyLoadPreset(path);
+// if (data)
+// {
+// std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(path), true));
+//
+// LLSettingsWater::ptr_t water = LLSettingsVOWater::buildFromLegacyPreset(name, data);
+// LLEnvironment::instance().addWater(water);
+// }
+// }
+// }
+//
+// // User water
+// {
+// dir = getUserDir("water");
+// LLDirIterator dir_iter(dir, "*.xml");
+// while (dir_iter.next(file))
+// {
+// std::string path = gDirUtilp->add(dir, file);
+//
+// LLSD data = legacyLoadPreset(path);
+// if (data)
+// {
+// std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(path), true));
+//
+// LLSettingsWater::ptr_t water = LLSettingsVOWater::buildFromLegacyPreset(name, data);
+// LLEnvironment::instance().addWater(water);
+// }
+// }
+// }
+//
+// // System Days
+// {
+// dir = getSysDir("days");
+// LLDirIterator dir_iter(dir, "*.xml");
+// while (dir_iter.next(file))
+// {
+// std::string path = gDirUtilp->add(dir, file);
+//
+// LLSD data = legacyLoadPreset(path);
+// if (data)
+// {
+// std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(path), true));
+//
+// LLSettingsDay::ptr_t day = LLSettingsVODay::buildFromLegacyPreset(name, data);
+// /*if (day->validate())
+// {
+// LL_INFOS() << "Adding Day Cycle " << name << "." << LL_ENDL;
+// LLEnvironment::instance().addDayCycle(day);
+// }
+// else
+// {
+// LL_WARNS() << "Day Cycle " << name << " was not valid. Ignoring." << LL_ENDL;
+// }*/
+// LL_INFOS() << "Adding Day Cycle " << name << "." << LL_ENDL;
+// LLEnvironment::instance().addDayCycle(day);
+// #ifdef EXPORT_PRESETS
+// std::string exportfile = LLURI::escape(name) + "(new).xml";
+// std::string exportpath = gDirUtilp->add(getSysDir("new"), exportfile);
+//
+// LLSD settings = day->getSettings();
+//
+// std::ofstream daycyclefile(exportpath);
+// LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter();
+// formatter->format(settings, daycyclefile, LLSDFormatter::OPTIONS_PRETTY);
+// daycyclefile.close();
+// #endif
+// }
+// }
+// }
+//
+// // User Days
+// {
+// dir = getUserDir("days");
+// LLDirIterator dir_iter(dir, "*.xml");
+// while (dir_iter.next(file))
+// {
+// std::string path = gDirUtilp->add(dir, file);
+//
+// LLSD data = legacyLoadPreset(path);
+// if (data)
+// {
+// std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(path), true));
+//
+// LLSettingsDay::ptr_t day = LLSettingsVODay::buildFromLegacyPreset(name, data);
+// LLEnvironment::instance().addDayCycle(day);
+// }
+// }
+// }
}
void LLEnvironment::onAgentPositionHasChanged(const LLVector3 &localpos)
@@ -1521,9 +1526,6 @@ void LLEnvironment::onAgentPositionHasChanged(const LLVector3 &localpos)
S32 LLEnvironment::calculateSkyTrackForAltitude(F64 altitude)
{
-// //*LAPRAS* temp base on region's response.
-// return llmin((static_cast<S32>(altitude) / 100) + 1, (LLSettingsDay::TRACK_MAX - 1));
-
auto it = std::find_if_not(mTrackAltitudes.begin(), mTrackAltitudes.end(), [altitude](F32 test) { return altitude > test; });
if (it == mTrackAltitudes.begin())
diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h
index 32ce99ccc9..7c8304a7ed 100644
--- a/indra/newview/llenvironment.h
+++ b/indra/newview/llenvironment.h
@@ -55,6 +55,14 @@ public:
static const F32Seconds TRANSITION_SLOW;
static const F32Seconds TRANSITION_ALTITUDE;
+ static const LLUUID KNOWN_SKY_DEFAULT;
+ static const LLUUID KNOWN_WATER_DEFAULT;
+ static const LLUUID KNOWN_DAY_DEFAULT;
+ static const LLUUID KNOWN_SKY_SUNRISE;
+ static const LLUUID KNOWN_SKY_MIDDAY;
+ static const LLUUID KNOWN_SKY_SUNSET;
+ static const LLUUID KNOWN_SKY_MIDNIGHT;
+
struct EnvironmentInfo
{
EnvironmentInfo();
@@ -159,6 +167,8 @@ public:
void setEnvironment(EnvSelection_t env, const LLSettingsSky::ptr_t & fixed) { setEnvironment(env, fixedEnvironment_t(fixed, LLSettingsWater::ptr_t())); }
void setEnvironment(EnvSelection_t env, const LLSettingsWater::ptr_t & fixed) { setEnvironment(env, fixedEnvironment_t(LLSettingsSky::ptr_t(), fixed)); }
void setEnvironment(EnvSelection_t env, const LLSettingsSky::ptr_t & fixeds, const LLSettingsWater::ptr_t & fixedw) { setEnvironment(env, fixedEnvironment_t(fixeds, fixedw)); }
+ void setEnvironment(EnvSelection_t env, const LLUUID &assetId);
+
void clearEnvironment(EnvSelection_t env);
LLSettingsDay::ptr_t getEnvironmentDay(EnvSelection_t env);
S64Seconds getEnvironmentDayLength(EnvSelection_t env);
@@ -177,9 +187,11 @@ public:
list_name_id_t getWaterList() const;
list_name_id_t getDayCycleList() const;
+ // *LAPRAS* TODO : Remove these vvv
LLSettingsSky::ptr_t findSkyByName(std::string name) const;
LLSettingsWater::ptr_t findWaterByName(std::string name) const;
LLSettingsDay::ptr_t findDayCycleByName(std::string name) const;
+ // *LAPRAS* TODO : Remove these ^^^
inline LLVector2 getCloudScrollDelta() const { return mCloudScrollDelta; }
@@ -376,9 +388,10 @@ private:
void recordEnvironment(S32 parcel_id, EnvironmentInfo::ptr_t environment);
void onAgentPositionHasChanged(const LLVector3 &localpos);
+
+ void onSetEnvAssetLoaded(EnvSelection_t env, LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status);
//=========================================================================
void legacyLoadAllPresets();
- static LLSD legacyLoadPreset(const std::string& path);
static std::string getSysDir(const std::string &subdir);
static std::string getUserDir(const std::string &subdir);
diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp
index 706dd99fc9..4703a1ec16 100644
--- a/indra/newview/llfloatereditextdaycycle.cpp
+++ b/indra/newview/llfloatereditextdaycycle.cpp
@@ -795,6 +795,14 @@ void LLFloaterEditExtDayCycle::loadInventoryItem(const LLUUID &inventoryId)
void LLFloaterEditExtDayCycle::onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status)
{
+ if (!settings || status)
+ {
+ LLSD args;
+ args["DESC"] = (mInventoryItem) ? mInventoryItem->getName() : "Unknown";
+ LLNotificationsUtil::add("FailedToFindSettings", args);
+ closeFloater();
+ return;
+ }
mEditDay = std::dynamic_pointer_cast<LLSettingsDay>(settings);
updateEditEnvironment();
syncronizeTabs();
diff --git a/indra/newview/llfloaterenvironmentsettings.cpp b/indra/newview/llfloaterenvironmentsettings.cpp
index b7bf6918fe..1b96db6611 100644
--- a/indra/newview/llfloaterenvironmentsettings.cpp
+++ b/indra/newview/llfloaterenvironmentsettings.cpp
@@ -122,6 +122,7 @@ void LLFloaterEnvironmentSettings::onSelectDayCyclePreset()
void LLFloaterEnvironmentSettings::onBtnOK()
{
+#if 0
bool use_region_settings = mRegionSettingsRadioGroup->getSelectedIndex() == 0;
LLEnvironment::instance().clearEnvironment(LLEnvironment::ENV_EDIT);
@@ -157,7 +158,6 @@ void LLFloaterEnvironmentSettings::onBtnOK()
LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL);
}
-#if 0
// Save and apply new user preferences.
bool use_region_settings = mRegionSettingsRadioGroup->getSelectedIndex() == 0;
bool use_fixed_sky = mDayCycleSettingsRadioGroup->getSelectedIndex() == 0;
diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp
index d5fc34a04b..6c1080294d 100644
--- a/indra/newview/llfloaterfixedenvironment.cpp
+++ b/indra/newview/llfloaterfixedenvironment.cpp
@@ -212,6 +212,15 @@ void LLFloaterFixedEnvironment::loadInventoryItem(const LLUUID &inventoryId)
void LLFloaterFixedEnvironment::onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status)
{
+ if (!settings || status)
+ {
+ LLSD args;
+ args["DESC"] = (mInventoryItem) ? mInventoryItem->getName() : "Unknown";
+ LLNotificationsUtil::add("FailedToFindSettings", args);
+ closeFloater();
+ return;
+ }
+
mSettings = settings;
updateEditEnvironment();
syncronizeTabs();
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 2b74116f8b..fe7d302992 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -6903,7 +6903,44 @@ LLUIImagePtr LLSettingsBridge::getIcon() const
void LLSettingsBridge::performAction(LLInventoryModel* model, std::string action)
{
- LLItemBridge::performAction(model, action);
+ if ("apply_settings_local" == action)
+ {
+ // Single item only
+ LLViewerInventoryItem* item = static_cast<LLViewerInventoryItem*>(getItem());
+ if (!item)
+ return;
+ LLUUID asset_id = item->getProtectedAssetUUID();
+ LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, asset_id);
+ LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL);
+ }
+ else if ("apply_settings_parcel" == action)
+ {
+ // Single item only
+ LLViewerInventoryItem* item = static_cast<LLViewerInventoryItem*>(getItem());
+ if (!item)
+ return;
+ LLUUID asset_id = item->getProtectedAssetUUID();
+ // *LAPRAS* TODO update on simulator.
+ LL_WARNS("LAPRAS") << "Only updating locally!!! NOT REALLY PARCEL UPDATE" << LL_ENDL;
+ LLEnvironment::instance().clearEnvironment(LLEnvironment::ENV_LOCAL);
+ LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_PARCEL, asset_id);
+ LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL);
+ }
+ else if ("apply_settings_region" == action)
+ {
+ // Single item only
+ LLViewerInventoryItem* item = static_cast<LLViewerInventoryItem*>(getItem());
+ if (!item)
+ return;
+ LLUUID asset_id = item->getProtectedAssetUUID();
+ // *LAPRAS* TODO update on simulator.
+ LL_WARNS("LAPRAS") << "Only updating locally!!! NOT REALLY REGION UPDATE" << LL_ENDL;
+ LLEnvironment::instance().clearEnvironment(LLEnvironment::ENV_LOCAL);
+ LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_REGION, asset_id);
+ LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL);
+ }
+ else
+ LLItemBridge::performAction(model, action);
}
void LLSettingsBridge::openItem()
@@ -6917,9 +6954,48 @@ void LLSettingsBridge::openItem()
void LLSettingsBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
- LLItemBridge::buildContextMenu(menu, flags);
-}
+ LL_DEBUGS() << "LLSettingsBridge::buildContextMenu()" << LL_ENDL;
+ menuentry_vec_t items;
+ menuentry_vec_t disabled_items;
+ if (isMarketplaceListingsFolder())
+ {
+ menuentry_vec_t items;
+ menuentry_vec_t disabled_items;
+ addMarketplaceContextMenuOptions(flags, items, disabled_items);
+ items.push_back(std::string("Properties"));
+ getClipboardEntries(false, items, disabled_items, flags);
+ hide_context_entries(menu, items, disabled_items);
+ }
+ else if (isItemInTrash())
+ {
+ addTrashContextMenuOptions(items, disabled_items);
+ }
+ else
+ {
+ items.push_back(std::string("Share"));
+ if (!canShare())
+ {
+ disabled_items.push_back(std::string("Share"));
+ }
+
+ addOpenRightClickMenuOption(items);
+ items.push_back(std::string("Properties"));
+
+ getClipboardEntries(true, items, disabled_items, flags);
+
+ items.push_back("Settings Separator");
+ items.push_back("Settings Apply Local");
+
+ items.push_back("Settings Apply Parcel");
+ // *LAPRAS* TODO: test for permission
+
+ items.push_back("Settings Apply Region");
+ // *LAPRAS* TODO: test for permission
+ }
+ addLinkReplaceMenuOption(items, disabled_items);
+ hide_context_entries(menu, items, disabled_items);
+}
std::string LLSettingsBridge::getLabelSuffix() const
{
return LLItemBridge::getLabelSuffix();
diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp
index 1ac607cd1f..39046004b8 100644
--- a/indra/newview/llsettingsvo.cpp
+++ b/indra/newview/llsettingsvo.cpp
@@ -58,47 +58,33 @@
#include "llassetstorage.h"
#include "llvfile.h"
+#include <boost/algorithm/string/replace.hpp>
+
#undef VERIFY_LEGACY_CONVERSION
//=========================================================================
namespace
{
-LLSD ensureArray4(LLSD in, F32 fill)
-{
- if (in.size() >= 4)
- return in;
-
- LLSD out(LLSD::emptyArray());
-
- for (S32 idx = 0; idx < in.size(); ++idx)
- {
- out.append(in[idx]);
- }
-
- while (out.size() < 4)
- {
- out.append(LLSD::Real(fill));
- }
- return out;
-}
-
+ LLSD ensure_array_4(LLSD in, F32 fill);
+ LLSD read_legacy_preset_data(const std::string& path);
-//-------------------------------------------------------------------------
-class LLSettingsInventoryCB : public LLInventoryCallback
-{
-public:
- typedef std::function<void(const LLUUID &)> callback_t;
+ //-------------------------------------------------------------------------
+ class LLSettingsInventoryCB : public LLInventoryCallback
+ {
+ public:
+ typedef std::function<void(const LLUUID &)> callback_t;
- LLSettingsInventoryCB(callback_t cbfn) :
- mCbfn(cbfn)
- { }
+ LLSettingsInventoryCB(callback_t cbfn) :
+ mCbfn(cbfn)
+ { }
- void fire(const LLUUID& inv_item) override { if (mCbfn) mCbfn(inv_item); }
+ void fire(const LLUUID& inv_item) override { if (mCbfn) mCbfn(inv_item); }
-private:
- callback_t mCbfn;
-};
+ private:
+ callback_t mCbfn;
+ };
+ //-------------------------------------------------------------------------
}
@@ -240,9 +226,10 @@ void LLSettingsVOBase::onAssetDownloadComplete(LLVFS *vfs, const LLUUID &asset_i
}
else
{
- LL_WARNS("SETTINGS") << "Error retrieving asset asset_id. Status code=" << status << "(" << LLAssetStorage::getErrorString(status) << ") ext_status=" << ext_status << LL_ENDL;
+ LL_WARNS("SETTINGS") << "Error retrieving asset " << asset_id << ". Status code=" << status << "(" << LLAssetStorage::getErrorString(status) << ") ext_status=" << ext_status << LL_ENDL;
}
- callback(asset_id, settings, status, ext_status);
+ if (callback)
+ callback(asset_id, settings, status, ext_status);
}
@@ -392,6 +379,37 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildFromLegacyPreset(const std::string &n
return skyp;
}
+namespace
+{
+ // This is a disturbing hack
+ std::string legacy_name_to_filename(const std::string &name)
+ {
+ std::string fixedname(LLURI::escape(name));
+
+ boost::algorithm::replace_all(fixedname, "-", "%2D");
+ return fixedname;
+ }
+}
+
+LLSettingsSky::ptr_t LLSettingsVOSky::buildFromLegacyPresetFile(const std::string &name, const std::string &path)
+{
+ std::string full_path(path);
+ std::string full_name(legacy_name_to_filename(name));
+ full_name += ".xml";
+
+ gDirUtilp->append(full_path, full_name);
+ LLSD legacy_data = read_legacy_preset_data(full_path);
+
+ if (!legacy_data)
+ {
+ LL_WARNS("SETTINGS") << "Could not load legacy Windlight \"" << name << "\" from " << full_path << LL_ENDL;
+ return ptr_t();
+ }
+
+ return buildFromLegacyPreset(name, legacy_data);
+}
+
+
LLSettingsSky::ptr_t LLSettingsVOSky::buildDefaultSky()
{
LLSD settings = LLSettingsSky::defaults();
@@ -429,9 +447,9 @@ void LLSettingsVOSky::convertAtmosphericsToLegacy(LLSD& legacy, LLSD& settings)
{
// LEGACY_ATMOSPHERICS
// These will need to be inferred from new settings' density profiles
- legacy[SETTING_AMBIENT] = ensureArray4(settings[SETTING_AMBIENT], 1.0f);
- legacy[SETTING_BLUE_DENSITY] = ensureArray4(settings[SETTING_BLUE_DENSITY], 1.0);
- legacy[SETTING_BLUE_HORIZON] = ensureArray4(settings[SETTING_BLUE_HORIZON], 1.0);
+ legacy[SETTING_AMBIENT] = ensure_array_4(settings[SETTING_AMBIENT], 1.0f);
+ legacy[SETTING_BLUE_DENSITY] = ensure_array_4(settings[SETTING_BLUE_DENSITY], 1.0);
+ legacy[SETTING_BLUE_HORIZON] = ensure_array_4(settings[SETTING_BLUE_HORIZON], 1.0);
legacy[SETTING_DENSITY_MULTIPLIER] = LLSDArray(settings[SETTING_DENSITY_MULTIPLIER].asReal())(0.0f)(0.0f)(1.0f);
legacy[SETTING_DISTANCE_MULTIPLIER] = LLSDArray(settings[SETTING_DISTANCE_MULTIPLIER].asReal())(0.0f)(0.0f)(1.0f);
legacy[SETTING_HAZE_DENSITY] = LLSDArray(settings[SETTING_HAZE_DENSITY])(0.0f)(0.0f)(1.0f);
@@ -453,20 +471,20 @@ LLSD LLSettingsVOSky::convertToLegacy(const LLSettingsSky::ptr_t &psky, bool isA
convertAtmosphericsToLegacy(legacy, settings);
- legacy[SETTING_CLOUD_COLOR] = ensureArray4(settings[SETTING_CLOUD_COLOR], 1.0);
- legacy[SETTING_CLOUD_POS_DENSITY1] = ensureArray4(settings[SETTING_CLOUD_POS_DENSITY1], 1.0);
- legacy[SETTING_CLOUD_POS_DENSITY2] = ensureArray4(settings[SETTING_CLOUD_POS_DENSITY2], 1.0);
+ legacy[SETTING_CLOUD_COLOR] = ensure_array_4(settings[SETTING_CLOUD_COLOR], 1.0);
+ legacy[SETTING_CLOUD_POS_DENSITY1] = ensure_array_4(settings[SETTING_CLOUD_POS_DENSITY1], 1.0);
+ legacy[SETTING_CLOUD_POS_DENSITY2] = ensure_array_4(settings[SETTING_CLOUD_POS_DENSITY2], 1.0);
legacy[SETTING_CLOUD_SCALE] = LLSDArray(settings[SETTING_CLOUD_SCALE])(LLSD::Real(0.0))(LLSD::Real(0.0))(LLSD::Real(1.0));
legacy[SETTING_CLOUD_SCROLL_RATE] = settings[SETTING_CLOUD_SCROLL_RATE];
legacy[SETTING_LEGACY_ENABLE_CLOUD_SCROLL] = LLSDArray(LLSD::Boolean(!is_approx_zero(settings[SETTING_CLOUD_SCROLL_RATE][0].asReal())))
(LLSD::Boolean(!is_approx_zero(settings[SETTING_CLOUD_SCROLL_RATE][1].asReal())));
legacy[SETTING_CLOUD_SHADOW] = LLSDArray(settings[SETTING_CLOUD_SHADOW].asReal())(0.0f)(0.0f)(1.0f);
legacy[SETTING_GAMMA] = LLSDArray(settings[SETTING_GAMMA])(0.0f)(0.0f)(1.0f);
- legacy[SETTING_GLOW] = ensureArray4(settings[SETTING_GLOW], 1.0);
- legacy[SETTING_LIGHT_NORMAL] = ensureArray4(psky->getLightDirection().getValue(), 0.0f);
+ legacy[SETTING_GLOW] = ensure_array_4(settings[SETTING_GLOW], 1.0);
+ legacy[SETTING_LIGHT_NORMAL] = ensure_array_4(psky->getLightDirection().getValue(), 0.0f);
legacy[SETTING_MAX_Y] = LLSDArray(settings[SETTING_MAX_Y])(0.0f)(0.0f)(1.0f);
legacy[SETTING_STAR_BRIGHTNESS] = settings[SETTING_STAR_BRIGHTNESS];
- legacy[SETTING_SUNLIGHT_COLOR] = ensureArray4(settings[SETTING_SUNLIGHT_COLOR], 1.0f);
+ legacy[SETTING_SUNLIGHT_COLOR] = ensure_array_4(settings[SETTING_SUNLIGHT_COLOR], 1.0f);
LLSettingsSky::azimalt_t azialt = psky->getSunRotationAzAl();
@@ -595,6 +613,25 @@ LLSettingsWater::ptr_t LLSettingsVOWater::buildFromLegacyPreset(const std::strin
return waterp;
}
+LLSettingsWater::ptr_t LLSettingsVOWater::buildFromLegacyPresetFile(const std::string &name, const std::string &path)
+{
+ std::string full_path(path);
+ std::string full_name(legacy_name_to_filename(name));
+ full_name += ".xml";
+
+ gDirUtilp->append(full_path, full_name);
+ LLSD legacy_data = read_legacy_preset_data(full_path);
+
+ if (!legacy_data)
+ {
+ LL_WARNS("SETTINGS") << "Could not load legacy Windlight \"" << name << "\" from " << full_path << LL_ENDL;
+ return ptr_t();
+ }
+
+ return buildFromLegacyPreset(name, legacy_data);
+}
+
+
LLSettingsWater::ptr_t LLSettingsVOWater::buildDefaultWater()
{
LLSD settings = LLSettingsWater::defaults();
@@ -635,7 +672,7 @@ LLSD LLSettingsVOWater::convertToLegacy(const LLSettingsWater::ptr_t &pwater)
LLSD settings = pwater->getSettings();
legacy[SETTING_LEGACY_BLUR_MULTIPILER] = settings[SETTING_BLUR_MULTIPILER];
- legacy[SETTING_LEGACY_FOG_COLOR] = ensureArray4(settings[SETTING_FOG_COLOR], 1.0f);
+ legacy[SETTING_LEGACY_FOG_COLOR] = ensure_array_4(settings[SETTING_FOG_COLOR], 1.0f);
legacy[SETTING_LEGACY_FOG_DENSITY] = settings[SETTING_FOG_DENSITY];
legacy[SETTING_LEGACY_FOG_MOD] = settings[SETTING_FOG_MOD];
legacy[SETTING_LEGACY_FRESNEL_OFFSET] = settings[SETTING_FRESNEL_OFFSET];
@@ -740,10 +777,18 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildDay(LLSD settings)
}
//-------------------------------------------------------------------------
-LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyPreset(const std::string &name, const LLSD &oldsettings)
+LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyPreset(const std::string &name, const std::string &path, const LLSD &oldsettings)
{
LLSD newsettings(defaults());
std::set<std::string> framenames;
+ std::set<std::string> notfound;
+
+ std::string base_path(gDirUtilp->getDirName(path));
+ std::string water_path(base_path);
+ std::string sky_path(base_path);
+
+ gDirUtilp->append(water_path, "water");
+ gDirUtilp->append(sky_path, "skies");
newsettings[SETTING_NAME] = name;
@@ -767,14 +812,16 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyPreset(const std::string &n
LLSD frames(LLSD::emptyMap());
{
- LLSettingsWater::ptr_t pwater = LLEnvironment::instance().findWaterByName("Default");
- frames["water:Default"] = pwater->getSettings();
+ LLSettingsWater::ptr_t pwater = LLSettingsVOWater::buildFromLegacyPresetFile("Default", water_path);
+ if (pwater)
+ frames["water:Default"] = pwater->getSettings();
}
for (std::set<std::string>::iterator itn = framenames.begin(); itn != framenames.end(); ++itn)
{
- LLSettingsSky::ptr_t psky = LLEnvironment::instance().findSkyByName(*itn);
- frames["sky:" + (*itn)] = psky->getSettings();
+ LLSettingsSky::ptr_t psky = LLSettingsVOSky::buildFromLegacyPresetFile((*itn), sky_path);
+ if (psky)
+ frames["sky:" + (*itn)] = psky->getSettings();
}
newsettings[SETTING_FRAMES] = frames;
@@ -806,6 +853,26 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyPreset(const std::string &n
return dayp;
}
+LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyPresetFile(const std::string &name, const std::string &path)
+{
+ std::string full_path(path);
+ std::string full_name(legacy_name_to_filename(name));
+ full_name += ".xml";
+
+ gDirUtilp->append(full_path, full_name);
+ LLSD legacy_data = read_legacy_preset_data(full_path);
+
+ if (!legacy_data)
+ {
+ LL_WARNS("SETTINGS") << "Could not load legacy Windlight \"" << name << "\" from " << full_path << LL_ENDL;
+ return ptr_t();
+ }
+
+ return buildFromLegacyPreset(name, path, legacy_data);
+}
+
+
+
LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyMessage(const LLUUID &regionId, LLSD daycycle, LLSD skydefs, LLSD waterdef)
{
LLSD frames(LLSD::emptyMap());
@@ -863,6 +930,8 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyMessage(const LLUUID &regio
return dayp;
}
+
+
LLSettingsDay::ptr_t LLSettingsVODay::buildDefaultDayCycle()
{
LLSD settings = LLSettingsDay::defaults();
@@ -996,12 +1065,43 @@ LLSettingsWaterPtr_t LLSettingsVODay::buildWater(LLSD settings) const
return LLSettingsWater::ptr_t();
}
-LLSettingsSkyPtr_t LLSettingsVODay::getNamedSky(const std::string &name) const
+//=========================================================================
+namespace
{
- return LLEnvironment::instance().findSkyByName(name);
-}
+ LLSD ensure_array_4(LLSD in, F32 fill)
+ {
+ if (in.size() >= 4)
+ return in;
-LLSettingsWaterPtr_t LLSettingsVODay::getNamedWater(const std::string &name) const
-{
- return LLEnvironment::instance().findWaterByName(name);
+ LLSD out(LLSD::emptyArray());
+
+ for (S32 idx = 0; idx < in.size(); ++idx)
+ {
+ out.append(in[idx]);
+ }
+
+ while (out.size() < 4)
+ {
+ out.append(LLSD::Real(fill));
+ }
+ return out;
+ }
+
+ //---------------------------------------------------------------------
+ LLSD read_legacy_preset_data(const std::string& path)
+ {
+ llifstream xml_file;
+// std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(path), /*strip_exten = */ true));
+
+ xml_file.open(path.c_str());
+ if (!xml_file)
+ return LLSD();
+
+ LLSD params_data;
+ LLPointer<LLSDParser> parser = new LLSDXMLParser();
+ parser->parse(xml_file, params_data, LLSDSerialize::SIZE_UNLIMITED);
+ xml_file.close();
+
+ return params_data;
+ }
}
diff --git a/indra/newview/llsettingsvo.h b/indra/newview/llsettingsvo.h
index 3339aaf037..8f6f96a758 100644
--- a/indra/newview/llsettingsvo.h
+++ b/indra/newview/llsettingsvo.h
@@ -90,6 +90,8 @@ public:
static ptr_t buildDefaultSky();
virtual ptr_t buildClone() override;
+ static ptr_t buildFromLegacyPresetFile(const std::string &name, const std::string &path);
+
static LLSD convertToLegacy(const ptr_t &, bool isAdvanced);
bool isAdvanced() const { return m_isAdvanced; }
@@ -121,6 +123,8 @@ public:
static ptr_t buildDefaultWater();
virtual ptr_t buildClone() override;
+ static ptr_t buildFromLegacyPresetFile(const std::string &name, const std::string &path);
+
static LLSD convertToLegacy(const ptr_t &);
protected:
LLSettingsVOWater();
@@ -144,7 +148,8 @@ public:
static ptr_t buildDay(LLSD settings);
- static ptr_t buildFromLegacyPreset(const std::string &name, const LLSD &oldsettings);
+ 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 buildFromLegacyMessage(const LLUUID &regionId, LLSD daycycle, LLSD skys, LLSD water);
static ptr_t buildDefaultDayCycle();
static ptr_t buildFromEnvironmentMessage(LLSD settings);
@@ -156,8 +161,6 @@ public:
virtual LLSettingsWaterPtr_t getDefaultWater() const override;
virtual LLSettingsSkyPtr_t buildSky(LLSD) const override;
virtual LLSettingsWaterPtr_t buildWater(LLSD) const override;
- virtual LLSettingsSkyPtr_t getNamedSky(const std::string &) const override;
- virtual LLSettingsWaterPtr_t getNamedWater(const std::string &) const override;
protected:
LLSettingsVODay();
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index ce1e740425..8153e41b45 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -8391,26 +8391,22 @@ class LLWorldEnvSettings : public view_listener_t
if (tod == "sunrise")
{
- LLSettingsSky::ptr_t psky = LLEnvironment::instance().findSkyByName("Sunrise");
- LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, psky);
+ LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, LLEnvironment::KNOWN_SKY_SUNRISE);
LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL);
}
else if (tod == "noon")
{
- LLSettingsSky::ptr_t psky = LLEnvironment::instance().findSkyByName("Midday");
- LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, psky);
+ LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, LLEnvironment::KNOWN_SKY_MIDDAY);
LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL);
}
else if (tod == "sunset")
{
- LLSettingsSky::ptr_t psky = LLEnvironment::instance().findSkyByName("Sunset");
- LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, psky);
+ LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, LLEnvironment::KNOWN_SKY_SUNSET);
LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL);
}
else if (tod == "midnight")
{
- LLSettingsSky::ptr_t psky = LLEnvironment::instance().findSkyByName("Midnight");
- LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, psky);
+ LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, LLEnvironment::KNOWN_SKY_MIDNIGHT);
LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL);
}
else
diff --git a/indra/newview/skins/default/xui/en/menu_inventory.xml b/indra/newview/skins/default/xui/en/menu_inventory.xml
index 29915788f1..edd1f42d92 100644
--- a/indra/newview/skins/default/xui/en/menu_inventory.xml
+++ b/indra/newview/skins/default/xui/en/menu_inventory.xml
@@ -863,6 +863,33 @@
function="Inventory.DoToSelected"
parameter="take_off" />
</menu_item_call>
+ <menu_item_separator
+ layout="topleft"
+ name="Settings Separator" />
+ <menu_item_call
+ name="Settings Apply Local"
+ layout="topleft"
+ label="Apply Only To Myself">
+ <menu_item_call.on_click
+ function="Inventory.DoToSelected"
+ parameter="apply_settings_local" />
+ </menu_item_call>
+ <menu_item_call
+ name="Settings Apply Parcel"
+ layout="topleft"
+ label="Apply To Parcel">
+ <menu_item_call.on_click
+ function="Inventory.DoToSelected"
+ parameter="apply_settings_parcel" />
+ </menu_item_call>
+ <menu_item_call
+ name="Settings Apply Region"
+ layout="topleft"
+ label="Apply To Region">
+ <menu_item_call.on_click
+ function="Inventory.DoToSelected"
+ parameter="apply_settings_region" />
+ </menu_item_call>
<menu_item_separator
layout="topleft"
name="Marketplace Separator" />
diff --git a/indra/newview/skins/default/xui/en/menu_save_settings.xml b/indra/newview/skins/default/xui/en/menu_save_settings.xml
index 0d52d9b16e..a72b02c593 100644
--- a/indra/newview/skins/default/xui/en/menu_save_settings.xml
+++ b/indra/newview/skins/default/xui/en/menu_save_settings.xml
@@ -28,14 +28,14 @@
</menu_item_call>
<menu_item_call
name="apply_parcel"
- label="Apply Parcel">
+ label="Apply To Parcel">
<menu_item_call.on_click
function="FlyoutCombo.Button.Action"
userdata="parcel" />
</menu_item_call>
<menu_item_call
name="apply_region"
- label="Apply Region">
+ label="Apply To Region">
<menu_item_call.on_click
function="FlyoutCombo.Button.Action"
userdata="region" />
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 6aa6653f42..d7193c511f 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -11104,4 +11104,13 @@ Cannot create large prims that intersect other players. Please re-try when othe
yestext="OK"/>
</notification>
+ <notification
+ icon="notify.tga"
+ name="FailedToFindSettings"
+ persist="true"
+ type="alertmodal">
+Failed to find the settisgs named [DESC] in database.
+ <tag>fail</tag>
+ </notification>
+
</notifications>