| 162 | //----------------------------------------------------------------------------- |
| 163 | |
| 164 | bool SFXTrack::onAdd() |
| 165 | { |
| 166 | if( !Parent::onAdd() ) |
| 167 | return false; |
| 168 | |
| 169 | // If we have no SFXDescription, try to grab a default. |
| 170 | |
| 171 | if( !mDescription ) |
| 172 | { |
| 173 | if( !Sim::findObject( "AudioEffects", mDescription ) && Sim::getSFXDescriptionSet()->size() > 0 ) |
| 174 | mDescription = dynamic_cast< SFXDescription* >( Sim::getSFXDescriptionSet()->at( 0 ) ); |
| 175 | |
| 176 | if( !mDescription ) |
| 177 | { |
| 178 | Con::errorf( |
| 179 | "SFXTrack(%s)::onAdd: The profile is missing a description!", |
| 180 | getName() ); |
| 181 | return false; |
| 182 | } |
| 183 | } |
| 184 | |
| 185 | Sim::getSFXTrackSet()->addObject( this ); |
| 186 | |
| 187 | return true; |
| 188 | } |
| 189 | |
| 190 | //----------------------------------------------------------------------------- |
| 191 | |