MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / _createShape

Method _createShape

Engine/source/T3D/tsStatic.cpp:322–386  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

320}
321
322bool TSStatic::_createShape()
323{
324 // Cleanup before we create.
325 mCollisionDetails.clear();
326 mLOSDetails.clear();
327 SAFE_DELETE( mPhysicsRep );
328 SAFE_DELETE( mShapeInstance );
329 mAmbientThread = NULL;
330 mShape = NULL;
331
332 if (!mShapeName || mShapeName[0] == '\0')
333 {
334 Con::errorf( "TSStatic::_createShape() - No shape name!" );
335 return false;
336 }
337
338 mShapeHash = _StringTable::hashString(mShapeName);
339
340 mShape = ResourceManager::get().load(mShapeName);
341 if ( bool(mShape) == false )
342 {
343 Con::errorf( "TSStatic::_createShape() - Unable to load shape: %s", mShapeName );
344 return false;
345 }
346
347 if ( isClientObject() &&
348 !mShape->preloadMaterialList(mShape.getPath()) &&
349 NetConnection::filesWereDownloaded() )
350 return false;
351
352 mObjBox = mShape->bounds;
353 resetWorldBox();
354
355 mShapeInstance = new TSShapeInstance( mShape, isClientObject() );
356
357 if( isGhost() )
358 {
359 // Reapply the current skin
360 mAppliedSkinName = "";
361 reSkin();
362 }
363
364 prepCollision();
365
366 // Find the "ambient" animation if it exists
367 S32 ambientSeq = mShape->findSequence("ambient");
368
369 if ( ambientSeq > -1 && !mAmbientThread )
370 mAmbientThread = mShapeInstance->addThread();
371
372 if ( mAmbientThread )
373 mShapeInstance->setSequence( mAmbientThread, ambientSeq, 0);
374
375 // Resolve CubeReflectorDesc.
376 if ( cubeDescName.isNotEmpty() )
377 {
378 Sim::findObject( cubeDescName, reflectorDesc );
379 }

Callers

nothing calls this directly

Calls 11

errorfFunction · 0.85
preloadMaterialListMethod · 0.80
getFunction · 0.50
findObjectFunction · 0.50
clearMethod · 0.45
loadMethod · 0.45
getPathMethod · 0.45
findSequenceMethod · 0.45
addThreadMethod · 0.45
setSequenceMethod · 0.45
isNotEmptyMethod · 0.45

Tested by

no test coverage detected