| 343 | //------------------------------------------------------------------------------ |
| 344 | |
| 345 | void GuiObjectView::setObjectModel( const String& modelName ) |
| 346 | { |
| 347 | SAFE_DELETE( mModel ); |
| 348 | mRunThread = 0; |
| 349 | mModelName = String::EmptyString; |
| 350 | |
| 351 | // Load the shape. |
| 352 | |
| 353 | Resource< TSShape > model = ResourceManager::get().load( modelName ); |
| 354 | if( !model ) |
| 355 | { |
| 356 | Con::warnf( "GuiObjectView::setObjectModel - Failed to load model '%s'", modelName.c_str() ); |
| 357 | return; |
| 358 | } |
| 359 | |
| 360 | // Instantiate it. |
| 361 | |
| 362 | mModel = new TSShapeInstance( model, true ); |
| 363 | mModelName = modelName; |
| 364 | |
| 365 | if( !mSkinName.isEmpty() ) |
| 366 | mModel->reSkin( mSkinName ); |
| 367 | |
| 368 | // Initialize camera values. |
| 369 | |
| 370 | mOrbitPos = mModel->getShape()->center; |
| 371 | mMinOrbitDist = mModel->getShape()->mRadius; |
| 372 | |
| 373 | // Initialize animation. |
| 374 | |
| 375 | _initAnimation(); |
| 376 | _initMount(); |
| 377 | } |
| 378 | |
| 379 | //------------------------------------------------------------------------------ |
| 380 | |