Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 26, 2005, 3:17:43 AM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: now there is a posibility to play only parts of the animation:
use anim→playNextKeyframes(count_of_keyframes_to_play); to make it work

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/util/animation/animation3d.cc

    r3981 r3982  
    138138      if (localTime >= this->currentKeyFrame->duration)
    139139        {
    140           // switching to the next Key-Frame
    141           this->localTime -= this->currentKeyFrame->duration;
    142           this->currentKeyFrame = this->nextKeyFrame;
    143           // checking, if we should still Play the animation
    144           if (this->currentKeyFrame == this->keyFrameList->lastElement())
    145             this->handleInfinity();
    146           this->nextKeyFrame = this->keyFrameList->nextElement(this->currentKeyFrame);
    147           this->setAnimFuncMov(this->currentKeyFrame->animFuncMov);
    148           this->setAnimFuncRot(this->currentKeyFrame->animFuncRot);
    149         }
     140          if (likely(this->keyFramesToPlay != 0))
     141            {
     142              if (unlikely(this->keyFramesToPlay > 0))
     143                --this->keyFramesToPlay;
     144              // switching to the next Key-Frame
     145              this->localTime -= this->currentKeyFrame->duration;
     146              this->currentKeyFrame = this->nextKeyFrame;
     147              // checking, if we should still Play the animation
     148              if (this->currentKeyFrame == this->keyFrameList->lastElement())
     149                this->handleInfinity();
     150              this->nextKeyFrame = this->keyFrameList->nextElement(this->currentKeyFrame);
     151              this->setAnimFuncMov(this->currentKeyFrame->animFuncMov);
     152              this->setAnimFuncRot(this->currentKeyFrame->animFuncRot);
     153            }
     154          else
     155            this->pause();
     156        }     
    150157      /* now animate it */
    151158      (this->*animFuncMov)(this->localTime);
Note: See TracChangeset for help on using the changeset viewer.