KFbxImporter Class Reference

#include <kfbximporter.h>

Inherits KFbxIO.

Inheritance diagram for KFbxImporter:

Inheritance graph
List of all members.

Detailed Description

Class to import an FBX file into SDK objects.

Typical workflow for using the KFbxImporter class:

  1. create an importer
  2. initialize the importer with a file name
  3. set numerous states, take information, defining how the importer will behave
  4. call KFbxImporter::Import() with an empty scene

Definition at line 86 of file kfbximporter.h.

Import Functions

enum  EStreamOptionsGeneration
 Stream options identifiers. More...
virtual bool Initialize (const char *pFileName)
 Initialize object.
void GetFileVersion (int &pMajor, int &pMinor, int &pRevision)
 Get the FBX version number of the FBX file.
bool GetDefaultRenderResolution (KString &pCamName, KString &pResolutionMode, double &pW, double &pH)
 Get the default rendering resolution if present in the file header.
KFbxStreamOptionsGetImportOptions (EStreamOptionsGeneration pStreamOptionsGeneration=eSTREAMOPTIONS_PARSE_FILE)
 Read the currently opened file header to retrieve information related to takes.
KFbxStreamOptionsGetImportOptions (IFbxObject *pFbxObject)
 Read the currently opened file header to retrieve information related to takes.
bool Import (KFbxScene &pScene, KFbxStreamOptions *pStreamOptions=NULL)
 Import the currently opened file into a scene.
bool Import (KFbxScene &pScene, KFbxStreamOptions *pStreamOptions, IFbxObject *pFbxObject)
 Import the FBX file into a scene.
void ReleaseImportOptions (KFbxStreamOptions *pStreamOptions)
 Release the file import options.

Take Description Access

int GetTakeCount ()
 Get the number of available takes in the file.
KFbxTakeInfoGetTakeInfo (int pIndex)
 Get the take information about an available take.
char * GetCurrentTakeName ()
 Return the current take name.

Scene Description Access

KFbxSceneInfoGetSceneInfo ()
 Get the scene info.

File Format

void SetFileFormat (int pFileFormat)
 Set the imported file format.
int GetFileFormat ()
 Get the format of the imported file.
bool IsFBX ()
 
Returns:
true if the file format is a recognized FBX format.


Public Member Functions

void SetPassword (char *pPassword)
 Set the password.


Member Enumeration Documentation

Stream options identifiers.

  • eSTREAMOPTIONS_PARSE_FILE
  • eSTREAMOPTIONS_FAST Do not parse the file.
  • eSTREAMOPTIONS_COUNT

Definition at line 132 of file kfbximporter.h.


Member Function Documentation

virtual bool Initialize ( const char *  pFileName  )  [virtual]

Initialize object.

Parameters:
pFileName Name of file to access.
Returns:
true on success, false otherwise.
Remarks:
To identify the error that occurred, call KFbxIO::GetLastErrorID().

Reimplemented from KFbxIO.

void GetFileVersion ( int &  pMajor,
int &  pMinor,
int &  pRevision 
)

Get the FBX version number of the FBX file.

FBX version numbers start at 5.0.0.

Parameters:
pMajor Version major number.
pMinor Version minor number.
pRevision Version revision number.
Remarks:
This function must be called after KFbxImporter::Initialize().

bool GetDefaultRenderResolution ( KString pCamName,
KString pResolutionMode,
double &  pW,
double &  pH 
)

Get the default rendering resolution if present in the file header.

Parameters:
pCamName Returned name of the camera.
pResolutionMode Returned resolution mode.
pW Returned width.
pH Returned height.
Returns:
true if the default rendering settings are defined in the file, otherwise returns false with empty parameters.

KFbxStreamOptions* GetImportOptions ( EStreamOptionsGeneration  pStreamOptionsGeneration = eSTREAMOPTIONS_PARSE_FILE  ) 

Read the currently opened file header to retrieve information related to takes.

Parameters:
pStreamOptionsGeneration Stream options identifier.
Returns:
Pointer to file import options or NULL on failure.
Remarks:
Caller gets ownership of the returned structure.

KFbxStreamOptions* GetImportOptions ( IFbxObject *  pFbxObject  ) 

Read the currently opened file header to retrieve information related to takes.

Parameters:
pFbxObject Target FBX file.
Returns:
Pointer to stream import options or NULL on failure.
Remarks:
Caller gets ownership of the returned structure.

bool Import ( KFbxScene pScene,
KFbxStreamOptions pStreamOptions = NULL 
)

Import the currently opened file into a scene.

Parameters:
pScene Scene to fill with file content.
pStreamOptions Pointer to file import options.
Returns:
true on success, false otherwise.
Remarks:
To identify the error that occurred, call KFbxIO::GetLastErrorID(). If the imported file is password protected and the password is not set or wrong, function KFbxIO::GetLastErrorID() returns KFbxIO::ePASSWORD_ERROR.

bool Import ( KFbxScene pScene,
KFbxStreamOptions pStreamOptions,
IFbxObject *  pFbxObject 
)

Import the FBX file into a scene.

Parameters:
pScene Scene to fill with file content.
pStreamOptions Pointer to file import options.
pFbxObject Source FBX file.
Returns:
true on success, false otherwise.
Remarks:
To identify the error that occurred, call KFbxIO::GetLastErrorID(). If the imported file is password protected and the password is not set or wrong, function KFbxIO::GetLastErrorID() returns KFbxIO::ePASSWORD_ERROR.

void ReleaseImportOptions ( KFbxStreamOptions pStreamOptions  ) 

Release the file import options.

Parameters:
pStreamOptions Pointer to file import options.

void SetPassword ( char *  pPassword  ) 

Set the password.

All subsequently imported files are opened with the given password.

Parameters:
pPassword Password string.

int GetTakeCount (  ) 

Get the number of available takes in the file.

Returns:
Number of takes.
Remarks:
This function must be called after KFbxImporter::Initialize().

KFbxTakeInfo* GetTakeInfo ( int  pIndex  ) 

Get the take information about an available take.

Use the returned reference to a KFbxTakeInfo object to set whether the indexed take is imported.

Parameters:
pIndex Index of the requested take.
Returns:
Take information or NULL if function failed.
Remarks:
This function must be called after KFbxImporter::Initialize().

char* GetCurrentTakeName (  ) 

Return the current take name.

Returns:
Current take name if there is one, otherwise returns an empty string.
Remarks:
This function must be called after KFbxImporter::Initialize().

KFbxSceneInfo* GetSceneInfo (  ) 

Get the scene info.

Returns:
Pointer to the scene info or NULL if no scene information is available in the file.

void SetFileFormat ( int  pFileFormat  ) 

Set the imported file format.

Parameters:
pFileFormat File format identifier.

int GetFileFormat (  ) 

Get the format of the imported file.

Returns:
File format identifier.

bool IsFBX (  ) 

Returns:
true if the file format is a recognized FBX format.