HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
collectionPredicateLibrary.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 
8 #ifndef PXR_IMAGING_HD_COLLECTION_PREDICATE_LIBRARY_H
9 #define PXR_IMAGING_HD_COLLECTION_PREDICATE_LIBRARY_H
10 
11 #include "pxr/pxr.h"
12 
13 #include "pxr/imaging/hd/api.h"
14 
16 
18 
19 struct HdSceneIndexPrim;
20 
23 
24 ///
25 /// \defgroup group_hd_collectionPredicates Hydra Collection Predicate API
26 /// Functions for use in path expressions that are evaluated on prims in a
27 /// scene index.
28 /// @{
29 /// The library returned by \ref HdGetCollectionPredicateLibrary provides the
30 /// following predicate functions:
31 ///
32 /// \li \c hdType(string primType)
33 /// Returns true if the scene index prim's type is \p primType.
34 ///
35 /// \li \c hdVisible(bool visibility = true)
36 /// Returns true if the scene index prim's visibility is \p visibility.
37 ///
38 /// \li \c hdPurpose(string purpose)
39 /// Returns true if the scene index prim's purpose is \p purpose.
40 ///
41 /// \li \c hdHasDataSource(string locatorStr)
42 /// Returns true if the scene index prim's container has a valid data source
43 /// at data source locator \p locatorStr.
44 /// Multiple locator tokens may be provided by using '.' as the delimiter.
45 /// e.g. "primvars.foo".
46 /// A locator token may contain a namespace prefix.
47 /// e.g. "primvars.ri:baz" is parsed as two tokens, "primvars" and "ri:baz".
48 ///
49 /// \li \c hdHasPrimvar(string primvarName)
50 /// Returns true if the scene index prim has a primvar named \p primvarName.
51 ///
52 /// \li \c hdHasMaterialBinding(string materialPath)
53 /// Returns true if the scene index prim's resolved (allPurpose) material
54 /// binding path contains the substring \p materialPath.
55 ///
56 /// \deprecated
57 /// The following predicate functions are deprecated and will be removed in a
58 /// future release:
59 ///
60 /// \li \c type
61 /// \li \c visible
62 /// \li \c purpose
63 /// \li \c hasDataSOurce
64 /// \li \c hasPrimvar
65 /// \li \c hasMaterialBinding
66 ///
67 /// Any predicate functions in hd will use the 'hd' prefix henceforth to make
68 /// it clear to the author/reader that it is a (core) hydra predicate.
69 ///
70 /// \section hd_predicate_usage Usage Examples
71 /// \ingroup group_hd_collectionPredicates
72 ///
73 /// This section provides usage examples for the Hydra Collection Predicate API.
74 ///
75 /// \c "/World//{hdType:basisCurves}" matches all descendant prims of /World that
76 /// are basis curves.
77 ///
78 /// \c "//{hdVisible:false}" matches all scene index prims that are invisible.
79 ///
80 /// \c "//{hdPurpose:guide}" matches all scene index prims whose purpose is
81 /// 'guide'.
82 ///
83 /// \c "//Foo/{hdHasDataSource:"bar.baz"}" matches children of any prim named Foo
84 /// that have a valid data source at bar.baz .
85 ///
86 /// \c "/Foo//{hdHasPrimvar:baz}" matches all descendant prims of Foo that have a
87 /// primvar named "baz".
88 ///
89 /// \c "//{hdHasMaterialBinding:"GlossyMat"}" matches all scene index prims
90 /// whose resolved (allPurpose) material binding path contains the string
91 /// "GlossyMat".
92 ///
93 
94 /// \brief Return a predicate library with a foundational set of predicate
95 /// functions to evaluate SdfPathExpressions on prims in a scene index.
96 ///
97 /// To evaluate the path expression, an evaluator object is constructed with
98 /// the predicate library as an argument.
99 ///
100 /// \sa HdCollectionExpressionEvaluator
101 /// \sa SdfPathExpression
102 ///
103 HD_API
106 
107 /// @}
108 
110 
111 #endif // PXR_IMAGING_HD_COLLECTION_PREDICATE_LIBRARY_H
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
#define HD_API
Definition: api.h:23
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
HD_API const HdCollectionPredicateLibrary & HdGetCollectionPredicateLibrary()
Return a predicate library with a foundational set of predicate functions to evaluate SdfPathExpressi...