fbxsdk/fileio/fbxexternaldocreflistener.h Source File
 
 
 
fbxsdk/fileio/fbxexternaldocreflistener.h
Go to the documentation of this file.
00001 /****************************************************************************************
00002  
00003    Copyright (C) 2013 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/fbxlistener.h>
00019 
00020 #include <fbxsdk/fbxsdk_nsbegin.h>
00021 
00025 struct FBXSDK_DLL FbxExternalDocumentInfo
00026 {
00027     FbxString mDocumentName;      
00028     FbxString mClassName;         
00029     FbxString mParentFullName;    
00030     FbxString mFilePathUrl;       
00031 };
00032 
00036 class FBXSDK_DLL FbxEventReferencedDocument : public FbxEvent<FbxEventReferencedDocument>, public FbxExternalDocumentInfo
00037 {
00038     FBXSDK_EVENT_DECLARE(FbxEventReferencedDocument);
00039 public:
00040     FbxEventReferencedDocument() {}
00041 };
00042 
00043 
00044 class FbxExternalDocRefListenerData;
00045 
00056 class FBXSDK_DLL FbxExternalDocRefListener : public FbxListener
00057 {
00058 public:
00065     FbxExternalDocRefListener( FbxManager & pManager, const FbxString & pDocFilePath );
00066     virtual ~FbxExternalDocRefListener();
00067 
00072     virtual void SetDocumentFilePath( const FbxString & pDocFilePath );
00073 
00078     virtual bool AreAllExternalDocumentsStillValid() const;
00079 
00080     // 
00085     virtual bool WereAllExternalDocumentsValid() const;
00086 
00089     virtual void UnloadExternalDocuments();
00090 
00091     // External document reference event handler.
00092     //
00093     // Operation: calls FindDocument() to find the specified external document
00094     //            and if not found calls LoadDocument() either directly,
00095     //            if it has not parent, or via ConnectToParentLibrary().
00096     //            If its parent cannot be found, it's added to the dangling
00097     //            document list (and it is not loaded until it's parent is found).
00098     //            After, it tries to resolve dangling documents by calling
00099     //            TryConnectingDanglingLibraries().
00110     virtual void HandleEvent(const FbxEventReferencedDocument * pEvent);
00111 
00112 protected:
00117     virtual FbxString MakeFilenameAbsolute(const FbxString & pFilename) const;
00119     virtual FbxDocument * FindDocument( const FbxString & pPathToDoc );
00121     virtual FbxDocument * LoadDocument(FbxObject * pParent, const FbxString & pClassName, const FbxString & pFilename);
00123     virtual bool ConnectToParentLibrary(const FbxExternalDocumentInfo &);
00125     virtual void TryConnectingDanglingLibraries();
00126 
00127 private:
00128     FbxExternalDocRefListenerData * mData;
00129 };
00130 
00131 #include <fbxsdk/fbxsdk_nsend.h>
00132 
00133 #endif /* _FBXSDK_FILEIO_EXTERNAL_DOCREF_LISTENER_H_ */