FBX SDK Reference Guide: kfbxwriter.h Source File
Go to the documentation of this file.
00001 
00004 #ifndef FBXFILESDK_KFBXIO_KFBXWRITER_H
00005 #define FBXFILESDK_KFBXIO_KFBXWRITER_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 #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 
00061 class KFBX_DLL KFbxWriter
00062 {
00063 public:
00064     KFbxWriter(KFbxSdkManager& pManager, int pID);
00065     virtual ~KFbxWriter();
00066 
00068     typedef enum
00069     {
00070         eFILE_CORRUPTED,
00071         eFILE_NOT_OPENED,
00072         eFILE_NOT_CREATED,
00073         eOUT_OF_DISK_SPACE,
00074         eSTREAM_OPTIONS_NOT_SET,
00075         eINVALID_DOCUMENT_HANDLE,
00076         eDOCUMENT_NOT_SUPPORTED,
00077         eUNIDENTIFIED_ERROR,
00078         eEMBEDDED_OUT_OF_SPACE,
00079         eERROR_COUNT
00080     } EError;
00081 
00082     enum KInfoRequest {
00083         eInfoExtension, // return a null terminated char const* const*
00084         eInfoDescriptions, // return a null terminated char const* const*
00085         eInfoVersions, // return a null terminated char const* const*
00086         eReserved1 = 0xFBFB,
00087     };
00088 
00089     typedef KFbxWriter*             (*CreateFuncType)(KFbxSdkManager& pManager, KFbxExporter& pExporter, int pSubID, int pPluginID);
00090     typedef void                    (*IOSettingsFillerFuncType)(KFbxIOSettings& pIOS);
00091     typedef void*                   (*GetInfoFuncType)(KInfoRequest pRequest, int pWriterTypeId);
00092 
00093     virtual bool                    FileCreate(char* pFileName) = 0;
00094     virtual bool                    FileClose() = 0;
00095     virtual bool                    IsFileOpen() = 0;
00096 
00097     virtual KFbxStreamOptions*      GetWriteOptions() = 0;
00098     virtual bool                    Write(KFbxDocument* pDocument, KFbxStreamOptions* pStreamOptions) = 0;
00099 
00100     virtual bool                    PreprocessScene(KFbxScene &pScene) = 0;
00101     virtual bool                    PostprocessScene(KFbxScene &pScene) = 0;
00102     virtual KFbxNode*               FindRootNode(KFbxScene& pScene);
00103     virtual bool                    CheckSpaceInNodeNameRecursive(KFbxNode* pNode, KString& pNodeNameList);
00104 
00105     virtual void                    PluginWriteSettings(KFbxObject& pSettings){}
00106 
00107     bool                            SetFileExportVersion(KString pVersion);
00108     void                            SetRenamingMode(KFbxSceneRenamer::ERenamingMode pRenamingMode){mRenamingMode = pRenamingMode;}
00109     inline void                     SetResamplingRate(double pResamplingRate){mResamplingRate = pResamplingRate;}
00110     bool                            IsGenuine();
00111 
00112     KError&                         GetError();
00113     EError                          GetLastErrorID() const;
00114     const char*                     GetLastErrorString() const;
00115     void                            GetMessage(KString &pMessage) const;
00116     KString&                        GetMessage();
00117     void                            ClearMessage();
00118 
00119 protected:
00120     void                            PluginsWriteBegin(KFbxScene& pScene);
00121     void                            PluginsWrite(KFbx& pFbx);
00122     void                            PluginsWriteEnd(KFbxScene& pScene);
00123 
00124     KFbxWriter&                     operator=(KFbxWriter const&) { return *this; }
00125 
00126     KFbxSdkManager&                 mManager;
00127     KString                         mFileVersion;
00128     double                          mResamplingRate;
00129     KFbxSceneRenamer::ERenamingMode mRenamingMode;
00130 
00131 private:
00132     KError                          mError;
00133     KString                         mMessage;
00134     int                             mInternalID;
00135 };
00136 
00137 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00138 
00139 #endif // FBXFILESDK_KFBXIO_KFBXWRITER_H
00140