Loading...
Searching...
No Matches
primCompositionQuery.h
Go to the documentation of this file.
1//
2// Copyright 2019 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_USD_USD_PRIM_COMPOSITION_QUERY_H
8#define PXR_USD_USD_PRIM_COMPOSITION_QUERY_H
9
11
12#include "pxr/pxr.h"
13#include "pxr/usd/usd/api.h"
14#include "pxr/usd/usd/prim.h"
15
16#include "pxr/usd/pcp/node.h"
17#include "pxr/usd/pcp/primIndex.h"
18
19#include <memory>
20
21PXR_NAMESPACE_OPEN_SCOPE
22
37{
38public:
40
58
60 USD_API
62
68 USD_API
70
72
75
78 USD_API
79 SdfLayerHandle GetTargetLayer() const;
80
83 USD_API
85
96 USD_API
98 const SdfLayerHandle &subLayer = nullptr) const;
99
109 USD_API
111 const SdfLayerHandle &subLayer = nullptr) const;
112
114
121
128 USD_API
129 SdfLayerHandle GetIntroducingLayer() const;
130
141 USD_API
143
153 USD_API
155 SdfReference *ref) const;
156
166 USD_API
168 SdfPayload *payload) const;
169
179 USD_API
181 SdfPath *path) const;
182
192 USD_API
194 std::string *name) const;
195
197
202
204 USD_API
206
211 USD_API
212 bool IsImplicit() const;
213
216 USD_API
217 bool IsAncestral() const;
218
221 USD_API
222 bool HasSpecs() const;
223
228 USD_API
230
234 USD_API
236
238
239private:
240 // These will only be created by a UsdPrimCompositionQuery itself.
241 friend class UsdPrimCompositionQuery;
243
244 PcpNodeRef _node;
245 PcpNodeRef _originalIntroducedNode;
246 PcpNodeRef _introducingNode;
247
248 std::shared_ptr<PcpPrimIndex> _primIndex;
249};
250
264{
265public:
267 enum class ArcTypeFilter
268 {
269 All = 0,
270
271 // Single arc types
272 Reference,
273 Payload,
274 Inherit,
275 Specialize,
276 Variant,
277 Relocate,
278
279 // Related arc types
280 ReferenceOrPayload,
281 InheritOrSpecialize,
282
283 // Inverse of related arc types
284 NotReferenceOrPayload,
285 NotInheritOrSpecialize,
286 NotVariant,
287 NotRelocate
288 };
289
294 {
295 All = 0,
296
297 Direct,
298 Ancestral
299 };
300
304 {
305 All = 0,
306
307 // Indicates that we only want arcs that are authored somewhere in the
308 // root layer stack.
309 IntroducedInRootLayerStack,
310
311 // Indicates that we only want arcs that are authored directly in the
312 // in the prim's prim spec in the root layer stack.
313 IntroducedInRootLayerPrimSpec
314 };
315
318 enum class HasSpecsFilter
319 {
320 All = 0,
321
322 HasSpecs,
323 HasNoSpecs
324 };
325
328 struct Filter
329 {
331 ArcTypeFilter arcTypeFilter {ArcTypeFilter::All};
332
334 DependencyTypeFilter dependencyTypeFilter {DependencyTypeFilter::All};
335
337 ArcIntroducedFilter arcIntroducedFilter {ArcIntroducedFilter::All};
338
340 HasSpecsFilter hasSpecsFilter {HasSpecsFilter::All};
341
342 Filter() {};
343
344 bool operator==(const Filter &rhs) {
345 return arcIntroducedFilter == rhs.arcIntroducedFilter &&
346 arcTypeFilter == rhs.arcTypeFilter &&
347 dependencyTypeFilter == rhs.dependencyTypeFilter &&
348 hasSpecsFilter == rhs.hasSpecsFilter;
349 };
350
351 bool operator!=(const Filter &rhs) {
352 return !(*this == rhs);
353 };
354 };
355
358 USD_API
360
363 USD_API
365
369 USD_API
371
374 USD_API
376 const Filter &filter = Filter());
377
378 ~UsdPrimCompositionQuery() = default;
379
381 USD_API
382 void SetFilter(const Filter &filter);
383
385 USD_API
387
391 USD_API
392 std::vector<UsdPrimCompositionQueryArc> GetCompositionArcs();
393
394private:
395 UsdPrim _prim;
396 Filter _filter;
397 std::shared_ptr<PcpPrimIndex> _expandedPrimIndex;
398 std::vector<UsdPrimCompositionQueryArc> _unfilteredArcs;
399};
400
401
402PXR_NAMESPACE_CLOSE_SCOPE
403
404#endif // PXR_USD_USD_PRIM_COMPOSITION_QUERY_H
405
PcpNode represents a node in an expression tree for compositing scene description.
Definition: node.h:47
Represents a set of list editing operations.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:280
Represents a payload and all its meta data.
Definition: payload.h:41
Represents a reference and all its meta data.
Definition: reference.h:58
This represents a composition arc that is returned by a UsdPrimCompositionQuery.
USD_API SdfLayerHandle GetIntroducingLayer() const
Returns the specific layer in the layer stack that adds this arc to the composition graph.
USD_API PcpNodeRef GetIntroducingNode() const
Returns the node that introduces this arc into composition graph.
USD_API bool IsAncestral() const
Returns whether this arc is ancestral, i.e.
USD_API bool IsImplicit() const
Returns whether this arc was implicitly added to this prim meaning it exists because of the introduct...
USD_API bool GetIntroducingListEditor(SdfReferenceEditorProxy *editor, SdfReference *ref) const
Gets the list editor and authored SdfReference value that introduces this arc to the composition grap...
USD_API SdfPath GetIntroducingPrimPath() const
Returns the path of the prim that introduces this arc to the composition graph within the layer in wh...
USD_API SdfPath GetTargetPrimPath() const
Returns the path of the prim spec that is targeted by this composition arc in the target layer stack.
USD_API bool GetIntroducingListEditor(SdfNameEditorProxy *editor, std::string *name) const
Gets the list editor and authored string value that introduces this arc to the composition graph for ...
USD_API bool IsIntroducedInRootLayerPrimSpec() const
Returns whether the composition opinion that introduces this arc is authored directly on the prim's p...
USD_API SdfLayerHandle GetTargetLayer() const
Returns the root layer of the layer stack that holds the prim spec targeted by this composition arc.
USD_API bool HasSpecs() const
Returns whether the target node of this arc contributes any local spec opinions that are composed for...
USD_API bool IsIntroducedInRootLayerStack() const
Returns whether the composition opinion that introduces this arc is authored in the root layer stack.
USD_API bool GetIntroducingListEditor(SdfPathEditorProxy *editor, SdfPath *path) const
Gets the list editor and authored SdfPath value that introduced this arc to the composition graph for...
USD_API PcpArcType GetArcType() const
Returns the arc type.
USD_API UsdResolveTarget MakeResolveTargetUpTo(const SdfLayerHandle &subLayer=nullptr) const
Creates and returns a resolve target that, when passed to a UsdAttributeQuery for one of this prim's ...
USD_API UsdResolveTarget MakeResolveTargetStrongerThan(const SdfLayerHandle &subLayer=nullptr) const
Creates and returns a resolve target that, when passed to a UsdAttributeQuery for one of this prim's ...
USD_API PcpNodeRef GetTargetNode() const
Returns the targeted node of this composition arc.
USD_API bool GetIntroducingListEditor(SdfPayloadEditorProxy *editor, SdfPayload *payload) const
Gets the list editor and authored SdfPayload value that introduces this arc to the composition graph ...
Object for making optionally filtered composition queries about a prim.
static USD_API UsdPrimCompositionQuery GetDirectInherits(const UsdPrim &prim)
Returns a prim composition query for the given prim with a preset filter that only returns inherit ar...
USD_API std::vector< UsdPrimCompositionQueryArc > GetCompositionArcs()
Return a list of composition arcs for this query's prim using the current query filter.
static USD_API UsdPrimCompositionQuery GetDirectRootLayerArcs(const UsdPrim &prim)
Returns a prim composition query for the given prim with a preset filter that only returns direct arc...
ArcTypeFilter
Choices for filtering composition arcs based on arc type.
HasSpecsFilter
Choices for filtering composition arcs on whether the node contributes specs to the prim.
USD_API Filter GetFilter() const
Return a copy of the current filter parameters.
static USD_API UsdPrimCompositionQuery GetDirectReferences(const UsdPrim &prim)
Returns a prim composition query for the given prim with a preset filter that only returns reference ...
USD_API UsdPrimCompositionQuery(const UsdPrim &prim, const Filter &filter=Filter())
Create a prim composition query for the with the given option filter.
DependencyTypeFilter
Choices for filtering composition arcs on dependency type.
USD_API void SetFilter(const Filter &filter)
Change the filter for this query.
ArcIntroducedFilter
Choices for filtering composition arcs based on where the arc is introduced.
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:117
Defines a subrange of nodes and layers within a prim's prim index to consider when performing value r...
Definition: resolveTarget.h:56
Aggregate filter for filtering composition arcs by the previously defined criteria.
DependencyTypeFilter dependencyTypeFilter
Filters by dependency type, direct or ancestral.
ArcTypeFilter arcTypeFilter
Filters by arc type.
ArcIntroducedFilter arcIntroducedFilter
Filters by where the arc is introduced.
HasSpecsFilter hasSpecsFilter
Filters by whether the arc provides specs for the prim.
PcpArcType
Describes the type of arc connecting two nodes in the prim index.
Definition: types.h:27