Loading...
Searching...
No Matches
primCompositionQuery.h
Go to the documentation of this file.
1//
2// Copyright 2019 Pixar
3//
4// Licensed under the Apache License, Version 2.0 (the "Apache License")
5// with the following modification; you may not use this file except in
6// compliance with the Apache License and the following modification to it:
7// Section 6. Trademarks. is deleted and replaced with:
8//
9// 6. Trademarks. This License does not grant permission to use the trade
10// names, trademarks, service marks, or product names of the Licensor
11// and its affiliates, except as required to comply with Section 4(c) of
12// the License and to reproduce the content of the NOTICE file.
13//
14// You may obtain a copy of the Apache License at
15//
16// http://www.apache.org/licenses/LICENSE-2.0
17//
18// Unless required by applicable law or agreed to in writing, software
19// distributed under the Apache License with the above modification is
20// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21// KIND, either express or implied. See the Apache License for the specific
22// language governing permissions and limitations under the Apache License.
23//
24#ifndef PXR_USD_USD_PRIM_COMPOSITION_QUERY_H
25#define PXR_USD_USD_PRIM_COMPOSITION_QUERY_H
26
28
29#include "pxr/pxr.h"
30#include "pxr/usd/usd/api.h"
31#include "pxr/usd/usd/prim.h"
32
33#include "pxr/usd/pcp/node.h"
34#include "pxr/usd/pcp/primIndex.h"
35
36#include <memory>
37
38PXR_NAMESPACE_OPEN_SCOPE
39
54{
55public:
57
75
77 USD_API
79
85 USD_API
87
89
92
95 USD_API
96 SdfLayerHandle GetTargetLayer() const;
97
100 USD_API
102
113 USD_API
115 const SdfLayerHandle &subLayer = nullptr) const;
116
126 USD_API
128 const SdfLayerHandle &subLayer = nullptr) const;
129
131
138
145 USD_API
146 SdfLayerHandle GetIntroducingLayer() const;
147
155 USD_API
157
167 USD_API
169 SdfReference *ref) const;
170
180 USD_API
182 SdfPayload *payload) const;
183
193 USD_API
195 SdfPath *path) const;
196
206 USD_API
208 std::string *name) const;
209
211
216
218 USD_API
220
225 USD_API
226 bool IsImplicit() const;
227
230 USD_API
231 bool IsAncestral() const;
232
235 USD_API
236 bool HasSpecs() const;
237
242 USD_API
244
248 USD_API
250
252
253private:
254 // These will only be created by a UsdPrimCompositionQuery itself.
255 friend class UsdPrimCompositionQuery;
257
258 PcpNodeRef _node;
259 PcpNodeRef _originalIntroducedNode;
260 PcpNodeRef _introducingNode;
261
262 std::shared_ptr<PcpPrimIndex> _primIndex;
263};
264
278{
279public:
281 enum class ArcTypeFilter
282 {
283 All = 0,
284
285 // Single arc types
286 Reference,
287 Payload,
288 Inherit,
289 Specialize,
290 Variant,
291
292 // Related arc types
293 ReferenceOrPayload,
294 InheritOrSpecialize,
295
296 // Inverse of related arc types
297 NotReferenceOrPayload,
298 NotInheritOrSpecialize,
299 NotVariant
300 };
301
306 {
307 All = 0,
308
309 Direct,
310 Ancestral
311 };
312
316 {
317 All = 0,
318
319 // Indicates that we only want arcs that are authored somewhere in the
320 // root layer stack.
321 IntroducedInRootLayerStack,
322
323 // Indicates that we only want arcs that are authored directly in the
324 // in the prim's prim spec in the root layer stack.
325 IntroducedInRootLayerPrimSpec
326 };
327
330 enum class HasSpecsFilter
331 {
332 All = 0,
333
334 HasSpecs,
335 HasNoSpecs
336 };
337
340 struct Filter
341 {
343 ArcTypeFilter arcTypeFilter {ArcTypeFilter::All};
344
346 DependencyTypeFilter dependencyTypeFilter {DependencyTypeFilter::All};
347
349 ArcIntroducedFilter arcIntroducedFilter {ArcIntroducedFilter::All};
350
352 HasSpecsFilter hasSpecsFilter {HasSpecsFilter::All};
353
354 Filter() {};
355
356 bool operator==(const Filter &rhs) {
357 return arcIntroducedFilter == rhs.arcIntroducedFilter &&
358 arcTypeFilter == rhs.arcTypeFilter &&
359 dependencyTypeFilter == rhs.dependencyTypeFilter &&
360 hasSpecsFilter == rhs.hasSpecsFilter;
361 };
362
363 bool operator!=(const Filter &rhs) {
364 return !(*this == rhs);
365 };
366 };
367
370 USD_API
372
375 USD_API
377
381 USD_API
383
386 USD_API
388 const Filter &filter = Filter());
389
390 ~UsdPrimCompositionQuery() = default;
391
393 USD_API
394 void SetFilter(const Filter &filter);
395
397 USD_API
399
403 USD_API
404 std::vector<UsdPrimCompositionQueryArc> GetCompositionArcs();
405
406private:
407 UsdPrim _prim;
408 Filter _filter;
409 std::shared_ptr<PcpPrimIndex> _expandedPrimIndex;
410 std::vector<UsdPrimCompositionQueryArc> _unfilteredArcs;
411};
412
413
414PXR_NAMESPACE_CLOSE_SCOPE
415
416#endif // PXR_USD_USD_PRIM_COMPOSITION_QUERY_H
417
PcpNode represents a node in an expression tree for compositing scene description.
Definition: node.h:64
Represents a set of list editing operations.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:291
Represents a payload and all its meta data.
Definition: payload.h:58
Represents a reference and all its meta data.
Definition: reference.h:75
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:134
Defines a subrange of nodes and layers within a prim's prim index to consider when performing value r...
Definition: resolveTarget.h:73
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:44