Loading...
Searching...
No Matches
HdInstancingAwareCollectionExpressionEvaluator Class Reference

A wrapper around HdCollectionExpressionEvaluator that uses the "unrolled" instance proxy view of the scene to provide instancing-aware evaluation of collection path expressions. More...

#include <instancingAwareCollectionExpressionEvaluator.h>

Classes

struct  MatchResult
 Result type for AppendAllMatches. More...
 

Public Member Functions

 HdInstancingAwareCollectionExpressionEvaluator ()=default
 Default constructor. Constructs an empty evaluator.
 
HD_API HdInstancingAwareCollectionExpressionEvaluator (const HdInstanceProxyViewSceneIndexRefPtr &proxyViewSceneIndex, const SdfPathExpression &expr, const HdCollectionPredicateLibrary &predicateLib)
 Constructs an evaluator for expr evaluated against the input scene of proxyViewSceneIndex using predicateLib.
 
bool IsEmpty () const
 Returns true if the evaluator that uses the proxy view's input scene has no valid scene index or expression.
 
HD_API SdfPredicateFunctionResult Match (const SdfPath &path) const
 Evaluates the expression at path using the evaluator backed by the proxy view's input scene.
 
HD_API MatchResult GetAllMatches (const SdfPath &rootPath, HdCollectionExpressionEvaluator::MatchKind matchKind, bool includeInstanceProxyMatches=false) const
 Convenience wrapper that calls AppendAllMatches() on a default-constructed MatchResult and returns it.
 
HD_API void AppendAllMatches (const SdfPath &rootPath, HdCollectionExpressionEvaluator::MatchKind matchKind, bool includeInstanceProxyMatches, MatchResult *const result) const
 Accumulates two-pass match results into result.
 

Detailed Description

A wrapper around HdCollectionExpressionEvaluator that uses the "unrolled" instance proxy view of the scene to provide instancing-aware evaluation of collection path expressions.

Outermost instance prims (that correspond to leaf USD instance prims that aren't under a prototype) are classified as fully or partially matched, and matched instance proxy prims can be accumulated into the result.

This evaluator takes a HdInstanceProxyViewSceneIndexRefPtr (and not any HdSceneIndexBaseRefPtr) as its c'tor argument to facilitate a two-pass evaluation of the expression in AppendAllMatches().

Definition at line 41 of file instancingAwareCollectionExpressionEvaluator.h.


Class Documentation

◆ HdInstancingAwareCollectionExpressionEvaluator::MatchResult

struct HdInstancingAwareCollectionExpressionEvaluator::MatchResult

Result type for AppendAllMatches.

Definition at line 45 of file instancingAwareCollectionExpressionEvaluator.h.

Class Members
SdfPathSet fullyMatchedInstances Outermost instance prim paths where ALL instance proxy descendants match the expression.

This includes the constant-true case (Match() returned true with IsConstant()=true) and the varying case where every proxy prim is matched. XXX If the outermost instance alone is matched, it is currently not classified as fully/partially matched. Should it be the former? (i.e. /Path/To/OuterInstance// is fully matched, but /Path/To/OuterInstance is not)

SdfPathSet matchedInstanceProxyPaths Instance proxy prim paths that matched the expression.

Populated only when includeInstanceProxyMatches=true is passed to AppendAllMatches() or GetAllMatches().

SdfPathSet nonInstanceMatches Paths of prims that matched the expression excluding outermost instance prim paths.

XXX This currently includes prims under /UsdNiPropagatedPrototypes. Should we filter those out?

SdfPathSet partiallyMatchedInstances Outermost instance prim paths where SOME but not all instance proxy descendants match the expression.

It does not matter if the outermost instance itself matches or not.

Constructor & Destructor Documentation

◆ HdInstancingAwareCollectionExpressionEvaluator() [1/2]

Default constructor. Constructs an empty evaluator.

◆ HdInstancingAwareCollectionExpressionEvaluator() [2/2]

HD_API HdInstancingAwareCollectionExpressionEvaluator ( const HdInstanceProxyViewSceneIndexRefPtr & proxyViewSceneIndex,
const SdfPathExpression & expr,
const HdCollectionPredicateLibrary & predicateLib )

Constructs an evaluator for expr evaluated against the input scene of proxyViewSceneIndex using predicateLib.

proxyViewSceneIndex is held as a non-owning TfWeakPtr and provides instance proxy traversal for pass 2 of AppendAllMatches().

Member Function Documentation

◆ AppendAllMatches()

HD_API void AppendAllMatches ( const SdfPath & rootPath,
HdCollectionExpressionEvaluator::MatchKind matchKind,
bool includeInstanceProxyMatches,
MatchResult *const result ) const

Accumulates two-pass match results into result.

  1. Standard scene traversal via the HdCollectionExpressionEvaluator that uses the proxy view's input scene. Outermost instance paths are filtered out and classified in pass 2.
  2. For each outermost instance prim, Match() is called using an HdCollectionExpressionEvaluator that uses the proxy view scene index. If the instance prim matches and is constant over descendants, the instance is classified as "fully matched" immediately. Otherwise, instance proxy descendants are traversed to determine whether the instance is fully matched (all proxy prims match) or partially matched (some but not all proxy prims match).

When includeInstanceProxyMatches=true, all proxy paths are traversed and those that match are accumulated into result->matchedInstanceProxyPaths.

◆ GetAllMatches()

HD_API MatchResult GetAllMatches ( const SdfPath & rootPath,
HdCollectionExpressionEvaluator::MatchKind matchKind,
bool includeInstanceProxyMatches = false ) const

Convenience wrapper that calls AppendAllMatches() on a default-constructed MatchResult and returns it.

◆ IsEmpty()

bool IsEmpty ( ) const
inline

Returns true if the evaluator that uses the proxy view's input scene has no valid scene index or expression.

XXX Should this include the proxy view evaluator as well?

Definition at line 89 of file instancingAwareCollectionExpressionEvaluator.h.

◆ Match()

HD_API SdfPredicateFunctionResult Match ( const SdfPath & path) const

Evaluates the expression at path using the evaluator backed by the proxy view's input scene.

The rationale is that clients shouldn't have to concern themselves with instance proxy prim paths that don't exist in the input scene. The instance proxy view is only needed when evaluating an expression over all prims in the scene to drive invalidation.


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