00001 /**************************************************************************************** 00002 00003 Copyright (C) 2012 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 00013 #ifndef _FBXSDK_FILEIO_EXTERNAL_DOCREF_LISTENER_H_ 00014 #define _FBXSDK_FILEIO_EXTERNAL_DOCREF_LISTENER_H_ 00015 00016 #include <fbxsdk/fbxsdk_def.h> 00017 00018 #include <fbxsdk/core/fbxevent.h> 00019 #include <fbxsdk/core/fbxlistener.h> 00020 #include <fbxsdk/core/base/fbxstring.h> 00021 00022 #include <fbxsdk/fbxsdk_nsbegin.h> 00023 00024 class FbxObject; 00025 class FbxDocument; 00026 class FbxManager; 00027 00031 struct FBXSDK_DLL FbxExternalDocumentInfo 00032 { 00033 FbxString mDocumentName; 00034 FbxString mClassName; 00035 FbxString mParentFullName; 00036 FbxString mFilePathUrl; 00037 }; 00038 00042 class FBXSDK_DLL FbxEventReferencedDocument : public FbxEvent<FbxEventReferencedDocument>, public FbxExternalDocumentInfo 00043 { 00044 FBXSDK_EVENT_DECLARE(FbxEventReferencedDocument); 00045 public: 00046 FbxEventReferencedDocument() {} 00047 }; 00048 00049 00050 class FBXSDK_DLL FbxExternalDocRefListenerData; 00051 00062 class FBXSDK_DLL FbxExternalDocRefListener : public FbxListener 00063 { 00064 public: 00071 FbxExternalDocRefListener( FbxManager & pManager, const FbxString & pDocFilePath ); 00072 virtual ~FbxExternalDocRefListener(); 00073 00078 virtual void SetDocumentFilePath( const FbxString & pDocFilePath ); 00079 00084 virtual bool AreAllExternalDocumentsStillValid() const; 00085 00086 // 00091 virtual bool WereAllExternalDocumentsValid() const; 00092 00095 virtual void UnloadExternalDocuments(); 00096 00097 // External document reference event handler. 00098 // 00099 // Operation: calls FindDocument() to find the specified external document 00100 // and if not found calls LoadDocument() either directly, 00101 // if it has not parent, or via ConnectToParentLibrary(). 00102 // If its parent cannot be found, it's added to the dangling 00103 // document list (and it is not loaded until it's parent is found). 00104 // After, it tries to resolve dangling documents by calling 00105 // TryConnectingDanglingLibraries(). 00116 virtual void HandleEvent(const FbxEventReferencedDocument * pEvent); 00117 00118 protected: 00123 virtual FbxString MakeFilenameAbsolute(const FbxString & pFilename) const; 00125 virtual FbxDocument * FindDocument( const FbxString & pPathToDoc ); 00127 virtual FbxDocument * LoadDocument(FbxObject * pParent, const FbxString & pClassName, const FbxString & pFilename); 00129 virtual bool ConnectToParentLibrary(const FbxExternalDocumentInfo &); 00131 virtual void TryConnectingDanglingLibraries(); 00132 00133 private: 00134 FbxExternalDocRefListenerData * mData; 00135 }; 00136 00137 #include <fbxsdk/fbxsdk_nsend.h> 00138 00139 #endif /* _FBXSDK_FILEIO_EXTERNAL_DOCREF_LISTENER_H_ */