Loading...
Searching...
No Matches
dependencies.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_USD_UTILS_DEPENDENCIES_H
25#define PXR_USD_USD_UTILS_DEPENDENCIES_H
26
37
38#include "pxr/pxr.h"
39#include "pxr/usd/usdUtils/api.h"
41
42#include <string>
43#include <vector>
44
45PXR_NAMESPACE_OPEN_SCOPE
46
59USDUTILS_API
61 const std::string& filePath,
62 std::vector<std::string>* subLayers,
63 std::vector<std::string>* references,
64 std::vector<std::string>* payloads);
65
76USDUTILS_API
77bool
79 std::vector<SdfLayerRefPtr> *layers,
80 std::vector<std::string> *assets,
81 std::vector<std::string> *unresolvedPaths);
82
87using UsdUtilsModifyAssetPathFn = std::function<std::string(
88 const std::string& assetPath)>;
89
98USDUTILS_API
100 const SdfLayerHandle& layer,
101 const UsdUtilsModifyAssetPathFn& modifyFn);
102
103// Enum class representing the type of dependency.
104enum class UsdUtilsDependencyType {
105 Reference,
106 SubLayer,
107 Payload
108};
109
110// Signature for user supplied processing function. Note if the asset path
111// that is returned from this function is the empty string then the asset
112// path will be removed.
113// \param layer The layer containing this dependency
114// \param assetPath The asset path as authored in the layer
115// \param dependencies All actual dependencies associated with this asset path.
116// Multiple items may be present in this array if the asset path is, for
117// example, a udim specifier or a clips 'templateAssetPath'
118// \param dependencyType enumerates the type of this dependency
119using UsdUtilsProcessingFunc = std::function<std::string(
120 const SdfLayerRefPtr &layer,
121 const std::string &assetPath,
122 const std::vector<std::string>& dependencies,
123 UsdUtilsDependencyType dependencyType)>;
124
125PXR_NAMESPACE_CLOSE_SCOPE
126
127#endif // PXR_USD_USD_UTILS_DEPENDENCIES_H
Contains an asset path and an optional resolved path.
Definition: assetPath.h:47
USDUTILS_API bool UsdUtilsComputeAllDependencies(const SdfAssetPath &assetPath, std::vector< SdfLayerRefPtr > *layers, std::vector< std::string > *assets, std::vector< std::string > *unresolvedPaths)
Recursively computes all the dependencies of the given asset and populates layers with all the depend...
USDUTILS_API void UsdUtilsModifyAssetPaths(const SdfLayerHandle &layer, const UsdUtilsModifyAssetPathFn &modifyFn)
Helper function that visits every asset path in layer, calls modifyFn and replaces the value with the...
std::function< std::string(const std::string &assetPath)> UsdUtilsModifyAssetPathFn
Callback that is used to modify asset paths in a layer.
Definition: dependencies.h:88
USDUTILS_API void UsdUtilsExtractExternalReferences(const std::string &filePath, std::vector< std::string > *subLayers, std::vector< std::string > *references, std::vector< std::string > *payloads)
Parses the file at filePath, identifying external references, and sorting them into separate type-bas...