fbxsdk/fileio/fbximporter.h Source File
 
 
 
fbxsdk/fileio/fbximporter.h
Go to the documentation of this file.
00001 /****************************************************************************************
00002  
00003    Copyright (C) 2013 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/fbxsystemunit.h>
00019 #include <fbxsdk/core/base/fbxtime.h>
00020 #include <fbxsdk/fileio/fbxiobase.h>
00021 #include <fbxsdk/fileio/fbxprogress.h>
00022 #include <fbxsdk/fileio/fbxiosettings.h>
00023 #include <fbxsdk/fileio/fbxstatistics.h>
00024 #include <fbxsdk/scene/fbxaxissystem.h>
00025 
00026 #include <fbxsdk/fbxsdk_nsbegin.h>
00027 
00028 class FbxIO;
00029 class FbxIOFileHeaderInfo;
00030 class FbxDocumentInfo;
00031 class FbxTakeInfo;
00032 class FbxReader;
00033 class FbxThread;
00034 
00035 struct FbxImportThreadArg;
00036 
00090 class FBXSDK_DLL FbxImporter : public FbxIOBase
00091 {
00092         FBXSDK_OBJECT_DECLARE(FbxImporter, FbxIOBase);
00093 
00094 public:
00099 
00110         virtual bool Initialize(const char* pFileName, const int pFileFormat=-1, FbxIOSettings * pIOSettings=NULL);
00111 
00123         virtual bool Initialize(FbxStream* pStream, void* pStreamData=NULL, const int pFileFormat=-1, FbxIOSettings* pIOSettings=NULL);
00124 
00132         void GetFileVersion(int& pMajor, int& pMinor, int& pRevision);
00133 
00142         bool GetDefaultRenderResolution(FbxString& pCamName, FbxString& pResolutionMode, double& pW, double& pH);
00143 
00147         FbxIOFileHeaderInfo* GetFileHeaderInfo();
00148 
00153         enum EStreamOptionsGeneration
00154         {
00155                 eParseFile,             // Parse the file
00156                 eDoNotParseFile // Do not parse the file (fast)
00157         };
00158 
00164           bool GetImportOptions(EStreamOptionsGeneration pStreamOptionsGeneration = eParseFile);        
00165 
00171           bool GetImportOptions(FbxIO* pFbxObject);
00172 
00184           bool Import(FbxDocument* pDocument, bool pNonBlocking=false);
00185 
00186 #ifndef FBXSDK_ENV_WINRT
00187 
00195           bool IsImporting(bool& pImportResult);
00196 #endif /* !FBXSDK_ENV_WINRT */
00197 
00202       float GetProgress(FbxString* pStatus=NULL);
00203 
00208       void SetProgressCallback(FbxProgressCallback pCallback, void* pArgs=NULL);
00209 
00213         void SetEmbeddingExtractionFolder(const char* pExtractFolder);
00214 
00217         const char* GetEmbeddingExtractionFolder();
00218 
00222           FbxIOSettings* GetIOSettings();
00223 
00227           void SetIOSettings(FbxIOSettings* pIOSettings);
00228 
00233       void SetPassword(char* pPassword);
00234 
00240         
00245       int GetAnimStackCount();
00246 
00253           FbxTakeInfo* GetTakeInfo(int pIndex);
00254 
00259       FbxString GetActiveAnimStackName();
00260 
00262 
00267 
00272         FbxDocumentInfo* GetSceneInfo();
00273 
00275 
00279 
00288         int GetFileFormat ();
00289 
00292         bool IsFBX();
00294 
00295 /*****************************************************************************************************************************
00296 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
00297 *****************************************************************************************************************************/
00298 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00299         FbxFile* GetFile();
00300     FbxStream* GetStream();
00301     void*      GetStreamData();
00302 
00303         void ParseForGlobalSettings(bool pState);
00304     void ParseForStatistics(bool pState);
00305         bool GetAxisInfo(FbxAxisSystem* pAxisSystem, FbxSystemUnit* pSystemUnits);
00306     bool GetStatistics(FbxStatistics* pStatistics);
00307         bool GetFrameRate(FbxTime::EMode &pTimeMode);
00308 
00309 protected:
00310         virtual void Construct(const FbxImporter* pFrom);
00311         virtual void Destruct(bool pRecursive);
00312 
00313         void Reset();
00314     bool FileOpen(FbxFile* pFile = NULL);
00315         bool FileOpen(FbxStream* pStream, void* pStreamData);
00316         void FileClose();
00317 
00318         void GetImportOptionsInfo();
00319     bool IsNativeExtension ();
00320 
00321         //These two internal functions are only used to read old character pose data
00322         bool Initialize(FbxFile* pFile, const int pFileFormat=-1, FbxIOSettings* pIOSettings=NULL);
00323         bool Import(FbxDocument* pDocument, FbxIO* pFbxObject);
00324 
00325 private:
00326         bool ImportProcess(FbxDocument* pDocument);
00327 
00328     int                                         mFileFormat;
00329     FbxReader*                          mReader;
00330         FbxString                               mExtractFolder;
00331     bool                                        mParseForGlobalSettings;
00332     FbxAxisSystem                       mAxisSystem;
00333     FbxSystemUnit                       mSystemUnits;
00334         FbxTime::EMode                  mFrameRate;
00335     bool                                        mParseForStatistics;
00336     FbxStatistics                       mStatistics;
00337 #ifndef FBXSDK_ENV_WINRT
00338         FbxThread*                              mImportThread;
00339         FbxImportThreadArg*             mImportThreadArg;
00340         bool                                    mImportThreadResult;
00341         bool                                    mIsThreadImporting;
00342 #endif /* !FBXSDK_ENV_WINRT */
00343     FbxProgress                         mProgress;
00344     FbxFile*                            mFile;
00345         FbxStream*                              mStream;
00346         void*                                   mStreamData;
00347         bool                                    mImportOptionsDone;
00348         FbxArray<FbxTakeInfo*>  mTakeInfo;
00349         FbxDocumentInfo*                mSceneInfo;
00350         FbxString                               mActiveAnimStackName;
00351         int                                             mMajorVersion;
00352         int                                             mMinorVersion;
00353         int                                             mRevisionVersion;
00354         FbxIOFileHeaderInfo*    mHeaderInfo;
00355         FbxIOSettings*                  mIOSettings;
00356         bool                                    mClientIOSettings;
00357 
00358         //For Initialize and Import
00359         friend class FbxReaderFbx5;
00360         friend class FbxReaderFbx6;
00361         friend struct FbxReaderFbx7_Impl;
00362 
00363         friend void ImportThread(void*);
00364 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
00365 };
00366 
00368 class FBXSDK_DLL FbxEventPreImport : public FbxEvent<FbxEventPreImport>
00369 {
00370     FBXSDK_EVENT_DECLARE(FbxEventPreImport);
00371 public:
00372     inline FbxEventPreImport( FbxDocument* pDocument ) : mDocument(pDocument) {};
00373 
00375     FbxDocument* mDocument; 
00376 };
00377 
00379 class FBXSDK_DLL FbxEventPostImport : public FbxEvent<FbxEventPostImport>
00380 {
00381     FBXSDK_EVENT_DECLARE(FbxEventPostImport);
00382 public:
00383     inline FbxEventPostImport( FbxDocument* pDocument ) : mDocument(pDocument) {};
00384 
00386     FbxDocument* mDocument; 
00387 };
00388 
00389 #include <fbxsdk/fbxsdk_nsend.h>
00390 
00391 #endif /* _FBXSDK_FILEIO_IMPORTER_H_ */