summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/llinventory/llsettingsbase.h7
-rw-r--r--indra/llinventory/llsettingsdaycycle.cpp63
-rw-r--r--indra/llinventory/llsettingsdaycycle.h4
3 files changed, 61 insertions, 13 deletions
diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h
index a74579e7a6..beaeac2d04 100644
--- a/indra/llinventory/llsettingsbase.h
+++ b/indra/llinventory/llsettingsbase.h
@@ -244,10 +244,15 @@ public:
inline void setAssetId(LLUUID value)
{ // note that this skips setLLSD
- LL_WARNS("LAPRAS") << "Settings asset id set to:{" << value << "}" << LL_ENDL;
mSettings[SETTING_ASSETID] = value;
}
+ inline void clearAssetId()
+ {
+ if (mSettings.has(SETTING_ASSETID))
+ mSettings.erase(SETTING_ASSETID);
+ }
+
protected:
LLSettingsBase();
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;
diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h
index e2f095aa74..484c59e57f 100644
--- a/indra/llinventory/llsettingsdaycycle.h
+++ b/indra/llinventory/llsettingsdaycycle.h
@@ -103,7 +103,6 @@ public:
void setSettingsAtKeyframe(const LLSettingsBase::ptr_t &settings, const LLSettingsBase::TrackPosition& keyframe, S32 track);
LLSettingsBase::ptr_t getSettingsAtKeyframe(const LLSettingsBase::TrackPosition& keyframe, S32 track) const;
CycleTrack_t::value_type getSettingsNearKeyframe(const LLSettingsBase::TrackPosition &keyframe, S32 track, F32 fudge) const;
- void clearTrack(S32 track);
//---------------------------------------------------------------------
void startDayCycle();
@@ -116,6 +115,9 @@ public:
void setInitialized(bool value = true) { mInitialized = value; }
CycleTrack_t & getCycleTrack(S32 track);
+ bool clearCycleTrack(S32 track);
+ bool replaceCycleTrack(S32 track, const CycleTrack_t &source);
+ bool isTrackEmpty(S32 track) const;
virtual validation_list_t getValidationList() const SETTINGS_OVERRIDE;
static validation_list_t validationList();