This document is for a version of USD that is under development. See this page for the current release.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
propertyIndex.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_PCP_PROPERTY_INDEX_H
8#define PXR_USD_PCP_PROPERTY_INDEX_H
9
10#include "pxr/pxr.h"
11#include "pxr/usd/pcp/api.h"
12#include "pxr/usd/pcp/errors.h"
13#include "pxr/usd/pcp/iterator.h"
14#include "pxr/usd/pcp/node.h"
15
16#include "pxr/usd/sdf/path.h"
18
19#include <memory>
20#include <vector>
21
22PXR_NAMESPACE_OPEN_SCOPE
23
24// Forward declarations:
25class PcpCache;
26
32struct Pcp_PropertyInfo
33{
34 Pcp_PropertyInfo() { }
35 Pcp_PropertyInfo(const SdfPropertySpecHandle& prop, const PcpNodeRef& node)
36 : propertySpec(prop), originatingNode(node) { }
37
38 SdfPropertySpecHandle propertySpec;
39 PcpNodeRef originatingNode;
40};
41
49{
50public:
52 PCP_API
54
56 PCP_API
58
60 PCP_API
61 void Swap(PcpPropertyIndex& index);
62
65 PCP_API
66 bool IsEmpty() const;
67
74 PCP_API
75 PcpPropertyRange GetPropertyRange(bool localOnly = false) const;
76
78 PcpErrorVector GetLocalErrors() const {
79 return _localErrors ? *_localErrors.get() : PcpErrorVector();
80 }
81
83 PCP_API
84 size_t GetNumLocalSpecs() const;
85
86private:
87 friend class PcpPropertyIterator;
88 friend class Pcp_PropertyIndexer;
89
90 // The property stack is a list of Pcp_PropertyInfo objects in
91 // strong-to-weak order.
92 std::vector<Pcp_PropertyInfo> _propertyStack;
93
96 std::unique_ptr<PcpErrorVector> _localErrors;
97};
98
102PCP_API
103void
104PcpBuildPropertyIndex( const SdfPath& propertyPath,
105 PcpCache *cache,
106 PcpPropertyIndex *propertyIndex,
107 PcpErrorVector *allErrors );
108
111PCP_API
112void
113PcpBuildPrimPropertyIndex( const SdfPath& propertyPath,
114 const PcpCache& cache,
115 const PcpPrimIndex& owningPrimIndex,
116 PcpPropertyIndex *propertyIndex,
117 PcpErrorVector *allErrors );
118
119PXR_NAMESPACE_CLOSE_SCOPE
120
121#endif // PXR_USD_PCP_PROPERTY_INDEX_H
PcpCache is the context required to make requests of the Pcp composition algorithm and cache the resu...
Definition: cache.h:77
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
PcpPropertyIndex is an index of all sites in scene description that contribute opinions to a specific...
Definition: propertyIndex.h:49
PCP_API bool IsEmpty() const
Returns true if this property index contains no opinions, false otherwise.
PCP_API PcpPropertyIndex()
Construct an empty property index.
PcpErrorVector GetLocalErrors() const
Return the list of errors local to this property.
Definition: propertyIndex.h:78
PCP_API size_t GetNumLocalSpecs() const
Returns the number of local properties in this prim index.
PCP_API void Swap(PcpPropertyIndex &index)
Swap the contents of this property index with index.
PCP_API PcpPropertyIndex(const PcpPropertyIndex &rhs)
Copy-construct a property index.
PCP_API PcpPropertyRange GetPropertyRange(bool localOnly=false) const
Returns range of iterators that encompasses properties in this index's property stack.
Object used to iterate over property specs in a property index in strong-to-weak order.
Definition: iterator.h:355
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:274