Loading...
Searching...
No Matches
resolver.h
1//
2// Copyright 2016 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_RESOLVER_H
25#define PXR_USD_USD_RESOLVER_H
26
27#include "pxr/pxr.h"
28#include "pxr/usd/usd/api.h"
29#include "pxr/usd/usd/common.h"
30
31#include "pxr/usd/pcp/node.h"
32#include "pxr/usd/pcp/iterator.h"
33
34#include "pxr/usd/sdf/path.h"
36
37PXR_NAMESPACE_OPEN_SCOPE
38
39class PcpPrimIndex;
41
47class Usd_Resolver {
48public:
49
55 USD_API
56 explicit Usd_Resolver(
57 const PcpPrimIndex* index,
58 bool skipEmptyNodes = true);
59
66 USD_API
67 explicit Usd_Resolver(
68 const UsdResolveTarget *resolveTarget,
69 bool skipEmptyNodes = true);
70
76 bool IsValid() const {
77 return _curNode != _endNode;
78 }
79
88 USD_API
89 bool NextLayer();
90
97 USD_API
98 void NextNode();
99
106 PcpNodeRef GetNode() const {
107 return *_curNode;
108 }
109
117 const SdfLayerRefPtr& GetLayer() const {
118 return *_curLayer;
119 }
120
125 const SdfPath& GetLocalPath() const {
126 return _curNode->GetPath();
127 }
128
133 SdfPath GetLocalPath(TfToken const &propName) const {
134 return propName.IsEmpty() ? GetLocalPath() :
135 GetLocalPath().AppendProperty(propName);
136 }
137
142 const PcpPrimIndex* GetPrimIndex() const {
143 return _index;
144 }
145
146private:
147 void _SkipEmptyNodes();
148
149 const PcpPrimIndex* _index;
150 bool _skipEmptyNodes;
151
152 PcpNodeIterator _curNode;
153 PcpNodeIterator _endNode;
154 SdfLayerRefPtrVector::const_iterator _curLayer;
155 SdfLayerRefPtrVector::const_iterator _endLayer;
156 const UsdResolveTarget *_resolveTarget;
157};
158
159PXR_NAMESPACE_CLOSE_SCOPE
160
161#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:51
PcpNode represents a node in an expression tree for compositing scene description.
Definition: node.h:64
PcpPrimIndex is an index of the all sites of scene description that contribute opinions to a specific...
Definition: primIndex.h:78
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:291
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:88
bool IsEmpty() const
Returns true iff this token contains the empty string "".
Definition: token.h:305
Defines a subrange of nodes and layers within a prim's prim index to consider when performing value r...
Definition: resolveTarget.h:73