summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandreykproductengine <andreykproductengine@lindenlab.com>2018-09-13 16:32:41 +0300
committerandreykproductengine <andreykproductengine@lindenlab.com>2018-09-13 16:32:41 +0300
commitceb336c5f340c260ac5c1923723dbc8204b98157 (patch)
tree5de27b1199c0a79ce7d531d1512bd09e43fc1237
parentf31b35cb5cba5cdf4985fa411ff45c43afa695b5 (diff)
SL-1168 EEP Shouldn't be possible to create more than 20 keframes
-rw-r--r--indra/llui/llmultislider.h4
-rw-r--r--indra/llui/llmultisliderctrl.h4
-rw-r--r--indra/newview/llfloatereditextdaycycle.cpp23
3 files changed, 24 insertions, 7 deletions
diff --git a/indra/llui/llmultislider.h b/indra/llui/llmultislider.h
index 3884b0a2a0..9a997de16a 100644
--- a/indra/llui/llmultislider.h
+++ b/indra/llui/llmultislider.h
@@ -105,6 +105,10 @@ public:
/*virtual*/ BOOL handleKeyHere(KEY key, MASK mask);
/*virtual*/ void draw();
+ S32 getMaxNumSliders() { return mMaxNumSliders; }
+ S32 getCurNumSliders() { return mValue.size(); }
+ bool canAddSliders() { return mValue.size() < mMaxNumSliders; }
+
protected:
LLSD mValue;
std::string mCurSlider;
diff --git a/indra/llui/llmultisliderctrl.h b/indra/llui/llmultisliderctrl.h
index a1593c28e0..ad2dc94779 100644
--- a/indra/llui/llmultisliderctrl.h
+++ b/indra/llui/llmultisliderctrl.h
@@ -115,6 +115,10 @@ public:
F32 getMinValue() const { return mMultiSlider->getMinValue(); }
F32 getMaxValue() const { return mMultiSlider->getMaxValue(); }
+ S32 getMaxNumSliders() { return mMultiSlider->getMaxNumSliders(); }
+ S32 getCurNumSliders() { return mMultiSlider->getCurNumSliders(); }
+ bool canAddSliders() { return mMultiSlider->canAddSliders(); }
+
void setLabel(const std::string& label) { if (mLabelBox) mLabelBox->setText(label); }
void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; }
void setDisabledLabelColor(const LLColor4& c) { mTextDisabledColor = c; }
diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp
index ad797c686a..4ba23493d1 100644
--- a/indra/newview/llfloatereditextdaycycle.cpp
+++ b/indra/newview/llfloatereditextdaycycle.cpp
@@ -551,6 +551,12 @@ void LLFloaterEditExtDayCycle::onAddTrack()
LL_WARNS("ENVDAYEDIT") << "Attempt to add new frame too close to existing frame." << LL_ENDL;
return;
}
+ if (!mFramesSlider->canAddSliders())
+ {
+ // Shouldn't happen, button should be disabled
+ LL_WARNS("ENVDAYEDIT") << "Attempt to add new frame when slider is full." << LL_ENDL;
+ return;
+ }
if (mCurrentTrack == LLSettingsDay::TRACK_WATER)
{
@@ -903,7 +909,7 @@ void LLFloaterEditExtDayCycle::updateButtons()
//bool can_add = static_cast<bool>(settings);
//mAddFrameButton->setEnabled(can_add);
//mDeleteFrameButton->setEnabled(!can_add);
- mAddFrameButton->setEnabled(true && mCanMod);
+ mAddFrameButton->setEnabled(mCanMod && mFramesSlider->canAddSliders());
mDeleteFrameButton->setEnabled(isRemovingFrameAllowed() && mCanMod);
}
@@ -964,13 +970,16 @@ void LLFloaterEditExtDayCycle::addSliderFrame(const F32 frame, LLSettingsBase::p
// multi slider distinguishes elements by key/name in string format
// store names to map to be able to recall dependencies
std::string new_slider = mFramesSlider->addSlider(frame);
- mSliderKeyMap[new_slider] = FrameData(frame, setting);
-
- if (update_ui)
+ if (!new_slider.empty())
{
- mLastFrameSlider = new_slider;
- mTimeSlider->setCurSliderValue(frame);
- updateTabs();
+ mSliderKeyMap[new_slider] = FrameData(frame, setting);
+
+ if (update_ui)
+ {
+ mLastFrameSlider = new_slider;
+ mTimeSlider->setCurSliderValue(frame);
+ updateTabs();
+ }
}
}