Changeset 3743 in orxonox.OLD for orxonox/trunk/src/simple_animation.cc
- Timestamp:
- Apr 7, 2005, 2:57:33 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/simple_animation.cc
r3739 r3743 97 97 { 98 98 this->workingObject = NULL; 99 this->workingAnimator = NULL; 99 100 this->bDescriptive = false; 100 101 } … … 117 118 void SimpleAnimation::selectObject(WorldEntity* entity) 118 119 { 120 printf("SimpleAnimation::selectObject() - selecing active object\n"); 119 121 Animation* anim = getAnimationFromWorldEntity(entity); 120 122 if( anim == NULL) … … 125 127 anim->lastPosition = new Vector(); 126 128 anim->tmpVect = new Vector(); 127 frames = new tList<KeyFrame>();129 anim->frames = new tList<KeyFrame>(); 128 130 bRunning = false; 129 131 deltaT = 0.0; 130 132 this->animators->add(anim); 131 133 } 134 else 135 printf("SimpleAnimation::selectObject() - animation already existent, using it\n"); 132 136 this->workingAnimator = anim; 137 printf("SimpleAnimation::selectObject() - selection completed\n"); 133 138 } 134 139 … … 143 148 void SimpleAnimation::addKeyFrame(Vector* point, Quaternion* direction, float time) 144 149 { 145 if( !this->bDescriptive )150 if( !this->bDescriptive || this->workingAnimator == NULL) 146 151 { 147 152 PRINTF(1)("SimpleAnimation: executing animation code outside a AnimationBegin()/AnimationEnd() - ignoring\n"); … … 153 158 frame->time = time; 154 159 frame->mode = DEFAULT_ANIMATION_MODE; 155 frame->object = this->working Object;156 this-> frames->add(frame);160 frame->object = this->workingAnimator->object; 161 this->workingAnimator->frames->add(frame); 157 162 } 158 163 … … 167 172 void SimpleAnimation::addKeyFrame(Vector* point, Quaternion* direction, float time, movementMode mode) 168 173 { 169 if( !this->bDescriptive )174 if( !this->bDescriptive || this->workingAnimator == NULL) 170 175 { 171 176 PRINTF(1)("SimpleAnimation: executing animation code outside a AnimationBegin()/AnimationEnd() - ignoring\n"); … … 177 182 frame->time = time; 178 183 frame->mode = mode; 179 frame->object = this->working Object;180 this-> frames->add(frame);184 frame->object = this->workingAnimator->object; 185 this->workingAnimator->frames->add(frame); 181 186 } 182 187 … … 187 192 void SimpleAnimation::addKeyFrame(KeyFrame* frame) 188 193 { 189 if( !this->bDescriptive) 194 printf("SimpleAnimation::addKeyFrame() - adding frame\n"); 195 if( !this->bDescriptive || this->workingAnimator == NULL) 190 196 { 191 197 PRINTF(1)("SimpleAnimation: executing animation code outside a AnimationBegin()/AnimationEnd() - ignoring\n"); 192 198 return; 193 199 } 194 frame->object = this->workingObject; 195 this->frames->add(frame); 200 frame->object = this->workingAnimator->object; 201 this->workingAnimator->frames->add(frame); 202 printf("SimpleAnimation::addKeyFrame() - addition completed\n"); 196 203 } 197 204 … … 202 209 void SimpleAnimation::reset() 203 210 { 211 /* 204 212 tIterator<KeyFrame>* iterator = this->frames->getIterator(); 205 213 KeyFrame* frame = iterator->nextElement(); … … 218 226 this->currentFrame = NULL; 219 227 this->lastFrame = NULL; 228 */ 220 229 } 221 230 … … 232 241 233 242 this->localTime = 0; 234 this->lastFrame = this->frames->firstElement(); 235 this->currentFrame = this->frames->nextElement(this->currentFrame); 243 244 /* 245 tIterator<Animation>* iterator = this->animators->getIterator(); 246 Animation* anim = iterator->nextElement(); 247 while( anim != NULL) 248 { 249 printf("SimpleAnimation::start() - initializing an animaion\n"); 250 anim->currentFrame = anim->frames->firstElement(); 251 anim->lastFrame = anim->frames->nextElement(anim->currentFrame); 252 anim = iterator->nextElement(); 253 } 254 */ 255 236 256 this->bRunning = true; 237 257 } … … 252 272 { 253 273 this->localTime = 0; 254 this->lastFrame = this->frames->firstElement();255 this->currentFrame = this->frames->nextElement(this->currentFrame);274 //this->lastFrame = this->frames->firstElement(); 275 //this->currentFrame = this->frames->nextElement(this->currentFrame); 256 276 this->bRunning = true; 257 277 } … … 285 305 { 286 306 if( anim->bRunning) 287 { 288 307 { 289 308 290 309 /* first get the current frame via time-stamps */
Note: See TracChangeset
for help on using the changeset viewer.