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
00300 virtual void Destruct(bool pRecursive, bool pDependents);
00301 virtual void Construct(const KFbxLibrary* pFrom);
00302
00303 mutable KFbxLocalizationManager * mLocalizationManager;
00304
00305 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00306 };
00307
00308
00309 template < class T > T* KFbxLibrary::InstantiateMember( T const* pFBX_TYPE, const KFbxObjectFilter& pFilter, bool pRecurse, KFbxObject* pOptContainer )
00310 {
00311
00312 int i = 0;
00313 for( i = 0; i < GetMemberCount( FBX_TYPE(T) ); ++i )
00314 {
00315 T* lObject = GetMember( FBX_TYPE(T), i );
00316 if( pFilter.Match(lObject) )
00317 return KFbxCast<T>(CloneAsset(lObject,pOptContainer));
00318 }
00319
00320 if( pRecurse )
00321 {
00322
00323 for( i = 0; i < GetMemberCount( FBX_TYPE(KFbxLibrary) ); ++i )
00324 {
00325 KFbxLibrary* lLibrary = GetMember( FBX_TYPE(KFbxLibrary), i );
00326 T* lClonedObject = lLibrary->InstantiateMember( pFBX_TYPE, pFilter, pRecurse, pOptContainer );
00327 if( lClonedObject )
00328 return lClonedObject;
00329 }
00330 }
00331
00332 return NULL;
00333 }
00334
00335
00340 class KFBX_DLL KFbxEventPopulateSystemLibrary : public KFbxEvent<KFbxEventPopulateSystemLibrary>
00341 {
00342 KFBXEVENT_DECLARE(KFbxEventPopulateSystemLibrary)
00343
00344 public:
00349
00353 KFbxEventPopulateSystemLibrary(KFbxLibrary *pLibrary) { mLibrary = pLibrary; }
00354
00356
00357 public:
00362
00363 inline KFbxLibrary* GetLibrary() const { return mLibrary; }
00364 private:
00365 KFbxLibrary* mLibrary;
00367 };
00368
00373 class KFBX_DLL KFbxEventUpdateSystemLibrary : public KFbxEvent<KFbxEventUpdateSystemLibrary>
00374 {
00375 KFBXEVENT_DECLARE(KFbxEventUpdateSystemLibrary)
00376 public:
00381
00385 KFbxEventUpdateSystemLibrary(KFbxLibrary *pLibrary) { mLibrary = pLibrary; }
00386
00388
00393
00395 inline KFbxLibrary* GetLibrary() const { return mLibrary; }
00396
00398 private:
00399 KFbxLibrary* mLibrary;
00400 };
00401
00412 class KFBX_DLL KFbxEventWriteLocalization : public KFbxEvent<KFbxEventWriteLocalization>
00413 {
00414 KFBXEVENT_DECLARE(KFbxEventWriteLocalization)
00415 public:
00416 KFbxEventWriteLocalization(KFbxLibrary *pAssetLibrary) { mAssetLibrary = pAssetLibrary; }
00417
00418 inline KFbxLibrary* GetLibrary() const { return mAssetLibrary; }
00419
00420 private:
00421 KFbxLibrary* mAssetLibrary;
00422 };
00423
00425
00426
00427
00428
00429
00430
00432 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00433
00434
00435 class KFBX_DLL KFbxEventMapAssetFileToAssetObject : public KFbxEvent<KFbxEventMapAssetFileToAssetObject>
00436 {
00437 KFBXEVENT_DECLARE(KFbxEventMapAssetFileToAssetObject)
00438 public:
00439
00440
00441 KFbxEventMapAssetFileToAssetObject(const char* pFile) :
00442 mFilePath( pFile ),
00443 mAsset(NULL)
00444 {}
00445
00446
00447 inline const char* GetFilePath() const { return mFilePath; }
00448
00449
00450 mutable KFbxObject* mAsset;
00451
00452 private:
00453 KString mFilePath;
00454 };
00455
00456 #endif //DOXYGEN_SHOULD_SKIP_THIS
00457
00458 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00459
00460 #endif // FBXFILESDK_KFBXPLUGINS_KFBXLIBRARY_H
00461