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

Method colladaExportSelection

Engine/source/gui/worldEditor/worldEditor.cpp:3527–3588  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3525#endif
3526
3527void WorldEditor::colladaExportSelection( const String &path )
3528{
3529#ifdef TORQUE_COLLADA
3530
3531 Vector< SceneObject* > objectList;
3532
3533 for ( S32 i = 0; i < mSelected->size(); i++ )
3534 {
3535 SceneObject *pObj = dynamic_cast< SceneObject* >( ( *mSelected )[i] );
3536 if ( pObj )
3537 objectList.push_back( pObj );
3538 }
3539
3540 if ( objectList.empty() )
3541 return;
3542
3543 Point3F centroid;
3544 MatrixF orientation;
3545
3546 if ( objectList.size() == 1 )
3547 {
3548 orientation = objectList[0]->getTransform();
3549 centroid = objectList[0]->getPosition();
3550 }
3551 else
3552 {
3553 orientation.identity();
3554 centroid.zero();
3555
3556 S32 count = 0;
3557
3558 for ( S32 i = 0; i < objectList.size(); i++ )
3559 {
3560 SceneObject *pObj = objectList[i];
3561 if ( pObj->isGlobalBounds() )
3562 continue;
3563
3564 centroid += pObj->getPosition();
3565 count++;
3566 }
3567
3568 centroid /= count;
3569 }
3570
3571 orientation.setPosition( centroid );
3572 orientation.inverse();
3573
3574 OptimizedPolyList polyList;
3575 polyList.setBaseTransform( orientation );
3576
3577 for ( S32 i = 0; i < objectList.size(); i++ )
3578 {
3579 SceneObject *pObj = objectList[i];
3580 if ( !pObj->buildPolyList( PLC_Export, &polyList, pObj->getWorldBox(), pObj->getWorldSphere() ) )
3581 Con::warnf( "colladaExportObjectList() - object %i returned no geometry.", pObj->getId() );
3582 }
3583
3584 // Use a ColladaUtils function to do the actual export to a Collada file

Callers 3

menuHandlers.ed.csFile · 0.80
menuHandlers.ed.csFile · 0.80
worldEditor.cppFile · 0.80

Calls 15

warnfFunction · 0.85
isGlobalBoundsMethod · 0.80
setBaseTransformMethod · 0.80
sizeMethod · 0.45
push_backMethod · 0.45
emptyMethod · 0.45
getTransformMethod · 0.45
getPositionMethod · 0.45
identityMethod · 0.45
zeroMethod · 0.45
setPositionMethod · 0.45
inverseMethod · 0.45

Tested by

no test coverage detected