00001 
00004 #ifndef FBXFILESDK_KFBXIO_KFBXWRITER_H
00005 #define FBXFILESDK_KFBXIO_KFBXWRITER_H
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 
00040 
00041 
00042 #include <fbxfilesdk/components/kbaselib/kaydaradef_h.h>
00043 #include <fbxfilesdk/components/kbaselib/klib/kerror.h>
00044 #include <fbxfilesdk/components/kbaselib/klib/kstring.h>
00045 #include <fbxfilesdk/components/kbaselib/klib/karrayul.h>
00046 
00047 #include <fbxfilesdk/components/kbaselib/kbaselib_forward.h>
00048 #include <fbxfilesdk/kfbxplugins/kfbxrenamingstrategy.h>
00049 
00050 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00051 
00052 class KFbxNode;
00053 class KFbxDocument;
00054 class KFbxScene;
00055 class KFbxSdkManager;
00056 class KFbxExporter;
00057 class KFbxStreamOptions;
00058 class KFbxIOSettings;
00059 class KFbxObject;
00060 
00064 class KFBX_DLL KFbxWriter
00065 {
00066 public:
00071     KFbxWriter(KFbxSdkManager& pManager, int pID);
00074     virtual ~KFbxWriter();
00075 
00088     typedef enum
00089     {
00090         eFILE_CORRUPTED,
00091         eFILE_NOT_OPENED,
00092         eFILE_NOT_CREATED,
00093         eOUT_OF_DISK_SPACE,
00094         eSTREAM_OPTIONS_NOT_SET,
00095         eINVALID_DOCUMENT_HANDLE,
00096         eDOCUMENT_NOT_SUPPORTED,
00097         eUNIDENTIFIED_ERROR,
00098         eEMBEDDED_OUT_OF_SPACE,
00099         eERROR_COUNT
00100     } EError;
00101 
00102     enum KInfoRequest {
00103         eInfoExtension, 
00104         eInfoDescriptions, 
00105         eInfoVersions, 
00106         eReserved1 = 0xFBFB,
00107     };
00108 
00109     typedef KFbxWriter*             (*CreateFuncType)(KFbxSdkManager& pManager, KFbxExporter& pExporter, int pSubID, int pPluginID);
00110     typedef void                    (*IOSettingsFillerFuncType)(KFbxIOSettings& pIOS);
00111     typedef void*                   (*GetInfoFuncType)(KInfoRequest pRequest, int pWriterTypeId);
00112 
00116     virtual bool                    FileCreate(char* pFileName) = 0;
00118     virtual bool                    FileClose() = 0;
00120     virtual bool                    IsFileOpen() = 0;
00122     virtual KFbxStreamOptions*      GetWriteOptions() = 0;
00123 
00128     virtual bool                    Write(KFbxDocument* pDocument, KFbxStreamOptions* pStreamOptions) = 0;
00129 
00133     virtual bool                    PreprocessScene(KFbxScene &pScene) = 0;
00134 
00138     virtual bool                    PostprocessScene(KFbxScene &pScene) = 0;
00139 
00144     virtual KFbxNode*               FindRootNode(KFbxScene& pScene);
00145 
00153     virtual bool                    CheckSpaceInNodeNameRecursive(KFbxNode* pNode, KString& pNodeNameList);
00154 
00158     virtual void                    PluginWriteParameters(KFbxObject& pParams){}
00159 
00163     bool                            SetFileExportVersion(KString pVersion);
00164  
00168     void                            SetRenamingMode(KFbxSceneRenamer::ERenamingMode pRenamingMode){mRenamingMode = pRenamingMode;}
00169 
00173     inline void                     SetResamplingRate(double pResamplingRate){mResamplingRate = pResamplingRate;}
00174 
00178     bool                            IsGenuine();
00179 
00183     KError&                         GetError();
00184 
00188     EError                          GetLastErrorID() const;
00189 
00193     const char*                     GetLastErrorString() const;
00194 
00198     void                            GetMessage(KString &pMessage) const;
00199 
00203     KString&                        GetMessage();
00204 
00207     void                            ClearMessage();
00208 
00209 protected:
00210     void                            PluginsWriteBegin(KFbxScene& pScene);
00211     void                            PluginsWrite(KFbx& pFbx);
00212     void                            PluginsWriteEnd(KFbxScene& pScene);
00213 
00214     KFbxWriter&                     operator=(KFbxWriter const&) { return *this; }
00215 
00216     KFbxSdkManager&                 mManager;
00217     KString                         mFileVersion;
00218     double                          mResamplingRate;
00219     KFbxSceneRenamer::ERenamingMode mRenamingMode;
00220 
00221 private:
00222     KError                          mError;
00223     KString                         mMessage;
00224     int                             mInternalID;
00225 };
00226 
00227 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00228 
00229 #endif // FBXFILESDK_KFBXIO_KFBXWRITER_H
00230