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 - 2009 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/components/kbaselib/kfbx/kfbx.h>
00049 
00050 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00051 
00052 class KFbxDocument;
00053 class KFbxNode;
00054 class KFbxSdkManager;
00055 class KFbxImporter;
00056 class KFbxStreamOptions;
00057 class KFbxIOSettings;
00058 class KFbxAxisSystem;
00059 class KFbxSystemUnit;
00060 class KFbxStatistics;
00061 class KFile;
00062 class KFbxObject;
00063 class KFbxScene;
00064 
00065 
00070 class KFBX_DLL KFbxReader
00071 {
00072 public:
00077     KFbxReader(KFbxSdkManager& pManager, int pID);
00078 
00081     virtual ~KFbxReader();
00082 
00083     
00098     typedef enum
00099     {
00100         eFILE_CORRUPTED,
00101         eFILE_VERSION_NOT_SUPPORTED_YET,
00102         eFILE_VERSION_NOT_SUPPORTED_ANYMORE,
00103         eFILE_NOT_OPENED,
00104         eFILE_NOT_CREATED,
00105         eWRONG_PASSWORD,
00106         eSTREAM_OPTIONS_NOT_SET,
00107         eINVALID_DOCUMENT_HANDLE,
00108         eDOCUMENT_NOT_SUPPORTED,
00109         eUNRESOLVED_EXTERNAL_REFERENCES, // this is a warning
00110         eUNIDENTIFIED_ERROR,
00111         eERROR_COUNT
00112     } EError;
00113 
00114     enum KInfoRequest {
00115         eInfoExtension, // return a null terminated char const* const*
00116         eInfoDescriptions, // return a null terminated char const* const*
00117         eReserved1 = 0xFBFB,
00118     };
00119 
00120     enum EFileOpenSpecialFlags {
00121         ParseForGlobalSettings = 1, 
00122         ParseForStatistics = 2
00123     };
00124 
00125     typedef KFbxReader*         (*CreateFuncType)(KFbxSdkManager& pManager, KFbxImporter& pImporter, int pSubID, int pPluginID);
00126     typedef void                (*IOSettingsFillerFuncType)(KFbxIOSettings& pIOS);
00127     typedef void*               (*GetInfoFuncType)(KInfoRequest pRequest, int pReaderTypeId);
00128 
00129 
00130 
00136     virtual void                GetVersion(int& pMajor, int& pMinor, int& pRevision){ pMajor = pMinor = pRevision = 0; }
00137 
00142     virtual bool                FileOpen(char* pFileName) = 0;
00143 
00148     virtual bool                FileOpen(KFile * pFile);
00149 
00153     virtual bool                FileClose() = 0;
00154 
00158     virtual bool                IsFileOpen() = 0;
00159 
00164     virtual KFbxStreamOptions*  GetReadOptions(bool pParseFileAsNeeded = true) = 0;
00165 
00171     virtual bool                Read(KFbxDocument* pDocument, KFbxStreamOptions* pStreamOptions) = 0;
00172 
00173 
00174 
00175 
00176 //----------------------------------------------------------------------------------------------------------------------
00180     virtual void                PluginReadParameters(KFbxObject& pParams){}
00181 //----------------------------------------------------------------------------------------------------------------------
00182 
00188     virtual bool                FileOpen(char* pFileName, EFileOpenSpecialFlags pFlags){ return FileOpen(pFileName); }
00189 
00195     virtual bool                GetAxisInfo(KFbxAxisSystem* pAxisSystem, KFbxSystemUnit* pSystemUnits){ return false; }
00196 
00201     virtual bool                GetStatistics(KFbxStatistics* pStats){ return false; }
00202 
00210     bool                        GetDefaultRenderResolution(KString& pCamName, KString& pResolutionMode, double& pW, double& pH);
00211 
00215     bool                        IsGenuine();
00216 
00220     KError&                     GetError();
00224     EError                      GetLastErrorID() const;
00225 
00229     const char*                 GetLastErrorString() const;
00230 
00234     void                        GetMessage(KString& pMessage) const;
00235 
00239     KString&                    GetMessage();
00240 
00243     void                        ClearMessage();
00244 
00245 protected:
00246     void                        SetDefaultRenderResolution(const char* pCamName, const char* pResolutionMode, double pW, double pH);
00247     
00248     void                        PluginsReadBegin(KFbxScene& pScene);
00249     void                        PluginsRead(char* pName, char* pVersion);
00250     void                        PluginsReadEnd(KFbxScene& pScene);
00251 
00252     KFbxReader&                 operator=(KFbxReader const&) { return *this; }
00253     virtual bool                CheckDuplicateNodeNames(KFbxNode* pRootNode, KString& pDuplicateNodeNameList);
00254 
00255     KFbxSdkManager&             mManager;
00256     KDefaultRenderResolution*   mData;
00257 
00258 private:
00259     KError                      mError;
00260     KString                     mMessage;
00261     int                         mInternalID;
00262 };
00263 
00264 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00265 
00266 #endif // FBXFILESDK_KFBXIO_KFBXREADER_H
00267