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 - 2009 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 
00042 
00043 #include <fbxfilesdk/components/kbaselib/kaydaradef_h.h>
00044 #include <fbxfilesdk/kfbxio/kfbxio.h>
00045 #include <fbxfilesdk/kfbxevents/kfbxevents.h>
00046 
00047 #include <fbxfilesdk/components/kbaselib/klib/kstring.h>
00048 #include <fbxfilesdk/components/kbaselib/klib/karrayul.h>
00049 
00050 #include <fbxfilesdk/components/kbaselib/kbaselib_forward.h>
00051 
00052 #ifdef KARCH_DEV_MACOSX_CFM
00053     #include <CFURL.h>
00054     #include <Files.h>
00055 #endif
00056 
00057 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00058 
00059 class KFbxDocument;
00060 class KFbxImporterImp;
00061 class KFbxStreamOptionsFbx;
00062 class KFbxTakeInfo;
00063 class KFbxDocumentInfo;
00064 class KFbxStreamOptionsFbxReader;
00065 class KFbxAxisSystem;
00066 class KFbxSystemUnit;
00067 class KFbxStatistics;
00068 class KFile;
00069 class KFbxFileHeaderInfo;
00070 
00072 class KFBX_DLL KFbxEventPreImport : public KFbxEvent<KFbxEventPreImport>
00073 {
00074     KFBXEVENT_DECLARE(KFbxEventPreImport);
00075 public:
00076     inline KFbxEventPreImport( KFbxDocument* pDocument ) : mDocument(pDocument) {};
00077 
00079     KFbxDocument* mDocument; 
00080 };
00081 
00083 class KFBX_DLL KFbxEventPostImport : public KFbxEvent<KFbxEventPostImport>
00084 {
00085     KFBXEVENT_DECLARE(KFbxEventPostImport);
00086 public:
00087     inline KFbxEventPostImport( KFbxDocument* pDocument ) : mDocument(pDocument) {};
00088 
00090     KFbxDocument* mDocument; 
00091 };
00092 
00101 class KFBX_DLL KFbxImporter : public KFbxIO
00102 {
00103     KFBXOBJECT_DECLARE(KFbxImporter,KFbxIO);
00104 public:
00109 
00118     virtual bool Initialize(const char *pFileName, const int pFileFormat = -1);
00119 
00128     virtual bool Initialize(KFile * pFile, const int pFileFormat = -1);
00129 
00130 #ifdef KARCH_DEV_MACOSX_CFM
00131     virtual bool Initialize(const FSSpec &pMacFileSpec);
00132     virtual bool Initialize(const FSRef &pMacFileRef);
00133     virtual bool Initialize(const CFURLRef &pMacURL);
00134 #endif
00135 
00139     virtual KFile * GetFile();
00140 
00148     void GetFileVersion(int& pMajor, int& pMinor, int& pRevision);
00149 
00158     bool GetDefaultRenderResolution(KString& pCamName, KString& pResolutionMode, double& pW, double& pH);
00159 
00163     KFbxFileHeaderInfo* GetFileHeaderInfo();
00164 
00170     typedef enum 
00171     {
00172         eSTREAMOPTIONS_PARSE_FILE,
00173         eSTREAMOPTIONS_FAST,        // Do not parse the file
00174         eSTREAMOPTIONS_COUNT
00175     } EStreamOptionsGeneration;
00176 
00182     KFbxStreamOptions* GetImportOptions(EStreamOptionsGeneration pStreamOptionsGeneration = eSTREAMOPTIONS_PARSE_FILE); 
00183 
00189     KFbxStreamOptions* GetImportOptions(KFbx* pFbxObject);
00190 
00200     bool Import(KFbxDocument* pDocument, KFbxStreamOptions* pStreamOptions = NULL); 
00201 
00205     void ReleaseImportOptions(KFbxStreamOptions* pStreamOptions);
00206 
00208 
00213     void SetPassword(char* pPassword);
00214 
00219     
00224     int GetTakeCount();
00225 
00232     KFbxTakeInfo* GetTakeInfo(int pIndex);
00233 
00238     char* GetCurrentTakeName();
00239 
00241 
00246 
00251     KFbxDocumentInfo* GetSceneInfo();
00252 
00254 
00258 
00262     K_DEPRECATED void SetFileFormat (int pFileFormat);
00263 
00267     int GetFileFormat ();
00268 
00271     bool IsFBX();
00273 
00275 //
00276 //  WARNING!
00277 //
00278 //  Anything beyond these lines may not be documented accurately and is 
00279 //  subject to change without notice.
00280 //
00282 
00283     void ParseForGlobalSettings(bool pState);
00284     bool GetAxisInfo(KFbxAxisSystem* pAxisSystem, KFbxSystemUnit* pSystemUnits);
00285 
00286     void ParseForStatistics(bool pState);
00287     bool GetStatistics(KFbxStatistics* pStatistics);
00288 
00289 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00290     bool UpdateImportOptions(KFbxStreamOptions* pStreamOptions);
00291 
00292     //Internal use only, please use the other Import function to do your imports
00293     bool Import(KFbxDocument* pDocument, KFbxStreamOptions* pStreamOptions, KFbx* pFbxObject);
00294 
00295 protected:
00296     void SetImportOptionsInfo(KFbxStreamOptionsFbxReader* pStreamOptionsFbx);
00297     void GetImportOptionsInfo(KFbxStreamOptionsFbxReader* pStreamOptionsFbx);
00298     
00299     KFbxImporter(KFbxSdkManager& pManager,char const* pName);
00300     virtual void Destruct(bool pRecursive, bool pDependents);
00301 
00302     void Reset();
00303 
00304     bool FileOpen(KFile* pFile = NULL);
00305     void FileClose();
00306     
00307     bool IsNativeExtension ();
00308 
00309     KFbxImporterImp*                mImp;
00310     KFile*                          mFile;
00311     bool                            mImportOptionsDone;
00312     KArrayTemplate<KFbxTakeInfo*>   mTakeInfo;
00313     KFbxDocumentInfo*               mSceneInfo;
00314     KString                         mCurrentTakeName;
00315     int                             mMajorVersion;
00316     int                             mMinorVersion;
00317     int                             mRevisionVersion;
00318     KFbxFileHeaderInfo              *mHeaderInfo;
00319 
00320 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00321 };
00322 
00323 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00324 
00325 #endif // FBXFILESDK_KFBXIO_KFBXIMPORTER_H
00326