FBX C++ API Reference
fbximporter.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_IMPORTER_H_
14 #define _FBXSDK_FILEIO_IMPORTER_H_
15 
16 #include <fbxsdk/fbxsdk_def.h>
17 
25 
26 #include <fbxsdk/fbxsdk_nsbegin.h>
27 
28 class FbxIO;
30 class FbxDocumentInfo;
31 class FbxTakeInfo;
32 class FbxReader;
33 class FbxThread;
35 
36 struct FbxImportThreadArg;
37 
92 {
94 
95 public:
100 
111  bool Initialize(const char* pFileName, int pFileFormat=-1, FbxIOSettings * pIOSettings=NULL) override;
112 
124  virtual bool Initialize(FbxStream* pStream, void* pStreamData=NULL, const int pFileFormat=-1, FbxIOSettings* pIOSettings=NULL);
125 
133  void GetFileVersion(int& pMajor, int& pMinor, int& pRevision);
134 
143  bool GetDefaultRenderResolution(FbxString& pCamName, FbxString& pResolutionMode, double& pW, double& pH);
144 
148  FbxIOFileHeaderInfo* GetFileHeaderInfo();
149 
155  {
156  eParseFile, // Parse the file
157  eDoNotParseFile // Do not parse the file (fast)
158  };
159 
165  bool GetImportOptions(EStreamOptionsGeneration pStreamOptionsGeneration = eParseFile);
166 
172  bool GetImportOptions(FbxIO* pFbxObject);
173 
185  bool Import(FbxDocument* pDocument, bool pNonBlocking=false);
186 
187 #if !defined(FBXSDK_ENV_WINSTORE) && !defined(FBXSDK_ENV_EMSCRIPTEN)
188 
196  bool IsImporting(bool& pImportResult);
197 #endif /* !FBXSDK_ENV_WINSTORE && !defined(FBXSDK_ENV_EMSCRIPTEN) */
198 
203  float GetProgress(FbxString* pStatus=NULL);
204 
209  void SetProgressCallback(FbxProgressCallback pCallback, void* pArgs=NULL);
210 
214  void SetEmbeddingExtractionFolder(const char* pExtractFolder);
215 
218  const char* GetEmbeddingExtractionFolder();
219 
227  void SetEmbeddedFileReadCallback(FbxEmbeddedFileCallback* pCallback);
228 
231  FbxEmbeddedFileCallback* GetEmbeddedFileReadCallback();
232 
236  FbxIOSettings* GetIOSettings();
237 
241  void SetIOSettings(FbxIOSettings* pIOSettings);
242 
247  void SetPassword(char* pPassword);
248 
254 
259  int GetAnimStackCount();
260 
267  FbxTakeInfo* GetTakeInfo(int pIndex);
268 
273  FbxString GetActiveAnimStackName();
274 
276 
281 
286  FbxDocumentInfo* GetSceneInfo();
287 
289 
293 
302  int GetFileFormat ();
303 
306  bool IsFBX();
308 
309 /*****************************************************************************************************************************
310 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
311 *****************************************************************************************************************************/
312 #ifndef DOXYGEN_SHOULD_SKIP_THIS
313  FbxFile* GetFile();
314  FbxStream* GetStream();
315  void* GetStreamData();
316 
317  void ParseForGlobalSettings(bool pState);
318  void ParseForStatistics(bool pState);
319  bool GetAxisInfo(FbxAxisSystem* pAxisSystem, FbxSystemUnit* pSystemUnits);
320  bool GetStatistics(FbxStatistics* pStatistics);
321  bool GetFrameRate(FbxTime::EMode &pTimeMode);
322 
323 protected:
324  void Construct(const FbxObject* pFrom) override;
325  void Destruct(bool pRecursive) override;
326  virtual void SetOrCreateIOSettings(FbxIOSettings* pIOSettings, bool pAllowNULL);
327 
328  void Reset();
329  bool FileOpen(FbxFile* pFile = NULL);
330  bool FileOpen(FbxStream* pStream, void* pStreamData);
331  void FileClose();
332 
333  void GetImportOptionsInfo();
334  bool IsNativeExtension ();
335 
336  //These two internal functions are only used to read old character pose data
337 public:
338  bool Initialize(FbxFile* pFile, const int pFileFormat=-1, FbxIOSettings* pIOSettings=NULL);
339  bool Import(FbxDocument* pDocument, FbxIO* pFbxObject);
340 
341 private:
342  bool ImportProcess(FbxDocument* pDocument);
343 
344  int mFileFormat;
345  FbxReader* mReader;
346  FbxString mExtractFolder;
347  bool mParseForGlobalSettings;
348  FbxAxisSystem mAxisSystem;
349  FbxSystemUnit mSystemUnits;
350  FbxTime::EMode mFrameRate;
351  bool mParseForStatistics;
352  FbxStatistics mStatistics;
353 #if !defined(FBXSDK_ENV_WINSTORE) && !defined(FBXSDK_ENV_EMSCRIPTEN)
354  FbxThread* mImportThread;
355  FbxImportThreadArg* mImportThreadArg;
356  bool mImportThreadResult;
357  bool mIsThreadImporting;
358 #endif /* !FBXSDK_ENV_WINSTORE && !defined(FBXSDK_ENV_EMSCRIPTEN) */
359  FbxProgress mProgress;
360  FbxFile* mFile;
361  FbxStream* mStream;
362  void* mStreamData;
363  bool mImportOptionsDone;
364  FbxArray<FbxTakeInfo*> mTakeInfo;
365  FbxDocumentInfo* mSceneInfo;
366  FbxString mActiveAnimStackName;
367  int mMajorVersion;
368  int mMinorVersion;
369  int mRevisionVersion;
370  FbxIOFileHeaderInfo* mHeaderInfo;
371  FbxIOSettings* mIOSettings;
372  bool mClientIOSettings;
373 
374  FbxEmbeddedFileCallback* mEmbeddedFileCallbackObj;
375 
376  //For Initialize and Import
377  friend class FbxReaderFbx5;
378  friend class FbxReaderFbx6;
379  friend struct FbxReaderFbx7_Impl;
380 
381  friend void ImportThread(void*);
382 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
383 };
384 
386 class FBXSDK_DLL FbxEventPreImport : public FbxEvent<FbxEventPreImport>
387 {
389 public:
390  inline FbxEventPreImport( FbxDocument* pDocument ) : mDocument(pDocument) {};
391 
393  FbxDocument* mDocument;
394 };
395 
397 class FBXSDK_DLL FbxEventPostImport : public FbxEvent<FbxEventPostImport>
398 {
400 public:
401  inline FbxEventPostImport( FbxDocument* pDocument ) : mDocument(pDocument) {};
402 
404  FbxDocument* mDocument;
405 };
406 
407 #include <fbxsdk/fbxsdk_nsend.h>
408 
409 #endif /* _FBXSDK_FILEIO_IMPORTER_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.
This class represents the coordinate system of the scene and can convert scenes to other coordinate s...
Definition: fbxaxissystem.h:97
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
This class is a basic class to get the quantity of items.
Definition: fbxstatistics.h:62
Base class of other readers used internally.
Definition: fbxreader.h:65
FbxIOSettings is a collection of properties, arranged as a tree, that can be used by FBX file readers...
This class contains scene thumbnails and user-defined summary data.
Base class for FBX file importer and exporter.
Definition: fbxiobase.h:28
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.
virtual void Construct(const FbxObject *pFrom)
Optional constructor override, automatically called by default constructor.
EMode
Time modes.
Definition: fbxtime.h:91
Class for progress reporting.
Definition: fbxprogress.h:31
EStreamOptionsGeneration
Stream options identifiers.
Definition: fbximporter.h:154
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
This class describes the units of measurement used within a particular scene.
Definition: fbxsystemunit.h:31
This class contains take information from an imported file or exported to an output file...
Definition: fbxtakeinfo.h:56
#define FBXSDK_DLL
Definition: fbxarch.h:176
Class for interfacing with files, providing a similar interface for files independant of the OS or fi...
Definition: fbxfile.h:27
virtual void Destruct(bool pRecursive)
Optional destructor override, automatically called by default destructor.
This class is the FBX v6 reader.
Definition: fbxreaderfbx6.h:82
Event that is emitted to plugins before a FBX file has been imported.
Definition: fbximporter.h:386
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
Event that is emitted to plugins after a FBX file has been imported.
Definition: fbximporter.h:397
Class to import an FBX file into SDK objects.
Definition: fbximporter.h:91