kfbxreader.h

Go to the documentation of this file.
00001 
00004 #ifndef FBXFILESDK_KFBXIO_KFBXREADER_H
00005 #define FBXFILESDK_KFBXIO_KFBXREADER_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/components/kbaselib/klib/kerror.h>
00044 #include <fbxfilesdk/components/kbaselib/kfbx/kfbx.h>
00045 
00046 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00047 
00048 class KFbxDocument;
00049 class KFbxDocumentInfo;
00050 class KFbxNode;
00051 class KFbxSdkManager;
00052 class KFbxImporter;
00053 class KFbxIOSettings;
00054 class KFbxAxisSystem;
00055 class KFbxSystemUnit;
00056 class KFbxStatistics;
00057 class KFbxTakeInfo;
00058 class KFile;
00059 class KFbxObject;
00060 class KFbxScene;
00061 class KFbxProgress;
00062 
00086 class KFBX_DLL KFbxReader
00087 {
00088 public:
00093     KFbxReader(KFbxSdkManager& pManager, int pID);
00094 
00097     virtual ~KFbxReader();
00098     
00112     typedef enum
00113     {
00114         eFILE_CORRUPTED,
00115         eFILE_VERSION_NOT_SUPPORTED_YET,
00116         eFILE_VERSION_NOT_SUPPORTED_ANYMORE,
00117         eFILE_NOT_OPENED,
00118         eFILE_NOT_CREATED,
00119         eWRONG_PASSWORD,
00120         eINVALID_DOCUMENT_HANDLE,
00121         eDOCUMENT_NOT_SUPPORTED,
00122         eUNRESOLVED_EXTERNAL_REFERENCES, // this is a warning
00123         eUNIDENTIFIED_ERROR,
00124         eERROR_COUNT
00125     } EError;
00126 
00133     enum KInfoRequest {
00134         eInfoExtension,     
00135         eInfoDescriptions,  
00136         eReserved1 = 0xFBFB,
00137     };
00138 
00144     enum EFileOpenSpecialFlags {
00145         ParseForGlobalSettings = 1,
00146         ParseForStatistics = 2     
00147     };
00148 
00150     typedef KFbxReader*         (*CreateFuncType)(KFbxSdkManager& pManager, KFbxImporter& pImporter, int pSubID, int pPluginID);
00151 
00153     typedef void                (*IOSettingsFillerFuncType)(KFbxIOSettings& pIOS);
00154 
00156     typedef void*               (*GetInfoFuncType)(KInfoRequest pRequest, int pReaderTypeId);
00157 
00163     virtual void                GetVersion(int& pMajor, int& pMinor, int& pRevision){ pMajor = pMinor = pRevision = 0; }
00164 
00169     virtual bool                FileOpen(char* pFileName) = 0;
00170 
00175     virtual bool                FileOpen(KFile * pFile);
00176 
00180     virtual bool                FileClose() = 0;
00181 
00185     virtual bool                IsFileOpen() = 0;
00186 
00191     virtual bool                GetReadOptions(bool pParseFileAsNeeded = true) = 0;
00192 
00197     virtual bool                Read(KFbxDocument* pDocument) = 0;
00198 
00207     virtual void                PluginReadParameters(KFbxObject& pParams);
00208 
00214     virtual bool                FileOpen(char* pFileName, EFileOpenSpecialFlags pFlags){ return FileOpen(pFileName); }
00215 
00221     virtual bool                GetAxisInfo(KFbxAxisSystem* pAxisSystem, KFbxSystemUnit* pSystemUnits){ return false; }
00222 
00227     virtual bool                GetStatistics(KFbxStatistics* pStats){ return false; }
00228 
00232     virtual KFbxDocumentInfo*   GetSceneInfo(){return NULL;}
00233 
00237     virtual KArrayTemplate<KFbxTakeInfo*>* GetTakeInfo(){return NULL;}
00238 
00246     virtual bool                GetDefaultRenderResolution(KString& pCamName, KString& pResolutionMode, double& pW, double& pH);
00247 
00252     bool                        IsGenuine();
00253 
00257     KError&                     GetError();
00258 
00262     EError                      GetLastErrorID() const;
00263 
00267     const char*                 GetLastErrorString() const;
00268 
00272     void                        GetMessage(KString& pMessage) const;
00273 
00277     KString&                    GetMessage();
00278 
00281     void                        ClearMessage();
00282 
00287     virtual KFbxIOSettings * GetIOSettings();
00288 
00292     virtual void SetIOSettings(KFbxIOSettings * pIOSettings);
00293 
00297     virtual void SetProgressHandler(KFbxProgress *pProgress){}
00298 
00299 protected:
00300     void                        SetDefaultRenderResolution(const char* pCamName, const char* pResolutionMode, double pW, double pH);
00301     
00302     void                        PluginsReadBegin(KFbxScene& pScene);
00303     void                        PluginsRead(const char* pName, const char* pVersion);
00304     void                        PluginsReadEnd(KFbxScene& pScene);
00305 
00306     KFbxReader&                 operator=(KFbxReader const&) { return *this; }
00307     virtual bool                CheckDuplicateNodeNames(KFbxNode* pRootNode, KString& pDuplicateNodeNameList);
00308 
00309     KFbxSdkManager&             mManager;
00310     KDefaultRenderResolution*   mData;
00311 
00312 private:
00313     KError                      mError;
00314     KString                     mMessage;
00315     int                         mInternalID;
00316     KFbxIOSettings *            mIOSettings;
00317 
00318     friend struct KFbxReaderFbx7Impl;
00319 };
00320 
00322 #define IOS_REF (*GetIOSettings())
00323 
00324 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00325 
00326 #endif // FBXFILESDK_KFBXIO_KFBXREADER_H
00327