All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
resolveTarget.h
1//
2// Copyright 2022 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_RESOLVE_TARGET_H
8#define PXR_USD_USD_RESOLVE_TARGET_H
9
10#include "pxr/pxr.h"
11#include "pxr/usd/usd/api.h"
12#include "pxr/usd/pcp/node.h"
13#include "pxr/usd/pcp/primIndex.h"
15
16#include <memory>
17
18PXR_NAMESPACE_OPEN_SCOPE
19
20SDF_DECLARE_HANDLES(SdfLayer);
21
57
58public:
59 UsdResolveTarget() = default;
60
62 const PcpPrimIndex *GetPrimIndex() const {
63 return _expandedPrimIndex.get();
64 }
65
68 USD_API
70
73 USD_API
74 SdfLayerHandle GetStartLayer() const;
75
78 USD_API
80
83 USD_API
84 SdfLayerHandle GetStopLayer() const;
85
87 bool IsNull() const {
88 return !bool(_expandedPrimIndex);
89 }
90
91private:
92 // Non-null UsdResolveTargets can only be created by functions in UsdPrim
93 // and UsdPrimCompositionQueryArc.
94 friend class UsdPrim;
95 friend class UsdPrimCompositionQueryArc;
96
97 // Usd_Resolver wants to access the iterators provided by this target.
98 friend class Usd_Resolver;
99
100 USD_API
102 const std::shared_ptr<PcpPrimIndex> &index,
103 const PcpNodeRef &node,
104 const SdfLayerHandle &layer);
105
106 USD_API
108 const std::shared_ptr<PcpPrimIndex> &index,
109 const PcpNodeRef &node,
110 const SdfLayerHandle &layer,
111 const PcpNodeRef &stopNode,
112 const SdfLayerHandle &stopLayer);
113
114 // Resolve targets are created with an expanded prim index either from
115 // a composition query (which owns and holds it) or from a UsdPrim (which
116 // creates it solely to create the resolve target). The expanded prim index
117 // is not otherwise cached, so we have to hold on to it during the lifetime
118 // of the resolve target.
119 std::shared_ptr<PcpPrimIndex> _expandedPrimIndex;
120 PcpNodeRange _nodeRange;
121
122 PcpNodeIterator _startNodeIt;
123 SdfLayerRefPtrVector::const_iterator _startLayerIt;
124 PcpNodeIterator _stopNodeIt;
125 SdfLayerRefPtrVector::const_iterator _stopLayerIt;
126};
127
128PXR_NAMESPACE_CLOSE_SCOPE
129
130#endif // PXR_USD_USD_RESOLVE_TARGET_H
Object used to iterate over nodes in the prim index graph in strong-to-weak order.
Definition: iterator.h:34
PcpNode represents a node in an expression tree for compositing scene description.
Definition: node.h:47
PcpPrimIndex is an index of the all sites of scene description that contribute opinions to a specific...
Definition: primIndex.h:62
A scene description container that can combine with other such containers to form simple component as...
Definition: layer.h:84
This represents a composition arc that is returned by a UsdPrimCompositionQuery.
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
USD_API SdfLayerHandle GetStopLayer() const
Returns the layer in the layer stack of the stop node that value resolution with this resolve target ...
USD_API SdfLayerHandle GetStartLayer() const
Returns the layer in the layer stack of the start node that value resolution with this resolve target...
USD_API PcpNodeRef GetStopNode() const
Returns the node that value resolution with this resolve target will stop at when the "stop at" layer...
USD_API PcpNodeRef GetStartNode() const
Returns the node that value resolution with this resolve target will start at.
bool IsNull() const
Returns true if this is a null resolve target.
Definition: resolveTarget.h:87
const PcpPrimIndex * GetPrimIndex() const
Get the prim index of the resolve target.
Definition: resolveTarget.h:62