FBX C++ API Reference
fbxmanager.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_CORE_MANAGER_H_
14 #define _FBXSDK_CORE_MANAGER_H_
15 
16 #include <fbxsdk/fbxsdk_def.h>
17 
18 #include <fbxsdk/core/fbxobject.h>
19 
20 #include <fbxsdk/fbxsdk_nsbegin.h>
21 
22 class FbxIOSettings;
24 class FbxAnimEvaluator;
25 class FbxSceneReference;
27 class FbxMessageEmitter;
28 class FbxLocalizationManager;
29 class FbxXRefManager;
30 class FbxManager_internal;
31 
32 #ifndef FBXSDK_ENV_WINSTORE
33  class FbxPlugin;
34 #endif
35 
57 {
58 public:
67  static FbxManager* Create();
68 
72  virtual void Destroy();
74 
83  static const char* GetVersion(bool pFull=true);
84 
90  static void GetFileFormatVersion(int& pMajor, int& pMinor, int& pRevision);
92 
93 
108  template <typename T1, typename T2> inline FbxClassId RegisterFbxClass(const char* pName, const T1* /*T1*/, const T2* /*T2*/, const char* pFbxFileTypeName=0, const char* pFbxFileSubTypeName=0)
109  {
110  T1::ClassId = Internal_RegisterFbxClass(pName, T2::ClassId, (FbxObjectCreateProc)T1::Allocate, pFbxFileTypeName, pFbxFileSubTypeName);
111  return T1::ClassId;
112  }
113 
123  template <typename T> inline FbxClassId RegisterRuntimeFbxClass(const char* pName, const T* /*T*/, const char* pFbxFileTypeName=0,const char* pFbxFileSubTypeName=0)
124  {
125  return Internal_RegisterFbxClass(pName, T::ClassId, (FbxObjectCreateProc)T::Allocate, pFbxFileTypeName, pFbxFileSubTypeName);
126  }
127 
131  inline void UnregisterRuntimeFbxClass(const char* pName)
132  {
133  FbxClassId lClassId = FindClass(pName);
134  if( !(lClassId == FbxClassId()) )
135  {
136  Internal_UnregisterFbxClass(lClassId);
137  }
138  }
139 
145  template <typename T1,typename T2> inline FbxClassId OverrideFbxClass(const T1* pFBX_TYPE_Class, const T2* pFBX_TYPE_OverridenClass)
146  {
147  T1::ClassId = Internal_OverrideFbxClass(T2::ClassId,(FbxObjectCreateProc)T1::Allocate );
148  return T1::ClassId;
149  }
150 
161  FbxObject* CreateNewObjectFromClassId(FbxClassId pClassId, const char* pName, FbxObject* pContainer=NULL, const FbxObject* pCloneFrom=NULL);
162 
166  FbxClassId FindClass(const char* pClassName) const;
167 
172  FbxClassId FindFbxFileClass(const char* pFbxFileTypeName, const char* pFbxFileSubTypeName) const;
173 
177  template <typename T> inline void UnregisterFbxClass(const T* pFBX_TYPE_Class)
178  {
179  Internal_UnregisterFbxClass(T::ClassId);
180  T::ClassId = FbxClassId();
181  }
183 
193  FbxDataType CreateDataType(const char* pName, const EFbxType pType);
194 
198  int GetDataTypeCount() const;
199 
204  FbxDataType& GetDataType(const int pIndex) const;
205 
210  FbxDataType& GetDataTypeFromName(const char* pDataType) const;
212 
221  FbxUserNotification* GetUserNotification() const;
222 
226  void SetUserNotification(FbxUserNotification* pUN);
228 
237  virtual FbxIOSettings* GetIOSettings() const;
238 
242  virtual void SetIOSettings(FbxIOSettings* pIOSettings);
244 
245 
253  FbxMessageEmitter& GetMessageEmitter();
258  bool SetMessageEmitter(FbxMessageEmitter* pMessageEmitter);
260 
261 
269  void AddLocalization(FbxLocalizationManager* pLocManager);
270 
274  void RemoveLocalization(FbxLocalizationManager* pLocManager);
275 
279  bool SetLocale(const char* pLocale);
280 
287  const char* Localize(const char* pID, const char* pDefault=NULL) const;
289 
297  FbxXRefManager& GetXRefManager();
299 
307  FbxLibrary* GetRootLibrary() const;
308  FbxLibrary* GetSystemLibraries() const;
309  FbxLibrary* GetUserLibraries() const;
311 
319  FbxIOPluginRegistry* GetIOPluginRegistry() const;
321 
326  #ifndef FBXSDK_ENV_WINSTORE
327 
332  bool LoadPluginsDirectory(const char* pFilename, const char* pExtensions=NULL);
333 
338  bool LoadPlugin(const char* pFilename);
339 
342  bool UnloadPlugins();
343 
347  bool EmitPluginsEvent(const FbxEventBase& pEvent);
348 
350  FbxArray<const FbxPlugin*> GetPlugins() const;
351 
355  int GetPluginCount() const;
356 
362  FbxPlugin* FindPlugin(const char* pName, const char* pVersion) const;
363  #endif /* !FBXSDK_ENV_WINSTORE */
364 
365 
366 
371  // Add IOSettings in hierarchy from different modules
372 
376  void FillIOSettingsForReadersRegistered(FbxIOSettings& pIOS);
377 
381  void FillIOSettingsForWritersRegistered(FbxIOSettings& pIOS);
382 
387  void FillCommonIOSettings(FbxIOSettings& pIOS, bool pImport);
389 
399  void RegisterObject(FbxObject* pObject);
400 
405  void UnregisterObject(FbxObject* pObject);
406 
411  void RegisterObjects(const FbxArray<FbxObject*>& pArray);
412 
417  void UnregisterObjects(const FbxArray<FbxObject*>& pArray);
418 
422  void IncreaseDestroyingSceneFlag();
427  void DecreaseDestroyingSceneFlag();
435  int GetReferenceCount() const;
436 
441  FbxSceneReference* GetReference(int pIndex) const;
442 
448  int AddReference(FbxSceneReference* pReference);
449 
455  bool RemoveReference(FbxSceneReference* pReference);
456 
462  bool ClearReference(FbxSceneReference* pReference);
464 
474  static FbxString PrefixName(const char* pPrefix, const char* pName);
475 
479  int GetDocumentCount();
480 
485  FbxDocument* GetDocument(int pIndex);
486 
487 /*****************************************************************************************************************************
488 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
489 *****************************************************************************************************************************/
490 #ifndef DOXYGEN_SHOULD_SKIP_THIS
491  static FbxManager* GetDefaultManager();
492  void CreateMissingBindPoses(FbxScene* pScene);
493  int GetBindPoseCount(FbxScene *pScene) const;
494  int GetFbxClassCount() const;
495  FbxClassId GetNextFbxClass(FbxClassId pClassId /* invalid id: first one */) const;
496 
497 protected:
498  FbxManager();
499  virtual ~FbxManager();
500 
501  void Clear();
502  void ClassInit();
503  void ClassRelease();
504  void DataTypeInit();
505  void DataTypeRelease();
506 
507 private:
508  bool CanAutoDestroySrcObject(FbxObject* pObject, FbxObject* pSrcObject, bool pRecursive) const;
509 
510  void Create_Common_Import_IOSettings_Groups(FbxIOSettings& pIOS);
511  void Create_Common_Export_IOSettings_Groups(FbxIOSettings& pIOS);
512  void Add_Common_Import_IOSettings(FbxIOSettings& pIOS);
513  void Add_Common_Export_IOSettings(FbxIOSettings& pIOS);
514  void Add_Common_RW_Import_IOSettings(FbxIOSettings& pIOS);
515  void Add_Common_RW_Export_IOSettings(FbxIOSettings& pIOS);
516 
517  FbxClassId Internal_RegisterFbxClass(const char* pClassName, FbxClassId pParentClassId, FbxObjectCreateProc=0, const char* pFbxFileTypeName=0, const char* pFbxFileSubTypeName=0);
518  bool Internal_RegisterFbxClass(FbxClassId pClassId);
519  FbxClassId Internal_OverrideFbxClass(FbxClassId pClassId, FbxObjectCreateProc=0);
520  void Internal_UnregisterFbxClass(FbxClassId pClassId);
521 
522  void RemoveObjectsOfType(const FbxClassId& pClassId);
523 
524  FbxAnimEvaluator* GetDefaultAnimationEvaluator();
525 
526  FbxArray<FbxObject*> mObjects;
527  FbxArray<FbxDocument*> mDocuments;
528 
529  FbxIOSettings* mIOSettings;
530  FbxIOPluginRegistry* mRegistry;
531  FbxUserNotification* mUserNotification;
532  FbxMessageEmitter* mMessageEmitter;
533  FbxArray<FbxLocalizationManager*> mLocalizationManagerArray;
534  FbxArray<FbxSceneReference*> mSceneReferenceArray;
535  FbxAnimEvaluator* mDefaultAnimationEvaluator;
536 
537  FbxArray<FbxObject*> mDestroyingObjects;
538  FbxArray<FbxDocument*> mDestroyingDocuments;
539  int mIsDestroyingScene;
540 
541  FbxManager_internal* mInternal;
542  static FbxManager* smDefaultManager;
543 
545  friend class FbxObject;
546  friend class FbxProperty; //For GetDefaultAnimationEvaluator()
547  friend class FbxNode; //For GetDefaultAnimationEvaluator()
548  friend class FbxScene; //For GetDefaultAnimationEvaluator()
549  friend class FbxAnimEvaluator; //For GetDefaultAnimationEvaluator()
550 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
551 };
552 
553 #include <fbxsdk/fbxsdk_nsend.h>
554 
555 #endif /* _FBXSDK_CORE_MANAGER_H_ */
This class serves as the registrar for file formats.
FBX SDK environment definition.
#define FBXSDK_FRIEND_NEW()
Definition: fbxnew.h:397
SDK object manager.
Definition: fbxmanager.h:56
Contains information about a referenced file.
Definition: fbxreference.h:25
#define NULL
Definition: fbxarch.h:210
void UnregisterFbxClass(const T *pFBX_TYPE_Class)
Class unregistration.
Definition: fbxmanager.h:177
Utility class to manipulate strings.
Definition: fbxstring.h:66
FbxDocument is a base class for FbxScene and FbxLibrary classes.
Definition: fbxdocument.h:46
FbxClassId RegisterFbxClass(const char *pName, const T1 *, const T2 *, const char *pFbxFileTypeName=0, const char *pFbxFileSubTypeName=0)
Class registration.
Definition: fbxmanager.h:108
FBX SDK data type class.
Definition: fbxdatatypes.h:26
This class accumulates user notifications and sends them to any device opened by the derived classes...
FbxObject *(* FbxObjectCreateProc)(FbxManager &pManager, const char *pName, const FbxObject *pFrom)
The function pointer type for object constructor functions.
Definition: fbxclassid.h:26
FbxIOSettings is a collection of properties, arranged as a tree, that can be used by FBX file readers...
The base class to inherit from when creating new plug-ins for the FBX SDK.
Definition: fbxplugin.h:148
FbxClassId OverrideFbxClass(const T1 *pFBX_TYPE_Class, const T2 *pFBX_TYPE_OverridenClass)
Override class.
Definition: fbxmanager.h:145
EFbxType
Type identifier constants.
void UnregisterRuntimeFbxClass(const char *pName)
Runtime class unregistration.
Definition: fbxmanager.h:131
The base class of most FBX objects.
Definition: fbxobject.h:157
Represents an element in the scene graph.
Definition: fbxnode.h:72
This class contains the description of a 3D scene.
Definition: fbxscene.h:61
FBX SDK event base class.
Definition: fbxevent.h:40
This class manages external references to files.
Definition: fbxxref.h:30
The principal interface for animation evaluators.
FbxClassId RegisterRuntimeFbxClass(const char *pName, const T *, const char *pFbxFileTypeName=0, const char *pFbxFileSubTypeName=0)
Runtime class registration.
Definition: fbxmanager.h:123
Internal class used to differentiate objects during run-time.
Definition: fbxclassid.h:39
Class to hold user properties.
Definition: fbxproperty.h:37
#define FBXSDK_DLL
Definition: fbxarch.h:173
This library class represents libraries that store sub-libraries and shading objects.
Definition: fbxlibrary.h:30
Class for array of basic elements such as pointers and basic types.
Definition: fbxarray.h:23