All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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"
13
14#include "pxr/usd/pcp/node.h"
15#include "pxr/usd/pcp/iterator.h"
16
17#include "pxr/usd/sdf/path.h"
19
20PXR_NAMESPACE_OPEN_SCOPE
21
22class PcpPrimIndex;
24
30class Usd_Resolver {
31public:
32
38 USD_API
39 explicit Usd_Resolver(
40 const PcpPrimIndex* index,
41 bool skipEmptyNodes = true);
42
49 USD_API
50 explicit Usd_Resolver(
51 const UsdResolveTarget *resolveTarget,
52 bool skipEmptyNodes = true);
53
59 bool IsValid() const {
60 return _curNode != _endNode;
61 }
62
71 USD_API
72 bool NextLayer();
73
80 USD_API
81 void NextNode();
82
89 PcpNodeRef GetNode() const {
90 return *_curNode;
91 }
92
100 const SdfLayerRefPtr& GetLayer() const {
101 return *_curLayer;
102 }
103
108 const SdfPath& GetLocalPath() const {
109 return _curNode->GetPath();
110 }
111
116 SdfPath GetLocalPath(TfToken const &propName) const {
117 return propName.IsEmpty() ? GetLocalPath() :
118 GetLocalPath().AppendProperty(propName);
119 }
120
125 const PcpPrimIndex* GetPrimIndex() const {
126 return _index;
127 }
128
129private:
130 void _SkipEmptyNodes();
131
132 const PcpPrimIndex* _index;
133 bool _skipEmptyNodes;
134
135 PcpNodeIterator _curNode;
136 PcpNodeIterator _endNode;
137 SdfLayerRefPtrVector::const_iterator _curLayer;
138 SdfLayerRefPtrVector::const_iterator _endLayer;
139 const UsdResolveTarget *_resolveTarget;
140};
141
142PXR_NAMESPACE_CLOSE_SCOPE
143
144#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:274
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
Defines a subrange of nodes and layers within a prim's prim index to consider when performing value r...
Definition: resolveTarget.h:56