Loading...
Searching...
No Matches
defaultResolver.h
Go to the documentation of this file.
1//
2// Copyright 2016 Pixar
3//
4// Licensed under the Apache License, Version 2.0 (the "Apache License")
5// with the following modification; you may not use this file except in
6// compliance with the Apache License and the following modification to it:
7// Section 6. Trademarks. is deleted and replaced with:
8//
9// 6. Trademarks. This License does not grant permission to use the trade
10// names, trademarks, service marks, or product names of the Licensor
11// and its affiliates, except as required to comply with Section 4(c) of
12// the License and to reproduce the content of the NOTICE file.
13//
14// You may obtain a copy of the Apache License at
15//
16// http://www.apache.org/licenses/LICENSE-2.0
17//
18// Unless required by applicable law or agreed to in writing, software
19// distributed under the Apache License with the above modification is
20// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21// KIND, either express or implied. See the Apache License for the specific
22// language governing permissions and limitations under the Apache License.
23//
24#ifndef PXR_USD_AR_DEFAULT_RESOLVER_H
25#define PXR_USD_AR_DEFAULT_RESOLVER_H
26
28
29#include "pxr/pxr.h"
30#include "pxr/usd/ar/api.h"
33#include "pxr/usd/ar/resolver.h"
34
35#include <memory>
36#include <string>
37#include <vector>
38
39PXR_NAMESPACE_OPEN_SCOPE
40
68 : public ArResolver
69{
70public:
71 AR_API
72 ArDefaultResolver() = default;
73
74 AR_API
75 virtual ~ArDefaultResolver() = default;
76
88 AR_API
90 const std::vector<std::string>& searchPath);
91
92protected:
93 AR_API
94 std::string _CreateIdentifier(
95 const std::string& assetPath,
96 const ArResolvedPath& anchorAssetPath) const override;
97
98 AR_API
100 const std::string& assetPath,
101 const ArResolvedPath& anchorAssetPath) const override;
102
103 AR_API
105 const std::string& assetPath) const override;
106
107 AR_API
109 const std::string& assetPath) const override;
110
111 AR_API
113
121 AR_API
123 const std::string& assetPath) const override;
124
128 AR_API
130 const std::string& contextStr) const override;
131
132 AR_API
134 const std::string& assetPath) const override;
135
136 AR_API
138 const std::string& path,
139 const ArResolvedPath& resolvedPath) const override;
140
141 AR_API
142 std::shared_ptr<ArAsset> _OpenAsset(
143 const ArResolvedPath& resolvedPath) const override;
144
147 AR_API
148 std::shared_ptr<ArWritableAsset> _OpenAssetForWrite(
149 const ArResolvedPath& resolvedPath,
150 WriteMode writeMode) const override;
151
152private:
153 const ArDefaultResolverContext* _GetCurrentContextPtr() const;
154
155 ArResolverContext _defaultContext;
156};
157
158PXR_NAMESPACE_CLOSE_SCOPE
159
160#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:40
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:60
WriteMode
Enumeration of write modes for OpenAssetForWrite.
Definition: resolver.h:312
Represents a timestamp for an asset.
Definition: timestamp.h:43