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 - 2010 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 #include <fbxfilesdk/fbxfilesdk_def.h>
00042 
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/kfbxplugins/kfbxrenamingstrategy.h>
00048 
00049 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00050 
00051 class KFbxNode;
00052 class KFbxDocument;
00053 class KFbxScene;
00054 class KFbxSdkManager;
00055 class KFbxExporter;
00056 class KFbxIOSettings;
00057 class KFbxObject;
00058 class KFbx;
00059 class KFbxProgress;
00060 
00061 #define IOSP GetIOSettings()
00062 
00085 class KFBX_DLL KFbxWriter
00086 {
00087 public:
00092     KFbxWriter(KFbxSdkManager& pManager, int pID);
00095     virtual ~KFbxWriter();
00096 
00108     typedef enum
00109     {
00110         eFILE_CORRUPTED,
00111         eFILE_NOT_OPENED,
00112         eFILE_NOT_CREATED,
00113         eOUT_OF_DISK_SPACE,
00114         eINVALID_DOCUMENT_HANDLE,
00115         eDOCUMENT_NOT_SUPPORTED,
00116         eUNIDENTIFIED_ERROR,
00117         eEMBEDDED_OUT_OF_SPACE,
00118         eERROR_COUNT
00119     } EError;
00120 
00130     enum KInfoRequest {
00131         eInfoExtension,      
00132         eInfoDescriptions,   
00133         eInfoVersions,       
00134         eInfoCompatibleDesc, 
00135         eInfoUILabel,        
00136         eReserved1 = 0xFBFB,
00137     };
00138     
00140     typedef KFbxWriter*             (*CreateFuncType)(KFbxSdkManager& pManager, KFbxExporter& pExporter, int pSubID, int pPluginID);
00141 
00143     typedef void                    (*IOSettingsFillerFuncType)(KFbxIOSettings& pIOS);
00144 
00146     typedef void*                   (*GetInfoFuncType)(KInfoRequest pRequest, int pWriterTypeId);
00147 
00151     virtual bool                    FileCreate(char* pFileName) = 0;
00152     
00155     virtual bool                    FileClose() = 0;
00156     
00159     virtual bool                    IsFileOpen() = 0;
00160 
00163     virtual void                    GetWriteOptions() = 0;
00164 
00168     virtual bool                    Write(KFbxDocument* pDocument) = 0;
00169 
00173     virtual bool                    PreprocessScene(KFbxScene &pScene) = 0;
00174 
00178     virtual bool                    PostprocessScene(KFbxScene &pScene) = 0;
00179 
00188     virtual void                    PluginWriteParameters(KFbxObject& pParams);
00189 
00194     virtual KFbxNode*               FindRootNode(KFbxScene& pScene);
00195 
00203     virtual bool                    CheckSpaceInNodeNameRecursive(KFbxNode* pNode, KString& pNodeNameList);
00204 
00208     bool                            SetFileExportVersion(KString pVersion);
00209  
00213     void                            SetRenamingMode(KFbxSceneRenamer::ERenamingMode pRenamingMode){mRenamingMode = pRenamingMode;}
00214 
00218     inline void                     SetResamplingRate(double pResamplingRate){mResamplingRate = pResamplingRate;}
00219 
00224     bool                            IsGenuine();
00225 
00229     KError&                         GetError();
00230 
00234     EError                          GetLastErrorID() const;
00235 
00239     const char*                     GetLastErrorString() const;
00240 
00244     void                            GetMessage(KString &pMessage) const;
00245 
00249     KString&                        GetMessage();
00250 
00253     void                            ClearMessage();
00254 
00259     virtual KFbxIOSettings * GetIOSettings();
00260 
00264     virtual void SetIOSettings(KFbxIOSettings * pIOSettings);
00265 
00269     virtual void SetProgressHandler(KFbxProgress *pProgress){}
00270 
00271 protected:
00272     void                            PluginsWriteBegin(KFbxScene& pScene);
00273     void                            PluginsWrite(KFbx& pFbx, bool pWriteObjectId);
00274     void                            PluginsWriteEnd(KFbxScene& pScene);
00275 
00276     KFbxWriter&                     operator=(KFbxWriter const&) { return *this; }
00277 
00278     KFbxSdkManager&                 mManager;
00279     KString                         mFileVersion;
00280     double                          mResamplingRate;
00281     KFbxSceneRenamer::ERenamingMode mRenamingMode;
00282 
00283 private:
00284     KError                          mError;
00285     KString                         mMessage;
00286     int                             mInternalID;
00287     KFbxIOSettings *                mIOSettings;
00288 
00289     friend struct KFbxWriterFbx7Impl;
00290 };
00291 
00293 #define IOS_REF (*GetIOSettings())
00294 
00295 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00296 
00297 #endif // FBXFILESDK_KFBXIO_KFBXWRITER_H
00298