MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / setObjectModel

Method setObjectModel

Engine/source/T3D/guiObjectView.cpp:345–377  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

343//------------------------------------------------------------------------------
344
345void 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

Callers 1

guiObjectView.cppFile · 0.45

Calls 7

getFunction · 0.50
warnfFunction · 0.50
loadMethod · 0.45
c_strMethod · 0.45
isEmptyMethod · 0.45
reSkinMethod · 0.45
getShapeMethod · 0.45

Tested by

no test coverage detected