fbxwriter.h

Go to the documentation of this file.
00001 /****************************************************************************************
00002  
00003    Copyright (C) 2012 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 
00013 #ifndef _FBXSDK_FILEIO_WRITER_H_
00014 #define _FBXSDK_FILEIO_WRITER_H_
00015 
00016 #include <fbxsdk/fbxsdk_def.h>
00017 
00018 #include <fbxsdk/core/base/fbxerror.h>
00019 #include <fbxsdk/core/base/fbxstring.h>
00020 #include <fbxsdk/core/base/fbxarray.h>
00021 
00022 #include <fbxsdk/utils/fbxrenamingstrategy.h>
00023 
00024 #include <fbxsdk/fbxsdk_nsbegin.h>
00025 
00026 class FbxNode;
00027 class FbxDocument;
00028 class FbxScene;
00029 class FbxManager;
00030 class FbxExporter;
00031 class FbxIOSettings;
00032 class FbxObject;
00033 class FbxIO;
00034 class FbxProgress;
00035 class FbxStream;
00036 
00037 #define IOSP GetIOSettings()
00038 
00061 class FBXSDK_DLL FbxWriter
00062 {
00063 public:
00068     FbxWriter(FbxManager& pManager, int pID);
00070     virtual ~FbxWriter();
00071 
00074     enum EErrorCode
00075     {
00076         eFileCorrupted,
00077         eFileNotOpened,
00078         eFileNotCreated,
00079         eOutOfSpace,
00080         eInvalidDocumentHandle,
00081         eDocumentNotSupported,
00082         eUnknownError,
00083         eEmbeddedOutOfSpace,
00084         eErrorCount
00085     };
00086 
00090     enum EInfoRequest
00091     {
00092         eInfoExtension,         
00093         eInfoDescriptions,      
00094         eInfoVersions,          
00095         eInfoCompatibleDesc,    
00096         eInfoUILabel,           
00097         eReserved1 = 0xFBFB,
00098     };
00099     
00101     typedef FbxWriter*              (*CreateFuncType)(FbxManager& pManager, FbxExporter& pExporter, int pSubID, int pPluginID);
00102 
00104     typedef void                    (*IOSettingsFillerFuncType)(FbxIOSettings& pIOS);
00105 
00107     typedef void*                   (*GetInfoFuncType)(EInfoRequest pRequest, int pWriterTypeId);
00108 
00112     virtual bool                    FileCreate(char* pFileName) = 0;
00113 
00118     virtual bool                    FileCreate(FbxStream* pStream, void* pStreamData);
00119     
00122     virtual bool                    FileClose() = 0;
00123     
00126     virtual bool                    IsFileOpen() = 0;
00127 
00130     virtual void                    GetWriteOptions() = 0;
00131 
00135     virtual bool                    Write(FbxDocument* pDocument) = 0;
00136 
00140     virtual bool                    PreprocessScene(FbxScene &pScene) = 0;
00141 
00145     virtual bool                    PostprocessScene(FbxScene &pScene) = 0;
00146 
00155     virtual void                    PluginWriteParameters(FbxObject& pParams);
00156 
00161     virtual FbxNode*                FindRootNode(FbxScene& pScene);
00162 
00170     virtual bool                    CheckSpaceInNodeNameRecursive(FbxNode* pNode, FbxString& pNodeNameList);
00171 
00175     bool                            SetFileExportVersion(FbxString pVersion);
00176  
00180     void                            SetRenamingMode(FbxSceneRenamer::ERenamingMode pRenamingMode){mRenamingMode = pRenamingMode;}
00181 
00185     inline void                     SetResamplingRate(double pResamplingRate){mResamplingRate = pResamplingRate;}
00186 
00191     bool                            IsGenuine();
00192 
00196     FbxError&                           GetError();
00197 
00201     EErrorCode                          GetLastErrorID() const;
00202 
00206     const char*                     GetLastErrorString() const;
00207 
00211     void                            GetMessage(FbxString &pMessage) const;
00212 
00216     FbxString&                      GetMessage();
00217 
00220     void                            ClearMessage();
00221 
00226     virtual FbxIOSettings * GetIOSettings();
00227 
00231     virtual void SetIOSettings(FbxIOSettings * pIOSettings);
00232 
00236     virtual void SetProgressHandler(FbxProgress* /*pProgress*/){}
00237 
00239     virtual bool SupportsStreams() const;
00240 
00241 protected:
00243     void                            PluginsWriteBegin(FbxScene& pScene);
00249     void                            PluginsWrite(FbxIO& pFbx, bool pWriteObjectId);
00251     void                            PluginsWriteEnd(FbxScene& pScene);
00252 
00253     FbxWriter&                      operator=(FbxWriter const&) { return *this; }
00254 
00255     FbxManager&                 mManager;
00256     FbxString                           mFileVersion;
00258     double                          mResamplingRate;
00260     FbxSceneRenamer::ERenamingMode  mRenamingMode;
00261 
00262 private:
00263     FbxError                            mError;
00264     FbxString                       mMessage;
00265     int                             mInternalID;
00266     FbxIOSettings *                mIOSettings;
00267 
00268     friend struct FbxWriterFbx7_Impl;
00269 };
00270 
00272 #define IOS_REF (*GetIOSettings())
00273 
00274 #include <fbxsdk/fbxsdk_nsend.h>
00275 
00276 #endif /* _FBXSDK_FILEIO_WRITER_H_ */