diff options
Diffstat (limited to 'linden/indra/newview/llfloateranimpreview.cpp')
-rw-r--r-- | linden/indra/newview/llfloateranimpreview.cpp | 191 |
1 files changed, 81 insertions, 110 deletions
diff --git a/linden/indra/newview/llfloateranimpreview.cpp b/linden/indra/newview/llfloateranimpreview.cpp index ca6982b..41a1a35 100644 --- a/linden/indra/newview/llfloateranimpreview.cpp +++ b/linden/indra/newview/llfloateranimpreview.cpp | |||
@@ -76,13 +76,14 @@ const F32 PREVIEW_CAMERA_DISTANCE = 4.f; | |||
76 | const F32 MIN_CAMERA_ZOOM = 0.5f; | 76 | const F32 MIN_CAMERA_ZOOM = 0.5f; |
77 | const F32 MAX_CAMERA_ZOOM = 10.f; | 77 | const F32 MAX_CAMERA_ZOOM = 10.f; |
78 | 78 | ||
79 | const F32 BASE_ANIM_TIME_OFFSET = 5.f; | ||
80 | |||
79 | //----------------------------------------------------------------------------- | 81 | //----------------------------------------------------------------------------- |
80 | // LLFloaterAnimPreview() | 82 | // LLFloaterAnimPreview() |
81 | //----------------------------------------------------------------------------- | 83 | //----------------------------------------------------------------------------- |
82 | LLFloaterAnimPreview::LLFloaterAnimPreview(const char* filename) : | 84 | LLFloaterAnimPreview::LLFloaterAnimPreview(const char* filename) : |
83 | LLFloaterNameDesc(filename) | 85 | LLFloaterNameDesc(filename) |
84 | { | 86 | { |
85 | mLastSliderValue = 0.f; | ||
86 | mLastMouseX = 0; | 87 | mLastMouseX = 0; |
87 | mLastMouseY = 0; | 88 | mLastMouseY = 0; |
88 | 89 | ||
@@ -413,20 +414,32 @@ void LLFloaterAnimPreview::resetMotion() | |||
413 | LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar(); | 414 | LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar(); |
414 | BOOL paused = avatarp->areAnimationsPaused(); | 415 | BOOL paused = avatarp->areAnimationsPaused(); |
415 | 416 | ||
416 | mPauseRequest = NULL; | 417 | // *TODO: Fix awful casting hack |
418 | LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID); | ||
419 | |||
420 | // Set emotion | ||
421 | std::string emote = childGetValue("emote_combo").asString(); | ||
422 | motionp->setEmote(mIDList[emote]); | ||
417 | 423 | ||
418 | LLUUID anim_id = mIDList[childGetValue("preview_base_anim").asString()]; | 424 | LLUUID base_id = mIDList[childGetValue("preview_base_anim").asString()]; |
419 | avatarp->stopMotion(anim_id, TRUE); | 425 | avatarp->deactivateAllMotions(); |
420 | avatarp->stopMotion(mMotionID, TRUE); | 426 | avatarp->startMotion(base_id, BASE_ANIM_TIME_OFFSET); |
421 | avatarp->startMotion(anim_id, 5.f); | 427 | avatarp->startMotion(mMotionID, 0.0f); |
422 | avatarp->startMotion(mMotionID); | 428 | childSetValue("playback_slider", 0.0f); |
423 | childSetValue("playback_slider", 0.0); | 429 | |
424 | mLastSliderValue = 0.0f; | 430 | // Set pose |
431 | std::string handpose = childGetValue("hand_pose_combo").asString(); | ||
432 | avatarp->startMotion( ANIM_AGENT_HAND_MOTION, 0.0f ); | ||
433 | motionp->setHandPose(LLHandMotion::getHandPose(handpose)); | ||
425 | 434 | ||
426 | if (paused) | 435 | if (paused) |
427 | { | 436 | { |
428 | mPauseRequest = avatarp->requestPause(); | 437 | mPauseRequest = avatarp->requestPause(); |
429 | } | 438 | } |
439 | else | ||
440 | { | ||
441 | mPauseRequest = NULL; | ||
442 | } | ||
430 | } | 443 | } |
431 | 444 | ||
432 | //----------------------------------------------------------------------------- | 445 | //----------------------------------------------------------------------------- |
@@ -537,7 +550,8 @@ void LLFloaterAnimPreview::onMouseCaptureLost() | |||
537 | void LLFloaterAnimPreview::onBtnPlay(void* user_data) | 550 | void LLFloaterAnimPreview::onBtnPlay(void* user_data) |
538 | { | 551 | { |
539 | LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)user_data; | 552 | LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)user_data; |
540 | if (!previewp->getEnabled()) return; | 553 | if (!previewp->getEnabled()) |
554 | return; | ||
541 | 555 | ||
542 | if (previewp->mMotionID.notNull() && previewp->mAnimPreview) | 556 | if (previewp->mMotionID.notNull() && previewp->mAnimPreview) |
543 | { | 557 | { |
@@ -568,22 +582,14 @@ void LLFloaterAnimPreview::onBtnPlay(void* user_data) | |||
568 | void LLFloaterAnimPreview::onBtnStop(void* user_data) | 582 | void LLFloaterAnimPreview::onBtnStop(void* user_data) |
569 | { | 583 | { |
570 | LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)user_data; | 584 | LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)user_data; |
571 | if (!previewp->getEnabled()) return; | 585 | if (!previewp->getEnabled()) |
586 | return; | ||
572 | 587 | ||
573 | if (previewp->mMotionID.notNull() && previewp->mAnimPreview) | 588 | if (previewp->mMotionID.notNull() && previewp->mAnimPreview) |
574 | { | 589 | { |
575 | LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); | 590 | LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); |
576 | 591 | previewp->resetMotion(); | |
577 | // is the motion looping and have we passed the loop in point? | 592 | previewp->mPauseRequest = avatarp->requestPause(); |
578 | if (previewp->childGetValue("loop_check").asBoolean() && | ||
579 | (F32)previewp->childGetValue("loop_in_point").asReal() <= (F32)previewp->childGetValue("playback_slider").asReal() * 100.f) | ||
580 | { | ||
581 | avatarp->stopMotion(previewp->mMotionID, FALSE); | ||
582 | } | ||
583 | else | ||
584 | { | ||
585 | avatarp->stopMotion(previewp->mMotionID, FALSE); | ||
586 | } | ||
587 | } | 593 | } |
588 | } | 594 | } |
589 | 595 | ||
@@ -593,43 +599,24 @@ void LLFloaterAnimPreview::onBtnStop(void* user_data) | |||
593 | void LLFloaterAnimPreview::onSliderMove(LLUICtrl* ctrl, void*user_data) | 599 | void LLFloaterAnimPreview::onSliderMove(LLUICtrl* ctrl, void*user_data) |
594 | { | 600 | { |
595 | LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)user_data; | 601 | LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)user_data; |
596 | if (!previewp->getEnabled()) return; | 602 | if (!previewp->getEnabled()) |
603 | return; | ||
597 | 604 | ||
598 | if (previewp->mAnimPreview) | 605 | if (previewp->mAnimPreview) |
599 | { | 606 | { |
600 | LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); | 607 | LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); |
608 | F32 slider_value = (F32)previewp->childGetValue("playback_slider").asReal(); | ||
609 | LLUUID base_id = previewp->mIDList[previewp->childGetValue("preview_base_anim").asString()]; | ||
601 | LLMotion* motionp = avatarp->findMotion(previewp->mMotionID); | 610 | LLMotion* motionp = avatarp->findMotion(previewp->mMotionID); |
602 | LLMotion* base_motionp = | 611 | F32 duration = motionp->getDuration();// + motionp->getEaseOutDuration(); |
603 | avatarp->findMotion(previewp->mIDList[previewp->childGetValue("preview_base_anim").asString()]); | 612 | F32 delta_time = duration * slider_value; |
604 | 613 | avatarp->deactivateAllMotions(); | |
605 | if (motionp && base_motionp) | 614 | avatarp->startMotion(base_id, delta_time + BASE_ANIM_TIME_OFFSET); |
606 | { | 615 | avatarp->startMotion(previewp->mMotionID, delta_time); |
607 | if (!avatarp->isMotionActive(previewp->mMotionID)) | 616 | previewp->mPauseRequest = avatarp->requestPause(); |
608 | { | 617 | previewp->refresh(); |
609 | previewp->resetMotion(); | ||
610 | } | ||
611 | |||
612 | previewp->mPauseRequest = avatarp->requestPause(); | ||
613 | F32 original_activation_time = motionp->mActivationTimestamp; | ||
614 | motionp->mActivationTimestamp -= ((F32)previewp->childGetValue("playback_slider").asReal() - previewp->mLastSliderValue) * | ||
615 | motionp->getDuration(); | ||
616 | base_motionp->mActivationTimestamp -= ((F32)previewp->childGetValue("playback_slider").asReal() - previewp->mLastSliderValue) * | ||
617 | base_motionp->getDuration(); | ||
618 | |||
619 | if (motionp->mSendStopTimestamp != F32_MIN) | ||
620 | { | ||
621 | motionp->mSendStopTimestamp = motionp->mSendStopTimestamp - original_activation_time + motionp->mActivationTimestamp; | ||
622 | } | ||
623 | |||
624 | if (motionp->mStopTimestamp != F32_MIN) | ||
625 | { | ||
626 | motionp->mStopTimestamp = motionp->mStopTimestamp - original_activation_time + motionp->mActivationTimestamp; | ||
627 | } | ||
628 | previewp->refresh(); | ||
629 | } | ||
630 | } | 618 | } |
631 | 619 | ||
632 | previewp->mLastSliderValue = (F32)previewp->childGetValue("playback_slider").asReal(); | ||
633 | } | 620 | } |
634 | 621 | ||
635 | //----------------------------------------------------------------------------- | 622 | //----------------------------------------------------------------------------- |
@@ -638,8 +625,8 @@ void LLFloaterAnimPreview::onSliderMove(LLUICtrl* ctrl, void*user_data) | |||
638 | void LLFloaterAnimPreview::onCommitBaseAnim(LLUICtrl* ctrl, void* data) | 625 | void LLFloaterAnimPreview::onCommitBaseAnim(LLUICtrl* ctrl, void* data) |
639 | { | 626 | { |
640 | LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; | 627 | LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; |
641 | 628 | if (!previewp->getEnabled()) | |
642 | if (!previewp->getEnabled()) return; | 629 | return; |
643 | 630 | ||
644 | if (previewp->mAnimPreview) | 631 | if (previewp->mAnimPreview) |
645 | { | 632 | { |
@@ -668,8 +655,9 @@ void LLFloaterAnimPreview::onCommitBaseAnim(LLUICtrl* ctrl, void* data) | |||
668 | void LLFloaterAnimPreview::onCommitLoop(LLUICtrl* ctrl, void* data) | 655 | void LLFloaterAnimPreview::onCommitLoop(LLUICtrl* ctrl, void* data) |
669 | { | 656 | { |
670 | LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; | 657 | LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; |
671 | 658 | if (!previewp->getEnabled()) | |
672 | if (!previewp->getEnabled()) return; | 659 | return; |
660 | |||
673 | LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); | 661 | LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); |
674 | LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); | 662 | LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); |
675 | 663 | ||
@@ -687,7 +675,8 @@ void LLFloaterAnimPreview::onCommitLoop(LLUICtrl* ctrl, void* data) | |||
687 | void LLFloaterAnimPreview::onCommitLoopIn(LLUICtrl* ctrl, void* data) | 675 | void LLFloaterAnimPreview::onCommitLoopIn(LLUICtrl* ctrl, void* data) |
688 | { | 676 | { |
689 | LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; | 677 | LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; |
690 | if (!previewp->getEnabled()) return; | 678 | if (!previewp->getEnabled()) |
679 | return; | ||
691 | 680 | ||
692 | LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); | 681 | LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); |
693 | LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); | 682 | LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); |
@@ -707,7 +696,8 @@ void LLFloaterAnimPreview::onCommitLoopIn(LLUICtrl* ctrl, void* data) | |||
707 | void LLFloaterAnimPreview::onCommitLoopOut(LLUICtrl* ctrl, void* data) | 696 | void LLFloaterAnimPreview::onCommitLoopOut(LLUICtrl* ctrl, void* data) |
708 | { | 697 | { |
709 | LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; | 698 | LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; |
710 | if (!previewp->getEnabled()) return; | 699 | if (!previewp->getEnabled()) |
700 | return; | ||
711 | 701 | ||
712 | LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); | 702 | LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); |
713 | LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); | 703 | LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); |
@@ -727,7 +717,8 @@ void LLFloaterAnimPreview::onCommitLoopOut(LLUICtrl* ctrl, void* data) | |||
727 | void LLFloaterAnimPreview::onCommitName(LLUICtrl* ctrl, void* data) | 717 | void LLFloaterAnimPreview::onCommitName(LLUICtrl* ctrl, void* data) |
728 | { | 718 | { |
729 | LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; | 719 | LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; |
730 | if (!previewp->getEnabled()) return; | 720 | if (!previewp->getEnabled()) |
721 | return; | ||
731 | 722 | ||
732 | LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); | 723 | LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); |
733 | LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); | 724 | LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); |
@@ -746,13 +737,10 @@ void LLFloaterAnimPreview::onCommitName(LLUICtrl* ctrl, void* data) | |||
746 | void LLFloaterAnimPreview::onCommitHandPose(LLUICtrl* ctrl, void* data) | 737 | void LLFloaterAnimPreview::onCommitHandPose(LLUICtrl* ctrl, void* data) |
747 | { | 738 | { |
748 | LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; | 739 | LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; |
749 | if (!previewp->getEnabled()) return; | 740 | if (!previewp->getEnabled()) |
750 | 741 | return; | |
751 | LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); | ||
752 | LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); | ||
753 | 742 | ||
754 | motionp->setHandPose(LLHandMotion::getHandPose(previewp->childGetValue("hand_pose_combo").asString())); | 743 | previewp->resetMotion(); // sets hand pose |
755 | previewp->resetMotion(); | ||
756 | } | 744 | } |
757 | 745 | ||
758 | //----------------------------------------------------------------------------- | 746 | //----------------------------------------------------------------------------- |
@@ -761,13 +749,10 @@ void LLFloaterAnimPreview::onCommitHandPose(LLUICtrl* ctrl, void* data) | |||
761 | void LLFloaterAnimPreview::onCommitEmote(LLUICtrl* ctrl, void* data) | 749 | void LLFloaterAnimPreview::onCommitEmote(LLUICtrl* ctrl, void* data) |
762 | { | 750 | { |
763 | LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; | 751 | LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; |
764 | if (!previewp->getEnabled()) return; | 752 | if (!previewp->getEnabled()) |
753 | return; | ||
765 | 754 | ||
766 | LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); | 755 | previewp->resetMotion(); // ssts emote |
767 | LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); | ||
768 | |||
769 | motionp->setEmote(previewp->mIDList[previewp->childGetValue("emote_combo").asString()]); | ||
770 | previewp->resetMotion(); | ||
771 | } | 756 | } |
772 | 757 | ||
773 | //----------------------------------------------------------------------------- | 758 | //----------------------------------------------------------------------------- |
@@ -776,7 +761,8 @@ void LLFloaterAnimPreview::onCommitEmote(LLUICtrl* ctrl, void* data) | |||
776 | void LLFloaterAnimPreview::onCommitPriority(LLUICtrl* ctrl, void* data) | 761 | void LLFloaterAnimPreview::onCommitPriority(LLUICtrl* ctrl, void* data) |
777 | { | 762 | { |
778 | LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; | 763 | LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; |
779 | if (!previewp->getEnabled()) return; | 764 | if (!previewp->getEnabled()) |
765 | return; | ||
780 | 766 | ||
781 | LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); | 767 | LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); |
782 | LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); | 768 | LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); |
@@ -790,7 +776,8 @@ void LLFloaterAnimPreview::onCommitPriority(LLUICtrl* ctrl, void* data) | |||
790 | void LLFloaterAnimPreview::onCommitEaseIn(LLUICtrl* ctrl, void* data) | 776 | void LLFloaterAnimPreview::onCommitEaseIn(LLUICtrl* ctrl, void* data) |
791 | { | 777 | { |
792 | LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; | 778 | LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; |
793 | if (!previewp->getEnabled()) return; | 779 | if (!previewp->getEnabled()) |
780 | return; | ||
794 | 781 | ||
795 | LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); | 782 | LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); |
796 | LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); | 783 | LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); |
@@ -805,7 +792,8 @@ void LLFloaterAnimPreview::onCommitEaseIn(LLUICtrl* ctrl, void* data) | |||
805 | void LLFloaterAnimPreview::onCommitEaseOut(LLUICtrl* ctrl, void* data) | 792 | void LLFloaterAnimPreview::onCommitEaseOut(LLUICtrl* ctrl, void* data) |
806 | { | 793 | { |
807 | LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; | 794 | LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; |
808 | if (!previewp->getEnabled()) return; | 795 | if (!previewp->getEnabled()) |
796 | return; | ||
809 | 797 | ||
810 | LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); | 798 | LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); |
811 | LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); | 799 | LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); |
@@ -819,9 +807,9 @@ void LLFloaterAnimPreview::onCommitEaseOut(LLUICtrl* ctrl, void* data) | |||
819 | //----------------------------------------------------------------------------- | 807 | //----------------------------------------------------------------------------- |
820 | BOOL LLFloaterAnimPreview::validateEaseIn(LLUICtrl* spin, void* data) | 808 | BOOL LLFloaterAnimPreview::validateEaseIn(LLUICtrl* spin, void* data) |
821 | { | 809 | { |
822 | LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; | 810 | LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; |
823 | 811 | if (!previewp->getEnabled()) | |
824 | if (!previewp->getEnabled()) return FALSE; | 812 | return FALSE; |
825 | 813 | ||
826 | LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); | 814 | LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); |
827 | LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); | 815 | LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); |
@@ -842,7 +830,8 @@ BOOL LLFloaterAnimPreview::validateEaseOut(LLUICtrl* spin, void* data) | |||
842 | { | 830 | { |
843 | LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; | 831 | LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; |
844 | 832 | ||
845 | if (!previewp->getEnabled()) return FALSE; | 833 | if (!previewp->getEnabled()) |
834 | return FALSE; | ||
846 | 835 | ||
847 | LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); | 836 | LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); |
848 | LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); | 837 | LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); |
@@ -862,8 +851,8 @@ BOOL LLFloaterAnimPreview::validateEaseOut(LLUICtrl* spin, void* data) | |||
862 | BOOL LLFloaterAnimPreview::validateLoopIn(LLUICtrl* ctrl, void* data) | 851 | BOOL LLFloaterAnimPreview::validateLoopIn(LLUICtrl* ctrl, void* data) |
863 | { | 852 | { |
864 | LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; | 853 | LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; |
865 | 854 | if (!previewp->getEnabled()) | |
866 | if (!previewp->getEnabled()) return FALSE; | 855 | return FALSE; |
867 | 856 | ||
868 | F32 loop_in_value = (F32)previewp->childGetValue("loop_in_point").asReal(); | 857 | F32 loop_in_value = (F32)previewp->childGetValue("loop_in_point").asReal(); |
869 | F32 loop_out_value = (F32)previewp->childGetValue("loop_out_point").asReal(); | 858 | F32 loop_out_value = (F32)previewp->childGetValue("loop_out_point").asReal(); |
@@ -891,8 +880,8 @@ BOOL LLFloaterAnimPreview::validateLoopIn(LLUICtrl* ctrl, void* data) | |||
891 | BOOL LLFloaterAnimPreview::validateLoopOut(LLUICtrl* spin, void* data) | 880 | BOOL LLFloaterAnimPreview::validateLoopOut(LLUICtrl* spin, void* data) |
892 | { | 881 | { |
893 | LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; | 882 | LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; |
894 | 883 | if (!previewp->getEnabled()) | |
895 | if (!previewp->getEnabled()) return FALSE; | 884 | return FALSE; |
896 | 885 | ||
897 | F32 loop_out_value = (F32)previewp->childGetValue("loop_out_point").asReal(); | 886 | F32 loop_out_value = (F32)previewp->childGetValue("loop_out_point").asReal(); |
898 | F32 loop_in_value = (F32)previewp->childGetValue("loop_in_point").asReal(); | 887 | F32 loop_in_value = (F32)previewp->childGetValue("loop_in_point").asReal(); |
@@ -947,11 +936,8 @@ void LLFloaterAnimPreview::refresh() | |||
947 | { | 936 | { |
948 | if (motionp) | 937 | if (motionp) |
949 | { | 938 | { |
950 | F32 fraction_complete; | 939 | F32 fraction_complete = motionp->getLastUpdateTime() / motionp->getDuration(); |
951 | fraction_complete = motionp->getLastUpdateTime() / motionp->getDuration(); | ||
952 | |||
953 | childSetValue("playback_slider", fraction_complete); | 940 | childSetValue("playback_slider", fraction_complete); |
954 | mLastSliderValue = fraction_complete; | ||
955 | } | 941 | } |
956 | mPlayButton->setImages("button_anim_pause.tga", | 942 | mPlayButton->setImages("button_anim_pause.tga", |
957 | "button_anim_pause_selected.tga"); | 943 | "button_anim_pause_selected.tga"); |
@@ -964,7 +950,7 @@ void LLFloaterAnimPreview::refresh() | |||
964 | mPlayButton->setImages("button_anim_play.tga", | 950 | mPlayButton->setImages("button_anim_play.tga", |
965 | "button_anim_play_selected.tga"); | 951 | "button_anim_play_selected.tga"); |
966 | 952 | ||
967 | mStopButton->setEnabled(FALSE); | 953 | mStopButton->setEnabled(TRUE); // stop also resets, leave enabled. |
968 | } | 954 | } |
969 | childEnable("ok_btn"); | 955 | childEnable("ok_btn"); |
970 | mAnimPreview->requestUpdate(); | 956 | mAnimPreview->requestUpdate(); |
@@ -1037,12 +1023,12 @@ LLPreviewAnimation::LLPreviewAnimation(S32 width, S32 height) : LLDynamicTexture | |||
1037 | mDummyAvatar = (LLVOAvatar*)gObjectList.createObjectViewer(LL_PCODE_LEGACY_AVATAR, gAgent.getRegion()); | 1023 | mDummyAvatar = (LLVOAvatar*)gObjectList.createObjectViewer(LL_PCODE_LEGACY_AVATAR, gAgent.getRegion()); |
1038 | mDummyAvatar->createDrawable(&gPipeline); | 1024 | mDummyAvatar->createDrawable(&gPipeline); |
1039 | mDummyAvatar->mIsDummy = TRUE; | 1025 | mDummyAvatar->mIsDummy = TRUE; |
1040 | mDummyAvatar->mSpecialRenderMode = 2; | 1026 | mDummyAvatar->mSpecialRenderMode = 1; |
1041 | mDummyAvatar->setPositionAgent(LLVector3::zero); | 1027 | mDummyAvatar->setPositionAgent(LLVector3::zero); |
1042 | mDummyAvatar->slamPosition(); | 1028 | mDummyAvatar->slamPosition(); |
1043 | mDummyAvatar->updateJointLODs(); | 1029 | mDummyAvatar->updateJointLODs(); |
1044 | mDummyAvatar->updateGeometry(mDummyAvatar->mDrawable); | 1030 | mDummyAvatar->updateGeometry(mDummyAvatar->mDrawable); |
1045 | mDummyAvatar->startMotion(ANIM_AGENT_STAND, 5.f); | 1031 | mDummyAvatar->startMotion(ANIM_AGENT_STAND, BASE_ANIM_TIME_OFFSET); |
1046 | mDummyAvatar->mSkirtLOD.setVisible(FALSE, TRUE); | 1032 | mDummyAvatar->mSkirtLOD.setVisible(FALSE, TRUE); |
1047 | gPipeline.markVisible(mDummyAvatar->mDrawable, *LLViewerCamera::getInstance()); | 1033 | gPipeline.markVisible(mDummyAvatar->mDrawable, *LLViewerCamera::getInstance()); |
1048 | 1034 | ||
@@ -1110,30 +1096,15 @@ BOOL LLPreviewAnimation::render() | |||
1110 | 1096 | ||
1111 | //avatarp->setAnimationData("LookAtPoint", (void *)&mCameraRelPos); | 1097 | //avatarp->setAnimationData("LookAtPoint", (void *)&mCameraRelPos); |
1112 | 1098 | ||
1113 | //RN: timestep must be zero, because paused animations will never initialize | 1099 | //SJB: Animation is updated in LLVOAvatar::updateCharacter |
1114 | // av skeleton otherwise | ||
1115 | avatarp->setTimeStep(0.f); | ||
1116 | if (avatarp->areAnimationsPaused()) | ||
1117 | { | ||
1118 | avatarp->updateMotion(TRUE); | ||
1119 | } | ||
1120 | else | ||
1121 | { | ||
1122 | avatarp->updateMotion(); | ||
1123 | } | ||
1124 | 1100 | ||
1125 | LLVertexBuffer::unbind(); | ||
1126 | avatarp->updateLOD(); | ||
1127 | |||
1128 | |||
1129 | avatarp->mRoot.updateWorldMatrixChildren(); | ||
1130 | |||
1131 | stop_glerror(); | ||
1132 | |||
1133 | LLGLDepthTest gls_depth(GL_TRUE); | ||
1134 | |||
1135 | if (avatarp->mDrawable.notNull()) | 1101 | if (avatarp->mDrawable.notNull()) |
1136 | { | 1102 | { |
1103 | avatarp->updateLOD(); | ||
1104 | |||
1105 | LLVertexBuffer::unbind(); | ||
1106 | LLGLDepthTest gls_depth(GL_TRUE); | ||
1107 | |||
1137 | LLDrawPoolAvatar *avatarPoolp = (LLDrawPoolAvatar *)avatarp->mDrawable->getFace(0)->getPool(); | 1108 | LLDrawPoolAvatar *avatarPoolp = (LLDrawPoolAvatar *)avatarp->mDrawable->getFace(0)->getPool(); |
1138 | avatarp->dirtyMesh(); | 1109 | avatarp->dirtyMesh(); |
1139 | avatarPoolp->renderAvatars(avatarp); // renders only one avatar | 1110 | avatarPoolp->renderAvatars(avatarp); // renders only one avatar |