summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2019-02-19 16:13:42 -0800
committerRider Linden <rider@lindenlab.com>2019-02-19 16:13:42 -0800
commit4f14dccffaa3b38377ad55486e38e4587a233319 (patch)
treed43ed9640fc0d67a3e11afc0f2b2f1d146ceed98
parentf489a8915198b5846c744d3cb2c7ed7447bfe35e (diff)
SL-10570: Additional checking when loading a track from another day cycle. Restore original track if error. Extra messages to user.
-rw-r--r--indra/newview/llfloatereditextdaycycle.cpp49
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml27
2 files changed, 70 insertions, 6 deletions
diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp
index eccdf8249d..482caaaa85 100644
--- a/indra/newview/llfloatereditextdaycycle.cpp
+++ b/indra/newview/llfloatereditextdaycycle.cpp
@@ -587,6 +587,15 @@ BOOL LLFloaterEditExtDayCycle::handleKeyUp(KEY key, MASK mask, BOOL called_from_
void LLFloaterEditExtDayCycle::onButtonApply(LLUICtrl *ctrl, const LLSD &data)
{
std::string ctrl_action = ctrl->getName();
+
+ if (!mEditDay)
+ {
+ LL_WARNS("ENVDAYEDIT") << "mEditDay is null! This should never happen! Something is very very wrong" << LL_ENDL;
+ LLNotificationsUtil::add("EnvironmentApplyFailed");
+ closeFloater();
+ return;
+ }
+
LLSettingsDay::ptr_t dayclone = mEditDay->buildClone(); // create a compressed copy
if (!dayclone)
@@ -1078,22 +1087,50 @@ void LLFloaterEditExtDayCycle::cloneTrack(U32 source_index, U32 dest_index)
void LLFloaterEditExtDayCycle::cloneTrack(const LLSettingsDay::ptr_t &source_day, U32 source_index, U32 dest_index)
{
- if (source_index == LLSettingsDay::TRACK_WATER || dest_index == LLSettingsDay::TRACK_WATER)
- {
- LL_WARNS() << "water track can't be source or destination for copying" << LL_ENDL;
+ if ((source_index == LLSettingsDay::TRACK_WATER || dest_index == LLSettingsDay::TRACK_WATER) && (source_index != dest_index))
+ { // one of the tracks is a water track, the other is not
+ LLSD args;
+
+ LL_WARNS() << "Can not import water track into sky track or vice versa" << LL_ENDL;
+
+ LLButton* button = getChild<LLButton>(track_tabs[source_index], true);
+ args["TRACK1"] = button->getCurrentLabel();
+ button = getChild<LLButton>(track_tabs[dest_index], true);
+ args["TRACK2"] = button->getCurrentLabel();
+
+ LLNotificationsUtil::add("TrackLoadMismatch", args);
return;
}
// don't use replaceCycleTrack because we will end up with references, but we need to clone
+
+ // hold on to a backup of the
+ LLSettingsDay::CycleTrack_t backup_track = mEditDay->getCycleTrack(dest_index);
+
mEditDay->clearCycleTrack(dest_index); // because source can be empty
LLSettingsDay::CycleTrack_t source_track = source_day->getCycleTrack(source_index);
-
+ S32 addcount(0);
for (auto &track_frame : source_track)
{
- LLSettingsSky::ptr_t psky = std::static_pointer_cast<LLSettingsSky>(track_frame.second);
- mEditDay->setSettingsAtKeyframe(psky->buildDerivedClone(), track_frame.first, dest_index);
+ LLSettingsBase::ptr_t pframe = track_frame.second;
+ LLSettingsBase::ptr_t pframeclone = pframe->buildDerivedClone();
+ if (pframeclone)
+ {
+ ++addcount;
+ mEditDay->setSettingsAtKeyframe(pframeclone, track_frame.first, dest_index);
+ }
}
+ if (!addcount)
+ { // nothing was actually added. Restore the old track and issue a warning.
+ mEditDay->replaceCycleTrack(dest_index, backup_track);
+
+ LLSD args;
+ LLButton* button = getChild<LLButton>(track_tabs[dest_index], true);
+ args["TRACK"] = button->getCurrentLabel();
+
+ LLNotificationsUtil::add("TrackLoadFailed", args);
+ }
setDirtyFlag();
updateSlider();
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index dfc392e1f7..5ed3bd5df5 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -11347,5 +11347,32 @@ You may not edit settings directly from the libary.
Please copy to your own inventory and try again.
<tag>fail</tag>
</notification>
+
+ <notification
+ icon="notify.tga"
+ name="EnvironmentApplyFailed"
+ persist="true"
+ type="alertmodal">
+We have encountered an issue with these settings. They can not be saved or applied at this time.
+ <tag>fail</tag>
+ </notification>
+
+ <notification
+ icon="notify.tga"
+ name="TrackLoadFailed"
+ persist="true"
+ type="alertmodal">
+Unable to load the track into [TRACK].
+ <tag>fail</tag>
+ </notification>
+
+ <notification
+ icon="notify.tga"
+ name="TrackLoadMismatch"
+ persist="true"
+ type="alertmodal">
+Unable to load the track from [TRACK1] into [TRACK2].
+ <tag>fail</tag>
+ </notification>
</notifications>