KFbxImporter
#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 theKFbxImporterclass:

  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. callKFbxImporter::Import()with an empty scene

Definition at line110of filekfbximporter.h.


Import Functions

enum EStreamOptionsGeneration
 Stream options identifiers.More...
virtual bool Initialize(const char *pFileName)
 Initialize object.
virtual bool Initialize(KFile *pFile)
 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.
KFbxStreamOptionsGetImportOptions(EStreamOptionsGenerationpStreamOptionsGeneration=eSTREAMOPTIONS_PARSE_FILE)
 Read the currently opened file header to retrieve information related to takes.
KFbxStreamOptionsGetImportOptions(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.
bool Import(KFbxDocument*pDocument,KFbxStreamOptions*pStreamOptions, KFbx *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

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

Public Member Functions

void SetPassword(char *pPassword)
 Set the password.

Member Enumeration Documentation

Stream options identifiers.

  • eSTREAMOPTIONS_PARSE_FILE
  • eSTREAMOPTIONS_FASTDo not parse the file.
  • eSTREAMOPTIONS_COUNT

Definition at line173of filekfbximporter.h.

Member Function Documentation

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

Initialize object.

Parameters:
pFileName Name of file to access.
Returns:
trueon success,falseotherwise.
Remarks:
To identify the error that occurred, callKFbxIO::GetLastErrorID().

Reimplemented fromKFbxIO.

virtual bool Initialize(KFile * pFile ) [virtual]

Initialize object.

Parameters:
pFile file to access. Ownership is transfered to this object.
Returns:
trueon success,falseotherwise.
Remarks:
To identify the error that occurred, callKFbxIO::GetLastErrorID().

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 afterKFbxImporter::Initialize().

bool GetDefaultRenderResolution(KStringpCamName,
KStringpResolutionMode,
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:
trueif the default rendering settings are defined in the file, otherwise returnsfalsewith 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 orNULLon 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 orNULLon failure.
Remarks:
Caller gets ownership of the returned structure.

bool Import(KFbxDocumentpDocument,
KFbxStreamOptionspStreamOptions=NULL 
)

Import the currently opened file into a scene.

Parameters:
pDocument Document to fill with file content.
pStreamOptions Pointer to file import options.
Returns:
trueon success,falseotherwise.
Remarks:
To identify the error that occurred, callKFbxIO::GetLastErrorID(). If the imported file is password protected and the password is not set or wrong, functionKFbxIO::GetLastErrorID()returns KFbxIO::ePASSWORD_ERROR.

bool Import(KFbxDocumentpDocument,
KFbxStreamOptionspStreamOptions,
KFbx * pFbxObject 
)

Import the FBX file into a scene.

Parameters:
pDocument Document to fill with file content.
pStreamOptions Pointer to file import options.
pFbxObject Source FBX file.
Returns:
trueon success,falseotherwise.
Remarks:
To identify the error that occurred, callKFbxIO::GetLastErrorID(). If the imported file is password protected and the password is not set or wrong, functionKFbxIO::GetLastErrorID()returns KFbxIO::ePASSWORD_ERROR.

void ReleaseImportOptions(KFbxStreamOptionspStreamOptions ) 

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 afterKFbxImporter::Initialize().

KFbxTakeInfo* GetTakeInfo(int pIndex ) 

Get the take information about an available take.

Use the returned reference to aKFbxTakeInfoobject to set whether the indexed take is imported.

Parameters:
pIndex Index of the requested take.
Returns:
Take information orNULLif function failed.
Remarks:
This function must be called afterKFbxImporter::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 afterKFbxImporter::Initialize().

KFbxDocumentInfo* GetSceneInfo( ) 

Get the scene info.

Returns:
Pointer to the scene info orNULLif 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:
trueif the file format is a recognized FBX format.