diff options
author | Rider Linden <rider@lindenlab.com> | 2018-08-03 16:32:31 -0700 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2018-08-03 16:32:31 -0700 |
commit | 3f6cedbbf340ae4a4d825472aca53e0c04ee5322 (patch) | |
tree | 28480c5cc5328f3c9bafd5552778e29fd2240b79 /indra/llinventory/llsettingsdaycycle.cpp | |
parent | 56c773b3bc52d72a5a7056d6eb9ce014dedbc0d8 (diff) |
Synch settings with simulator.
Diffstat (limited to 'indra/llinventory/llsettingsdaycycle.cpp')
-rw-r--r-- | indra/llinventory/llsettingsdaycycle.cpp | 63 |
1 files changed, 52 insertions, 11 deletions
diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index ab01a585c6..a43eae16fe 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -498,6 +498,58 @@ LLSettingsDay::CycleTrack_t &LLSettingsDay::getCycleTrack(S32 track) return mDayTracks[track]; } +bool LLSettingsDay::clearCycleTrack(S32 track) +{ + if ((track < 0) || (track >= TRACK_MAX)) + { + LL_WARNS("DAYCYCLE") << "Attempt to clear track (#" << track << ") out of range!" << LL_ENDL; + return false; + } + mDayTracks[track].clear(); + clearAssetId(); + setDirtyFlag(true); + return true; +} + +bool LLSettingsDay::replaceCycleTrack(S32 track, const CycleTrack_t &source) +{ + if (source.empty()) + { + LL_WARNS("DAYCYCLE") << "Attempt to copy an empty track." << LL_ENDL; + return false; + } + + { + LLSettingsBase::ptr_t first((*source.begin()).second); + std::string setting_type = first->getSettingsType(); + + if (((setting_type == "water") && (track != 0)) || + ((setting_type == "sky") && (track == 0))) + { + LL_WARNS("DAYCYCLE") << "Attempt to copy track missmatch" << LL_ENDL; + return false; + } + } + + if (!clearCycleTrack(track)) + return false; + + mDayTracks[track] = source; + return true; +} + + +bool LLSettingsDay::isTrackEmpty(S32 track) const +{ + if ((track < 0) || (track >= TRACK_MAX)) + { + LL_WARNS("DAYCYCLE") << "Attempt to test track (#" << track << ") out of range!" << LL_ENDL; + return true; + } + + return mDayTracks[track].empty(); +} + //========================================================================= void LLSettingsDay::startDayCycle() { @@ -690,17 +742,6 @@ LLSettingsDay::CycleTrack_t::value_type LLSettingsDay::getSettingsNearKeyframe(c return CycleTrack_t::value_type(TrackPosition(INVALID_TRACKPOS), LLSettingsBase::ptr_t()); } -void LLSettingsDay::clearTrack(S32 track) -{ - if ((track < 0) || (track >= TRACK_MAX)) - { - LL_WARNS("DAYCYCLE") << "Attempt to clear track (#" << track << ") out of range!" << LL_ENDL; - return; - } - - mDayTracks[track].clear(); -} - LLSettingsBase::TrackPosition LLSettingsDay::getUpperBoundFrame(S32 track, const LLSettingsBase::TrackPosition& keyframe) { return get_wrapping_atafter(mDayTracks[track], keyframe)->first; |