kfbxreader.h

Go to the documentation of this file.
00001 /****************************************************************************************
00002 
00003    Copyright (C) 2010 Autodesk, Inc.
00004    All rights reserved.
00005 
00006    Use of this software is subject to the terms of the Autodesk license agreement
00007    provided at the time of installation or download, or which otherwise accompanies
00008    this software in either electronic or hard copy form.
00009 
00010 ****************************************************************************************/
00011 
00015 #ifndef FBXFILESDK_KFBXIO_KFBXREADER_H
00016 #define FBXFILESDK_KFBXIO_KFBXREADER_H
00017 
00018 
00019 #include <fbxfilesdk/fbxfilesdk_def.h>
00020 
00021 #include <fbxfilesdk/components/kbaselib/klib/kerror.h>
00022 #include <fbxfilesdk/components/kbaselib/kfbx/kfbx.h>
00023 
00024 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00025 
00026 class KFbxDocument;
00027 class KFbxDocumentInfo;
00028 class KFbxNode;
00029 class KFbxSdkManager;
00030 class KFbxImporter;
00031 class KFbxIOSettings;
00032 class KFbxAxisSystem;
00033 class KFbxSystemUnit;
00034 class KFbxStatistics;
00035 class KFbxTakeInfo;
00036 class KFile;
00037 class KFbxObject;
00038 class KFbxScene;
00039 class KFbxProgress;
00040 
00064 class KFBX_DLL KFbxReader
00065 {
00066 public:
00071     KFbxReader(KFbxSdkManager& pManager, int pID);
00072 
00075     virtual ~KFbxReader();
00076     
00079     typedef enum
00080     {
00081         eFILE_CORRUPTED,
00082         eFILE_VERSION_NOT_SUPPORTED_YET,
00083         eFILE_VERSION_NOT_SUPPORTED_ANYMORE,
00084         eFILE_NOT_OPENED,
00085         eFILE_NOT_CREATED,
00086         eWRONG_PASSWORD,
00087         eINVALID_DOCUMENT_HANDLE,
00088         eDOCUMENT_NOT_SUPPORTED,
00089         eUNRESOLVED_EXTERNAL_REFERENCES,
00090         eUNIDENTIFIED_ERROR,
00091         eERROR_COUNT
00092     } EError;
00093 
00097     enum KInfoRequest {
00098         eInfoExtension,     
00099         eInfoDescriptions,  
00100         eReserved1 = 0xFBFB,
00101     };
00102 
00106     enum EFileOpenSpecialFlags {
00107         ParseForGlobalSettings = 1, 
00108         ParseForStatistics = 2      
00109     };
00110 
00112     typedef KFbxReader*         (*CreateFuncType)(KFbxSdkManager& pManager, KFbxImporter& pImporter, int pSubID, int pPluginID);
00113 
00115     typedef void                (*IOSettingsFillerFuncType)(KFbxIOSettings& pIOS);
00116 
00118     typedef void*               (*GetInfoFuncType)(KInfoRequest pRequest, int pReaderTypeId);
00119 
00125     virtual void                GetVersion(int& pMajor, int& pMinor, int& pRevision){ pMajor = pMinor = pRevision = 0; }
00126 
00131     virtual bool                FileOpen(char* pFileName) = 0;
00132 
00133 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00134 
00138     virtual bool                FileOpen(KFile * pFile);
00139 #endif 
00140 
00144     virtual bool                FileClose() = 0;
00145 
00149     virtual bool                IsFileOpen() = 0;
00150 
00155     virtual bool                GetReadOptions(bool pParseFileAsNeeded = true) = 0;
00156 
00161     virtual bool                Read(KFbxDocument* pDocument) = 0;
00162 
00171     virtual void                PluginReadParameters(KFbxObject& pParams);
00172 
00178     virtual bool                FileOpen(char* pFileName, EFileOpenSpecialFlags pFlags){ return FileOpen(pFileName); }
00179 
00185     virtual bool                GetAxisInfo(KFbxAxisSystem* pAxisSystem, KFbxSystemUnit* pSystemUnits){ return false; }
00186 
00191     virtual bool                GetStatistics(KFbxStatistics* pStats){ return false; }
00192 
00199     virtual bool                GetFrameRate(KTime::ETimeMode &pTimeMode) { pTimeMode = KTime::eDEFAULT_MODE; return false; }
00200 
00201 
00205     virtual KFbxDocumentInfo*   GetSceneInfo(){return NULL;}
00206 
00210     virtual KArrayTemplate<KFbxTakeInfo*>* GetTakeInfo(){return NULL;}
00211 
00219     virtual bool                GetDefaultRenderResolution(KString& pCamName, KString& pResolutionMode, double& pW, double& pH);
00220 
00225     bool                        IsGenuine();
00226 
00230     KError&                     GetError();
00231 
00235     EError                      GetLastErrorID() const;
00236 
00240     const char*                 GetLastErrorString() const;
00241 
00245     void                        GetMessage(KString& pMessage) const;
00246 
00250     KString&                    GetMessage();
00251 
00253     void                        ClearMessage();
00254 
00259     virtual KFbxIOSettings * GetIOSettings();
00260 
00264     virtual void SetIOSettings(KFbxIOSettings * pIOSettings);
00265 
00269     virtual void SetProgressHandler(KFbxProgress *pProgress){}
00270 
00271     virtual void SetEmbeddingExtractionFolder(const char* pExtractFolder){}
00272 
00273 protected:
00281     void                        SetDefaultRenderResolution(const char* pCamName, const char* pResolutionMode, double pW, double pH);
00282     
00284     void                        PluginsReadBegin(KFbxScene& pScene);
00290     void                        PluginsRead(const char* pName, const char* pVersion);
00292     void                        PluginsReadEnd(KFbxScene& pScene);
00293 
00294     KFbxReader&                 operator=(KFbxReader const&) { return *this; }
00300     virtual bool                CheckDuplicateNodeNames(KFbxNode* pRootNode, KString& pDuplicateNodeNameList);
00301 
00303     KFbxSdkManager&             mManager;
00305     KDefaultRenderResolution*   mData;
00306 
00307 private:
00308     KError                      mError;
00309     KString                     mMessage;
00310     int                         mInternalID;
00311     KFbxIOSettings *            mIOSettings;
00312 
00313     friend struct KFbxReaderFbx7Impl;
00314 };
00315 
00317 #define IOS_REF (*GetIOSettings())
00318 
00319 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00320 
00321 #endif // FBXFILESDK_KFBXIO_KFBXREADER_H
00322