KFbxImporter Class Reference

#include <kfbximporter.h>
Inheritance diagram for KFbxImporter:
Inheritance graph
[legend]

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 101 of file kfbximporter.h.


Import Functions

enum   EStreamOptionsGeneration
  Stream options identifiers. More...
virtual bool  Initialize (const char *pFileName, const int pFileFormat=-1)
  Initialize object.
virtual bool  Initialize (KFile *pFile, const int pFileFormat=-1)
  Initialize object.
virtual KFile *  GetFile ()
  Get the file, if any.
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.
KFbxFileHeaderInfo GetFileHeaderInfo ()
  Get the complete file header information.
KFbxStreamOptions GetImportOptions (EStreamOptionsGeneration pStreamOptionsGeneration=eSTREAMOPTIONS_PARSE_FILE)
  Read the currently opened file header to retrieve information related to takes.
KFbxStreamOptions GetImportOptions (KFbx *pFbxObject)
  Read the currently opened file header to retrieve information related to takes.
bool  Import (KFbxDocument *pDocument, KFbxStreamOptions *pStreamOptions=NULL)
  Import the currently opened 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.
KFbxTakeInfo GetTakeInfo (int pIndex)
  Get the take information about an available take.
char *  GetCurrentTakeName ()
  Return the current take name.

Scene Description Access

KFbxDocumentInfo GetSceneInfo ()
  Get the scene info.

File Format

K_DEPRECATED void  SetFileFormat (int pFileFormat)
  Set the imported file format.
int  GetFileFormat ()
  Get the format of the imported file.
bool  IsFBX ()

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 170 of file kfbximporter.h.


Member Function Documentation

virtual bool Initialize ( const char *  pFileName,
const int  pFileFormat = -1  
) [virtual]

Initialize object.

Parameters:
pFileName  Name of file to access.
pFileFormat  file format identifier User does not need to specify it by default. if not specified, plugin will detect the file format according to file suffix automatically.
Returns:
true on success, false otherwise.
Remarks:
To identify the error that occurred, call KFbxIO::GetLastErrorID().

You do not need to give the pFileFormat if the suffix of pFileName is recognized

virtual bool Initialize ( KFile *  pFile,
const int  pFileFormat = -1  
) [virtual]

Initialize object.

Parameters:
pFile  file to access. Ownership is transfered to this object.
pFileFormat  file format identifier User does not need to specify it by default. if not specified, plugin will detect the file format according to file suffix automatically.
Returns:
true on success, false otherwise.
Remarks:
To identify the error that occurred, call KFbxIO::GetLastErrorID().

You do not need to give the pFileFormat if the suffix of pFileName is recognized

virtual KFile* GetFile (  )  [virtual]

Get the file, if any.

Returns:
File or an null if the file has not been set.

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.

KFbxFileHeaderInfo* GetFileHeaderInfo (  ) 

Get the complete file header information.

Returns:
valid pointer to the complete header information

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 ( KFbx 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 ( KFbxDocument pDocument,
KFbxStreamOptions pStreamOptions = NULL  
)

Import the currently opened file into a scene.

Parameters:
pDocument  Document 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.

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().

KFbxDocumentInfo* GetSceneInfo (  ) 

Get the scene info.

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

K_DEPRECATED 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.
KFbxImporter KFbxImporter KFbxImporter KFbxImporter KFbxImporter KFbxImporter KFbxImporter KFbxImporter KFbxImporter KFbxImporter
KFbxImporter KFbxImporter KFbxImporter KFbxImporter KFbxImporter KFbxImporter KFbxImporter KFbxImporter KFbxImporter KFbxImporter