diff options
author | Rider Linden <rider@lindenlab.com> | 2019-02-25 14:23:46 -0800 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2019-02-25 14:23:46 -0800 |
commit | c42a364841f68e08bccb2ee288f34c8c3f4be733 (patch) | |
tree | 111fb2696ad705cb94d3fc83ba7d905ce31a6a90 /indra | |
parent | 0aa46bb013e888d437054bfb31efe5fa1136d1ba (diff) |
SL-10165: Using Load Sky/Water when over an existing keyframe replaces the old frame.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llfloatereditextdaycycle.cpp | 31 | ||||
-rw-r--r-- | indra/newview/llfloatereditextdaycycle.h | 5 |
2 files changed, 26 insertions, 10 deletions
diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 18f22bf2d2..f81b2177a8 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -1368,7 +1368,7 @@ void LLFloaterEditExtDayCycle::updateTimeAndLabel() // Update blender here: } -void LLFloaterEditExtDayCycle::addSliderFrame(const F32 frame, const LLSettingsBase::ptr_t &setting, bool update_ui) +void LLFloaterEditExtDayCycle::addSliderFrame(F32 frame, const LLSettingsBase::ptr_t &setting, bool update_ui) { // multi slider distinguishes elements by key/name in string format // store names to map to be able to recall dependencies @@ -1408,6 +1408,19 @@ void LLFloaterEditExtDayCycle::removeCurrentSliderFrame() updateTabs(); } +void LLFloaterEditExtDayCycle::removeSliderFrame(F32 frame) +{ + keymap_t::iterator it = std::find_if(mSliderKeyMap.begin(), mSliderKeyMap.end(), + [frame](const keymap_t::value_type &value) { return fabs(value.second.mFrame - frame) < LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR; }); + + if (it != mSliderKeyMap.end()) + { + mFramesSlider->deleteSlider((*it).first); + mSliderKeyMap.erase(it); + } + +} + //------------------------------------------------------------------------- LLFloaterEditExtDayCycle::connection_t LLFloaterEditExtDayCycle::setEditCommitSignal(LLFloaterEditExtDayCycle::edit_commit_signal_t::slot_type cb) @@ -1997,18 +2010,20 @@ void LLFloaterEditExtDayCycle::onAssetLoadedForInsertion(LLUUID item_id, LLUUID } else { - // load single frame - - if ((mEditDay->getSettingsNearKeyframe(frame, dest_track, LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR)).second) - { - LL_WARNS("ENVDAYEDIT") << "Attempt to add new frame too close to existing frame." << LL_ENDL; - return; - } if (!mFramesSlider->canAddSliders()) { LL_WARNS("ENVDAYEDIT") << "Attempt to add new frame when slider is full." << LL_ENDL; return; } + + // load or replace single frame + LLSettingsDay::CycleTrack_t::value_type nearest = mEditDay->getSettingsNearKeyframe(frame, dest_track, LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR); + if (nearest.first != LLSettingsDay::INVALID_TRACKPOS) + { // There is already a frame near the target location. Remove it so we can put the new one in its place. + mEditDay->removeTrackKeyframe(dest_track, nearest.first); + removeSliderFrame(nearest.first); + } + // Don't forget to clone (we might reuse/load it couple times) if (settings->getSettingsType() == "sky") { diff --git a/indra/newview/llfloatereditextdaycycle.h b/indra/newview/llfloatereditextdaycycle.h index 311bbd52dc..c271f15840 100644 --- a/indra/newview/llfloatereditextdaycycle.h +++ b/indra/newview/llfloatereditextdaycycle.h @@ -144,8 +144,9 @@ private: void updateLabels(); void updateSlider(); //generate sliders from current track void updateTimeAndLabel(); - void addSliderFrame(const F32 frame, const LLSettingsBase::ptr_t &setting, bool update_ui = true); - void removeCurrentSliderFrame(); + void addSliderFrame(F32 frame, const LLSettingsBase::ptr_t &setting, bool update_ui = true); + void removeCurrentSliderFrame(); + void removeSliderFrame(F32 frame); void loadInventoryItem(const LLUUID &inventoryId); void onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status); |