FBX C++ API Reference
fbxexporter.h
Go to the documentation of this file.
1 /****************************************************************************************
2 
3  Copyright (C) 2019 Autodesk, Inc.
4  All rights reserved.
5 
6  Use of this software is subject to the terms of the Autodesk license agreement
7  provided at the time of installation or download, or which otherwise accompanies
8  this software in either electronic or hard copy form.
9 
10 ****************************************************************************************/
11 
13 #ifndef _FBXSDK_FILEIO_EXPORTER_H_
14 #define _FBXSDK_FILEIO_EXPORTER_H_
15 
16 #include <fbxsdk/fbxsdk_def.h>
17 
18 #include <fbxsdk/core/fbxevent.h>
24 
25 #include <fbxsdk/fbxsdk_nsbegin.h>
26 
27 class FbxIO;
29 class FbxThread;
30 class FbxWriter;
32 
33 struct FbxExportThreadArg;
34 
91 {
93 
94 public:
108  bool Initialize(const char* pFileName, int pFileFormat = -1, FbxIOSettings* pIOSettings = NULL) override;
109 
120  virtual bool Initialize(FbxStream* pStream, void* pStreamData=NULL, int pFileFormat = -1, FbxIOSettings * pIOSettings = NULL);
121 
125  bool GetExportOptions();
126 
130  FbxIOSettings* GetIOSettings();
131 
135  void SetIOSettings(FbxIOSettings* pIOSettings);
136 
137 
146  bool Export(FbxDocument* pDocument, bool pNonBlocking=false);
147 
148  #if !defined(FBXSDK_ENV_WINSTORE) && !defined(FBXSDK_ENV_EMSCRIPTEN)
149 
157  bool IsExporting(bool& pExportResult);
158  #endif /* !FBXSDK_ENV_WINSTORE && ! FBXSDK_ENV_EMSCRIPTEN */
159 
164  float GetProgress(FbxString* pStatus=NULL);
165 
170  void SetProgressCallback(FbxProgressCallback pCallback, void* pArgs=NULL);
171 
179  void SetEmbeddedFileWriteCallback(FbxEmbeddedFileCallback* pCallback);
180 
183  FbxEmbeddedFileCallback* GetEmbeddedFileWriteCallback();
185 
193  int GetFileFormat();
194 
197  bool IsFBX();
198 
217  char const* const* GetCurrentWritableVersions();
218 
224  bool SetFileExportVersion(FbxString pVersion, FbxSceneRenamer::ERenamingMode pRenamingMode=FbxSceneRenamer::eNone);
225 
229  inline void SetResamplingRate(double pResamplingRate){ mResamplingRate = pResamplingRate; }
230 
243  void SetDefaultRenderResolution(FbxString pCamName, FbxString pResolutionMode, double pW, double pH);
244 
248  FbxIOFileHeaderInfo* GetFileHeaderInfo();
250 
251 /*****************************************************************************************************************************
252 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
253 *****************************************************************************************************************************/
254 #ifndef DOXYGEN_SHOULD_SKIP_THIS
255  void TCSetDefinition(int pType);
256  bool GetExportOptions(FbxIO* pFbxObject);
257  bool Export(FbxDocument* pDocument, FbxIO* pFbxObject);
258 
259 protected:
260  void Construct(const FbxObject* pFrom) override;
261  void Destruct(bool pRecursive) override;
262  virtual void SetOrCreateIOSettings(FbxIOSettings* pIOSettings, bool pAllowNULL);
263 
264  void Reset();
265  bool FileCreate();
266  void FileClose();
267 
268 private:
269  bool ExportProcess(FbxDocument* pDocument);
270 
271  int mFileFormat;
272  FbxWriter* mWriter;
273 #if !defined(FBXSDK_ENV_WINSTORE) && !defined(FBXSDK_ENV_EMSCRIPTEN)
274  FbxThread* mExportThread;
275  FbxExportThreadArg* mExportThreadArg;
276  bool mExportThreadResult;
277  bool mIsThreadExporting;
278 #endif /* !FBXSDK_ENV_WINSTORE && !FBXSDK_ENV_EMSCRIPTEN */
279  FbxProgress mProgress;
280  FbxStream* mStream;
281  void* mStreamData;
282  FbxString mStrFileVersion;
283  double mResamplingRate;
284  FbxSceneRenamer::ERenamingMode mRenamingMode;
285  FbxIOFileHeaderInfo* mHeaderInfo;
286  FbxIOSettings* mIOSettings;
287  bool mClientIOSettings;
288  FbxEmbeddedFileCallback* mEmbeddedFileCallback;
289 
290  friend void ExportThread(void*);
291 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
292 };
293 
295 class FBXSDK_DLL FbxEventPreExport : public FbxEvent<FbxEventPreExport>
296 {
298 
299 public:
300  FbxEventPreExport(FbxDocument* pDocument) : mDocument(pDocument) {};
301 
303  FbxDocument* mDocument;
304 };
305 
307 class FBXSDK_DLL FbxEventPostExport : public FbxEvent<FbxEventPostExport>
308 {
310 
311 public:
312  FbxEventPostExport(FbxDocument* pDocument) : mDocument(pDocument) {};
313 
315  FbxDocument* mDocument;
316 };
317 
318 #include <fbxsdk/fbxsdk_nsend.h>
319 
320 #endif /* _FBXSDK_FILEIO_EXPORTER_H_ */
#define FBXSDK_OBJECT_DECLARE(Class, Parent)
Macro used to declare a new class derived from FbxObject.
Definition: fbxobject.h:61
Callback to operate on the embedded data while it is processed.
Definition: fbxcallbacks.h:166
FBX SDK environment definition.
Abstract class for implementing I/O operations through a stream of data.
Definition: fbxstream.h:26
#define NULL
Definition: fbxarch.h:213
Utility class to manipulate strings.
Definition: fbxstring.h:66
FbxDocument is a base class for FbxScene and FbxLibrary classes.
Definition: fbxdocument.h:46
FbxIOSettings is a collection of properties, arranged as a tree, that can be used by FBX file readers...
void SetResamplingRate(double pResamplingRate)
Set the resampling rate (only used when exporting to FBX 5.3 and lower)
Definition: fbxexporter.h:229
Base class for FBX file importer and exporter.
Definition: fbxiobase.h:28
Event that is emitted to plugins after a file is exported to the FBX format.
Definition: fbxexporter.h:307
The base class of most FBX objects.
Definition: fbxobject.h:157
virtual bool Initialize(const char *pFileName, int pFileFormat=-1, FbxIOSettings *pIOSettings=((void *) 0))
Initializes the object.
Class to export SDK objects into an FBX file.
Definition: fbxexporter.h:90
Base class of other writers used internally.
Definition: fbxwriter.h:59
virtual void Construct(const FbxObject *pFrom)
Optional constructor override, automatically called by default constructor.
Class for progress reporting.
Definition: fbxprogress.h:31
FBX header information used at beginning of the FBX file to get or set important values like the file...
Definition: fbxio.h:242
FbxIO represents an FBX file.
Definition: fbxio.h:347
#define FBXSDK_EVENT_DECLARE(Class)
Definition: fbxevent.h:68
Event that is emitted to plugins before a file is exported to the FBX format.
Definition: fbxexporter.h:295
#define FBXSDK_DLL
Definition: fbxarch.h:176
virtual void Destruct(bool pRecursive)
Optional destructor override, automatically called by default destructor.
This class implement a standard way to use threads across platforms.
Definition: fbxthread.h:29
bool(* FbxProgressCallback)(void *pArgs, float pPercentage, const char *pStatus)
Definition: fbxprogress.h:22
FBX event class, derived from FbxEventBase, and it contains a type ID for event.
Definition: fbxevent.h:134
ERenamingMode
The Mode describing from which format to which format.