24 #ifndef PXR_INCLUDED_FROM_AR_DEFAULT_RESOLVER_H
25 #error This file should not be included directly. Include resolverContext.h instead
28 #ifndef PXR_USD_AR_DEFAULT_RESOLVER_V1_H
29 #define PXR_USD_AR_DEFAULT_RESOLVER_V1_H
34 #include "pxr/usd/ar/api.h"
36 #include "pxr/usd/ar/resolver.h"
37 #include "pxr/usd/ar/threadLocalScopedCache.h"
39 #include <tbb/enumerable_thread_specific.h>
45 PXR_NAMESPACE_OPEN_SCOPE
75 virtual ~ArDefaultResolver();
84 const std::vector<std::string>& searchPath);
97 const std::string& anchorPath,
98 const std::string& path)
override;
107 virtual bool IsSearchPath(
const std::string& path)
override;
110 virtual std::string
GetExtension(
const std::string& path)
override;
122 virtual std::string
Resolve(
const std::string& path)
override;
126 const std::string& path,
131 const std::string& identifier,
132 const std::string& filePath,
133 const std::string& fileVersion,
138 const std::string& path,
139 const std::string& resolvedPath)
override;
143 const std::string& path,
144 const std::string& resolvedPath)
override;
147 virtual std::shared_ptr<ArAsset>
OpenAsset(
148 const std::string& resolvedPath)
override;
152 const std::string& path)
override;
156 const std::string& path,
157 std::string* whyNot)
override;
161 const std::string& identifier,
162 std::string* whyNot)
override;
176 const std::string& filePath)
override;
186 VtValue* cacheScopeData)
override;
190 VtValue* cacheScopeData)
override;
195 VtValue* bindingData)
override;
200 VtValue* bindingData)
override;
205 using _CachePtr = _PerThreadCache::CachePtr;
206 _CachePtr _GetCurrentCache();
210 std::string _ResolveNoCache(
const std::string& path);
218 using _ContextStack = std::vector<const ArDefaultResolverContext*>;
219 using _PerThreadContextStack =
220 tbb::enumerable_thread_specific<_ContextStack>;
221 _PerThreadContextStack _threadContextStack;
225 PXR_NAMESPACE_CLOSE_SCOPE
static AR_API void SetDefaultSearchPath(const std::vector< std::string > &searchPath)
Set the default search path that will be used during asset resolution.
virtual AR_API std::string AnchorRelativePath(const std::string &anchorPath, const std::string &path) override
Returns the path formed by anchoring path to anchorPath.
Default asset resolution implementation used when no plugin implementation is provided.
virtual AR_API VtValue GetModificationTimestamp(const std::string &path, const std::string &resolvedPath) override
Returns a value representing the last time the asset identified by path was modified.
virtual AR_API ArResolverContext CreateDefaultContext() override
Return a default ArResolverContext that may be bound to this resolver to resolve assets when no other...
virtual AR_API bool IsRepositoryPath(const std::string &path) override
Returns true if the given path is a repository path.
virtual AR_API void RefreshContext(const ArResolverContext &context) override
Refresh any caches associated with the given context.
virtual AR_API ArResolverContext GetCurrentContext() override
Returns the currently-bound asset resolver context.
Resolver context object that specifies a search path to use during asset resolution.
virtual AR_API std::string ComputeLocalPath(const std::string &path) override
Returns the local path for the given path.
virtual AR_API bool IsSearchPath(const std::string &path) override
Returns whether this path is a search path.
virtual AR_API void EndCacheScope(VtValue *cacheScopeData) override
Mark the end of a resolution caching scope.
virtual AR_API bool CreatePathForLayer(const std::string &path) override
Create path needed to write a file to the given path.
virtual AR_API bool CanWriteLayerToPath(const std::string &path, std::string *whyNot) override
Returns true if a file may be written to the given path, false otherwise.
virtual AR_API std::shared_ptr< ArAsset > OpenAsset(const std::string &resolvedPath) override
Returns an ArAsset object for the asset located at resolvedPath.
virtual AR_API void ConfigureResolverForAsset(const std::string &path) override
Sets the resolver's default context (returned by CreateDefaultContext()) to the same context you woul...
virtual AR_API bool FetchToLocalResolvedPath(const std::string &path, const std::string &resolvedPath) override
Fetch the asset identified by path to the filesystem location specified by resolvedPath.
virtual AR_API void BindContext(const ArResolverContext &context, VtValue *bindingData) override
Binds the given context to this resolver.
virtual AR_API bool IsRelativePath(const std::string &path) override
Returns true if the given path is a relative path.
virtual AR_API void BeginCacheScope(VtValue *cacheScopeData) override
Mark the start of a resolution caching scope.
virtual AR_API std::string ResolveWithAssetInfo(const std::string &path, ArAssetInfo *assetInfo) override
Returns the resolved filesystem path for the file identified by path following the same path resoluti...
virtual AR_API std::string Resolve(const std::string &path) override
Returns the resolved filesystem path for the file identified by the given path if it exists...
virtual AR_API ArResolverContext CreateDefaultContextForAsset(const std::string &filePath) override
Creates a context that adds the directory containing filePath as a first directory to be searched...
virtual AR_API std::string ComputeNormalizedPath(const std::string &path) override
Returns a normalized version of the given path.
An asset resolver context allows clients to provide additional data to the resolver for use during re...
virtual AR_API bool CanCreateNewLayerWithIdentifier(const std::string &identifier, std::string *whyNot) override
Returns true if a new file may be created using the given identifier, false otherwise.
virtual AR_API void UnbindContext(const ArResolverContext &context, VtValue *bindingData) override
Unbind the given context from this resolver.
virtual AR_API void UpdateAssetInfo(const std::string &identifier, const std::string &filePath, const std::string &fileVersion, ArAssetInfo *assetInfo) override
Update assetInfo with respect to the given fileVersion .
virtual AR_API std::string ComputeRepositoryPath(const std::string &path) override
Returns the computed repository path using the current resolver.
Provides a container which may hold any type, and provides introspection and iteration over array typ...
virtual AR_API std::string GetExtension(const std::string &path) override
Returns the normalized extension for the given path.
Interface for the asset resolution system.
Contains information about a resolved asset.