kfbxwriter.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_KFBXWRITER_H
00016 #define FBXFILESDK_KFBXIO_KFBXWRITER_H
00017 
00018 #include <fbxfilesdk/fbxfilesdk_def.h>
00019 
00020 #include <fbxfilesdk/components/kbaselib/klib/kerror.h>
00021 #include <fbxfilesdk/components/kbaselib/klib/kstring.h>
00022 #include <fbxfilesdk/components/kbaselib/klib/karrayul.h>
00023 
00024 #include <fbxfilesdk/kfbxplugins/kfbxrenamingstrategy.h>
00025 
00026 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00027 
00028 class KFbxNode;
00029 class KFbxDocument;
00030 class KFbxScene;
00031 class KFbxSdkManager;
00032 class KFbxExporter;
00033 class KFbxIOSettings;
00034 class KFbxObject;
00035 class KFbx;
00036 class KFbxProgress;
00037 
00038 #define IOSP GetIOSettings()
00039 
00062 class KFBX_DLL KFbxWriter
00063 {
00064 public:
00069     KFbxWriter(KFbxSdkManager& pManager, int pID);
00071     virtual ~KFbxWriter();
00072 
00075     typedef enum
00076     {
00077         eFILE_CORRUPTED,
00078         eFILE_NOT_OPENED,
00079         eFILE_NOT_CREATED,
00080         eOUT_OF_DISK_SPACE,
00081         eINVALID_DOCUMENT_HANDLE,
00082         eDOCUMENT_NOT_SUPPORTED,
00083         eUNIDENTIFIED_ERROR,
00084         eEMBEDDED_OUT_OF_SPACE,
00085         eERROR_COUNT
00086     } EError;
00087 
00091     enum KInfoRequest {
00092         eInfoExtension,         
00093         eInfoDescriptions,      
00094         eInfoVersions,          
00095         eInfoCompatibleDesc,    
00096         eInfoUILabel,           
00097         eReserved1 = 0xFBFB,
00098     };
00099     
00101     typedef KFbxWriter*             (*CreateFuncType)(KFbxSdkManager& pManager, KFbxExporter& pExporter, int pSubID, int pPluginID);
00102 
00104     typedef void                    (*IOSettingsFillerFuncType)(KFbxIOSettings& pIOS);
00105 
00107     typedef void*                   (*GetInfoFuncType)(KInfoRequest pRequest, int pWriterTypeId);
00108 
00112     virtual bool                    FileCreate(char* pFileName) = 0;
00113     
00116     virtual bool                    FileClose() = 0;
00117     
00120     virtual bool                    IsFileOpen() = 0;
00121 
00124     virtual void                    GetWriteOptions() = 0;
00125 
00129     virtual bool                    Write(KFbxDocument* pDocument) = 0;
00130 
00134     virtual bool                    PreprocessScene(KFbxScene &pScene) = 0;
00135 
00139     virtual bool                    PostprocessScene(KFbxScene &pScene) = 0;
00140 
00149     virtual void                    PluginWriteParameters(KFbxObject& pParams);
00150 
00155     virtual KFbxNode*               FindRootNode(KFbxScene& pScene);
00156 
00164     virtual bool                    CheckSpaceInNodeNameRecursive(KFbxNode* pNode, KString& pNodeNameList);
00165 
00169     bool                            SetFileExportVersion(KString pVersion);
00170  
00174     void                            SetRenamingMode(KFbxSceneRenamer::ERenamingMode pRenamingMode){mRenamingMode = pRenamingMode;}
00175 
00179     inline void                     SetResamplingRate(double pResamplingRate){mResamplingRate = pResamplingRate;}
00180 
00185     bool                            IsGenuine();
00186 
00190     KError&                         GetError();
00191 
00195     EError                          GetLastErrorID() const;
00196 
00200     const char*                     GetLastErrorString() const;
00201 
00205     void                            GetMessage(KString &pMessage) const;
00206 
00210     KString&                        GetMessage();
00211 
00214     void                            ClearMessage();
00215 
00220     virtual KFbxIOSettings * GetIOSettings();
00221 
00225     virtual void SetIOSettings(KFbxIOSettings * pIOSettings);
00226 
00230     virtual void SetProgressHandler(KFbxProgress *pProgress){}
00231 
00232 protected:
00234     void                            PluginsWriteBegin(KFbxScene& pScene);
00240     void                            PluginsWrite(KFbx& pFbx, bool pWriteObjectId);
00242     void                            PluginsWriteEnd(KFbxScene& pScene);
00243 
00244     KFbxWriter&                     operator=(KFbxWriter const&) { return *this; }
00245 
00246     KFbxSdkManager&                 mManager;
00247     KString                         mFileVersion;
00249     double                          mResamplingRate;
00251     KFbxSceneRenamer::ERenamingMode mRenamingMode;
00252 
00253 private:
00254     KError                          mError;
00255     KString                         mMessage;
00256     int                             mInternalID;
00257     KFbxIOSettings *                mIOSettings;
00258 
00259     friend struct KFbxWriterFbx7Impl;
00260 };
00261 
00263 #define IOS_REF (*GetIOSettings())
00264 
00265 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00266 
00267 #endif // FBXFILESDK_KFBXIO_KFBXWRITER_H
00268