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

Method _createShape

Engine/source/T3D/tsStatic.cpp:382–468  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

380}
381
382bool TSStatic::_createShape()
383{
384 // Cleanup before we create.
385 mCollisionDetails.clear();
386 mDecalDetails.clear();
387 mDecalDetailsPtr = 0;
388 mLOSDetails.clear();
389 SAFE_DELETE(mPhysicsRep);
390 SAFE_DELETE(mShapeInstance);
391 mAmbientThread = NULL;
392 mShape = NULL;
393
394 if(!mShapeAsset.isNull())
395 {
396 //Special-case handling, usually because we set noShape
397 mShape = mShapeAsset->getShapeResource();
398 }
399
400 if (!mShape)
401 {
402 Con::errorf("TSStatic::_createShape() - Shape Asset %s had no valid shape!", mShapeAsset.getAssetId());
403 return false;
404 }
405
406 if (isClientObject() &&
407 !mShape->preloadMaterialList(mShape.getPath()) &&
408 NetConnection::filesWereDownloaded())
409 return false;
410
411 mObjBox = mShape->mBounds;
412 resetWorldBox();
413
414 mShapeInstance = new TSShapeInstance(mShape, isClientObject());
415 mShapeInstance->resetMaterialList();
416 mShapeInstance->cloneMaterialList();
417
418 if (isGhost())
419 {
420 // Reapply the current skin
421 mAppliedSkinName = "";
422 reSkin();
423
424 updateMaterials();
425 }
426
427 prepCollision();
428
429 // Find the "ambient" animation if it exists
430 S32 ambientSeq = mShape->findSequence("ambient");
431
432 if (ambientSeq > -1 && !mAmbientThread)
433 mAmbientThread = mShapeInstance->addThread();
434
435 if ( mAmbientThread )
436 mShapeInstance->setSequence(mAmbientThread, ambientSeq, mAnimOffset);
437
438 // Resolve CubeReflectorDesc.
439 if (cubeDescName.isNotEmpty())

Callers

nothing calls this directly

Calls 14

getShapeResourceMethod · 0.80
preloadMaterialListMethod · 0.80
resetMaterialListMethod · 0.80
cloneMaterialListMethod · 0.80
errorfFunction · 0.50
findObjectFunction · 0.50
clearMethod · 0.45
isNullMethod · 0.45
getAssetIdMethod · 0.45
getPathMethod · 0.45
findSequenceMethod · 0.45
addThreadMethod · 0.45

Tested by

no test coverage detected