00001
00004 #ifndef _FBXSDK_LIBRARY_H_
00005 #define _FBXSDK_LIBRARY_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 <kaydaradef.h>
00042 #ifndef KFBX_DLL
00043 #define KFBX_DLL K_DLLIMPORT
00044 #endif
00045
00046 #include <fbxcore/fbxcollection/kfbxdocument.h>
00047 #include <kfbxplugins/kfbxobjectfilter.h>
00048
00049 #include <fbxfilesdk_nsbegin.h>
00050
00051 class KFbxWriterFbx6;
00052 class KFbxLocalizationManager;
00053 class KFbxCriteria;
00054
00058 class KFBX_DLL KFbxLibrary : public KFbxDocument
00059 {
00060 KFBXOBJECT_DECLARE(KFbxLibrary,KFbxDocument);
00061
00062 public:
00063
00065 KFbxLibrary* GetParentLibrary(void) const;
00066
00067 void SystemLibrary(bool pSystemLibrary);
00068 bool IsSystemLibrary() const;
00069
00080 void LocalizationBaseNamePrefix(const char* pPrefix);
00081 KString LocalizationBaseNamePrefix() const;
00082
00083
00084
00085
00086
00087
00088
00090 bool AddSubLibrary(KFbxLibrary* pSubLibrary);
00091
00093 bool RemoveSubLibrary(KFbxLibrary* pSubLibrary);
00094
00096 int GetSubLibraryCount(void) const;
00097
00099 KFbxLibrary* GetSubLibrary(int pIndex) const;
00100
00109 int GetSubLibraryCount(
00110 const KFbxImplementationFilter & pCriteria
00111 ) const;
00112
00120 KFbxLibrary* GetSubLibrary(
00121 int pIndex,
00122 const KFbxImplementationFilter & pCriteria
00123 ) const;
00124
00125
00126 KFbxObject* CloneAsset( KFbxObject* pToClone, KFbxObject* pOptionalDestinationContainer = NULL) const;
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136 static KFbxCriteria GetAssetCriteriaFilter();
00137
00138
00139
00140
00141
00142
00143
00144
00145 static KFbxCriteria GetAssetDependentsFilter();
00146
00170 bool ImportAssets(KFbxLibrary* pSrcLibrary);
00171 bool ImportAssets(KFbxLibrary* pSrcLibrary, const KFbxCriteria&);
00172
00173
00182 template < class T > T* InstantiateMember( T const* pFBX_TYPE, const KFbxObjectFilter& pFilter, bool pRecurse = true, KFbxObject* pOptContainer = NULL);
00183
00184
00185
00186
00187
00188
00189
00193 KFbxLocalizationManager & GetLocalizationManager() const;
00194
00201 virtual const char * Localize( const char * pID, const char * pDefault = NULL ) const;
00202
00203
00204
00205
00206
00207
00208
00210 bool AddShadingObject(KFbxObject* pShadingObject);
00211
00213 bool RemoveShadingObject(KFbxObject* pShadingObject);
00214
00216 int GetShadingObjectCount(void) const;
00217
00219 KFbxObject* GetShadingObject(int pIndex) const;
00220
00228 int GetShadingObjectCount(
00229 const KFbxImplementationFilter & pCriteria
00230 ) const;
00231
00239 KFbxObject* GetShadingObject(
00240 int pIndex,
00241 const KFbxImplementationFilter & pCriteria
00242 ) const;
00243
00245
00246
00247
00248
00249
00250
00252 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00253
00254 public:
00255
00256 virtual KFbxObject* Clone(KFbxObject* pContainer, KFbxObject::ECloneType pCloneType) const;
00257
00258 protected:
00259
00260
00261 KFbxLibrary(KFbxSdkManager& pManager, char const* pName);
00262 ~KFbxLibrary();
00263 virtual void Destruct (bool pRecursive, bool pDependents);
00264
00265 virtual void Construct(const KFbxLibrary* pFrom);
00266
00267 mutable KFbxLocalizationManager * mLocalizationManager;
00268
00269 friend class KFbxWriterFbx6;
00270
00271 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00272 };
00273
00274
00275 template < class T > T* KFbxLibrary::InstantiateMember( T const* pFBX_TYPE, const KFbxObjectFilter& pFilter, bool pRecurse, KFbxObject* pOptContainer )
00276 {
00277
00278 int i = 0;
00279 for( i = 0; i < GetMemberCount( FBX_TYPE(T) ); ++i )
00280 {
00281 T* lObject = GetMember( FBX_TYPE(T), i );
00282 if( pFilter.Match(lObject) )
00283 return KFbxCast<T>(CloneAsset(lObject,pOptContainer));
00284 }
00285
00286 if( pRecurse )
00287 {
00288
00289 for( i = 0; i < GetMemberCount( FBX_TYPE(KFbxLibrary) ); ++i )
00290 {
00291 KFbxLibrary* lLibrary = GetMember( FBX_TYPE(KFbxLibrary), i );
00292 T* lClonedObject = lLibrary->InstantiateMember( pFBX_TYPE, pFilter, pRecurse, pOptContainer );
00293 if( lClonedObject )
00294 return lClonedObject;
00295 }
00296 }
00297
00298 return NULL;
00299 }
00300
00301
00306 class KFBX_DLL KFbxEventPopulateSystemLibrary : public KFbxEvent<KFbxEventPopulateSystemLibrary>
00307 {
00308 KFBXEVENT_DECLARE(KFbxEventPopulateSystemLibrary)
00309
00310 public:
00315
00317 KFbxEventPopulateSystemLibrary(KFbxLibrary *pLibrary) { mLibrary = pLibrary; }
00318
00320
00321 public:
00326
00327 inline KFbxLibrary* GetLibrary() const { return mLibrary; }
00328 private:
00329 KFbxLibrary* mLibrary;
00331 };
00332
00337 class KFBX_DLL KFbxEventUpdateSystemLibrary : public KFbxEvent<KFbxEventUpdateSystemLibrary>
00338 {
00339 KFBXEVENT_DECLARE(KFbxEventUpdateSystemLibrary)
00340 public:
00345
00347 KFbxEventUpdateSystemLibrary(KFbxLibrary *pLibrary) { mLibrary = pLibrary; }
00348
00350
00355
00357 inline KFbxLibrary* GetLibrary() const { return mLibrary; }
00358
00360 private:
00361 KFbxLibrary* mLibrary;
00362 };
00363
00374 class KFBX_DLL KFbxEventWriteLocalization : public KFbxEvent<KFbxEventWriteLocalization>
00375 {
00376 KFBXEVENT_DECLARE(KFbxEventWriteLocalization)
00377 public:
00378 KFbxEventWriteLocalization(KFbxLibrary *pAssetLibrary) { mAssetLibrary = pAssetLibrary; }
00379
00380 inline KFbxLibrary* GetLibrary() const { return mAssetLibrary; }
00381
00382 private:
00383 KFbxLibrary* mAssetLibrary;
00384 };
00385
00387
00388
00389
00390
00391
00392
00394 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00395
00396
00397 class KFBX_DLL KFbxEventMapAssetFileToAssetObject : public KFbxEvent<KFbxEventMapAssetFileToAssetObject>
00398 {
00399 KFBXEVENT_DECLARE(KFbxEventMapAssetFileToAssetObject)
00400 public:
00401
00402
00403 KFbxEventMapAssetFileToAssetObject(const char* pFile) :
00404 mFilePath( pFile ),
00405 mAsset(NULL)
00406 {}
00407
00408
00409 inline const char* GetFilePath() const { return mFilePath; }
00410
00411
00412 mutable KFbxObject* mAsset;
00413
00414 private:
00415 KString mFilePath;
00416 };
00417
00418 #endif //DOXYGEN_SHOULD_SKIP_THIS
00419
00420 #include <fbxfilesdk_nsend.h>
00421
00422 #endif //_FBXSDK_LIBRARY_H_