This reference page is linked to from the following overview topics: FBX SDK 2012, Your First FBX SDK Program, Importing and Exporting a Scene, I/O Settings, Importing a Scene, FBX SDK Object Model, FBX Objects, List of Python FBX classes.
Class to import an FBX file into SDK objects.
Normally this class is used as is. But for very special needs a user can override Initialize() for special purpose.
An importer will select the appropriate reader to a particular file. Ex: When an importer must import an FBX 7 file, the importer will ask for all registered readers if an FBX 7 file reader is available, then if a reader is found, the importer will create the specialized FBX 7 reader and read the file. This way, an importer can "read" many different type of files like FBX 5/6/7, 3DS, Obj, Dxf, Collada, etc.
Typical workflow for using the KFbxImporter class:
ex: // create a SdkManager KFbxSdkManager *lSdkManager = KFbxSdkManager::Create(); // create an IOSettings object KFbxIOSettings * ios = KFbxIOSettings::Create(lSdkManager, IOSROOT ); // set some IOSettings options ios->SetBoolProp(IMP_FBX_MATERIAL, true); ios->SetBoolProp(IMP_FBX_TEXTURE, true); // create an empty scene KFbxScene* lScene = KFbxScene::Create(lSdkManager,""); // Create an importer. KFbxImporter* lImporter = KFbxImporter::Create(lSdkManager, ""); // Initialize the importer by providing a filename and the IOSettings to use lImporter->Initialize("C:\\myfile.fbx", -1, ios); // Import the scene. lImporter->Import(lScene); // Destroy the importer. lImporter->Destroy();
Common/Common.cxx, ExportScene05/main.cxx, MyOwnWriterReader/MyOwnWriterReader.cxx, MyOwnWriterReader/MyOwnWriterReader.h, UIExamples/Common/ImportExport.cxx, UIExamples/SceneTreeView/SDK_Utility.cxx, ViewScene/InitScene.cxx, and ViewScene/main.cxx.
Definition at line 139 of file kfbximporter.h.
#include <kfbximporter.h>
Public Member Functions |
|
void | ParseForGlobalSettings (bool pState) |
Set a flag to parse or not the
GlobalSettings data section when the importer is initialized.
|
|
void | ParseForStatistics (bool pState) |
Set a flag to parse or not in a FBX file the
Summary data section or the Definition data section when the
importer is initialized. |
|
bool | GetAxisInfo (KFbxAxisSystem *pAxisSystem, KFbxSystemUnit *pSystemUnits) |
Get FBX file Axis information and FBX file
System units. |
|
bool | GetStatistics (KFbxStatistics *pStatistics) |
Get FBX file Statistics informations.
|
|
bool | GetFrameRate (KTime::ETimeMode &pTimeMode) |
Get FBX file time mode read from
GlobalSettings in FBX 6.n and FBX 7.n. |
|
bool | Import (KFbxDocument *pDocument, KFbx *pFbxObject) |
Protected Member Functions |
|
void | GetImportOptionsInfo () |
KFbxImporter (KFbxSdkManager &pManager, char const *pName) | |
virtual void | Destruct (bool pRecursive, bool pDependents) |
void | Reset () |
bool | FileOpen (KFile *pFile=NULL) |
void | FileClose () |
bool | IsNativeExtension () |
Protected Attributes |
|
KFbxImporterImp * | mImp |
KFile * | mFile |
bool | mImportOptionsDone |
KArrayTemplate< KFbxTakeInfo * > | mTakeInfo |
KFbxDocumentInfo * | mSceneInfo |
KString | mActiveAnimStackName |
int | mMajorVersion |
int | mMinorVersion |
int | mRevisionVersion |
KFbxFileHeaderInfo * | mHeaderInfo |
KFbxIOSettings * | mIOSettings |
bool | mClientIOSettings |
Friends |
|
void | ImportThread (void *) |
Import Functions |
|
enum | EStreamOptionsGeneration { eSTREAMOPTIONS_PARSE_FILE, eSTREAMOPTIONS_FAST, eSTREAMOPTIONS_COUNT } |
Stream options identifiers. More... |
|
virtual bool | Initialize (const char *pFileName, const int pFileFormat=-1, KFbxIOSettings *pIOSettings=NULL) |
Initialize object. |
|
virtual bool | Initialize (KFile *pFile, const int pFileFormat=-1, KFbxIOSettings *pIOSettings=NULL) |
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.
|
|
bool | GetImportOptions (EStreamOptionsGeneration pStreamOptionsGeneration=eSTREAMOPTIONS_PARSE_FILE) |
Read the currently opened file header to
retrieve information related to takes. |
|
bool | GetImportOptions (KFbx *pFbxObject) |
Read the currently opened file header to
retrieve information related to takes. |
|
bool | Import (KFbxDocument *pDocument, bool pNonBlocking=false) |
Import the currently opened file into a
scene. |
|
bool | IsImporting (bool &pImportResult) |
Check if the importer is currently
importing. |
|
float | GetProgress (KString &pStatus) |
Get the progress status in non-blocking
mode. |
|
void | SetProgressCallback (KFbxProgressCallback pHandler) |
Register a callback function for progress
reporting in single thread mode. |
|
void | SetEmbeddingExtractionFolder (const char *pExtractFolder) |
Explicitly set the embedding extraction
folder. |
|
const char * | GetEmbeddingExtractionFolder () |
Retrieve the current folder destination
where the embedded files will be extracted. |
|
KFbxIOSettings * | GetIOSettings () |
Access to a IOSettings object. |
|
void | SetIOSettings (KFbxIOSettings *pIOSettings) |
Set the IOSettings pointer. |
|
void | SetPassword (char *pPassword) |
Set the password. |
|
Animation Stack Description Access |
|
|
|
int | GetAnimStackCount () |
Get the number of available animation stacks
in the file. |
|
KFbxTakeInfo * | GetTakeInfo (int pIndex) |
Get the take information about an available
take. |
|
KString | GetActiveAnimStackName () |
Return the active animation stack name.
|
|
Scene Description Access |
|
KFbxDocumentInfo * | GetSceneInfo () |
Get the scene info. |
|
File Format |
|
int | GetFileFormat () |
Returns the index of the reader (FbxReader)
associated with the file format. |
|
bool | IsFBX () |
Stream options identifiers.
Definition at line 206 of file kfbximporter.h.
{ eSTREAMOPTIONS_PARSE_FILE, // Parse the file eSTREAMOPTIONS_FAST, // Do not parse the file eSTREAMOPTIONS_COUNT } EStreamOptionsGeneration;
KFbxImporter | ( | KFbxSdkManager & | pManager, |
char const * | pName | ||
) | [protected] |
virtual bool Initialize | ( | const char * | pFileName, |
const int | pFileFormat = -1 , |
||
KFbxIOSettings * | pIOSettings =
NULL |
||
) | [virtual] |
Initialize object.
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. |
pIOSettings | client IOSettings, if not specified, a default IOSettings will be created |
true
on success, false
otherwise.virtual bool Initialize | ( | KFile * | pFile, |
const int | pFileFormat = -1 , |
||
KFbxIOSettings * | pIOSettings =
NULL |
||
) | [virtual] |
Initialize object.
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. |
pIOSettings | client IOSettings, if not specified, a default IOSettings will be created |
true
on success, false
otherwise.virtual KFile* GetFile | ( | ) | [virtual] |
Get the file, if any.
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.
pMajor | Version major number. |
pMinor | Version minor number. |
pRevision | Version revision number. |
bool GetDefaultRenderResolution | ( | KString & | pCamName, |
KString & | pResolutionMode, | ||
double & | pW, | ||
double & | pH | ||
) |
Get the default rendering resolution if present in the file header.
pCamName | Returned name of the camera. |
pResolutionMode | Returned resolution mode. |
pW | Returned width. |
pH | Returned height. |
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.
bool GetImportOptions | ( | EStreamOptionsGeneration | pStreamOptionsGeneration =
eSTREAMOPTIONS_PARSE_FILE |
) |
Read the currently opened file header to retrieve information related to takes.
pStreamOptionsGeneration | Stream options identifier. |
true
on success, false
otherwise.bool GetImportOptions | ( | KFbx * | pFbxObject | ) |
Read the currently opened file header to retrieve information related to takes.
pFbxObject | Target FBX file. |
true
on success, false
otherwise.bool Import | ( | KFbxDocument * | pDocument, |
bool | pNonBlocking =
false |
||
) |
Import the currently opened file into a scene.
pDocument | Document to fill with file content. |
pNonBlocking | If true, the import process will be executed in a new thread, allowing it to be non-blocking. To determine if the import finished, refer to the function IsImporting(). |
true
on success, false
otherwise.bool IsImporting | ( | bool & | pImportResult | ) |
Check if the importer is currently importing.
pImportResult | This parameter, after the import finished, will contain the result of the import success or failure. |
float GetProgress | ( | KString & | pStatus | ) |
Get the progress status in non-blocking mode.
pStatus | KString reference to retrieve current status |
void SetProgressCallback | ( | KFbxProgressCallback | pHandler | ) |
Register a callback function for progress reporting in single thread mode.
pHandler | Pointer of the callback function |
void SetEmbeddingExtractionFolder | ( | const char * | pExtractFolder | ) |
Explicitly set the embedding extraction folder.
If this is never called, the FBX SDK will determine the best folder to extract embedded files.
pExtractionFolder | The file path name where the embedded files should be extracted. |
const char* GetEmbeddingExtractionFolder | ( | ) |
Retrieve the current folder destination where the embedded files will be extracted.
This might not be initialized until file I/O is performed.
KFbxIOSettings* GetIOSettings | ( | ) |
Access to a IOSettings object.
NULL
if
the object has not been allocated.void SetIOSettings | ( | KFbxIOSettings * | pIOSettings | ) |
Set the IOSettings pointer.
pIOSettings | Point to a KFbxIOSettings object. |
void SetPassword | ( | char * | pPassword | ) |
Set the password.
All subsequently imported files are opened with the given password.
pPassword | Password string. |
int GetAnimStackCount | ( | ) |
Get the number of available animation stacks in the file.
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.
pIndex | Index of the requested take. |
NULL
if function failed.KString GetActiveAnimStackName | ( | ) |
Return the active animation stack name.
KFbxDocumentInfo* GetSceneInfo | ( | ) |
Get the scene info.
NULL
if no scene
information is available in the file.int GetFileFormat | ( | ) |
Returns the index of the reader (FbxReader) associated with the file format.
This index is considered the identifier of the file format. The array of registered readers can't be retrieved.
bool IsFBX | ( | ) |
true
if the file format is a recognized FBX
format.void ParseForGlobalSettings | ( | bool | pState | ) |
Set a flag to parse or not the GlobalSettings data section when the importer is initialized.
pState | true or false |
void ParseForStatistics | ( | bool | pState | ) |
Set a flag to parse or not in a FBX file the Summary data section or the Definition data section when the importer is initialized.
pState | true or false |
bool GetAxisInfo | ( | KFbxAxisSystem * | pAxisSystem, |
KFbxSystemUnit * | pSystemUnits | ||
) |
Get FBX file Axis information and FBX file System units.
pAxisSystem | pointer to a KFbxAxisSystem object |
pSystemUnits | pointer to a KFbxSystemUnit object |
true
on success, false
otherwise.bool GetStatistics | ( | KFbxStatistics * | pStatistics | ) |
Get FBX file Statistics informations.
Ex: Number of Models, Characters, Textures, Materials, etc.
pStatistics | pointer to a KFbxStatistics object |
true
on success, false
otherwise.bool GetFrameRate | ( | KTime::ETimeMode & | pTimeMode | ) |
Get FBX file time mode read from GlobalSettings in FBX 6.n and FBX 7.n.
pTimeMode | ref to a KTime::ETimeMode enum |
true
on success, false
otherwise.bool Import | ( | KFbxDocument * | pDocument, |
KFbx * | pFbxObject | ||
) |
void GetImportOptionsInfo | ( | ) | [protected] |
virtual void Destruct | ( | bool | pRecursive, |
bool | pDependents | ||
) | [protected, virtual] |
Reimplemented from KFbxObject.
void Reset | ( | ) | [protected] |
bool FileOpen | ( | KFile * | pFile = NULL |
) | [protected] |
void FileClose | ( | ) | [protected] |
bool IsNativeExtension | ( | ) | [protected] |
void ImportThread | ( | void * | ) | [friend] |
KFbxImporterImp* mImp
[protected] |
Definition at line 415 of file kfbximporter.h.
KFile* mFile
[protected] |
Definition at line 416 of file kfbximporter.h.
bool mImportOptionsDone
[protected] |
Definition at line 417 of file kfbximporter.h.
KArrayTemplate<KFbxTakeInfo*> mTakeInfo
[protected] |
Definition at line 418 of file kfbximporter.h.
KFbxDocumentInfo* mSceneInfo
[protected] |
Definition at line 419 of file kfbximporter.h.
KString mActiveAnimStackName
[protected] |
Definition at line 420 of file kfbximporter.h.
int mMajorVersion
[protected] |
Definition at line 421 of file kfbximporter.h.
int mMinorVersion
[protected] |
Definition at line 422 of file kfbximporter.h.
int mRevisionVersion
[protected] |
Definition at line 423 of file kfbximporter.h.
KFbxFileHeaderInfo*
mHeaderInfo
[protected] |
Definition at line 424 of file kfbximporter.h.
KFbxIOSettings* mIOSettings
[protected] |
Definition at line 425 of file kfbximporter.h.
bool mClientIOSettings
[protected] |
Definition at line 426 of file kfbximporter.h.