FBX SDK Reference Guide: kfbximporter.h Source File
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 © 2001 - 2008 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 
00116     virtual bool Initialize(const char *pFileName);
00117 
00124     virtual bool Initialize(KFile * pFile);
00125 
00126 #ifdef KARCH_DEV_MACOSX_CFM
00127     virtual bool Initialize(const FSSpec &pMacFileSpec);
00128     virtual bool Initialize(const FSRef &pMacFileRef);
00129     virtual bool Initialize(const CFURLRef &pMacURL);
00130 #endif
00131 
00135     virtual KFile * GetFile();
00136 
00144     void GetFileVersion(int& pMajor, int& pMinor, int& pRevision);
00145 
00154     bool GetDefaultRenderResolution(KString& pCamName, KString& pResolutionMode, double& pW, double& pH);
00155 
00159     KFbxFileHeaderInfo* GetFileHeaderInfo();
00160 
00166     typedef enum 
00167     {
00168         eSTREAMOPTIONS_PARSE_FILE,
00169         eSTREAMOPTIONS_FAST,        // Do not parse the file
00170         eSTREAMOPTIONS_COUNT
00171     } EStreamOptionsGeneration;
00172 
00178     KFbxStreamOptions* GetImportOptions(EStreamOptionsGeneration pStreamOptionsGeneration = eSTREAMOPTIONS_PARSE_FILE); 
00179 
00185     KFbxStreamOptions* GetImportOptions(KFbx* pFbxObject);
00186 
00196     bool Import(KFbxDocument* pDocument, KFbxStreamOptions* pStreamOptions = NULL); 
00197 
00201     void ReleaseImportOptions(KFbxStreamOptions* pStreamOptions);
00202 
00204 
00209     void SetPassword(char* pPassword);
00210 
00215     
00220     int GetTakeCount();
00221 
00228     KFbxTakeInfo* GetTakeInfo(int pIndex);
00229 
00234     char* GetCurrentTakeName();
00235 
00237 
00242 
00247     KFbxDocumentInfo* GetSceneInfo();
00248 
00250 
00254 
00258     void SetFileFormat (int pFileFormat);
00259 
00263     int GetFileFormat ();
00264 
00267     bool IsFBX();
00269 
00271 //
00272 //  WARNING!
00273 //
00274 //  Anything beyond these lines may not be documented accurately and is 
00275 //  subject to change without notice.
00276 //
00278 
00279     void ParseForGlobalSettings(bool pState);
00280     bool GetAxisInfo(KFbxAxisSystem* pAxisSystem, KFbxSystemUnit* pSystemUnits);
00281 
00282     void ParseForStatistics(bool pState);
00283     bool GetStatistics(KFbxStatistics* pStatistics);
00284 
00285 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00286     bool UpdateImportOptions(KFbxStreamOptions* pStreamOptions);
00287 
00288     //Internal use only, please use the other Import function to do your imports
00289     bool Import(KFbxDocument* pDocument, KFbxStreamOptions* pStreamOptions, KFbx* pFbxObject);
00290 
00291 protected:
00292     void SetImportOptionsInfo(KFbxStreamOptionsFbxReader* pStreamOptionsFbx);
00293     void GetImportOptionsInfo(KFbxStreamOptionsFbxReader* pStreamOptionsFbx);
00294 
00295     KFbxImporter(KFbxSdkManager& pManager,char const* pName);
00296     virtual ~KFbxImporter();
00297 
00298     void Reset();
00299 
00300     bool FileOpen(KFile* pFile = NULL);
00301     void FileClose();
00302 
00303     bool IsNativeExtension ();
00304 
00305     KFbxImporterImp*                mImp;
00306     KFile*                          mFile;
00307     bool                            mImportOptionsDone;
00308     KArrayTemplate<KFbxTakeInfo*>   mTakeInfo;
00309     KFbxDocumentInfo*               mSceneInfo;
00310     KString                         mCurrentTakeName;
00311     int                             mMajorVersion;
00312     int                             mMinorVersion;
00313     int                             mRevisionVersion;
00314     KFbxFileHeaderInfo              *mHeaderInfo;
00315 
00316 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00317 };
00318 
00319 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00320 
00321 #endif // FBXFILESDK_KFBXIO_KFBXIMPORTER_H
00322