FBX SDK Programmer's Guide > FBX Extensions SDK >

# Exporting with the FBX Extensions SDK

## Host Application Flow

The following pseudocode shows the order of execution of an FBX Extension while a scene is being exported by the host application.

    Before translating any scene objects to FBX:
        ExportBegin();

    For each object in the scene:
        If ( ExportHandled() returns TRUE ):
            The host application will let your extension translate the object.
        Else:
            The host application will translate the object, if it knows how to.

    For each object translated by the host application:
        ExportTranslated(), passing the object and its translation;

    The translation of the scene is now complete:
        ExportEnd()

## ExportBegin()

    EXPORT_DLL void MayaExt_ExportBegin( FbxScene* pFbxScene );
    EXPORT_DLL void MaxExt_ExportBegin( FbxScene* pFbxScene, INode* pMaxRootNode );
    EXPORT_DLL void MBExt_ExportBegin( FbxScene* pFbxScene );

This function is called before the host application translates any data from the scene into the corresponding FBX scene. The host application passes a pointer to the empty FBX scene that it has created. Your FBX Extension can access the 3ds Max/Maya/MotionBuilder scene by calling functions in the 3ds Max/Maya/MotionBuilder SDKs.

Your FBX Extension can create your custom data now, or wait at the end of the export depending if that custom data replaces objects in the FBX scene hierarchy.

## ExportHandled()

    EXPORT_DLL bool MayaExt_ExportHandled( MObject& pMayaObject );
    EXPORT_DLL bool MaxExt_ExportHandled( INode* pMaxObject );
    EXPORT_DLL bool MBExt_ExportHandled( HFBComponent pFBComponent );

Called for each object in the scene. Called before that object is translated into an FBX object. May be called more than once for the same object.

Your extension must return:

- true, if your extension is responsible for creating the corresponding FBX object for this 3ds Max/Maya/MotionBuilder object; the host application will not translate the object.
- false: the host application will translate the object (providing that it knows how to translate objects of that type).

## ExportTranslated()

    EXPORT_DLL void MayaExt_ExportTranslated( FbxObject* pFbxObject, MObject& pMayaObject );
    EXPORT_DLL void MaxExt_ExportTranslated( FbxObject* pFbxObject, INode* pMaxObject );
    EXPORT_DLL void MBExt_ExportTranslated( FbxObject* pFbxObject, HFBComponent pFBComponent );

After all objects in the scene have been translated into FBX objects, the host application calls this function once for each object that has been translated.

The purpose of this function is to tell the extension: for this 3ds Max/Maya/MotionBuilder object, this is the corresponding FBX object.

## ExportEnd()

    EXPORT_DLL void MayaExt_ExportEnd( FbxScene* pFbxScene );
    EXPORT_DLL void MaxExt_ExportEnd( FbxScene* pFbxScene, INode* pMaxRootNode );
    EXPORT_DLL void MBExt_ExportEnd( FbxScene* pFbxScene );

The host application calls this function after it has completely translated the scene into FBX (and before the file I/O begins). This is the last chance for your extension to modify the FBX scene.