HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
utils.h
Go to the documentation of this file.
1 //
2 // Copyright 2024 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_IMAGING_HDSI_UTILS_H
8 #define PXR_IMAGING_HDSI_UTILS_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/imaging/hdsi/api.h"
12 #include "pxr/usd/sdf/path.h"
14 #include "pxr/base/tf/token.h"
15 #include <optional>
16 
18 
20 
23 class SdfPathExpression;
24 
25 struct HdSceneIndexPrim;
26 
27 /// --------------------------------------------------------------------------
28 /// General use collection utilities.
29 /// --------------------------------------------------------------------------
30 
31 /// Extracts and compiles the membership expression of the collection
32 /// with the given \p collectionName, if it exists.
33 ///
35 void
37  HdCollectionsSchema &collections,
38  TfToken const& collectionName,
39  HdSceneIndexBaseRefPtr const& sceneIndex,
40  SdfPathExpression *expr,
41  std::optional<HdCollectionExpressionEvaluator> *eval);
42 
43 /// --------------------------------------------------------------------------
44 /// Utilities to evaluate membership expressions for collections with pruning
45 /// semantics.
46 /// --------------------------------------------------------------------------
47 
48 /// Returns whether the prim at \p primPath is pruned by the suppied
49 /// evaluator.
50 ///
52 bool
54  const SdfPath &primPath,
56 
57 /// Prunes the given list of children using the supplied evaluator.
59 void
61  const SdfPath &parentPath,
63  SdfPathVector *children);
64 
65 /// --------------------------------------------------------------------------
66 /// Utilities for working with materials
67 /// --------------------------------------------------------------------------
68 
69 /// Returns the path of the material bound to \p prim for the 'full' or
70 /// 'allPurpose' purposes (whichever is found first).
71 ///
72 /// If no material is bound to this prim for either of those purposes, an
73 /// empty path is returned.
75 SdfPath
77  const HdSceneIndexPrim& prim);
78 
79 /// ------------------------------------------------------------------------
80 
82 
83 #endif //PXR_IMAGING_HDSI_UTILS_H
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
HDSI_API void HdsiUtilsCompileCollection(HdCollectionsSchema &collections, TfToken const &collectionName, HdSceneIndexBaseRefPtr const &sceneIndex, SdfPathExpression *expr, std::optional< HdCollectionExpressionEvaluator > *eval)
Definition: token.h:70
HDSI_API bool HdsiUtilsIsPruned(const SdfPath &primPath, const HdCollectionExpressionEvaluator &eval)
std::vector< class SdfPath > SdfPathVector
HDSI_API void HdsiUtilsRemovePrunedChildren(const SdfPath &parentPath, const HdCollectionExpressionEvaluator &eval, SdfPathVector *children)
Prunes the given list of children using the supplied evaluator.
HUSD_API bool eval(VtValue &val, T &ret_val)
Definition: path.h:280
PXR_NAMESPACE_OPEN_SCOPE TF_DECLARE_WEAK_AND_REF_PTRS(HdSceneIndexBase)
#define HDSI_API
Definition: api.h:23
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
HDSI_API SdfPath HdsiUtilsGetBoundMaterial(const HdSceneIndexPrim &prim)