VOID ExportPath::ChangeFileName( const ExportPath& OtherPath ) { ChangeFileName( (const CHAR*)OtherPath.GetFileNameWithoutExtension() ); }
HRESULT FBXImport::ImportFile( const CHAR* strFileName ) { assert( g_pSDKManager != nullptr ); assert( g_pImporter != nullptr ); assert( g_pFBXScene != nullptr ); assert( g_pScene != nullptr ); CHAR strTemp[200]; g_pScene->Information().ExporterName = g_strExporterName; INT iMajorVersion, iMinorVersion, iRevision; g_pSDKManager->GetFileFormatVersion( iMajorVersion, iMinorVersion, iRevision ); sprintf_s( strTemp, "FBX SDK %d.%d.%d", iMajorVersion, iMinorVersion, iRevision ); g_pScene->Information().DCCNameAndVersion = strTemp; ExportLog::LogMsg( 2, "Compiled against %s", strTemp ); ExportLog::LogMsg( 1, "Loading FBX file \"%s\"...", strFileName ); INT iFileFormat = -1; bool bResult = g_pImporter->Initialize( strFileName, iFileFormat, g_pSDKManager->GetIOSettings() ); if( !bResult ) { ExportLog::LogError( "Could not initialize FBX importer." ); return E_FAIL; } bResult = g_pImporter->Import( g_pFBXScene ); if( !bResult ) { ExportLog::LogError( "Could not load FBX file \"%s\".", strFileName ); return E_FAIL; } ExportLog::LogMsg( 1, "FBX file \"%s\" was successfully loaded.", strFileName ); g_pImporter->GetFileVersion( iMajorVersion, iMinorVersion, iRevision ); ExportLog::LogMsg( 2, "FBX file version: %d.%d.%d", iMajorVersion, iMinorVersion, iRevision ); ExportLog::LogMsg( 2, "Parsing scene." ); auto pTransformer = reinterpret_cast<FBXTransformer*>( g_pScene->GetDCCTransformer() ); pTransformer->Initialize( g_pFBXScene ); SetBindPose(); g_bBindPoseFixupRequired = false; assert( g_pFBXScene->GetRootNode() != nullptr ); XMMATRIX matIdentity = XMMatrixIdentity(); ParseNode( g_pFBXScene->GetRootNode(), g_pScene, matIdentity ); if( g_bBindPoseFixupRequired ) { ExportLog::LogMsg( 2, "Fixing up frames with updated bind pose." ); FixupNode( g_pScene, matIdentity ); } if( g_pScene->Settings().bExportAnimations ) { ParseAnimation( g_pFBXScene ); if( g_pScene->Settings().bRenameAnimationsToFileName ) { auto AnimName = g_CurrentOutputFileName.GetFileNameWithoutExtension(); size_t dwAnimCount = g_pScene->GetAnimationCount(); for( size_t i = 0; i < dwAnimCount; ++i ) { CHAR strCurrentAnimName[MAX_PATH]; if( i > 0 ) { sprintf_s( strCurrentAnimName, "%s%Iu", (const CHAR*)AnimName, i ); } else { strcpy_s( strCurrentAnimName, (const CHAR*)AnimName ); } ExportAnimation* pAnim = g_pScene->GetAnimation( i ); ExportLog::LogMsg( 4, "Renaming animation \"%s\" to \"%s\".", pAnim->GetName().SafeString(), strCurrentAnimName ); pAnim->SetName( strCurrentAnimName ); } } } return S_OK; }