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 
00168     virtual bool Initialize(KFile* pFile, const int pFileFormat=-1, KFbxIOSettings* pIOSettings=NULL);
00169 
00173     virtual KFile * GetFile();
00174 
00182     void GetFileVersion(int& pMajor, int& pMinor, int& pRevision);
00183 
00192     bool GetDefaultRenderResolution(KString& pCamName, KString& pResolutionMode, double& pW, double& pH);
00193 
00197     KFbxFileHeaderInfo* GetFileHeaderInfo();
00198 
00204     typedef enum 
00205     {
00206         eSTREAMOPTIONS_PARSE_FILE,  // Parse the file
00207         eSTREAMOPTIONS_FAST,        // Do not parse the file
00208         eSTREAMOPTIONS_COUNT
00209     } EStreamOptionsGeneration;
00210 
00216       bool GetImportOptions(EStreamOptionsGeneration pStreamOptionsGeneration = eSTREAMOPTIONS_PARSE_FILE); 
00217 
00224       bool GetImportOptions(KFbx* pFbxObject);
00225 
00236       bool Import(KFbxDocument* pDocument, bool pNonBlocking=false);
00237 
00246       bool IsImporting(bool& pImportResult);
00247 
00252       float GetProgress(KString &pStatus);
00253 
00257       void SetProgressCallback(KFbxProgressCallback pHandler);
00258 
00262       KFbxIOSettings* GetIOSettings();
00263 
00267       void SetIOSettings(KFbxIOSettings* pIOSettings);
00268 
00273       void SetPassword(char* pPassword);
00274 
00280     
00286       K_DEPRECATED int GetTakeCount();
00287 
00292       int GetAnimStackCount();
00293 
00300       KFbxTakeInfo* GetTakeInfo(int pIndex);
00301 
00307       K_DEPRECATED char* GetCurrentTakeName();
00308 
00313       KString GetActiveAnimStackName();
00314 
00316 
00321 
00326     KFbxDocumentInfo* GetSceneInfo();
00327 
00329 
00333 
00342     int GetFileFormat ();
00343 
00346     bool IsFBX();
00348 
00350 //
00351 //  WARNING!
00352 //
00353 //  Anything beyond these lines may not be documented accurately and is 
00354 //  subject to change without notice.
00355 //
00357 
00363     void ParseForGlobalSettings(bool pState);
00364 
00370     void ParseForStatistics(bool pState);
00371 
00378     bool GetAxisInfo(KFbxAxisSystem* pAxisSystem, KFbxSystemUnit* pSystemUnits);
00379 
00386     bool GetStatistics(KFbxStatistics* pStatistics);
00387 
00388 
00389 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00390     //Internal use only, please use the other Import function to do your imports
00391     bool Import(KFbxDocument* pDocument, KFbx* pFbxObject);
00392 
00393 private:
00394     friend void ImportThread(void*);
00395     bool ImportProcess(KFbxDocument* pDocument);
00396 
00397 protected:
00398     void GetImportOptionsInfo();
00399     
00400     KFbxImporter(KFbxSdkManager& pManager,char const* pName);
00401     virtual void Destruct(bool pRecursive, bool pDependents);
00402 
00403     void Reset();
00404 
00405     bool FileOpen(KFile* pFile = NULL);
00406     void FileClose();
00407     
00408     bool IsNativeExtension ();
00409 
00410     KFbxImporterImp*                mImp;
00411     KFile*                          mFile;
00412     bool                            mImportOptionsDone;
00413     KArrayTemplate<KFbxTakeInfo*>   mTakeInfo;
00414     KFbxDocumentInfo*               mSceneInfo;
00415     KString                         mActiveAnimStackName;
00416     int                             mMajorVersion;
00417     int                             mMinorVersion;
00418     int                             mRevisionVersion;
00419     KFbxFileHeaderInfo              *mHeaderInfo;
00420     KFbxIOSettings*                 mIOSettings;
00421     bool                            mClientIOSettings;
00422 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00423 };
00424 
00425 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00426 
00427 #endif // FBXFILESDK_KFBXIO_KFBXIMPORTER_H
00428