00001 /**************************************************************************************** 00002 00003 Copyright (C) 2010 Autodesk, Inc. 00004 All rights reserved. 00005 00006 Use of this software is subject to the terms of the Autodesk license agreement 00007 provided at the time of installation or download, or which otherwise accompanies 00008 this software in either electronic or hard copy form. 00009 00010 ****************************************************************************************/ 00011 00012 00016 #ifndef FBXFILESDK_KFBXIO_KFBXEXTERNALDOCREFLISTENER_H 00017 #define FBXFILESDK_KFBXIO_KFBXEXTERNALDOCREFLISTENER_H 00018 00019 00020 #include <fbxfilesdk/fbxfilesdk_def.h> 00021 00022 #include <fbxfilesdk/kfbxevents/kfbxevents.h> 00023 #include <fbxfilesdk/kfbxevents/kfbxlistener.h> 00024 #include <fbxfilesdk/components/kbaselib/klib/kstring.h> 00025 00026 #include <fbxfilesdk/fbxfilesdk_nsbegin.h> 00027 00028 class KFbxObject; 00029 class KFbxDocument; 00030 class KFbxSdkManager; 00031 00035 struct KFBX_DLL KFbxExternalDocumentInfo 00036 { 00037 KString mDocumentName; 00038 KString mClassName; 00039 KString mParentFullName; 00040 KString mFilePathUrl; 00041 }; 00042 00046 class KFBX_DLL KFbxEventReferencedDocument : public KFbxEvent<KFbxEventReferencedDocument>, public KFbxExternalDocumentInfo 00047 { 00048 KFBXEVENT_DECLARE(KFbxEventReferencedDocument); 00049 public: 00050 KFbxEventReferencedDocument() {} 00051 }; 00052 00053 00054 class KFBX_DLL KFbxExternalDocRefListenerData; 00055 00066 class KFBX_DLL KFbxExternalDocRefListener : public kfbxevents::KFbxListener 00067 { 00068 public: 00075 KFbxExternalDocRefListener( KFbxSdkManager & pManager, const KString & pDocFilePath ); 00076 virtual ~KFbxExternalDocRefListener(); 00077 00082 virtual void SetDocumentFilePath( const KString & pDocFilePath ); 00083 00088 virtual bool AreAllExternalDocumentsStillValid() const; 00089 00090 // 00095 virtual bool WereAllExternalDocumentsValid() const; 00096 00099 virtual void UnloadExternalDocuments(); 00100 00101 // External document reference event handler. 00102 // 00103 // Operation: calls FindDocument() to find the specified external document 00104 // and if not found calls LoadDocument() either directly, 00105 // if it has not parent, or via ConnectToParentLibrary(). 00106 // If its parent cannot be found, it's added to the dangling 00107 // document list (and it is not loaded until it's parent is found). 00108 // After, it tries to resolve dangling documents by calling 00109 // TryConnectingDanglingLibraries(). 00120 virtual void HandleEvent(const KFbxEventReferencedDocument * pEvent); 00121 00122 protected: 00127 virtual KString MakeFilenameAbsolute(const KString & pFilename) const; 00129 virtual KFbxDocument * FindDocument( const KString & pPathToDoc ); 00131 virtual KFbxDocument * LoadDocument(KFbxObject * pParent, const KString & pClassName, const KString & pFilename); 00133 virtual bool ConnectToParentLibrary(const KFbxExternalDocumentInfo &); 00135 virtual void TryConnectingDanglingLibraries(); 00136 00137 private: 00138 KFbxExternalDocRefListenerData * mData; 00139 }; 00140 00141 #include <fbxfilesdk/fbxfilesdk_nsend.h> 00142 00143 #endif // FBXFILESDK_KFBXIO_KFBXEXTERNALDOCREFLISTENER_H 00144