Changeset 3727 in orxonox.OLD for orxonox/trunk/src/simple_animation.cc
- Timestamp:
- Apr 5, 2005, 7:44:05 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/simple_animation.cc
r3726 r3727 26 26 27 27 28 SimpleAnimation* SimpleAnimation::singletonRef = 0; 29 /** 30 \brief gets the singleton instance 31 \returns singleton instance 32 */ 33 SimpleAnimation* SimpleAnimation::getInstance() 34 { 35 if( singletonRef == NULL) 36 singletonRef = new SimpleAnimation(); 37 return singletonRef; 38 } 39 28 40 /** 29 41 \brief standard constructor 30 42 */ 31 SimpleAnimation::SimpleAnimation ( PNode* parent)43 SimpleAnimation::SimpleAnimation () 32 44 { 33 45 this->setClassName ("SimpleAnimation"); … … 35 47 this->localTime = 0; 36 48 this->bRunning = false; 37 this->parent = parent;38 49 this->currentFrame = NULL; 39 50 this->lastFrame = NULL; … … 61 72 62 73 74 /** 75 \brief this determines the start of an Animator Describtion 76 77 this can then be followed by different commands like addKeyFrame(..) etc. and 78 will be closed with AnimatiorEnd() 79 */ 80 void SimpleAnimation::AnimatorBegin() 81 { 82 this->bDescriptive = true; 83 } 84 85 86 /** 87 \brief this determines the end of an Animator Describtion 88 89 this can then be followed by different commands like addKeyFrame(..) etc. and 90 will be closed with AnimatiorEnd() 91 */ 92 void SimpleAnimation::AnimatorEnd() 93 { 94 this->workingObject = NULL; 95 this->bDescriptive = false; 96 } 97 98 99 /** 100 \brief select an object to work on by using this function 101 \param object wo work on 102 */ 103 void SimpleAnimation::selectObject(WorldEntity* entity) 104 { 105 this->workingObject = entity; 106 } 107 108 63 109 64 110 /** … … 70 116 void SimpleAnimation::addKeyFrame(Vector* point, Quaternion* orientation, float time) 71 117 { 118 if( !this->bDescriptive) 119 { 120 PRINTF(1)("SimpleAnimation: executing animation code outside a AnimationBegin()/AnimationEnd() - ignoring\n"); 121 return; 122 } 72 123 KeyFrame* frame = new KeyFrame; 73 124 frame->position = point; … … 75 126 frame->time = time; 76 127 frame->mode = DEFAULT_ANIMATION_MODE; 128 frame->object = this->workingObject; 77 129 this->frames->add(frame); 78 130 } … … 88 140 void SimpleAnimation::addKeyFrame(Vector* point, Quaternion* orientation, float time, movementMode mode) 89 141 { 142 if( !this->bDescriptive) 143 { 144 PRINTF(1)("SimpleAnimation: executing animation code outside a AnimationBegin()/AnimationEnd() - ignoring\n"); 145 return; 146 } 90 147 KeyFrame* frame = new KeyFrame; 91 148 frame->position = point; … … 93 150 frame->time = time; 94 151 frame->mode = mode; 152 frame->object = this->workingObject; 95 153 this->frames->add(frame); 96 154 } … … 102 160 void SimpleAnimation::addKeyFrame(KeyFrame* frame) 103 161 { 104 if( frame != NULL) 105 this->frames->add(frame); 162 if( !this->bDescriptive) 163 { 164 PRINTF(1)("SimpleAnimation: executing animation code outside a AnimationBegin()/AnimationEnd() - ignoring\n"); 165 return; 166 } 167 frame->object = this->workingObject; 168 this->frames->add(frame); 106 169 } 107 170
Note: See TracChangeset
for help on using the changeset viewer.