Loading...
Searching...
No Matches
defaultResolver.h
Go to the documentation of this file.
1//
2// Copyright 2016 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_USD_AR_DEFAULT_RESOLVER_H
8#define PXR_USD_AR_DEFAULT_RESOLVER_H
9
11
12#include "pxr/pxr.h"
13#include "pxr/usd/ar/api.h"
16#include "pxr/usd/ar/resolver.h"
17
18#include <memory>
19#include <string>
20#include <vector>
21
22PXR_NAMESPACE_OPEN_SCOPE
23
51 : public ArResolver
52{
53public:
54 AR_API
55 ArDefaultResolver() = default;
56
57 AR_API
58 virtual ~ArDefaultResolver() = default;
59
71 AR_API
73 const std::vector<std::string>& searchPath);
74
75protected:
76 AR_API
77 std::string _CreateIdentifier(
78 const std::string& assetPath,
79 const ArResolvedPath& anchorAssetPath) const override;
80
81 AR_API
83 const std::string& assetPath,
84 const ArResolvedPath& anchorAssetPath) const override;
85
86 AR_API
88 const std::string& assetPath) const override;
89
90 AR_API
92 const std::string& assetPath) const override;
93
94 AR_API
96
104 AR_API
106 const std::string& assetPath) const override;
107
111 AR_API
113 const std::string& contextStr) const override;
114
115 AR_API
117 const std::string& assetPath) const override;
118
119 AR_API
121 const std::string& path,
122 const ArResolvedPath& resolvedPath) const override;
123
124 AR_API
125 std::shared_ptr<ArAsset> _OpenAsset(
126 const ArResolvedPath& resolvedPath) const override;
127
130 AR_API
131 std::shared_ptr<ArWritableAsset> _OpenAssetForWrite(
132 const ArResolvedPath& resolvedPath,
133 WriteMode writeMode) const override;
134
135private:
136 const ArDefaultResolverContext* _GetCurrentContextPtr() const;
137
138 ArResolverContext _defaultContext;
139};
140
141PXR_NAMESPACE_CLOSE_SCOPE
142
143#endif // PXR_USD_AR_DEFAULT_RESOLVER_H
Resolver context object that specifies a search path to use during asset resolution.
Default asset resolution implementation used when no plugin implementation is provided.
AR_API bool _IsContextDependentPath(const std::string &assetPath) const override
Return true if the result of resolving the given assetPath may differ depending on the asset resolver...
AR_API std::string _CreateIdentifierForNewAsset(const std::string &assetPath, const ArResolvedPath &anchorAssetPath) const override
Return an identifier for a new asset at the given assetPath.
AR_API ArResolvedPath _Resolve(const std::string &assetPath) const override
Return the resolved path for the given assetPath or an empty ArResolvedPath if no asset exists at tha...
AR_API std::string _CreateIdentifier(const std::string &assetPath, const ArResolvedPath &anchorAssetPath) const override
Return an identifier for the asset at the given assetPath.
AR_API ArResolverContext _CreateContextFromString(const std::string &contextStr) const override
Creates an ArDefaultResolverContext from contextStr.
AR_API ArTimestamp _GetModificationTimestamp(const std::string &path, const ArResolvedPath &resolvedPath) const override
Return an ArTimestamp representing the last time the asset at assetPath was modified.
AR_API ArResolverContext _CreateDefaultContextForAsset(const std::string &assetPath) const override
Creates a context that adds the directory containing assetPath as a first directory to be searched,...
static AR_API void SetDefaultSearchPath(const std::vector< std::string > &searchPath)
Set the default search path that will be used during asset resolution.
AR_API std::shared_ptr< ArAsset > _OpenAsset(const ArResolvedPath &resolvedPath) const override
Return an ArAsset object for the asset located at resolvedPath.
AR_API std::shared_ptr< ArWritableAsset > _OpenAssetForWrite(const ArResolvedPath &resolvedPath, WriteMode writeMode) const override
Creates an ArFilesystemWriteableAsset for the asset at the given resolvedPath.
AR_API ArResolverContext _CreateDefaultContext() const override
Return a default ArResolverContext that may be bound to this resolver to resolve assets when no other...
AR_API ArResolvedPath _ResolveForNewAsset(const std::string &assetPath) const override
Return the resolved path for the given assetPath that may be used to create a new asset or an empty A...
Represents a resolved asset path.
Definition: resolvedPath.h:23
An asset resolver context allows clients to provide additional data to the resolver for use during re...
Interface for the asset resolution system.
Definition: resolver.h:43
WriteMode
Enumeration of write modes for OpenAssetForWrite.
Definition: resolver.h:295
Represents a timestamp for an asset.
Definition: timestamp.h:26