1
\$\begingroup\$

I am using FBX SDK 2018.1.1 to write a simple utility application on windows that will export existing FBX file (this file is exported from Blender 2.79).

I need to set the creator of the final FBX file to "My custom FBX exporter". As per documentation of FBX SDK, it can be done using

http://help.autodesk.com/cloudhelp/2018/ENU/FBX-Developer-Help/cpp_ref/class_fbx_i_o_file_header_info.html

here is the code snippet used to export the FBX:

FbxExporter* pExporter = FbxExporter::Create(m_pSdkManager, "");

pExporter->SetFileExportVersion(FBX_2012_00_COMPATIBLE);

FbxIOFileHeaderInfo *infoExporter = pExporter->GetFileHeaderInfo();
infoExporter->mCreator = "My custom FBX exporter";

pExporter->Export(m_pScene);
pExporter->Destroy();

But when I read this newly exported FBX file it shows "FBX SDK/FBX Plugins version 2018.1.1" in the mCreator field. This is the snippet when I import the file (just to check if mCreator property is properly set)

lImportStatus = lImporter->Import(m_pScene);

info = lImporter->GetFileHeaderInfo();

How do I properly set the mCreator in FBX file header so that it is set in final exported file?

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

Try this code as your baseline, which is from Unreal Engine in the file of UnrealEngine\Engine\Source\Editor\UnrealEd\Private\Fbx\FbxMainExport.cpp

void FFbxExporter::CreateDocument()
{
    Scene = FbxScene::Create(SdkManager,"");
    
    // create scene info
    FbxDocumentInfo* SceneInfo = FbxDocumentInfo::Create(SdkManager,"SceneInfo");
    SceneInfo->mTitle = "Unreal FBX Exporter";
    SceneInfo->mSubject = "Export FBX meshes from Unreal";
    SceneInfo->Original_ApplicationVendor.Set( "Epic Games" );
    SceneInfo->Original_ApplicationName.Set( "Unreal Engine" );
    SceneInfo->Original_ApplicationVersion.Set( TCHAR_TO_UTF8(*FEngineVersion::Current().ToString()) );
    SceneInfo->LastSaved_ApplicationVendor.Set( "Epic Games" );
    SceneInfo->LastSaved_ApplicationName.Set( "Unreal Engine" );
    SceneInfo->LastSaved_ApplicationVersion.Set( TCHAR_TO_UTF8(*FEngineVersion::Current().ToString()) );

    Scene->SetSceneInfo(SceneInfo);
    
    //FbxScene->GetGlobalSettings().SetOriginalUpAxis(KFbxAxisSystem::Max);
    FbxAxisSystem::EFrontVector FrontVector = (FbxAxisSystem::EFrontVector)-FbxAxisSystem::eParityOdd;
    if (GetExportOptions()->bForceFrontXAxis)
        FrontVector = FbxAxisSystem::eParityEven;

    const FbxAxisSystem UnrealZUp(FbxAxisSystem::eZAxis, FrontVector, FbxAxisSystem::eRightHanded);
    Scene->GetGlobalSettings().SetAxisSystem(UnrealZUp);
    Scene->GetGlobalSettings().SetOriginalUpAxis(UnrealZUp);
    // Maya use cm by default
    Scene->GetGlobalSettings().SetSystemUnit(FbxSystemUnit::cm);
    //FbxScene->GetGlobalSettings().SetOriginalSystemUnit( KFbxSystemUnit::m );

    bSceneGlobalTimeLineSet = false;
    Scene->GetGlobalSettings().SetTimeMode(FbxTime::eDefaultMode);
    
    // setup anim stack
    AnimStack = FbxAnimStack::Create(Scene, "Unreal Take");
    //KFbxSet<KTime>(AnimStack->LocalStart, KTIME_ONE_SECOND);
    AnimStack->Description.Set("Animation Take for Unreal.");

    // this take contains one base layer. In fact having at least one layer is mandatory.
    AnimLayer = FbxAnimLayer::Create(Scene, "Base Layer");
    AnimStack->AddMember(AnimLayer);
}
```
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .