diff options
author | Rider Linden <rider@lindenlab.com> | 2018-06-06 17:10:58 -0700 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2018-06-06 17:10:58 -0700 |
commit | bff5049b9262e703c3ae583962552ea416212e8b (patch) | |
tree | 1131b55f7d14e3086841107b4ee4827eb8f683df /indra/llinventory | |
parent | 5b4eb9fb93af87cbbe163ad6f87d98362a963389 (diff) |
Various editor fixes. Start adding a settings picker.
Diffstat (limited to 'indra/llinventory')
-rw-r--r-- | indra/llinventory/llsettingsbase.cpp | 2 | ||||
-rw-r--r-- | indra/llinventory/llsettingsbase.h | 1 | ||||
-rw-r--r-- | indra/llinventory/llsettingsdaycycle.cpp | 39 | ||||
-rw-r--r-- | indra/llinventory/llsettingsdaycycle.h | 1 |
4 files changed, 43 insertions, 0 deletions
diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 76b1e0b2a6..b677eb36df 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -38,6 +38,8 @@ namespace const LLSettingsBase::TrackPosition BREAK_POINT = 0.5; } +const LLSettingsBase::TrackPosition LLSettingsBase::INVALID_TRACKPOS(-1.0); + //========================================================================= std::ostream &operator <<(std::ostream& os, LLSettingsBase &settings) { diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 0920af4726..4ebec4a99d 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -61,6 +61,7 @@ public: typedef F64Seconds Seconds; typedef F64 BlendFactor; typedef F32 TrackPosition; // 32-bit as these are stored in LLSD as such + static const TrackPosition INVALID_TRACKPOS; static const std::string SETTING_ID; static const std::string SETTING_NAME; diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index e000b8f03f..807d8218a1 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -530,6 +530,14 @@ bool LLSettingsDay::moveTrackKeyframe(S32 trackno, const LLSettingsBase::TrackPo CycleTrack_t::iterator iter = track.find(old_frame); if (iter != track.end()) { + /*TODO check that we are not moving too close to another keyframe */ +// CycleTrack_t::value_type existing = getSettingsNearKeyfarme(new_frame, trackno, 2.5f); +// if ((*iter).first != existing.first) +// { +// LL_WARNS("DAYCYCLE") << "Track too close to existing track. Not moving." << LL_ENDL; +// return false; +// } + LLSettingsBase::ptr_t base = iter->second; track.erase(iter); track[llclamp(new_frame, 0.0f, 1.0f)] = base; @@ -624,6 +632,37 @@ LLSettingsBase::ptr_t LLSettingsDay::getSettingsAtKeyframe(const LLSettingsBase: return LLSettingsBase::ptr_t(); } +LLSettingsDay::CycleTrack_t::value_type LLSettingsDay::getSettingsNearKeyfarme(const LLSettingsBase::TrackPosition &keyframe, S32 track, F32 fudge) const +{ + if ((track < 0) || (track >= TRACK_MAX)) + { + LL_WARNS("DAYCYCLE") << "Attempt to get track (#" << track << ") out of range!" << LL_ENDL; + return CycleTrack_t::value_type(TrackPosition(INVALID_TRACKPOS), LLSettingsBase::ptr_t()); + } + + if (mDayTracks[track].empty()) + { + LL_INFOS("DAYCYCLE") << "Empty track" << LL_ENDL; + return CycleTrack_t::value_type(TrackPosition(INVALID_TRACKPOS), LLSettingsBase::ptr_t()); + } + + TrackPosition startframe(keyframe - fudge); + if (startframe < 0.0f) + startframe = 1.0f + startframe; + + CycleTrack_t::iterator it = get_wrapping_atafter(const_cast<CycleTrack_t &>(mDayTracks[track]), startframe); + + F32 dist = get_wrapping_distance(startframe, (*it).first); + + LL_WARNS("LAPRAS") << "[" << startframe << " ... " << keyframe << " -> " << (*it).first << "@" << dist << LL_ENDL; + + + if (dist <= (fudge * 2.0f)) + return (*it); + + return CycleTrack_t::value_type(TrackPosition(INVALID_TRACKPOS), LLSettingsBase::ptr_t()); +} + void LLSettingsDay::clearTrack(S32 track) { if ((track < 0) || (track >= TRACK_MAX)) diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index cc6e27b296..5aa6e91183 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -100,6 +100,7 @@ public: LLSettingsSkyPtr_t getSkyAtKeyframe(const LLSettingsBase::TrackPosition& keyframe, S32 track) const; 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 getSettingsNearKeyfarme(const LLSettingsBase::TrackPosition &keyframe, S32 track, F32 fudge) const; void clearTrack(S32 track); //--------------------------------------------------------------------- |