HDK
|
#include <collectionExpressionEvaluator.h>
Public Types | |
enum | MatchKind { MatchAll, ShallowestMatches, ShallowestMatchesAndAllDescendants } |
Public Member Functions | |
HdCollectionExpressionEvaluator ()=default | |
Default c'tor. Constructs an empty evaluator. More... | |
HD_API | HdCollectionExpressionEvaluator (const HdSceneIndexBaseRefPtr &sceneIndex, const SdfPathExpression &expr) |
HD_API | HdCollectionExpressionEvaluator (const HdSceneIndexBaseRefPtr &sceneIndex, const SdfPathExpression &expr, const HdCollectionPredicateLibrary &predicateLib) |
bool | IsEmpty () const |
HdSceneIndexBaseRefPtr | GetSceneIndex () const |
HD_API SdfPredicateFunctionResult | Match (const SdfPath &path) const |
HD_API void | PopulateAllMatches (const SdfPath &rootPath, SdfPathVector *const result) const |
HD_API void | PopulateMatches (const SdfPath &rootPath, MatchKind matchKind, SdfPathVector *const result) const |
Evaluates SdfPathExpressions with prims from a given HdSceneIndex.
Definition at line 40 of file collectionExpressionEvaluator.h.
Option to configure the paths returned by PopulateMatches.
Enumerator | |
---|---|
MatchAll | |
ShallowestMatches | |
ShallowestMatchesAndAllDescendants |
Definition at line 111 of file collectionExpressionEvaluator.h.
|
default |
Default c'tor. Constructs an empty evaluator.
HD_API HdCollectionExpressionEvaluator::HdCollectionExpressionEvaluator | ( | const HdSceneIndexBaseRefPtr & | sceneIndex, |
const SdfPathExpression & | expr | ||
) |
Constructs an evaluator that evaluates expr
on prims from sceneIndex
using the predicates in HdGetCollectionPredicateLibrary().
HD_API HdCollectionExpressionEvaluator::HdCollectionExpressionEvaluator | ( | const HdSceneIndexBaseRefPtr & | sceneIndex, |
const SdfPathExpression & | expr, | ||
const HdCollectionPredicateLibrary & | predicateLib | ||
) |
Constructs an evaluator that evaluates expr
on prims from sceneIndex
using the predicates in predicateLib
.
|
inline |
Returns the scene index provided during construction, or nullptr if it was default constructed.
Definition at line 72 of file collectionExpressionEvaluator.h.
|
inline |
Returns true if the evaluator has an invalid scene index or an empty underlying SdfPathExpressionEval object.
Definition at line 65 of file collectionExpressionEvaluator.h.
HD_API SdfPredicateFunctionResult HdCollectionExpressionEvaluator::Match | ( | const SdfPath & | path | ) | const |
Returns the result of evaluating the expression (provided on construction) against the scene index prim at path
.
HD_API void HdCollectionExpressionEvaluator::PopulateAllMatches | ( | const SdfPath & | rootPath, |
SdfPathVector *const | result | ||
) | const |
Updates result
with the paths of all prims in the subtree at rootPath
(including rootPath
) that match the expression (provided on construction).
An empty evaluator would leave result
unaffected.
result
is guaranteed to have unique paths because a scene index prim is traversed at most once. HD_API void HdCollectionExpressionEvaluator::PopulateMatches | ( | const SdfPath & | rootPath, |
MatchKind | matchKind, | ||
SdfPathVector *const | result | ||
) | const |
Utility that uses matchKind
to configure the paths returned by result
when evaluating the expression for the subtree at rootPath
(including rootPath
).
If matchKind
is MatchAll, the result is identical to that returned by PopulateAllMatches.
Example: Consider a scene index with prims: {"/a", "/a/foobar", "/a/foobar/b", "/a/foobar/bar", "/a/foobar/baz"}
PopulateMatches would return different results for the expression "/a/*bar" depending on matchKind
as follows:
MatchAll : {"/a/foobar", "/a/foobar/bar"}
ShallowestMatches : {"/a/foobar"}
ShallowestMatchesAndAllDescendants: {"/a/foobar", "/a/foobar/b", "/a/foobar/bar", "/a/foobar/baz"}
result
is guaranteed to have unique paths because a scene index prim is traversed at most once.