Loading...
Searching...
No Matches
instancingAwareCollectionExpressionEvaluator.h
1//
2// Copyright 2026 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_IMAGING_HD_INSTANCING_AWARE_COLLECTION_EXPRESSION_EVALUATOR_H
8#define PXR_IMAGING_HD_INSTANCING_AWARE_COLLECTION_EXPRESSION_EVALUATOR_H
9
10#include "pxr/pxr.h"
11#include "pxr/imaging/hd/api.h"
12
13#include "pxr/imaging/hd/collectionExpressionEvaluator.h"
14
16#include "pxr/base/tf/weakPtr.h"
17#include "pxr/usd/sdf/path.h"
18
19PXR_NAMESPACE_OPEN_SCOPE
20
23
25
42{
43public:
45 struct MatchResult {
51
61
66
71 };
72
75
80 HD_API
82 const HdInstanceProxyViewSceneIndexRefPtr &proxyViewSceneIndex,
83 const SdfPathExpression &expr,
84 const HdCollectionPredicateLibrary &predicateLib);
85
89 bool IsEmpty() const { return _inputEval.IsEmpty(); }
90
98 HD_API
100
103 HD_API
105 const SdfPath &rootPath,
107 bool includeInstanceProxyMatches = false) const;
108
128 HD_API
130 const SdfPath &rootPath,
132 bool includeInstanceProxyMatches,
133 MatchResult * const result) const;
134
135private:
139 void _CollectProxyMatches(
140 const SdfPath &path,
141 bool includeProxyPaths,
142 bool *allMatch,
143 bool *anyMatch,
144 SdfPathSet *matchedProxyPaths) const;
145
150 void _TraverseProxyDescendants(
151 const SdfPath &path,
152 SdfPathSet *proxyPaths) const;
153
154private:
155 // Data.
156
157 // Evaluator backed by the proxy view's input scene.
159 // Evaluator backed by the proxy view scene.
160 HdCollectionExpressionEvaluator _proxyViewEval;
161
162 // Non-owning handle; lifetime is managed by the owning scene index.
164};
165
166PXR_NAMESPACE_CLOSE_SCOPE
167
168#endif // PXR_IMAGING_HD_INSTANCING_AWARE_COLLECTION_EXPRESSION_EVALUATOR_H
Evaluates SdfPathExpressions with prims from a given HdSceneIndex.
bool IsEmpty() const
Returns true if the evaluator has an invalid scene index or an empty underlying SdfPathExpressionEval...
MatchKind
Option to configure the paths returned by PopulateMatches.
A scene index that provides a topological view of the scene as though instancing were not being used.
A wrapper around HdCollectionExpressionEvaluator that uses the "unrolled" instance proxy view of the ...
SdfPathSet nonInstanceMatches
Paths of prims that matched the expression excluding outermost instance prim paths.
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...
SdfPathSet partiallyMatchedInstances
Outermost instance prim paths where SOME but not all instance proxy descendants match the 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.
bool IsEmpty() const
Returns true if the evaluator that uses the proxy view's input scene has no valid scene index or expr...
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 predi...
SdfPathSet matchedInstanceProxyPaths
Instance proxy prim paths that matched the expression.
HD_API void AppendAllMatches(const SdfPath &rootPath, HdCollectionExpressionEvaluator::MatchKind matchKind, bool includeInstanceProxyMatches, MatchResult *const result) const
Accumulates two-pass match results into result.
SdfPathSet fullyMatchedInstances
Outermost instance prim paths where ALL instance proxy descendants match the expression.
HdInstancingAwareCollectionExpressionEvaluator()=default
Default constructor. Constructs an empty evaluator.
Objects of this class represent a logical expression syntax tree consisting of SdfPathPattern s,...
A path value used to locate objects in layers or scenegraphs.
Definition path.h:281
Represents the result of a predicate function: a pair of the boolean result and a Constancy token ind...
Represents a library of predicate functions for use with SdfPredicateExpression.
Pointer storage with deletion detection.
Definition weakPtr.h:128
Standard pointer typedefs.
#define TF_DECLARE_REF_PTRS(type)
Define standard ref pointer types.
Definition declarePtrs.h:58
Pointer storage with deletion detection.