All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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
138 USD_API
140
150 USD_API
152 SdfReference *ref) const;
153
163 USD_API
165 SdfPayload *payload) const;
166
176 USD_API
178 SdfPath *path) const;
179
189 USD_API
191 std::string *name) const;
192
194
199
201 USD_API
203
208 USD_API
209 bool IsImplicit() const;
210
213 USD_API
214 bool IsAncestral() const;
215
218 USD_API
219 bool HasSpecs() const;
220
225 USD_API
227
231 USD_API
233
235
236private:
237 // These will only be created by a UsdPrimCompositionQuery itself.
238 friend class UsdPrimCompositionQuery;
240
241 PcpNodeRef _node;
242 PcpNodeRef _originalIntroducedNode;
243 PcpNodeRef _introducingNode;
244
245 std::shared_ptr<PcpPrimIndex> _primIndex;
246};
247
261{
262public:
264 enum class ArcTypeFilter
265 {
266 All = 0,
267
268 // Single arc types
269 Reference,
270 Payload,
271 Inherit,
272 Specialize,
273 Variant,
274
275 // Related arc types
276 ReferenceOrPayload,
277 InheritOrSpecialize,
278
279 // Inverse of related arc types
280 NotReferenceOrPayload,
281 NotInheritOrSpecialize,
282 NotVariant
283 };
284
289 {
290 All = 0,
291
292 Direct,
293 Ancestral
294 };
295
299 {
300 All = 0,
301
302 // Indicates that we only want arcs that are authored somewhere in the
303 // root layer stack.
304 IntroducedInRootLayerStack,
305
306 // Indicates that we only want arcs that are authored directly in the
307 // in the prim's prim spec in the root layer stack.
308 IntroducedInRootLayerPrimSpec
309 };
310
313 enum class HasSpecsFilter
314 {
315 All = 0,
316
317 HasSpecs,
318 HasNoSpecs
319 };
320
323 struct Filter
324 {
326 ArcTypeFilter arcTypeFilter {ArcTypeFilter::All};
327
329 DependencyTypeFilter dependencyTypeFilter {DependencyTypeFilter::All};
330
332 ArcIntroducedFilter arcIntroducedFilter {ArcIntroducedFilter::All};
333
335 HasSpecsFilter hasSpecsFilter {HasSpecsFilter::All};
336
337 Filter() {};
338
339 bool operator==(const Filter &rhs) {
340 return arcIntroducedFilter == rhs.arcIntroducedFilter &&
341 arcTypeFilter == rhs.arcTypeFilter &&
342 dependencyTypeFilter == rhs.dependencyTypeFilter &&
343 hasSpecsFilter == rhs.hasSpecsFilter;
344 };
345
346 bool operator!=(const Filter &rhs) {
347 return !(*this == rhs);
348 };
349 };
350
353 USD_API
355
358 USD_API
360
364 USD_API
366
369 USD_API
371 const Filter &filter = Filter());
372
373 ~UsdPrimCompositionQuery() = default;
374
376 USD_API
377 void SetFilter(const Filter &filter);
378
380 USD_API
382
386 USD_API
387 std::vector<UsdPrimCompositionQueryArc> GetCompositionArcs();
388
389private:
390 UsdPrim _prim;
391 Filter _filter;
392 std::shared_ptr<PcpPrimIndex> _expandedPrimIndex;
393 std::vector<UsdPrimCompositionQueryArc> _unfilteredArcs;
394};
395
396
397PXR_NAMESPACE_CLOSE_SCOPE
398
399#endif // PXR_USD_USD_PRIM_COMPOSITION_QUERY_H
400
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:274
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