summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llfloatereditextdaycycle.cpp31
-rw-r--r--indra/newview/llfloatereditextdaycycle.h5
2 files changed, 26 insertions, 10 deletions
diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp
index f712901795..a64a3d46ff 100644
--- a/indra/newview/llfloatereditextdaycycle.cpp
+++ b/indra/newview/llfloatereditextdaycycle.cpp
@@ -1373,7 +1373,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
@@ -1413,6 +1413,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)
@@ -2002,18 +2015,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);