FBX C++ API Reference
fbxlibrary.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_SCENE_LIBRARY_H_
14 #define _FBXSDK_SCENE_LIBRARY_H_
15 
16 #include <fbxsdk/fbxsdk_def.h>
17 
20 
21 #include <fbxsdk/fbxsdk_nsbegin.h>
22 
23 class FbxLocalizationManager;
24 class FbxCriteria;
25 
31 {
33 
34 public:
36  FbxLibrary* GetParentLibrary(void) const;
37 
41  void SystemLibrary(bool pSystemLibrary);
42 
44  bool IsSystemLibrary() const;
45 
53  void LocalizationBaseNamePrefix(const char* pPrefix);
54 
56  FbxString LocalizationBaseNamePrefix() const;
57 
58  // =======================================================================
59  //
60  // sub-library
61  //
62  // =======================================================================
63 
68  bool AddSubLibrary(FbxLibrary* pSubLibrary);
69 
74  bool RemoveSubLibrary(FbxLibrary* pSubLibrary);
75 
77  int GetSubLibraryCount(void) const;
78 
82  FbxLibrary* GetSubLibrary(int pIndex) const;
83 
89  FbxObject* CloneAsset( FbxObject* pToClone, FbxObject* pOptionalDestinationContainer = NULL) const;
90 
91 
98  static FbxCriteria GetAssetCriteriaFilter();
99 
105  static FbxCriteria GetAssetDependentsFilter();
106 
131  bool ImportAssets(FbxLibrary* pSrcLibrary);
132 
158  bool ImportAssets(FbxLibrary* pSrcLibrary, const FbxCriteria& pAssetFilter);
159 
160 
169  template < class T > T* InstantiateMember( const T* pFBX_TYPE, const FbxObjectFilter& pFilter, bool pRecurse = true, FbxObject* pOptContainer = NULL);
170 
171 
172  // =======================================================================
173  //
174  // Localization
175  //
176  // =======================================================================
180  FbxLocalizationManager& GetLocalizationManager() const;
181 
188  virtual const char* Localize( const char* pID, const char* pDefault = NULL ) const;
189 
190  // =======================================================================
191  //
192  // Shading Object
193  //
194  // =======================================================================
195 
199  bool AddShadingObject(FbxObject* pShadingObject);
200 
204  bool RemoveShadingObject(FbxObject* pShadingObject);
205 
207  int GetShadingObjectCount(void) const;
208 
213  FbxObject* GetShadingObject(int pIndex) const;
214 
220  int GetShadingObjectCount(const FbxImplementationFilter& pCriteria) const;
221 
228  FbxObject* GetShadingObject(int pIndex, const FbxImplementationFilter& pCriteria) const;
229 
230 /*****************************************************************************************************************************
231 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
232 *****************************************************************************************************************************/
233 #ifndef DOXYGEN_SHOULD_SKIP_THIS
234 protected:
235  virtual void Construct(const FbxObject* pFrom);
236  virtual void Destruct(bool pRecursive);
237 
238  mutable FbxLocalizationManager* mLocalizationManager;
239 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
240 };
241 
242 /*****************************************************************************************************************************
243 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
244 *****************************************************************************************************************************/
245 #ifndef DOXYGEN_SHOULD_SKIP_THIS
246 
247 template <class T> T* FbxLibrary::InstantiateMember(const T* pFBX_TYPE, const FbxObjectFilter& pFilter, bool pRecurse, FbxObject* pOptContainer)
248 {
249  //First check all materials in the library.
250  for( int i = 0; i < GetMemberCount<T>(); ++i )
251  {
252  T* lObject = GetMember<T>(i);
253  if( pFilter.Match(lObject) )
254  return FbxCast<T>(CloneAsset(lObject,pOptContainer));
255  }
256 
257  if( pRecurse )
258  {
259  // then check all materials in each sub-library.
260  for( int i = 0; i < GetMemberCount<FbxLibrary>(); ++i )
261  {
262  FbxLibrary* lLibrary = GetMember<FbxLibrary>(i);
263  T* lClonedObject = lLibrary->InstantiateMember(pFBX_TYPE, pFilter, pRecurse, pOptContainer);
264  if( lClonedObject )
265  return lClonedObject;
266  }
267  }
268 
269  return NULL;
270 }
271 
272 class FBXSDK_DLL FbxEventPopulateSystemLibrary : public FbxEvent<FbxEventPopulateSystemLibrary>
273 {
274  FBXSDK_EVENT_DECLARE(FbxEventPopulateSystemLibrary)
275 
276 public:
277  FbxEventPopulateSystemLibrary(FbxLibrary* pLibrary) { mLibrary = pLibrary; }
278  inline FbxLibrary* GetLibrary() const { return mLibrary; }
279 
280 private:
281  FbxLibrary* mLibrary;
282 };
283 
284 class FBXSDK_DLL FbxEventUpdateSystemLibrary : public FbxEvent<FbxEventUpdateSystemLibrary>
285 {
286  FBXSDK_EVENT_DECLARE(FbxEventUpdateSystemLibrary)
287 
288 public:
289  FbxEventUpdateSystemLibrary(FbxLibrary *pLibrary) { mLibrary = pLibrary; }
290  inline FbxLibrary* GetLibrary() const { return mLibrary; }
291 
292 private:
293  FbxLibrary* mLibrary;
294 };
295 
296 class FBXSDK_DLL FbxEventWriteLocalization : public FbxEvent<FbxEventWriteLocalization>
297 {
298  FBXSDK_EVENT_DECLARE(FbxEventWriteLocalization)
299 
300 public:
301  FbxEventWriteLocalization(FbxLibrary* pAssetLibrary) { mAssetLibrary = pAssetLibrary; }
302  inline FbxLibrary* GetLibrary() const { return mAssetLibrary; }
303 
304 private:
305  FbxLibrary* mAssetLibrary;
306 };
307 
308 class FBXSDK_DLL FbxEventMapAssetFileToAssetObject : public FbxEvent<FbxEventMapAssetFileToAssetObject>
309 {
310  FBXSDK_EVENT_DECLARE(FbxEventMapAssetFileToAssetObject)
311 
312 public:
313  FbxEventMapAssetFileToAssetObject(const char* pFile) :
314  mAsset(NULL),
315  mFilePath( pFile )
316  {
317  }
318 
319  inline const char* GetFilePath() const { return mFilePath; }
320  mutable FbxObject* mAsset;
321 
322 private:
323  FbxString mFilePath;
324 };
325 
326 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
327 
328 #include <fbxsdk/fbxsdk_nsend.h>
329 
330 #endif /* _FBXSDK_SCENE_LIBRARY_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.
virtual bool Match(const FbxObject *pObjectPtr) const =0
Tells if this filter match the given object.
This object represents a filter criteria on an object.
#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
virtual const char * Localize(const char *pID, const char *pDefault=((void *) 0)) const
Localization helper function, it calls the implementation of FBX SDK manager.
FbxLibrary * GetParentLibrary() const
Returns a handle on the parent library of this object.
The base class of most FBX objects.
Definition: fbxobject.h:157
This object represents a shading node filter criteria based on the shading node implementation.
T * InstantiateMember(const T *pFBX_TYPE, const FbxObjectFilter &pFilter, bool pRecurse=true, FbxObject *pOptContainer=((void *) 0))
Returns a new instance of a library member.
virtual void Construct(const FbxObject *pFrom)
Optional constructor override, automatically called by default constructor.
Defines a filtering criteria for a query of objects, connections and properties, so that only those s...
Definition: fbxquery.h:104
#define FBXSDK_EVENT_DECLARE(Class)
Definition: fbxevent.h:68
#define FBXSDK_DLL
Definition: fbxarch.h:173
This library class represents libraries that store sub-libraries and shading objects.
Definition: fbxlibrary.h:30
virtual void Destruct(bool pRecursive)
Optional destructor override, automatically called by default destructor.
FBX event class, derived from FbxEventBase, and it contains a type ID for event.
Definition: fbxevent.h:134