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

Method mountShape

Engine/source/gui/editor/guiShapeEdPreview.cpp:507–553  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

505// MOUNTING
506
507bool GuiShapeEdPreview::mountShape(const char* modelName, const char* nodeName, const char* mountType, S32 slot)
508{
509 if ( !modelName || !modelName[0] )
510 return false;
511
512 Resource<TSShape> model = ResourceManager::get().load( modelName );
513 if ( !bool( model ) )
514 return false;
515
516 TSShapeInstance* tsi = new TSShapeInstance( model, true );
517
518 if ( slot == -1 )
519 {
520 slot = mMounts.size();
521 mMounts.push_back( new MountedShape );
522 }
523 else
524 {
525 // Check if we are switching shapes
526 if ( mMounts[slot]->mShape->getShape() != tsi->getShape() )
527 {
528 delete mMounts[slot]->mShape;
529 mMounts[slot]->mShape = NULL;
530 mMounts[slot]->mThread.init();
531 }
532 else
533 {
534 // Keep using the existing shape
535 delete tsi;
536 tsi = mMounts[slot]->mShape;
537 }
538 }
539
540 MountedShape* mount = mMounts[slot];
541 mount->mShape = tsi;
542
543 if ( dStrEqual( mountType, "Wheel" ) )
544 mount->mType = MountedShape::Wheel;
545 else if ( dStrEqual( mountType, "Image" ) )
546 mount->mType = MountedShape::Image;
547 else
548 mount->mType = MountedShape::Object;
549
550 setMountNode( slot, nodeName);
551
552 return true;
553}
554
555void GuiShapeEdPreview::setMountNode(S32 mountSlot, const char* nodeName)
556{

Callers 3

shapeEditor.ed.csFile · 0.80
shapeEditor.ed.csFile · 0.80

Calls 7

dStrEqualFunction · 0.85
getFunction · 0.70
loadMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45
getShapeMethod · 0.45
initMethod · 0.45

Tested by

no test coverage detected