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/fbxfilesdk_def.h>
00042 
00043 #include <fbxfilesdk/fbxcore/fbxcollection/kfbxdocument.h>
00044 #include <fbxfilesdk/kfbxplugins/kfbxobjectfilter.h>
00045 
00046 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00047 
00048 class KFbxLocalizationManager;
00049 class KFbxCriteria;
00050 
00055 class KFBX_DLL KFbxLibrary : public KFbxDocument
00056 {
00057     KFBXOBJECT_DECLARE(KFbxLibrary,KFbxDocument);
00058 
00059     public:
00060 
00062         KFbxLibrary* GetParentLibrary(void) const;
00063 
00067         void SystemLibrary(bool pSystemLibrary);
00068 
00070         bool IsSystemLibrary() const;
00071 
00079         void LocalizationBaseNamePrefix(const char* pPrefix);
00080 
00082         KString LocalizationBaseNamePrefix() const;
00083 
00084         
00085         
00086         
00087         
00088         
00089 
00094         bool AddSubLibrary(KFbxLibrary* pSubLibrary);
00095 
00100         bool RemoveSubLibrary(KFbxLibrary* pSubLibrary);
00101 
00103         int GetSubLibraryCount(void) const;
00104 
00108         KFbxLibrary* GetSubLibrary(int pIndex) const;
00109 
00115         KFbxObject* CloneAsset( KFbxObject* pToClone, KFbxObject* pOptionalDestinationContainer = NULL) const;
00116 
00117         
00124         static KFbxCriteria GetAssetCriteriaFilter();
00125 
00131         static KFbxCriteria GetAssetDependentsFilter();
00132 
00157         bool ImportAssets(KFbxLibrary* pSrcLibrary);
00158 
00184         bool ImportAssets(KFbxLibrary* pSrcLibrary, const KFbxCriteria& pAssetFilter);
00185 
00186 
00195         template < class T > T* InstantiateMember( T const* pFBX_TYPE, const KFbxObjectFilter& pFilter, bool pRecurse = true, KFbxObject* pOptContainer = NULL);
00196 
00197 
00198     
00199     
00200     
00201     
00202     
00206         KFbxLocalizationManager & GetLocalizationManager() const;
00207 
00214         virtual const char * Localize( const char * pID, const char * pDefault = NULL ) const;
00215 
00216     
00217     
00218     
00219     
00220     
00221 
00225         bool AddShadingObject(KFbxObject* pShadingObject);
00226 
00230         bool RemoveShadingObject(KFbxObject* pShadingObject);
00231 
00233         int GetShadingObjectCount(void) const;
00234 
00239         KFbxObject* GetShadingObject(int pIndex) const;
00240 
00246         int GetShadingObjectCount(
00247             const KFbxImplementationFilter & pCriteria
00248         ) const;
00249 
00256         KFbxObject* GetShadingObject(
00257             int pIndex,
00258             const KFbxImplementationFilter & pCriteria
00259         ) const;
00260 
00262         
00263         
00264         
00265         
00266         
00267         
00269         #ifndef DOXYGEN_SHOULD_SKIP_THIS
00270 
00271         public:
00272                 
00273             virtual KFbxObject* Clone(KFbxObject* pContainer, KFbxObject::ECloneType pCloneType) const;
00274 
00275         protected:
00276 
00277             
00278             KFbxLibrary(KFbxSdkManager& pManager, char const* pName);
00279 
00280             virtual void Destruct(bool pRecursive, bool pDependents);
00281             virtual void Construct(const KFbxLibrary* pFrom);
00282 
00283             mutable KFbxLocalizationManager * mLocalizationManager;
00284 
00285         #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00286     };
00287 
00288 
00289     template < class T > T* KFbxLibrary::InstantiateMember( T const* pFBX_TYPE, const KFbxObjectFilter& pFilter, bool pRecurse, KFbxObject* pOptContainer )
00290     {
00291         
00292         int i = 0;
00293         for( i = 0; i < GetMemberCount( FBX_TYPE(T) ); ++i )
00294         {
00295             T* lObject = GetMember( FBX_TYPE(T), i );
00296             if( pFilter.Match(lObject) )
00297                 return KFbxCast<T>(CloneAsset(lObject,pOptContainer));
00298         }
00299 
00300         if( pRecurse )
00301         {
00302             
00303             for( i = 0; i < GetMemberCount( FBX_TYPE(KFbxLibrary) ); ++i )
00304             {
00305                 KFbxLibrary* lLibrary = GetMember( FBX_TYPE(KFbxLibrary), i );
00306                 T* lClonedObject = lLibrary->InstantiateMember( pFBX_TYPE, pFilter, pRecurse, pOptContainer );
00307                 if( lClonedObject )
00308                     return lClonedObject;
00309             }
00310         }
00311 
00312         return NULL;
00313     }
00314 
00315 
00320     class KFBX_DLL KFbxEventPopulateSystemLibrary : public KFbxEvent<KFbxEventPopulateSystemLibrary>
00321     {
00322       KFBXEVENT_DECLARE(KFbxEventPopulateSystemLibrary)
00323 
00324         public:         
00329 
00333             KFbxEventPopulateSystemLibrary(KFbxLibrary *pLibrary) { mLibrary = pLibrary; }
00334 
00336        
00337             public:
00342 
00343                 inline KFbxLibrary* GetLibrary() const { return mLibrary; }
00344             private:
00345                 KFbxLibrary*    mLibrary;
00347     };
00348 
00353     class KFBX_DLL KFbxEventUpdateSystemLibrary : public KFbxEvent<KFbxEventUpdateSystemLibrary>
00354     {
00355         KFBXEVENT_DECLARE(KFbxEventUpdateSystemLibrary)
00356         public:
00361 
00365             KFbxEventUpdateSystemLibrary(KFbxLibrary *pLibrary) { mLibrary = pLibrary; }
00366 
00368 
00373 
00375             inline KFbxLibrary* GetLibrary() const { return mLibrary; }
00376 
00378         private:
00379                 KFbxLibrary*    mLibrary;
00380     };
00381 
00392     class KFBX_DLL KFbxEventWriteLocalization : public KFbxEvent<KFbxEventWriteLocalization>
00393     {
00394         KFBXEVENT_DECLARE(KFbxEventWriteLocalization)
00395         public:
00396             KFbxEventWriteLocalization(KFbxLibrary *pAssetLibrary) { mAssetLibrary = pAssetLibrary; }
00397 
00398             inline KFbxLibrary* GetLibrary() const { return mAssetLibrary; }
00399 
00400         private:
00401             KFbxLibrary*    mAssetLibrary;
00402     };
00403 
00405     
00406     
00407     
00408     
00409     
00410     
00412     #ifndef DOXYGEN_SHOULD_SKIP_THIS
00413 
00414     
00415     class KFBX_DLL KFbxEventMapAssetFileToAssetObject : public KFbxEvent<KFbxEventMapAssetFileToAssetObject>
00416     {
00417         KFBXEVENT_DECLARE(KFbxEventMapAssetFileToAssetObject)
00418         public:
00419 
00420             
00421             KFbxEventMapAssetFileToAssetObject(const char* pFile) :
00422                 mAsset(NULL),
00423                 mFilePath( pFile )
00424                 {}
00425 
00426             
00427             inline const char* GetFilePath() const { return mFilePath; }
00428 
00429             
00430             mutable KFbxObject* mAsset;
00431 
00432         private:
00433             KString mFilePath;
00434     };
00435 
00436     #endif //DOXYGEN_SHOULD_SKIP_THIS
00437 
00438 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00439 
00440 #endif // FBXFILESDK_KFBXPLUGINS_KFBXLIBRARY_H
00441