HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HdCollectionExpressionEvaluator Class Reference

#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
 

Detailed Description

Evaluates SdfPathExpressions with prims from a given HdSceneIndex.

Definition at line 40 of file collectionExpressionEvaluator.h.

Member Enumeration Documentation

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.
Enumerator
MatchAll 
ShallowestMatches 
ShallowestMatchesAndAllDescendants 

Definition at line 111 of file collectionExpressionEvaluator.h.

Constructor & Destructor Documentation

HdCollectionExpressionEvaluator::HdCollectionExpressionEvaluator ( )
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.

Member Function Documentation

HdSceneIndexBaseRefPtr HdCollectionExpressionEvaluator::GetSceneIndex ( ) const
inline

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

Definition at line 72 of file collectionExpressionEvaluator.h.

bool HdCollectionExpressionEvaluator::IsEmpty ( ) const
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.

Note
: 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"}

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: