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 /// Return a predicate library with a foundational set of predicate functions
25 /// to evaluate SdfPathExpressions on prims in a scene index.
26 ///
27 /// To evaluate the path expression, an evaluator object is constructed with
28 /// the predicate library as an argument.
29 ///
30 /// \sa HdCollectionExpressionEvaluator
31 /// \sa SdfPathExpression
32 ///
33 /// ----------------------------------------------------------------------------
34 ///
35 /// The library returned provides the following predicate functions:
36 ///
37 /// hdType(string primType)
38 /// Returns true if the scene index prim's type is \p primType.
39 ///
40 /// hdVisible(bool visibility = true)
41 /// Returns true if the scene index prim's visibility is \p visibility.
42 ///
43 /// hdPurpose(string purpose)
44 /// Returns true if the scene index prim's purpose is \p purpose.
45 ///
46 /// hdHasDataSource(string locatorStr)
47 /// Returns true if the scene index prim's container has a valid data source
48 /// at data source locator \p locatorStr.
49 /// Multiple locator tokens may be provided by using '.' as the delimiter.
50 /// e.g. "primvars.foo".
51 /// A locator token may contain a namespace prefix.
52 /// e.g. "primvars.ri:baz" is parsed as two tokens, "primvars" and "ri:baz".
53 ///
54 /// hdHasPrimvar(string primvarName)
55 /// Returns true if the scene index prim has a primvar named \p primvarName.
56 ///
57 /// hdHasMaterialBinding(string materialPath)
58 /// Returns true if the scene index prim's resolved (allPurpose) material
59 /// binding path contains the substring \p materialPath.
60 ///
61 /// \deprecated
62 /// The following predicate functions are deprecated and will be removed in a
63 /// future release:
64 ///
65 /// \li type
66 /// \li visible
67 /// \li purpose
68 /// \li hasDataSOurce
69 /// \li hasPrimvar
70 /// \li hasMaterialBinding
71 ///
72 /// Any predicate functions in hd will use the 'hd' prefix henceforth to make
73 /// it clear to the author/reader that it is a (core) hydra predicate.
74 ///
75 /// ----------------------------------------------------------------------------
76 ///
77 /// Usage examples:
78 ///
79 /// "/World//{hdType:basisCurves}" matches all descendant prims of /World that
80 /// are basis curves.
81 ///
82 /// "//{hdVisible:false}" matches all scene index prims that are invisible.
83 ///
84 /// "//{hdPurpose:guide}" matches all scene index prims whose purpose is
85 /// 'guide'.
86 ///
87 /// "//Foo/{hdHasDataSource:"bar.baz"}" matches children of any prim named Foo
88 /// that have a valid data source at bar.baz .
89 ///
90 /// "/Foo//{hdHasPrimvar:baz}" matches all descendant prims of Foo that have a
91 /// primvar named "baz".
92 ///
93 /// "//{hdHasMaterialBinding:"GlossyMat"}" matches all scene index prims
94 /// whose resolved (allPurpose) material binding path contains the string
95 /// "GlossyMat".
96 ///
97 /// ----------------------------------------------------------------------------
98 ///
99 HD_API
102 
104 
105 #endif // PXR_IMAGING_HD_COLLECTION_PREDICATE_LIBRARY_H
HD_API const HdCollectionPredicateLibrary & HdGetCollectionPredicateLibrary()
#define HD_API
Definition: api.h:23
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74