IFileResolutionManager.h

Go to the documentation of this file.
00001 //**************************************************************************/
00002 // Copyright 2008 Autodesk, Inc.  All rights reserved.
00003 //
00004 // Use of this software is subject to the terms of the Autodesk license agreement
00005 // provided at the time of installation or download, or which otherwise accompanies 
00006 // this software in either electronic or hard copy form.   
00007 
00008 //**************************************************************************/
00009 // DESCRIPTION: IFileResolutionManager.h - Public interface for resolving the 
00010 // physical location of asset files
00011 // AUTHOR: Peter Ochodo
00012 // DATE: 2008-06-09 
00013 //***************************************************************************/
00014 
00015 
00016 #pragma once
00017 
00018 #include "iFnPub.h"
00019 #include "maxtypes.h"
00020 #include "Path.h"
00021 #include "AssetManagement\AssetType.h"
00022 #include "AssetManagement\assetmanagementExport.h"
00023 #include "Noncopyable.h"
00024 #include "windows.h"
00025 #include "AssetManagement\AssetUser.h"
00026 
00027 #define FILERESOLUTIONMGR_INTERFACE Interface_ID(0x675b2cab, 0x19fe1fad)
00028 
00029 /* \brief Finds the physical location of an asset file
00030     
00031     The File Resolution Manager(FRM) returns an absolute file path as soon as it finds the physical location of the asset file.
00032     This file path is converted to an absolute UNC path if the user preference "Resolve Path to UNC" 
00033     is turned on. See the IPathConfigMgr::SetResolveUNC(bool aFlag)
00034 
00035     If the asset filename is an absolute path:
00036     - the FRM first checks the absolute path for the asset file
00037     - then, if a scenefile is currently open, it checks whether the file is in the same 
00038       directory as the current scenefile 
00039     - then it checks the User Paths directories associated with the asset's AssetType
00040     - then, if a scenefile is currently open, it checks all the subdirectories of the folder that 
00041       contains this current scenefile
00042     - then it gives up
00043 
00044     If the asset filename is a relative path:
00045     - the FRM roots the relative path to the 3dsmax project folder and checks whether the file is there
00046     - then, if a scenefile is currently open, the FRM roots the relative path to the folder that
00047       holds this current scenefile, then checks if the file exists there
00048     - then, if a scenefile is currently open, the FRM checks if the asset filename (without the relative
00049       path) exists in the folder that holds this current scenefile
00050     - then, the FRM roots the relative path to the User Paths directories associated with the asset's AssetType
00051       and checks whether the file exists there
00052     - then, if a scenefile is currently open, the FRM checks for the asset filename (without relative path) in
00053       all the subdirectories of the folder that contains this current scenefile.
00054     - then it gives up
00055 
00056 */
00057 class IFileResolutionManager : public FPStaticInterface, public MaxSDK::Util::Noncopyable
00058 {
00059 public:
00060 
00062     AssetMgmntExport static IFileResolutionManager* GetInstance();
00063 
00083     virtual MSTR GetFullFilePath(const MCHAR* filePath,MaxSDK::AssetManagement::AssetType assetType, bool byPassCache = false) = 0;
00084 
00106     virtual bool GetFullFilePath(MaxSDK::Util::Path& filePath, MaxSDK::AssetManagement::AssetType assetType, bool byPassCache = false) = 0;
00107 
00121     virtual bool GetFullFilePath(const MaxSDK::AssetManagement::AssetUser& assetUser, MaxSDK::Util::Path& filePath,
00122                                  bool byPassCache = false) = 0;
00123 
00137     virtual bool GetFullFilePath(const MaxSDK::AssetManagement::AssetUser& assetUser, MSTR& filePath,
00138                                 bool byPassCache = false) = 0;
00139     
00153     virtual bool GetFullFilePath(const MaxSDK::AssetManagement::AssetId& assetID, MaxSDK::Util::Path& filePath,
00154                                  bool byPassCache = false) = 0;
00155 
00169     virtual bool GetFullFilePath(const MaxSDK::AssetManagement::AssetId& assetID, MSTR& filePath, bool byPassCache = false) = 0;
00170 
00182     virtual MSTR GetFullFilePath(const MaxSDK::AssetManagement::AssetUser& assetUser, bool byPassCache = false) = 0;
00183 
00195     virtual MSTR GetFullFilePath(const MaxSDK::AssetManagement::AssetId& assetId, bool byPassCache = false) = 0;
00196     
00201     virtual DWORD GetMaximumCacheDuration() = 0;
00202 
00207     virtual void SetMaximumCacheDuration(DWORD newMaxDuration) = 0;
00208 
00212     virtual bool IsCachingEnabled() = 0;
00213 
00215     virtual void EnableCaching() = 0;
00216 
00218     virtual void DisableCaching() = 0;
00219 
00225     virtual void PushAllowCachingOfUnresolvedResults(bool newVal) = 0;
00226 
00228     virtual void PopAllowCachingOfUnresolvedResults() = 0;
00229 
00238     virtual void DoGetUniversalFileName(MaxSDK::Util::Path& aFullFilePath) const = 0;
00239 
00248     virtual void DoGetUniversalFileName(MSTR& fullFilePath) const = 0;
00249 
00250     /* \brief Writes File Resolution Manager's settings to the 3dsmax's .ini file
00251 
00252     Writes whether or not the FRM has caching enabled. Also writes the maximum caching duration
00253     that the FRM uses to validate cached data 
00254     */
00255     virtual void UpdateDotIniFile() = 0;
00256     
00259     virtual int GetNumAssetTypes()const = 0;
00260 
00268     virtual MaxSDK::AssetManagement::AssetType GetAssetType(const MSTR& assetType)const = 0;
00269 
00275     virtual const MCHAR* GetAssetTypeString(MaxSDK::AssetManagement::AssetType assetType)const = 0;
00276 
00277 
00278 protected:
00279     // virtual destructor
00280     virtual ~IFileResolutionManager(){}
00281 
00282 };
00283