FBX SDK Reference Guide: kfbximporter.h Source File
Go to the documentation of this file.
00001 
00004 #ifndef _FBXSDK_IMPORTER_H_
00005 #define _FBXSDK_IMPORTER_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 <kaydaradef.h>
00044 #ifndef KFBX_DLL 
00045     #define KFBX_DLL K_DLLIMPORT
00046 #endif
00047 
00048 #include <kfbxio/kfbxio.h>
00049 #include <kfbxevents/kfbxevents.h>
00050 
00051 #include <klib/kstring.h>
00052 #include <klib/karrayul.h>
00053 
00054 //#include <kfbx/kfbx.h>
00055 
00056 #include <kbaselib_forward.h>
00057 #ifndef MB_FBXSDK
00058 #include <kbaselib_nsuse.h>
00059 #endif
00060 
00061 #ifdef KARCH_DEV_MACOSX_CFM
00062     #include <CFURL.h>
00063     #include <Files.h>
00064 #endif
00065 
00066 #include <fbxfilesdk_nsbegin.h>
00067 
00068 class KFbxDocument;
00069 class KFbxImporterImp;
00070 class KFbxStreamOptionsFbx;
00071 class KFbxTakeInfo;
00072 class KFbxDocumentInfo;
00073 class KFbxStreamOptionsFbxReader;
00074 class KFbxAxisSystem;
00075 class KFbxSystemUnit;
00076 class KFbxStatistics;
00077 class KFile;
00078 class KFbxFileHeaderInfo;
00079 
00081 class KFBX_DLL KFbxEventPreImport : public KFbxEvent<KFbxEventPreImport>
00082 {
00083     KFBXEVENT_DECLARE(KFbxEventPreImport);
00084 public:
00085     inline KFbxEventPreImport( KFbxDocument* pDocument ) : mDocument(pDocument) {};
00086 
00088     KFbxDocument* mDocument; 
00089 };
00090 
00092 class KFBX_DLL KFbxEventPostImport : public KFbxEvent<KFbxEventPostImport>
00093 {
00094     KFBXEVENT_DECLARE(KFbxEventPostImport);
00095 public:
00096     inline KFbxEventPostImport( KFbxDocument* pDocument ) : mDocument(pDocument) {};
00097 
00099     KFbxDocument* mDocument; 
00100 };
00101 
00110 class KFBX_DLL KFbxImporter : public KFbxIO
00111 {
00112     KFBXOBJECT_DECLARE(KFbxImporter,KFbxIO);
00113 public:
00118 
00124     virtual bool Initialize(const char *pFileName);
00125 
00131     virtual bool Initialize(KFile * pFile);
00132 
00133 #ifdef KARCH_DEV_MACOSX_CFM
00134     virtual bool Initialize(const FSSpec &pMacFileSpec);
00135     virtual bool Initialize(const FSRef &pMacFileRef);
00136     virtual bool Initialize(const CFURLRef &pMacURL);
00137 #endif
00138 
00142     virtual KFile * GetFile();
00143 
00151     void GetFileVersion(int& pMajor, int& pMinor, int& pRevision);
00152 
00161     bool GetDefaultRenderResolution(KString& pCamName, KString& pResolutionMode, double& pW, double& pH);
00162 
00166     KFbxFileHeaderInfo* GetFileHeaderInfo();
00167 
00173     typedef enum 
00174     {
00175         eSTREAMOPTIONS_PARSE_FILE,
00176         eSTREAMOPTIONS_FAST,        // Do not parse the file
00177         eSTREAMOPTIONS_COUNT
00178     } EStreamOptionsGeneration;
00179 
00185     KFbxStreamOptions* GetImportOptions(EStreamOptionsGeneration pStreamOptionsGeneration = eSTREAMOPTIONS_PARSE_FILE); 
00186 
00192     KFbxStreamOptions* GetImportOptions(KFbx* pFbxObject);
00193 
00203     bool Import(KFbxDocument* pDocument, KFbxStreamOptions* pStreamOptions = NULL); 
00204 
00215     bool Import(KFbxDocument* pDocument, KFbxStreamOptions* pStreamOptions, KFbx* pFbxObject);
00216 
00220     void ReleaseImportOptions(KFbxStreamOptions* pStreamOptions);
00221 
00223 
00228     void SetPassword(char* pPassword);
00229 
00234     
00239     int GetTakeCount();
00240 
00247     KFbxTakeInfo* GetTakeInfo(int pIndex);
00248 
00253     char* GetCurrentTakeName();
00254 
00256 
00261 
00266     KFbxDocumentInfo* GetSceneInfo();
00267 
00269 
00273 
00277     void SetFileFormat (int pFileFormat);
00278 
00282     int GetFileFormat ();
00283 
00286     bool IsFBX();
00288 
00290 //
00291 //  WARNING!
00292 //
00293 //  Anything beyond these lines may not be documented accurately and is 
00294 //  subject to change without notice.
00295 //
00297 
00298     void ParseForGlobalSettings(bool pState);
00299     bool GetAxisInfo(KFbxAxisSystem* pAxisSystem, KFbxSystemUnit* pSystemUnits);
00300 
00301     void ParseForStatistics(bool pState);
00302     bool GetStatistics(KFbxStatistics* pStatistics);
00303 
00304 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00305     bool UpdateImportOptions(KFbxStreamOptions* pStreamOptions);
00306 
00307 protected:
00308 
00309 
00310     void SetImportOptionsInfo(KFbxStreamOptionsFbxReader* pStreamOptionsFbx);
00311     void GetImportOptionsInfo(KFbxStreamOptionsFbxReader* pStreamOptionsFbx);
00312 
00313     KFbxImporter(KFbxSdkManager& pManager,char const* pName);
00314     virtual ~KFbxImporter();
00315 
00316     void Reset();
00317 
00318     bool FileOpen(KFile* pFile = NULL);
00319     void FileClose();
00320 
00321     bool IsNativeExtension ();
00322 
00323     KFbxImporterImp*                mImp;
00324     KFile*                          mFile;
00325     bool                            mImportOptionsDone;
00326     KArrayTemplate<KFbxTakeInfo*>   mTakeInfo;
00327     KFbxDocumentInfo*               mSceneInfo;
00328     KString                         mCurrentTakeName;
00329     int                             mMajorVersion;
00330     int                             mMinorVersion;
00331     int                             mRevisionVersion;
00332     KFbxFileHeaderInfo              *mHeaderInfo;
00333 
00334 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00335 };
00336 
00337 #include <fbxfilesdk_nsend.h>
00338 
00339 #endif // #ifndef _FBXSDK_IMPORTER_H_
00340 
00341