Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3876 in orxonox.OLD for orxonox/trunk


Ignore:
Timestamp:
Apr 18, 2005, 5:18:45 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: rearanged keyFrame-addition

Location:
orxonox/trunk/src/util/animation
Files:
4 edited

Legend:

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

    r3868 r3876  
    2828
    2929  // initialize a beginning KeyFrame, that will be deleted afterwards
    30   this->bHasKeys = false;
     30  this->keyFrameCount = 0;
    3131  this->bHandled = true;
    3232  this->bDelete = false;
  • orxonox/trunk/src/util/animation/animation.h

    r3868 r3876  
    9494
    9595  BaseObject* baseObject;         //!< The same as object in the derived classes, but with reference to BaseObject
    96   bool bHasKeys;                  //!< If the animation has any keys at all. Needed to add the first keyframe (and delete the dummy).
     96  unsigned int keyFrameCount;     //!< The Count of KeyFrames.
    9797  bool bHandled;                  //!< If this Animation is handled by the AnimationPlayer.
    9898  bool bRunning;                  //!< If the animation is running
  • orxonox/trunk/src/util/animation/animation3d.cc

    r3874 r3876  
    9090  KeyFrame3D* tmpKeyFrame;
    9191   
    92   if (bHasKeys)
     92  // when adding the first frame
     93  if (this->keyFrameCount == 0)
     94    {
     95      tmpKeyFrame = this->keyFrameList->firstElement();
     96      this->setAnimFunc(animFunc);
     97    }
     98  else
    9399    {
    94100      tmpKeyFrame = new KeyFrame3D;
     101      // when adding the second frame
    95102      if (this->currentKeyFrame == this->nextKeyFrame)
    96103        this->nextKeyFrame = tmpKeyFrame;
    97104      this->keyFrameList->add(tmpKeyFrame);
    98 
    99     }
    100   else
    101     {
    102       tmpKeyFrame = this->keyFrameList->firstElement();
    103       bHasKeys = true;
    104       this->setAnimFunc(animFunc);
    105105    }
    106106
     
    109109  tmpKeyFrame->duration = duration;
    110110  tmpKeyFrame->animFunc = animFunc;
    111 
     111  this->keyFrameCount++;
    112112}
    113113
  • orxonox/trunk/src/util/animation/t_animation.h

    r3874 r3876  
    157157  KeyFrameF* tmpKeyFrame;
    158158   
    159   if (bHasKeys)
     159  // when adding the first frame
     160  if (this->keyFrameCount == 0)
     161    {
     162      tmpKeyFrame = this->keyFrameList->firstElement();
     163      this->setAnimFunc(animFunc);
     164    }
     165  else
    160166    {
    161167      tmpKeyFrame = new KeyFrameF;
     
    165171      this->keyFrameList->add(tmpKeyFrame);
    166172    }
    167   // when adding the first frame
    168   else
    169     {
    170       tmpKeyFrame = this->keyFrameList->firstElement();
    171       this->bHasKeys = true;
    172       this->setAnimFunc(animFunc);
    173     }
    174173
    175174  tmpKeyFrame->value = value;
    176175  tmpKeyFrame->duration = duration;
    177176  tmpKeyFrame->animFunc = animFunc;
     177  this->keyFrameCount++;
    178178}
    179179
Note: See TracChangeset for help on using the changeset viewer.