From 4f14dccffaa3b38377ad55486e38e4587a233319 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 19 Feb 2019 16:13:42 -0800 Subject: SL-10570: Additional checking when loading a track from another day cycle. Restore original track if error. Extra messages to user. --- indra/newview/llfloatereditextdaycycle.cpp | 49 ++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 6 deletions(-) (limited to 'indra/newview/llfloatereditextdaycycle.cpp') 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(track_tabs[source_index], true); + args["TRACK1"] = button->getCurrentLabel(); + button = getChild(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(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(track_tabs[dest_index], true); + args["TRACK"] = button->getCurrentLabel(); + + LLNotificationsUtil::add("TrackLoadFailed", args); + } setDirtyFlag(); updateSlider(); -- cgit v1.2.3 From 2401712d1073e85b4b9183d20c6e9274bc874f64 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 20 Feb 2019 15:20:30 -0800 Subject: SL-9660: Next pass cleanup. Removed and downgraded a number of logs. Removed refs to LAPAS. Better sync with legacy regions. --- indra/newview/llfloatereditextdaycycle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llfloatereditextdaycycle.cpp') diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 482caaaa85..3b148fa89e 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -1797,7 +1797,7 @@ void LLFloaterEditExtDayCycle::loadSettingFromFile(const std::vector