HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
stageCache.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_USD_UTILS_STAGE_CACHE_H
8 #define PXR_USD_USD_UTILS_STAGE_CACHE_H
9 
10 /// \file usdUtils/stageCache.h
11 /// A simple interface for handling a singleton usd stage cache.
12 
13 #include "pxr/pxr.h"
14 #include "pxr/usd/usdUtils/api.h"
15 #include "pxr/usd/usd/stageCache.h"
16 #include "pxr/usd/sdf/path.h"
17 
19 #include "pxr/base/tf/token.h"
20 
21 #include <string>
22 #include <vector>
23 
25 
26 
28 
29 /// \class UsdUtilsStageCache
30 ///
31 /// The UsdUtilsStageCache class provides a simple interface for handling a
32 /// singleton usd stage cache for use by all USD clients. This way code from
33 /// any location can make use of the same cache to maximize stage reuse.
34 ///
36 public:
37 
38  /// Returns the singleton stage cache.
40  static UsdStageCache &Get();
41 
42  /// Given variant selections as a vector of pairs (vector in case order
43  /// matters to the client), constructs a session layer with overs on the
44  /// given root modelName with the variant selections, or returns a cached
45  /// session layer with those opinions.
48  const TfToken& modelName,
49  const std::vector<std::pair<std::string, std::string>>&
50  variantSelections);
51 
52  /// Given variant selections as a vector of pairs (vector in case order
53  /// matters to the client), constructs a session layer with overs on \p
54  /// primPath with the variant selections or returns a cached session layer
55  /// with those opinions.
58  const SdfPath& primPath,
59  const std::vector<std::pair<std::string, std::string>>&
60  variantSelections);
61 };
62 
63 
65 
66 #endif /* PXR_USD_USD_UTILS_STAGE_CACHE_H */
PXR_NAMESPACE_OPEN_SCOPE TF_DECLARE_WEAK_AND_REF_PTRS(SdfLayer)
Definition: layer.h:81
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
static USDUTILS_API SdfLayerRefPtr GetSessionLayerForVariantSelections(const TfToken &modelName, const std::vector< std::pair< std::string, std::string >> &variantSelections)
Definition: token.h:70
static USDUTILS_API UsdStageCache & Get()
Returns the singleton stage cache.
Definition: path.h:280
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
#define USDUTILS_API
Definition: api.h:23