fbxreader.h

Go to the documentation of this file.
00001 /****************************************************************************************
00002  
00003    Copyright (C) 2012 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 
00013 #ifndef _FBXSDK_FILEIO_READER_H_
00014 #define _FBXSDK_FILEIO_READER_H_
00015 
00016 #include <fbxsdk/fbxsdk_def.h>
00017 
00018 #include <fbxsdk/core/base/fbxerror.h>
00019 #include <fbxsdk/fileio/fbx/fbxio.h>
00020 
00021 #include <fbxsdk/fbxsdk_nsbegin.h>
00022 
00023 class FbxDocument;
00024 class FbxDocumentInfo;
00025 class FbxNode;
00026 class FbxManager;
00027 class FbxImporter;
00028 class FbxIOSettings;
00029 class FbxAxisSystem;
00030 class FbxSystemUnit;
00031 class FbxStatistics;
00032 class FbxTakeInfo;
00033 class FbxFile;
00034 class FbxObject;
00035 class FbxScene;
00036 class FbxProgress;
00037 class FbxStream;
00038 
00062 class FBXSDK_DLL FbxReader
00063 {
00064 public:
00069     FbxReader(FbxManager& pManager, int pID);
00070 
00073     virtual ~FbxReader();
00074     
00076     enum EErrorCode
00077     {
00078         eFileCorrupted,
00079         eFileVersionNotSupportedYet,
00080         eFileVersionNotSupportedAnymore,
00081         eFileNotOpened,
00082         eFileNotCreated,
00083         eWrongPassword,
00084         eInvalidDocumentHandle,
00085         eDocumentNotSupported,
00086         eUnresolvedExternalReferences,
00087         eUnknownError,
00088         eErrorCount
00089     };
00090 
00094     enum EInfoRequest
00095     {
00096         eInfoExtension,     
00097         eInfoDescriptions,  
00098         eReserved1 = 0xFBFB,
00099     };
00100 
00104     enum EFileOpenSpecialFlags
00105     {
00106         eParseForGlobalSettings = 1, 
00107         eParseForStatistics = 2      
00108     };
00109 
00111     typedef FbxReader*          (*CreateFuncType)(FbxManager& pManager, FbxImporter& pImporter, int pSubID, int pPluginID);
00112 
00114     typedef void                (*IOSettingsFillerFuncType)(FbxIOSettings& pIOS);
00115 
00117     typedef void*               (*GetInfoFuncType)(EInfoRequest pRequest, int pReaderTypeId);
00118 
00124     virtual void                GetVersion(int& pMajor, int& pMinor, int& pRevision){ pMajor = pMinor = pRevision = 0; }
00125 
00130     virtual bool                FileOpen(char* pFileName) = 0;
00131 
00132 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00133 
00137     virtual bool                FileOpen(FbxFile * pFile);
00138 #endif 
00139 
00145     virtual bool                FileOpen(FbxStream* pStream, void* pStreamData);
00146 
00150     virtual bool                FileClose() = 0;
00151 
00155     virtual bool                IsFileOpen() = 0;
00156 
00161     virtual bool                GetReadOptions(bool pParseFileAsNeeded = true) = 0;
00162 
00167     virtual bool                Read(FbxDocument* pDocument) = 0;
00168 
00177     virtual void                PluginReadParameters(FbxObject& pParams);
00178 
00184     virtual bool                FileOpen(char* pFileName, EFileOpenSpecialFlags /*pFlags*/){ return FileOpen(pFileName); }
00185 
00191     virtual bool                GetAxisInfo(FbxAxisSystem* /*pAxisSystem*/, FbxSystemUnit* /*pSystemUnits*/){ return false; }
00192 
00197     virtual bool                GetStatistics(FbxStatistics* /*pStats*/){ return false; }
00198 
00205     virtual bool                GetFrameRate(FbxTime::EMode& pTimeMode) { pTimeMode = FbxTime::eDefaultMode; return false; }
00206 
00207 
00211     virtual FbxDocumentInfo*   GetSceneInfo(){return NULL;}
00212 
00216     virtual FbxArray<FbxTakeInfo*>* GetTakeInfo(){return NULL;}
00217 
00225     virtual bool                GetDefaultRenderResolution(FbxString& pCamName, FbxString& pResolutionMode, double& pW, double& pH);
00226 
00231     bool                        IsGenuine();
00232 
00236     FbxError&                       GetError();
00237 
00241     EErrorCode                      GetLastErrorID() const;
00242 
00246     const char*                 GetLastErrorString() const;
00247 
00251     void                        GetMessage(FbxString& pMessage) const;
00252 
00256     FbxString&                  GetMessage();
00257 
00259     void                        ClearMessage();
00260 
00265     virtual FbxIOSettings * GetIOSettings();
00266 
00270     virtual void SetIOSettings(FbxIOSettings * pIOSettings);
00271 
00275     virtual void SetProgressHandler(FbxProgress* /*pProgress*/){}
00276 
00277     virtual void SetEmbeddingExtractionFolder(const char* /*pExtractFolder*/){}
00278 
00280     virtual bool SupportsStreams() const;
00281 
00282 protected:
00290     void                        SetDefaultRenderResolution(const char* pCamName, const char* pResolutionMode, double pW, double pH);
00291     
00293     void                        PluginsReadBegin(FbxScene& pScene);
00299     void                        PluginsRead(const char* pName, const char* pVersion);
00301     void                        PluginsReadEnd(FbxScene& pScene);
00302 
00303     FbxReader&                  operator=(FbxReader const&) { return *this; }
00309     virtual bool                CheckDuplicateNodeNames(FbxNode* pRootNode, FbxString& pDuplicateNodeNameList);
00310 
00312     FbxManager&             mManager;
00314     FbxIODefaultRenderResolution*   mData;
00315 
00316 private:
00317     FbxError                        mError;
00318     FbxString                       mMessage;
00319     int                         mInternalID;
00320     FbxIOSettings *            mIOSettings;
00321 
00322     friend struct FbxReaderFbx7_Impl;
00323 };
00324 
00326 #define IOS_REF (*GetIOSettings())
00327 
00328 #include <fbxsdk/fbxsdk_nsend.h>
00329 
00330 #endif /* _FBXSDK_FILEIO_READER_H_ */