kfbximporter.h

Go to the documentation of this file.
00001 
00004 #ifndef FBXFILESDK_KFBXIO_KFBXIMPORTER_H
00005 #define FBXFILESDK_KFBXIO_KFBXIMPORTER_H
00006 
00007 /**************************************************************************************
00008 
00009  Copyright (C) 2001 - 2010 Autodesk, Inc. and/or its licensors.
00010  All Rights Reserved.
00011 
00012  The coded instructions, statements, computer programs, and/or related material 
00013  (collectively the "Data") in these files contain unpublished information 
00014  proprietary to Autodesk, Inc. and/or its licensors, which is protected by 
00015  Canada and United States of America federal copyright law and by international 
00016  treaties. 
00017  
00018  The Data may not be disclosed or distributed to third parties, in whole or in
00019  part, without the prior written consent of Autodesk, Inc. ("Autodesk").
00020 
00021  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00022  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
00023  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR ARISING
00024  BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES OF TITLE, 
00025  NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR USE. 
00026  WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT WARRANT THAT THE OPERATION
00027  OF THE DATA WILL BE UNINTERRUPTED OR ERROR FREE. 
00028  
00029  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
00030  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR EXPENSES
00031  OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE DAMAGES OR OTHER
00032  SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS OF PROFITS, REVENUE
00033  OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR DAMAGES OF ANY KIND),
00034  HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF LIABILITY, WHETHER DERIVED
00035  FROM CONTRACT, TORT (INCLUDING, BUT NOT LIMITED TO, NEGLIGENCE), OR OTHERWISE,
00036  ARISING OUT OF OR RELATING TO THE DATA OR ITS USE OR ANY OTHER PERFORMANCE,
00037  WHETHER OR NOT AUTODESK HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS
00038  OR DAMAGE. 
00039 
00040 **************************************************************************************/
00041 #include <fbxfilesdk/fbxfilesdk_def.h>
00042 
00043 #include <fbxfilesdk/kfbxio/kfbxio.h>
00044 #include <fbxfilesdk/kfbxevents/kfbxevents.h>
00045 
00046 #include <fbxfilesdk/kfbxio/kfbxiosettings.h>
00047 #include <fbxfilesdk/kfbxio/kfbxprogress.h>
00048 
00049 #include <fbxfilesdk/components/kbaselib/klib/kstring.h>
00050 #include <fbxfilesdk/components/kbaselib/klib/karrayul.h>
00051 
00052 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00053 
00054 class KFbxDocument;
00055 class KFbxImporterImp;
00056 class KFbxTakeInfo;
00057 class KFbxDocumentInfo;
00058 class KFbxAxisSystem;
00059 class KFbxSystemUnit;
00060 class KFbxStatistics;
00061 class KFile;
00062 class KFbxFileHeaderInfo;
00063 
00065 class KFBX_DLL KFbxEventPreImport : public KFbxEvent<KFbxEventPreImport>
00066 {
00067     KFBXEVENT_DECLARE(KFbxEventPreImport);
00068 public:
00069     inline KFbxEventPreImport( KFbxDocument* pDocument ) : mDocument(pDocument) {};
00070 
00072     KFbxDocument* mDocument; 
00073 };
00074 
00076 class KFBX_DLL KFbxEventPostImport : public KFbxEvent<KFbxEventPostImport>
00077 {
00078     KFBXEVENT_DECLARE(KFbxEventPostImport);
00079 public:
00080     inline KFbxEventPostImport( KFbxDocument* pDocument ) : mDocument(pDocument) {};
00081 
00083     KFbxDocument* mDocument; 
00084 };
00085 
00139 class KFBX_DLL KFbxImporter : public KFbxIO
00140 {
00141     KFBXOBJECT_DECLARE(KFbxImporter,KFbxIO);
00142 public:
00147 
00157     virtual bool Initialize(const char* pFileName, const int pFileFormat=-1, KFbxIOSettings * pIOSettings=NULL);
00158 
00159 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00160 
00169     virtual bool Initialize(KFile* pFile, const int pFileFormat=-1, KFbxIOSettings* pIOSettings=NULL);
00170 
00174     virtual KFile * GetFile();
00175 #endif 
00176 
00184     void GetFileVersion(int& pMajor, int& pMinor, int& pRevision);
00185 
00194     bool GetDefaultRenderResolution(KString& pCamName, KString& pResolutionMode, double& pW, double& pH);
00195 
00199     KFbxFileHeaderInfo* GetFileHeaderInfo();
00200 
00206     typedef enum 
00207     {
00208         eSTREAMOPTIONS_PARSE_FILE,  // Parse the file
00209         eSTREAMOPTIONS_FAST,        // Do not parse the file
00210         eSTREAMOPTIONS_COUNT
00211     } EStreamOptionsGeneration;
00212 
00218       bool GetImportOptions(EStreamOptionsGeneration pStreamOptionsGeneration = eSTREAMOPTIONS_PARSE_FILE); 
00219 
00226       bool GetImportOptions(KFbx* pFbxObject);
00227 
00238       bool Import(KFbxDocument* pDocument, bool pNonBlocking=false);
00239 
00248       bool IsImporting(bool& pImportResult);
00249 
00254       float GetProgress(KString &pStatus);
00255 
00259       void SetProgressCallback(KFbxProgressCallback pHandler);
00260 
00264     void SetEmbeddingExtractionFolder(const char* pExtractFolder);
00265 
00268     const char* GetEmbeddingExtractionFolder();
00269 
00273       KFbxIOSettings* GetIOSettings();
00274 
00278       void SetIOSettings(KFbxIOSettings* pIOSettings);
00279 
00284       void SetPassword(char* pPassword);
00285 
00291     
00296       int GetAnimStackCount();
00297 
00304       KFbxTakeInfo* GetTakeInfo(int pIndex);
00305 
00310       KString GetActiveAnimStackName();
00311 
00313 
00318 
00323     KFbxDocumentInfo* GetSceneInfo();
00324 
00326 
00330 
00339     int GetFileFormat ();
00340 
00343     bool IsFBX();
00345 
00347 //
00348 //  WARNING!
00349 //
00350 //  Anything beyond these lines may not be documented accurately and is 
00351 //  subject to change without notice.
00352 //
00354 
00360     void ParseForGlobalSettings(bool pState);
00361 
00367     void ParseForStatistics(bool pState);
00368 
00375     bool GetAxisInfo(KFbxAxisSystem* pAxisSystem, KFbxSystemUnit* pSystemUnits);
00376 
00383     bool GetStatistics(KFbxStatistics* pStatistics);
00384 
00391     bool GetFrameRate(KTime::ETimeMode &pTimeMode);
00392 
00393 
00394 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00395     //Internal use only, please use the other Import function to do your imports
00396     bool Import(KFbxDocument* pDocument, KFbx* pFbxObject);
00397 
00398 private:
00399     friend void ImportThread(void*);
00400     bool ImportProcess(KFbxDocument* pDocument);
00401 
00402 protected:
00403     void GetImportOptionsInfo();
00404     
00405     KFbxImporter(KFbxSdkManager& pManager,char const* pName);
00406     virtual void Destruct(bool pRecursive, bool pDependents);
00407 
00408     void Reset();
00409 
00410     bool FileOpen(KFile* pFile = NULL);
00411     void FileClose();
00412     
00413     bool IsNativeExtension ();
00414 
00415     KFbxImporterImp*                mImp;
00416     KFile*                          mFile;
00417     bool                            mImportOptionsDone;
00418     KArrayTemplate<KFbxTakeInfo*>   mTakeInfo;
00419     KFbxDocumentInfo*               mSceneInfo;
00420     KString                         mActiveAnimStackName;
00421     int                             mMajorVersion;
00422     int                             mMinorVersion;
00423     int                             mRevisionVersion;
00424     KFbxFileHeaderInfo              *mHeaderInfo;
00425     KFbxIOSettings*                 mIOSettings;
00426     bool                            mClientIOSettings;
00427 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00428 };
00429 
00430 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00431 
00432 #endif // FBXFILESDK_KFBXIO_KFBXIMPORTER_H
00433