Loading...
Searching...
No Matches
resolver.h
1//
2// Copyright 2016 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_RESOLVER_H
8#define PXR_USD_USD_RESOLVER_H
9
10#include "pxr/pxr.h"
11#include "pxr/usd/usd/api.h"
12#include "pxr/usd/usd/common.h"
14
15#include "pxr/usd/pcp/node.h"
16#include "pxr/usd/pcp/iterator.h"
17
18#include "pxr/usd/sdf/path.h"
20
21PXR_NAMESPACE_OPEN_SCOPE
22
23class PcpPrimIndex;
25
31class Usd_Resolver {
32public:
33
42 USD_API
43 explicit Usd_Resolver(
44 const PcpPrimIndex* index,
45 bool skipEmptyNodes = true,
46 const UsdResolveInfo *resolveInfo = nullptr);
47
56 USD_API
57 explicit Usd_Resolver(
58 const UsdResolveTarget *resolveTarget,
59 bool skipEmptyNodes = true,
60 const UsdResolveInfo *resolveInfo = nullptr);
61
67 bool IsValid() const {
68 return _curNode != _endNode;
69 }
70
79 USD_API
80 bool NextLayer();
81
88 USD_API
89 void NextNode();
90
97 PcpNodeRef GetNode() const {
98 return *_curNode;
99 }
100
108 const SdfLayerRefPtr& GetLayer() const {
109 return *_curLayer;
110 }
111
116 const SdfPath& GetLocalPath() const {
117 return _curNode->GetPath();
118 }
119
124 SdfPath GetLocalPath(TfToken const &propName) const {
125 return propName.IsEmpty() ? GetLocalPath() :
126 GetLocalPath().AppendProperty(propName);
127 }
128
133 const PcpPrimIndex* GetPrimIndex() const {
134 return _index;
135 }
136
137private:
138 void _SkipEmptyNodes();
139
140 const PcpPrimIndex* _index;
141 bool _skipEmptyNodes;
142
143 PcpNodeIterator _curNode;
144 PcpNodeIterator _endNode;
145 SdfLayerRefPtrVector::const_iterator _curLayer;
146 SdfLayerRefPtrVector::const_iterator _endLayer;
147 const UsdResolveTarget *_resolveTarget;
148};
149
150PXR_NAMESPACE_CLOSE_SCOPE
151
152#endif // PXR_USD_USD_RESOLVER_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 path value used to locate objects in layers or scenegraphs.
Definition: path.h:281
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
bool IsEmpty() const
Returns true iff this token contains the empty string "".
Definition: token.h:288
Container for information about the source of an attribute's value, i.e.
Definition: resolveInfo.h:55
Defines a subrange of nodes and layers within a prim's prim index to consider when performing value r...
Definition: resolveTarget.h:56