Loading...
Searching...
No Matches
HdCollectionExpressionEvaluator Class Reference

Evaluates SdfPathExpressions with prims from a given HdSceneIndex. More...

#include <collectionExpressionEvaluator.h>

Public Types

enum  MatchKind { MatchAll , ShallowestMatches , ShallowestMatchesAndAllDescendants }
 Option to configure the paths returned by PopulateMatches. More...
 

Public Member Functions

 HdCollectionExpressionEvaluator ()=default
 Default c'tor. Constructs an empty evaluator.
 
HD_API 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 (const HdSceneIndexBaseRefPtr &sceneIndex, const SdfPathExpression &expr, const HdCollectionPredicateLibrary &predicateLib)
 Constructs an evaluator that evaluates expr on prims from sceneIndex using the predicates in predicateLib.
 
bool IsEmpty () const
 Returns true if the evaluator has an invalid scene index or an empty underlying SdfPathExpressionEval object.
 
HdSceneIndexBaseRefPtr GetSceneIndex () const
 Returns the scene index provided during construction, or nullptr if it was default constructed.
 
HD_API SdfPredicateFunctionResult 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 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).
 
HD_API void 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).
 

Detailed Description

Evaluates SdfPathExpressions with prims from a given HdSceneIndex.

Definition at line 57 of file collectionExpressionEvaluator.h.

Member Enumeration Documentation

◆ MatchKind

enum MatchKind

Option to configure the paths returned by PopulateMatches.

  • MatchAll: Return the paths of all prims that match the expression.
  • ShallowestMatches: Return the paths of just the top level prims that match, in a level-order or BFS sense.
  • ShallowestMatchesAndAllDescendants: Returns the paths of the top level prims that match the expression, as well as all their descendants.

Definition at line 128 of file collectionExpressionEvaluator.h.

Constructor & Destructor Documentation

◆ HdCollectionExpressionEvaluator() [1/3]

Default c'tor. Constructs an empty evaluator.

◆ HdCollectionExpressionEvaluator() [2/3]

HD_API HdCollectionExpressionEvaluator ( const HdSceneIndexBaseRefPtr &  sceneIndex,
const SdfPathExpression expr 
)

Constructs an evaluator that evaluates expr on prims from sceneIndex using the predicates in HdGetCollectionPredicateLibrary().

◆ HdCollectionExpressionEvaluator() [3/3]

HD_API 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.

Member Function Documentation

◆ GetSceneIndex()

HdSceneIndexBaseRefPtr GetSceneIndex ( ) const
inline

Returns the scene index provided during construction, or nullptr if it was default constructed.

Definition at line 89 of file collectionExpressionEvaluator.h.

◆ IsEmpty()

bool IsEmpty ( ) const
inline

Returns true if the evaluator has an invalid scene index or an empty underlying SdfPathExpressionEval object.

Definition at line 82 of file collectionExpressionEvaluator.h.

◆ Match()

HD_API SdfPredicateFunctionResult Match ( const SdfPath path) const

Returns the result of evaluating the expression (provided on construction) against the scene index prim at path.

◆ PopulateAllMatches()

HD_API void 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.

Note
: result is guaranteed to have unique paths because a scene index prim is traversed at most once.

◆ PopulateMatches()

HD_API void 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"}

Note
: result is guaranteed to have unique paths because a scene index prim is traversed at most once.

The documentation for this class was generated from the following file: