diff options
Diffstat (limited to 'indra/newview/llfloatereditextdaycycle.cpp')
-rw-r--r-- | indra/newview/llfloatereditextdaycycle.cpp | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 5a6af85334..38e45dd6d5 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -410,7 +410,9 @@ void LLFloaterEditExtDayCycle::onTrackSelectionCallback(const LLSD& user_data) void LLFloaterEditExtDayCycle::onPlayActionCallback(const LLSD& user_data) { std::string action = user_data.asString(); + F32 frame = mTimeSlider->getCurSliderValue(); + if (action == ACTION_PLAY) { startPlay(); @@ -424,13 +426,13 @@ void LLFloaterEditExtDayCycle::onPlayActionCallback(const LLSD& user_data) F32 new_frame = 0; if (action == ACTION_FORWARD) { - new_frame = mEditDay->getUpperBoundFrame(mCurrentTrack, frame); + new_frame = mEditDay->getUpperBoundFrame(mCurrentTrack, frame + (mTimeSlider->getIncrement() / 2)); } else if (action == ACTION_BACK) { new_frame = mEditDay->getLowerBoundFrame(mCurrentTrack, frame - (mTimeSlider->getIncrement() / 2)); } - selectFrame(new_frame); + selectFrame(new_frame, 0.0f); stopPlay(); } } @@ -538,12 +540,12 @@ void LLFloaterEditExtDayCycle::onFrameSliderMouseUp(S32 x, S32 y, MASK mask) LL_WARNS("LAPRAS") << " UP: X=" << x << " Y=" << y << " MASK=" << mask << " Position=" << sliderpos << LL_ENDL; mTimeSlider->setCurSliderValue(sliderpos); - selectFrame(sliderpos); + selectFrame(sliderpos, FRAME_SLOP_FACTOR); } void LLFloaterEditExtDayCycle::onTimeSliderMoved() { - selectFrame(mTimeSlider->getCurSliderValue()); + selectFrame(mTimeSlider->getCurSliderValue(), FRAME_SLOP_FACTOR); } void LLFloaterEditExtDayCycle::selectTrack(U32 track_index, bool force ) @@ -566,16 +568,16 @@ void LLFloaterEditExtDayCycle::selectTrack(U32 track_index, bool force ) updateSlider(); } -void LLFloaterEditExtDayCycle::selectFrame(F32 frame) +void LLFloaterEditExtDayCycle::selectFrame(F32 frame, F32 slop_factor) { mFramesSlider->resetCurSlider(); - keymap_t::iterator iter = mSliderKeyMap.begin(); keymap_t::iterator end_iter = mSliderKeyMap.end(); while (iter != end_iter) { - if (fabs(iter->second.mFrame - frame) <= FRAME_SLOP_FACTOR) + F32 keyframe = iter->second.mFrame; + if (fabs(keyframe - frame) <= slop_factor) { mFramesSlider->setCurSlider(iter->first); frame = iter->second.mFrame; @@ -587,6 +589,7 @@ void LLFloaterEditExtDayCycle::selectFrame(F32 frame) mTimeSlider->setCurSliderValue(frame); // block or update tabs according to new selection updateTabs(); + LLEnvironment::instance().updateEnvironment(); } void LLFloaterEditExtDayCycle::clearTabs() @@ -685,11 +688,16 @@ void LLFloaterEditExtDayCycle::setSkyTabsEnabled(BOOL enable) void LLFloaterEditExtDayCycle::updateButtons() { - LLSettingsBase::Seconds frame(mTimeSlider->getCurSliderValue()); - LLSettingsBase::ptr_t settings = mEditDay->getSettingsAtKeyframe(frame, mCurrentTrack); - bool can_add = static_cast<bool>(settings); - mAddFrameButton->setEnabled(can_add); - mDeleteFrameButton->setEnabled(!can_add); + // This logic appears to work in reverse, the add frame button + // is only enabled when you're on an existing frame and disabled + // in all the interim positions where you'd want to add a frame... + //LLSettingsBase::Seconds frame(mTimeSlider->getCurSliderValue()); + //LLSettingsBase::ptr_t settings = mEditDay->getSettingsAtKeyframe(frame, mCurrentTrack); + //bool can_add = static_cast<bool>(settings); + //mAddFrameButton->setEnabled(can_add); + //mDeleteFrameButton->setEnabled(!can_add); + mAddFrameButton->setEnabled(true); + mDeleteFrameButton->setEnabled(true); } void LLFloaterEditExtDayCycle::updateSlider() @@ -717,7 +725,7 @@ void LLFloaterEditExtDayCycle::updateSlider() mLastFrameSlider.clear(); } - selectFrame(frame_position); + selectFrame(frame_position, FRAME_SLOP_FACTOR); } void LLFloaterEditExtDayCycle::updateTimeAndLabel() @@ -1101,7 +1109,7 @@ void LLFloaterEditExtDayCycle::stopPlay() gIdleCallbacks.deleteFunction(onIdlePlay, this); mPlayTimer.stop(); F32 frame = mTimeSlider->getCurSliderValue(); - selectFrame(frame); + selectFrame(frame, FRAME_SLOP_FACTOR); getChild<LLView>("play_layout", true)->setVisible(TRUE); getChild<LLView>("pause_layout", true)->setVisible(FALSE); |