diff options
-rw-r--r-- | indra/newview/llfloatereditextdaycycle.cpp | 17 | ||||
-rw-r--r-- | indra/newview/llfloatereditextdaycycle.h | 1 |
2 files changed, 17 insertions, 1 deletions
diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index a30e16ab2b..95df4206b7 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -1020,7 +1020,7 @@ void LLFloaterEditExtDayCycle::updateButtons() //bool can_add = static_cast<bool>(settings); //mAddFrameButton->setEnabled(can_add); //mDeleteFrameButton->setEnabled(!can_add); - mAddFrameButton->setEnabled(mCanMod && mFramesSlider->canAddSliders()); + mAddFrameButton->setEnabled(isAddingFrameAllowed() && mCanMod); mDeleteFrameButton->setEnabled(isRemovingFrameAllowed() && mCanMod); } @@ -1401,6 +1401,8 @@ void LLFloaterEditExtDayCycle::doApplyCommit(LLSettingsDay::ptr_t day) bool LLFloaterEditExtDayCycle::isRemovingFrameAllowed() { + if (mFramesSlider->getCurSlider().empty()) return false; + if (mCurrentTrack <= LLSettingsDay::TRACK_GROUND_LEVEL) { return (mSliderKeyMap.size() > 1); @@ -1411,6 +1413,18 @@ bool LLFloaterEditExtDayCycle::isRemovingFrameAllowed() } } +bool LLFloaterEditExtDayCycle::isAddingFrameAllowed() +{ + if (!mFramesSlider->getCurSlider().empty()) return false; + + LLSettingsBase::Seconds frame(mTimeSlider->getCurSliderValue()); + if ((mEditDay->getSettingsNearKeyframe(frame, mCurrentTrack, LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR)).second) + { + return false; + } + return mFramesSlider->canAddSliders(); +} + void LLFloaterEditExtDayCycle::onInventoryCreated(LLUUID asset_id, LLUUID inventory_id, LLSD results) { LL_INFOS("ENVDAYEDIT") << "Inventory item " << inventory_id << " has been created with asset " << asset_id << " results are:" << results << LL_ENDL; @@ -1536,6 +1550,7 @@ void LLFloaterEditExtDayCycle::onIdlePlay(void* user_data) self->mWaterBlender->setPosition(new_frame); self->synchronizeTabs(); self->updateTimeAndLabel(); + self->updateButtons(); } } diff --git a/indra/newview/llfloatereditextdaycycle.h b/indra/newview/llfloatereditextdaycycle.h index fd5fb67837..6224517aa0 100644 --- a/indra/newview/llfloatereditextdaycycle.h +++ b/indra/newview/llfloatereditextdaycycle.h @@ -173,6 +173,7 @@ private: virtual void clearDirtyFlag(); bool isRemovingFrameAllowed(); + bool isAddingFrameAllowed(); LLSettingsDay::ptr_t mEditDay; // edited copy LLSettingsDay::Seconds mDayLength; |