kfbxwriter.h

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 (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 #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, // return a null terminated char const* const*
00104         eInfoDescriptions, // return a null terminated char const* const*
00105         eInfoVersions, // return a null terminated char const* const*
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