FBX SDK Reference Guide: kfbxreader.h Source File
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 © 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 #include <fbxfilesdk/components/kbaselib/kaydaradef_h.h>
00043 #include <fbxfilesdk/components/kbaselib/klib/kerror.h>
00044 
00045 #include <fbxfilesdk/components/kbaselib/kbaselib_forward.h>
00046 #include <fbxfilesdk/components/kfcurve/kfcurve_forward.h>
00047 
00048 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00049 
00050 class KFbxDocument;
00051 class KFbxNode;
00052 class KFbxSdkManager;
00053 class KFbxImporter;
00054 class KFbxStreamOptions;
00055 class KFbxIOSettings;
00056 class KFbxAxisSystem;
00057 class KFbxSystemUnit;
00058 class KFbxStatistics;
00059 class KFile;
00060 class KFbxObject;
00061 class KFbxScene;
00062 
00063 struct KFbxReaderData;
00064 
00065 class KFBX_DLL KFbxReader
00066 {
00067 public:
00068     KFbxReader(KFbxSdkManager& pManager, int pID);
00069     virtual ~KFbxReader();
00070 
00072     typedef enum
00073     {
00074         eFILE_CORRUPTED,
00075         eFILE_VERSION_NOT_SUPPORTED_YET,
00076         eFILE_VERSION_NOT_SUPPORTED_ANYMORE,
00077         eFILE_NOT_OPENED,
00078         eFILE_NOT_CREATED,
00079         eWRONG_PASSWORD,
00080         eSTREAM_OPTIONS_NOT_SET,
00081         eINVALID_DOCUMENT_HANDLE,
00082         eDOCUMENT_NOT_SUPPORTED,
00083         eUNRESOLVED_EXTERNAL_REFERENCES, // this is a warning
00084         eUNIDENTIFIED_ERROR,
00085         eERROR_COUNT
00086     } EError;
00087 
00088     enum KInfoRequest {
00089         eInfoExtension, // return a null terminated char const* const*
00090         eInfoDescriptions, // return a null terminated char const* const*
00091         eReserved1 = 0xFBFB,
00092     };
00093 
00094     enum EFileOpenSpecialFlags {
00095         ParseForGlobalSettings = 1, 
00096         ParseForStatistics = 2
00097     };
00098 
00099     typedef KFbxReader*         (*CreateFuncType)(KFbxSdkManager& pManager, KFbxImporter& pImporter, int pSubID, int pPluginID);
00100     typedef void                (*IOSettingsFillerFuncType)(KFbxIOSettings& pIOS);
00101     typedef void*               (*GetInfoFuncType)(KInfoRequest pRequest, int pReaderTypeId);
00102 
00103     virtual void                GetVersion(int& pMajor, int& pMinor, int& pRevision){ pMajor = pMinor = pRevision = 0; }
00104     virtual bool                FileOpen(char* pFileName) = 0;
00105     virtual bool                FileOpen(KFile * pFile);
00106     virtual bool                FileClose() = 0;
00107     virtual bool                IsFileOpen() = 0;
00108 
00109     virtual KFbxStreamOptions*  GetReadOptions(bool pParseFileAsNeeded = true) = 0;
00110     virtual bool                Read(KFbxDocument* pDocument, KFbxStreamOptions* pStreamOptions) = 0;
00111 
00112     virtual void                PluginReadSettings(KFbxObject& pSettings){}
00113 
00114     virtual bool                FileOpen(char* pFileName, EFileOpenSpecialFlags pFlags){ return FileOpen(pFileName); }
00115     virtual bool                GetAxisInfo(KFbxAxisSystem* pAxisSystem, KFbxSystemUnit* pSystemUnits){ return false; }
00116     virtual bool                GetStatistics(KFbxStatistics* pStats){ return false; }
00117     bool                        GetDefaultRenderResolution(KString& pCamName, KString& pResolutionMode, double& pW, double& pH);
00118     bool                        IsGenuine();
00119 
00120     KError&                     GetError();
00121     EError                      GetLastErrorID() const;
00122     const char*                 GetLastErrorString() const;
00123     void                        GetMessage(KString& pMessage) const;
00124     KString&                    GetMessage();
00125     void                        ClearMessage();
00126 
00127 protected:
00128     void                        SetDefaultRenderResolution(const char* pCamName, const char* pResolutionMode, double pW, double pH);
00129     void                        InvalidateDefaultRenderResolution();
00130 
00131     void                        PluginsReadBegin(KFbxScene& pScene);
00132     void                        PluginsRead(char* pName, char* pVersion);
00133     void                        PluginsReadEnd(KFbxScene& pScene);
00134 
00135     KFbxReader&                 operator=(KFbxReader const&) { return *this; }
00136     virtual bool                CheckDuplicateNodeNames(KFbxNode* pRootNode, KString& pDuplicateNodeNameList);
00137 
00138     KFbxSdkManager&             mManager;
00139 
00140 private:
00141     KError                      mError;
00142     KString                     mMessage;
00143     KFbxReaderData*             mData;
00144     int                         mInternalID;
00145 };
00146 
00147 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00148 
00149 #endif // FBXFILESDK_KFBXIO_KFBXREADER_H
00150