00001
00004 #ifndef FBXFILESDK_KFBXPLUGINS_KFBXLIBRARY_H
00005 #define FBXFILESDK_KFBXPLUGINS_KFBXLIBRARY_H
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 #include <fbxfilesdk/components/kbaselib/kaydaradef_h.h>
00042 #include <fbxfilesdk/fbxcore/fbxcollection/kfbxdocument.h>
00043 #include <fbxfilesdk/kfbxplugins/kfbxobjectfilter.h>
00044
00045 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00046
00047 class KFbxLocalizationManager;
00048 class KFbxCriteria;
00049
00053 class KFBX_DLL KFbxLibrary : public KFbxDocument
00054 {
00055 KFBXOBJECT_DECLARE(KFbxLibrary,KFbxDocument);
00056
00057 public:
00058
00060 KFbxLibrary* GetParentLibrary(void) const;
00061
00062 void SystemLibrary(bool pSystemLibrary);
00063 bool IsSystemLibrary() const;
00064
00076 void LocalizationBaseNamePrefix(const char* pPrefix);
00078 KString LocalizationBaseNamePrefix() const;
00079
00080
00081
00082
00083
00084
00085
00090 bool AddSubLibrary(KFbxLibrary* pSubLibrary);
00091
00096 bool RemoveSubLibrary(KFbxLibrary* pSubLibrary);
00097
00099 int GetSubLibraryCount(void) const;
00100
00104 KFbxLibrary* GetSubLibrary(int pIndex) const;
00105
00114 int GetSubLibraryCount(
00115 const KFbxImplementationFilter & pCriteria
00116 ) const;
00117
00125 KFbxLibrary* GetSubLibrary(
00126 int pIndex,
00127 const KFbxImplementationFilter & pCriteria
00128 ) const;
00129
00130
00131 KFbxObject* CloneAsset( KFbxObject* pToClone, KFbxObject* pOptionalDestinationContainer = NULL) const;
00132
00133
00140 static KFbxCriteria GetAssetCriteriaFilter();
00141
00148 static KFbxCriteria GetAssetDependentsFilter();
00149
00174 bool ImportAssets(KFbxLibrary* pSrcLibrary);
00175
00201 bool ImportAssets(KFbxLibrary* pSrcLibrary, const KFbxCriteria& pAssetFilter);
00202
00203
00212 template < class T > T* InstantiateMember( T const* pFBX_TYPE, const KFbxObjectFilter& pFilter, bool pRecurse = true, KFbxObject* pOptContainer = NULL);
00213
00214
00215
00216
00217
00218
00219
00223 KFbxLocalizationManager & GetLocalizationManager() const;
00224
00231 virtual const char * Localize( const char * pID, const char * pDefault = NULL ) const;
00232
00233
00234
00235
00236
00237
00238
00242 bool AddShadingObject(KFbxObject* pShadingObject);
00243
00247 bool RemoveShadingObject(KFbxObject* pShadingObject);
00248
00250 int GetShadingObjectCount(void) const;
00251
00256 KFbxObject* GetShadingObject(int pIndex) const;
00257
00265 int GetShadingObjectCount(
00266 const KFbxImplementationFilter & pCriteria
00267 ) const;
00268
00276 KFbxObject* GetShadingObject(
00277 int pIndex,
00278 const KFbxImplementationFilter & pCriteria
00279 ) const;
00280
00282
00283
00284
00285
00286
00287
00289 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00290
00291 public:
00292
00293 virtual KFbxObject* Clone(KFbxObject* pContainer, KFbxObject::ECloneType pCloneType) const;
00294
00295 protected:
00296
00297
00298 KFbxLibrary(KFbxSdkManager& pManager, char const* pName);
00299 ~KFbxLibrary();
00300 virtual void Destruct (bool pRecursive, bool pDependents);
00301
00302 virtual void Construct(const KFbxLibrary* pFrom);
00303
00304 mutable KFbxLocalizationManager * mLocalizationManager;
00305
00306 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00307 };
00308
00309
00310 template < class T > T* KFbxLibrary::InstantiateMember( T const* pFBX_TYPE, const KFbxObjectFilter& pFilter, bool pRecurse, KFbxObject* pOptContainer )
00311 {
00312
00313 int i = 0;
00314 for( i = 0; i < GetMemberCount( FBX_TYPE(T) ); ++i )
00315 {
00316 T* lObject = GetMember( FBX_TYPE(T), i );
00317 if( pFilter.Match(lObject) )
00318 return KFbxCast<T>(CloneAsset(lObject,pOptContainer));
00319 }
00320
00321 if( pRecurse )
00322 {
00323
00324 for( i = 0; i < GetMemberCount( FBX_TYPE(KFbxLibrary) ); ++i )
00325 {
00326 KFbxLibrary* lLibrary = GetMember( FBX_TYPE(KFbxLibrary), i );
00327 T* lClonedObject = lLibrary->InstantiateMember( pFBX_TYPE, pFilter, pRecurse, pOptContainer );
00328 if( lClonedObject )
00329 return lClonedObject;
00330 }
00331 }
00332
00333 return NULL;
00334 }
00335
00336
00341 class KFBX_DLL KFbxEventPopulateSystemLibrary : public KFbxEvent<KFbxEventPopulateSystemLibrary>
00342 {
00343 KFBXEVENT_DECLARE(KFbxEventPopulateSystemLibrary)
00344
00345 public:
00350
00354 KFbxEventPopulateSystemLibrary(KFbxLibrary *pLibrary) { mLibrary = pLibrary; }
00355
00357
00358 public:
00363
00364 inline KFbxLibrary* GetLibrary() const { return mLibrary; }
00365 private:
00366 KFbxLibrary* mLibrary;
00368 };
00369
00374 class KFBX_DLL KFbxEventUpdateSystemLibrary : public KFbxEvent<KFbxEventUpdateSystemLibrary>
00375 {
00376 KFBXEVENT_DECLARE(KFbxEventUpdateSystemLibrary)
00377 public:
00382
00386 KFbxEventUpdateSystemLibrary(KFbxLibrary *pLibrary) { mLibrary = pLibrary; }
00387
00389
00394
00396 inline KFbxLibrary* GetLibrary() const { return mLibrary; }
00397
00399 private:
00400 KFbxLibrary* mLibrary;
00401 };
00402
00413 class KFBX_DLL KFbxEventWriteLocalization : public KFbxEvent<KFbxEventWriteLocalization>
00414 {
00415 KFBXEVENT_DECLARE(KFbxEventWriteLocalization)
00416 public:
00417 KFbxEventWriteLocalization(KFbxLibrary *pAssetLibrary) { mAssetLibrary = pAssetLibrary; }
00418
00419 inline KFbxLibrary* GetLibrary() const { return mAssetLibrary; }
00420
00421 private:
00422 KFbxLibrary* mAssetLibrary;
00423 };
00424
00426
00427
00428
00429
00430
00431
00433 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00434
00435
00436 class KFBX_DLL KFbxEventMapAssetFileToAssetObject : public KFbxEvent<KFbxEventMapAssetFileToAssetObject>
00437 {
00438 KFBXEVENT_DECLARE(KFbxEventMapAssetFileToAssetObject)
00439 public:
00440
00441
00442 KFbxEventMapAssetFileToAssetObject(const char* pFile) :
00443 mFilePath( pFile ),
00444 mAsset(NULL)
00445 {}
00446
00447
00448 inline const char* GetFilePath() const { return mFilePath; }
00449
00450
00451 mutable KFbxObject* mAsset;
00452
00453 private:
00454 KString mFilePath;
00455 };
00456
00457 #endif //DOXYGEN_SHOULD_SKIP_THIS
00458
00459 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00460
00461 #endif // FBXFILESDK_KFBXPLUGINS_KFBXLIBRARY_H
00462