All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
assetPathResolver.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 SDF_ASSET_PATH_RESOLVER_H
25 #define SDF_ASSET_PATH_RESOLVER_H
26 
28 
29 #include "pxr/pxr.h"
30 #include "pxr/usd/sdf/declareHandles.h"
31 #include "pxr/usd/sdf/layer.h"
32 
33 #include "pxr/usd/ar/assetInfo.h"
34 #include "pxr/usd/ar/resolverContext.h"
35 #include "pxr/base/vt/value.h"
36 
37 #include <string>
38 
39 PXR_NAMESPACE_OPEN_SCOPE
40 
41 SDF_DECLARE_HANDLES(SdfLayer);
42 
47 struct Sdf_AssetInfo
48 {
49  std::string identifier;
50  std::string realPath;
51  ArResolverContext resolverContext;
52  ArAssetInfo assetInfo;
53 };
54 
57 bool operator==(const Sdf_AssetInfo& lhs, const Sdf_AssetInfo& rhs);
58 
62 bool Sdf_CanCreateNewLayerWithIdentifier(
63  const std::string& identifier,
64  std::string* whyNot);
65 
70 std::string Sdf_ResolvePath(
71  const std::string& layerPath,
72  ArAssetInfo* assetInfo = 0);
73 
76 std::string Sdf_ComputeFilePath(
77  const std::string& layerPath,
78  ArAssetInfo* assetInfo = 0);
79 
81 bool Sdf_CanWriteLayerToPath(const std::string& layerPath);
82 
87 Sdf_AssetInfo* Sdf_ComputeAssetInfoFromIdentifier(
88  const std::string& identifier,
89  const std::string& filePath,
90  const ArAssetInfo& assetInfo,
91  const std::string& fileVersion = std::string());
92 
95 std::string Sdf_ComputeAnonLayerIdentifier(
96  const std::string& identifierTemplate,
97  const SdfLayer* layer);
98 
100 bool Sdf_IsAnonLayerIdentifier(
101  const std::string& identifier);
102 
106 std::string Sdf_GetAnonLayerDisplayName(
107  const std::string& identifier);
108 
111 std::string Sdf_GetAnonLayerIdentifierTemplate(
112  const std::string& tag);
113 
117 bool Sdf_SplitIdentifier(
118  const std::string& identifier,
119  std::string* layerPath,
120  std::string* arguments);
121 
123 bool Sdf_SplitIdentifier(
124  const std::string& identifier,
125  std::string* layerPath,
126  SdfLayer::FileFormatArguments* arguments);
127 
131 std::string Sdf_CreateIdentifier(
132  const std::string& layerPath,
133  const std::string& arguments);
134 
136 std::string Sdf_CreateIdentifier(
137  const std::string& layerPath,
138  const SdfLayer::FileFormatArguments& arguments);
139 
142 bool Sdf_IdentifierContainsArguments(
143  const std::string& identifier);
144 
148 std::string Sdf_GetLayerDisplayName(
149  const std::string& identifier);
150 
153 std::string Sdf_GetExtension(
154  const std::string& identifier);
155 
158 bool Sdf_IsPackageOrPackagedLayer(
159  const SdfLayerHandle& layer);
160 
163 bool Sdf_IsPackageOrPackagedLayer(
164  const SdfFileFormatConstPtr& fileFormat,
165  const std::string& identifier);
166 
168 std::string Sdf_CanonicalizeRealPath(
169  const std::string& realPath);
170 
171 PXR_NAMESPACE_CLOSE_SCOPE
172 
173 #endif // SDF_ASSET_PATH_RESOLVER_H
A unit of scene description that you combine with other units of scene description to form a shot...
Definition: layer.h:93
AR_API bool operator==(const ArAssetInfo &lhs, const ArAssetInfo &rhs)
std::map< std::string, std::string > FileFormatArguments
Type for specifying additional file format-specific arguments to layer API.
Definition: layer.h:119
An asset resolver context allows clients to provide additional data to the resolver for use during re...
Contains information about a resolved asset.
Definition: assetInfo.h:40