//----------------------------------------------------------------------------- // refresh() //----------------------------------------------------------------------------- void LLFloaterAnimPreview::refresh() { if (!mAnimPreview) { childShow("bad_animation_text"); mPlayButton->setEnabled(FALSE); mStopButton->setEnabled(FALSE); childDisable("ok_btn"); } else { childHide("bad_animation_text"); mPlayButton->setEnabled(TRUE); LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar(); if (avatarp->isMotionActive(mMotionID)) { mStopButton->setEnabled(TRUE); LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID); if (avatarp->areAnimationsPaused()) { mPlayButton->setImages(std::string("button_anim_play.tga"), std::string("button_anim_play_selected.tga")); } else { if (motionp) { F32 fraction_complete = motionp->getLastUpdateTime() / motionp->getDuration(); childSetValue("playback_slider", fraction_complete); } mPlayButton->setImages(std::string("button_anim_pause.tga"), std::string("button_anim_pause_selected.tga")); } } else { mPauseRequest = avatarp->requestPause(); mPlayButton->setImages(std::string("button_anim_play.tga"), std::string("button_anim_play_selected.tga")); mStopButton->setEnabled(TRUE); // stop also resets, leave enabled. } childEnable("ok_btn"); mAnimPreview->requestUpdate(); } }
//----------------------------------------------------------------------------- // refresh() //----------------------------------------------------------------------------- void LLFloaterAnimPreview::refresh() { // Are we showing the play button (default) or the pause button? bool show_play = true; if (!mAnimPreview) { getChildView("bad_animation_text")->setVisible(TRUE); // play button visible but disabled mPlayButton->setEnabled(FALSE); mStopButton->setEnabled(FALSE); getChildView("ok_btn")->setEnabled(FALSE); } else { getChildView("bad_animation_text")->setVisible(FALSE); // re-enabled in case previous animation was bad mPlayButton->setEnabled(TRUE); mStopButton->setEnabled(TRUE); LLVOAvatar* avatarp = mAnimPreview->getPreviewAvatar(); if (avatarp->isMotionActive(mMotionID)) { mStopButton->setEnabled(TRUE); LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID); if (!avatarp->areAnimationsPaused()) { // animation is playing if (motionp) { F32 fraction_complete = motionp->getLastUpdateTime() / motionp->getDuration(); getChild<LLUICtrl>("playback_slider")->setValue(fraction_complete); } show_play = false; } } else { // Motion just finished playing mPauseRequest = avatarp->requestPause(); } getChildView("ok_btn")->setEnabled(TRUE); mAnimPreview->requestUpdate(); } mPlayButton->setVisible(show_play); mPauseButton->setVisible(!show_play); }