fbximporter.h

Go to the documentation of this file.
00001 /****************************************************************************************
00002  
00003    Copyright (C) 2012 Autodesk, Inc.
00004    All rights reserved.
00005  
00006    Use of this software is subject to the terms of the Autodesk license agreement
00007    provided at the time of installation or download, or which otherwise accompanies
00008    this software in either electronic or hard copy form.
00009  
00010 ****************************************************************************************/
00011 
00013 #ifndef _FBXSDK_FILEIO_IMPORTER_H_
00014 #define _FBXSDK_FILEIO_IMPORTER_H_
00015 
00016 #include <fbxsdk/fbxsdk_def.h>
00017 
00018 #include <fbxsdk/core/base/fbxstring.h>
00019 #include <fbxsdk/core/base/fbxarray.h>
00020 #include <fbxsdk/core/fbxevent.h>
00021 
00022 #include <fbxsdk/fileio/fbxiobase.h>
00023 #include <fbxsdk/fileio/fbxiosettings.h>
00024 #include <fbxsdk/fileio/fbxprogress.h>
00025 
00026 #include <fbxsdk/fbxsdk_nsbegin.h>
00027 
00028 class FbxDocument;
00029 class FbxImporter_Impl;
00030 class FbxTakeInfo;
00031 class FbxDocumentInfo;
00032 class FbxAxisSystem;
00033 class FbxSystemUnit;
00034 class FbxStatistics;
00035 class FbxFile;
00036 class FbxIOFileHeaderInfo;
00037 class FbxIO;
00038 
00040 class FBXSDK_DLL FbxEventPreImport : public FbxEvent<FbxEventPreImport>
00041 {
00042     FBXSDK_EVENT_DECLARE(FbxEventPreImport);
00043 public:
00044     inline FbxEventPreImport( FbxDocument* pDocument ) : mDocument(pDocument) {};
00045 
00047     FbxDocument* mDocument; 
00048 };
00049 
00051 class FBXSDK_DLL FbxEventPostImport : public FbxEvent<FbxEventPostImport>
00052 {
00053     FBXSDK_EVENT_DECLARE(FbxEventPostImport);
00054 public:
00055     inline FbxEventPostImport( FbxDocument* pDocument ) : mDocument(pDocument) {};
00056 
00058     FbxDocument* mDocument; 
00059 };
00060 
00114 class FBXSDK_DLL FbxImporter : public FbxIOBase
00115 {
00116     FBXSDK_OBJECT_DECLARE(FbxImporter,FbxIOBase);
00117 public:
00122 
00132     virtual bool Initialize(const char* pFileName, const int pFileFormat=-1, FbxIOSettings * pIOSettings=NULL);
00133 
00134 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00135 
00144     virtual bool Initialize(FbxFile* pFile, const int pFileFormat=-1, FbxIOSettings* pIOSettings=NULL);
00145 
00149     virtual FbxFile * GetFile();
00150 #endif 
00151 
00162     virtual bool Initialize(FbxStream* pStream, void* pStreamData=NULL, const int pFileFormat=-1, FbxIOSettings* pIOSettings=NULL);
00163 
00171     void GetFileVersion(int& pMajor, int& pMinor, int& pRevision);
00172 
00181     bool GetDefaultRenderResolution(FbxString& pCamName, FbxString& pResolutionMode, double& pW, double& pH);
00182 
00186     FbxIOFileHeaderInfo* GetFileHeaderInfo();
00187 
00192     enum EStreamOptionsGeneration
00193     {
00194         eParseFile,     // Parse the file
00195         eDoNotParseFile // Do not parse the file (fast)
00196     };
00197 
00203       bool GetImportOptions(EStreamOptionsGeneration pStreamOptionsGeneration = eParseFile);    
00204 
00211       bool GetImportOptions(FbxIO* pFbxObject);
00212 
00223       bool Import(FbxDocument* pDocument, bool pNonBlocking=false);
00224 
00233       bool IsImporting(bool& pImportResult);
00234 
00239       float GetProgress(FbxString &pStatus);
00240 
00244       void SetProgressCallback(FbxProgressCallback pHandler);
00245 
00249     void SetEmbeddingExtractionFolder(const char* pExtractFolder);
00250 
00253     const char* GetEmbeddingExtractionFolder();
00254 
00258       FbxIOSettings* GetIOSettings();
00259 
00263       void SetIOSettings(FbxIOSettings* pIOSettings);
00264 
00269       void SetPassword(char* pPassword);
00270 
00276     
00281       int GetAnimStackCount();
00282 
00289       FbxTakeInfo* GetTakeInfo(int pIndex);
00290 
00295       FbxString GetActiveAnimStackName();
00296 
00298 
00303 
00308     FbxDocumentInfo* GetSceneInfo();
00309 
00311 
00315 
00324     int GetFileFormat ();
00325 
00328     bool IsFBX();
00330 
00332 //
00333 //  WARNING!
00334 //
00335 //  Anything beyond these lines may not be documented accurately and is 
00336 //  subject to change without notice.
00337 //
00339 
00345     void ParseForGlobalSettings(bool pState);
00346 
00352     void ParseForStatistics(bool pState);
00353 
00360     bool GetAxisInfo(FbxAxisSystem* pAxisSystem, FbxSystemUnit* pSystemUnits);
00361 
00368     bool GetStatistics(FbxStatistics* pStatistics);
00369 
00376     bool GetFrameRate(FbxTime::EMode &pTimeMode);
00377 
00378 
00379 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00380     //Internal use only, please use the other Import function to do your imports
00381     bool Import(FbxDocument* pDocument, FbxIO* pFbxObject);
00382 
00383 private:
00384     friend void ImportThread(void*);
00385     bool ImportProcess(FbxDocument* pDocument);
00386 
00387 protected:
00388     void GetImportOptionsInfo();
00389     
00390     FbxImporter(FbxManager& pManager,char const* pName);
00391     virtual void Destruct(bool pRecursive, bool pDependents);
00392 
00393     void Reset();
00394 
00395     bool FileOpen(FbxFile* pFile = NULL);
00396     bool FileOpen(FbxStream* pStream, void* pStreamData);
00397     void FileClose();
00398     
00399     bool IsNativeExtension ();
00400 
00401     FbxImporter_Impl*               mImp;
00402     FbxFile*                          mFile;
00403     FbxStream*                      mStream;
00404     void*                           mStreamData;
00405     bool                            mImportOptionsDone;
00406     FbxArray<FbxTakeInfo*>  mTakeInfo;
00407     FbxDocumentInfo*                mSceneInfo;
00408     FbxString                           mActiveAnimStackName;
00409     int                             mMajorVersion;
00410     int                             mMinorVersion;
00411     int                             mRevisionVersion;
00412     FbxIOFileHeaderInfo             *mHeaderInfo;
00413     FbxIOSettings*                 mIOSettings;
00414     bool                            mClientIOSettings;
00415 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00416 };
00417 
00418 #include <fbxsdk/fbxsdk_nsend.h>
00419 
00420 #endif /* _FBXSDK_FILEIO_IMPORTER_H_ */