fbxsdk/fileio/fbximporter.h Source File

fbximporter.h
Go to the documentation of this file.
1 /****************************************************************************************
2 
3  Copyright (C) 2015 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;
34 
35 struct FbxImportThreadArg;
36 
91 {
93 
94 public:
99 
110  virtual bool Initialize(const char* pFileName, int pFileFormat=-1, FbxIOSettings * pIOSettings=NULL);
111 
123  virtual bool Initialize(FbxStream* pStream, void* pStreamData=NULL, const int pFileFormat=-1, FbxIOSettings* pIOSettings=NULL);
124 
132  void GetFileVersion(int& pMajor, int& pMinor, int& pRevision);
133 
142  bool GetDefaultRenderResolution(FbxString& pCamName, FbxString& pResolutionMode, double& pW, double& pH);
143 
147  FbxIOFileHeaderInfo* GetFileHeaderInfo();
148 
154  {
155  eParseFile, // Parse the file
156  eDoNotParseFile // Do not parse the file (fast)
157  };
158 
164  bool GetImportOptions(EStreamOptionsGeneration pStreamOptionsGeneration = eParseFile);
165 
171  bool GetImportOptions(FbxIO* pFbxObject);
172 
184  bool Import(FbxDocument* pDocument, bool pNonBlocking=false);
185 
186 #if !defined(FBXSDK_ENV_WINSTORE) && !defined(FBXSDK_ENV_EMSCRIPTEN)
187 
195  bool IsImporting(bool& pImportResult);
196 #endif /* !FBXSDK_ENV_WINSTORE && !defined(FBXSDK_ENV_EMSCRIPTEN) */
197 
202  float GetProgress(FbxString* pStatus=NULL);
203 
208  void SetProgressCallback(FbxProgressCallback pCallback, void* pArgs=NULL);
209 
213  void SetEmbeddingExtractionFolder(const char* pExtractFolder);
214 
217  const char* GetEmbeddingExtractionFolder();
218 
222  FbxIOSettings* GetIOSettings();
223 
227  void SetIOSettings(FbxIOSettings* pIOSettings);
228 
233  void SetPassword(char* pPassword);
234 
240 
245  int GetAnimStackCount();
246 
253  FbxTakeInfo* GetTakeInfo(int pIndex);
254 
259  FbxString GetActiveAnimStackName();
260 
262 
267 
272  FbxDocumentInfo* GetSceneInfo();
273 
275 
279 
288  int GetFileFormat ();
289 
292  bool IsFBX();
294 
295 /*****************************************************************************************************************************
296 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
297 *****************************************************************************************************************************/
298 #ifndef DOXYGEN_SHOULD_SKIP_THIS
299  FbxFile* GetFile();
300  FbxStream* GetStream();
301  void* GetStreamData();
302 
303  void ParseForGlobalSettings(bool pState);
304  void ParseForStatistics(bool pState);
305  bool GetAxisInfo(FbxAxisSystem* pAxisSystem, FbxSystemUnit* pSystemUnits);
306  bool GetStatistics(FbxStatistics* pStatistics);
307  bool GetFrameRate(FbxTime::EMode &pTimeMode);
308 
309 protected:
310  virtual void Construct(const FbxObject* pFrom);
311  virtual void Destruct(bool pRecursive);
312  virtual void SetOrCreateIOSettings(FbxIOSettings* pIOSettings, bool pAllowNULL);
313 
314  void Reset();
315  bool FileOpen(FbxFile* pFile = NULL);
316  bool FileOpen(FbxStream* pStream, void* pStreamData);
317  void FileClose();
318 
319  void GetImportOptionsInfo();
320  bool IsNativeExtension ();
321 
322  //These two internal functions are only used to read old character pose data
323  bool Initialize(FbxFile* pFile, const int pFileFormat=-1, FbxIOSettings* pIOSettings=NULL);
324  bool Import(FbxDocument* pDocument, FbxIO* pFbxObject);
325 
326 private:
327  bool ImportProcess(FbxDocument* pDocument);
328 
329  int mFileFormat;
330  FbxReader* mReader;
331  FbxString mExtractFolder;
332  bool mParseForGlobalSettings;
333  FbxAxisSystem mAxisSystem;
334  FbxSystemUnit mSystemUnits;
335  FbxTime::EMode mFrameRate;
336  bool mParseForStatistics;
337  FbxStatistics mStatistics;
338 #if !defined(FBXSDK_ENV_WINSTORE) && !defined(FBXSDK_ENV_EMSCRIPTEN)
339  FbxThread* mImportThread;
340  FbxImportThreadArg* mImportThreadArg;
341  bool mImportThreadResult;
342  bool mIsThreadImporting;
343 #endif /* !FBXSDK_ENV_WINSTORE && !defined(FBXSDK_ENV_EMSCRIPTEN) */
344  FbxProgress mProgress;
345  FbxFile* mFile;
346  FbxStream* mStream;
347  void* mStreamData;
348  bool mImportOptionsDone;
349  FbxArray<FbxTakeInfo*> mTakeInfo;
350  FbxDocumentInfo* mSceneInfo;
351  FbxString mActiveAnimStackName;
352  int mMajorVersion;
353  int mMinorVersion;
354  int mRevisionVersion;
355  FbxIOFileHeaderInfo* mHeaderInfo;
356  FbxIOSettings* mIOSettings;
357  bool mClientIOSettings;
358 
359  //For Initialize and Import
360  friend class FbxReaderFbx5;
361  friend class FbxReaderFbx6;
362  friend struct FbxReaderFbx7_Impl;
363 
364  friend void ImportThread(void*);
365 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
366 };
367 
369 class FBXSDK_DLL FbxEventPreImport : public FbxEvent<FbxEventPreImport>
370 {
372 public:
373  inline FbxEventPreImport( FbxDocument* pDocument ) : mDocument(pDocument) {};
374 
376  FbxDocument* mDocument;
377 };
378 
380 class FBXSDK_DLL FbxEventPostImport : public FbxEvent<FbxEventPostImport>
381 {
383 public:
384  inline FbxEventPostImport( FbxDocument* pDocument ) : mDocument(pDocument) {};
385 
387  FbxDocument* mDocument;
388 };
389 
390 #include <fbxsdk/fbxsdk_nsend.h>
391 
392 #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
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:210
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:64
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:90
Class for progress reporting.
Definition: fbxprogress.h:31
EStreamOptionsGeneration
Stream options identifiers.
Definition: fbximporter.h:153
FBX header information used at beginning of the FBX file to get or set important values like the file...
Definition: fbxio.h:223
FbxIO represents an FBX file.
Definition: fbxio.h:324
#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:173
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:369
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:380
Class to import an FBX file into SDK objects.
Definition: fbximporter.h:90