All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
rprimCollection.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_IMAGING_HD_RPRIM_COLLECTION_H
8#define PXR_IMAGING_HD_RPRIM_COLLECTION_H
9
10#include "pxr/pxr.h"
11#include "pxr/imaging/hd/api.h"
12#include "pxr/imaging/hd/version.h"
13#include "pxr/imaging/hd/repr.h"
14#include "pxr/usd/sdf/path.h"
15#include "pxr/base/tf/token.h"
16
17#include <string>
18
19PXR_NAMESPACE_OPEN_SCOPE
20
21
38public:
39 HD_API
41
49 HD_API
51 HdReprSelector const& reprSelector,
52 bool forcedRepr=false,
53 TfToken const& materialTag = TfToken());
54
63 HD_API
65 HdReprSelector const& reprSelector,
66 SdfPath const& rootPath,
67 bool forcedRepr=false,
68 TfToken const& materialTag = TfToken());
69
71 HD_API
73
74 // Destructor.
75 HD_API
76 virtual ~HdRprimCollection();
77
80 HD_API
82
87 TfToken const& GetName() const {
88 return _name;
89 }
90
92 void SetName(TfToken const& name) {
93 _name = name;
94 }
95
103 return _reprSelector;
104 }
105
106 void SetReprSelector(HdReprSelector const& reprSelector) {
107 _reprSelector = reprSelector;
108 }
109
110 bool IsForcedRepr() const {
111 return _forcedRepr;
112 }
113
114 void SetForcedRepr(bool flag) {
115 _forcedRepr = flag;
116 }
117
123 HD_API
124 SdfPathVector const& GetRootPaths() const;
125
129 HD_API
130 void SetRootPaths(SdfPathVector const& rootPaths);
131
135 HD_API
136 void SetRootPath(SdfPath const& rootPath);
137
140 HD_API
141 void SetExcludePaths(SdfPathVector const& excludePaths);
142
146 HD_API
147 SdfPathVector const& GetExcludePaths() const;
148
160 HD_API
161 void SetMaterialTag(TfToken const& tag);
162
163 HD_API
164 TfToken const& GetMaterialTag() const;
165
166 HD_API
167 size_t ComputeHash() const;
168
169 struct Hash {
170 size_t operator()(HdRprimCollection const& value) const {
171 return value.ComputeHash();
172 }
173 };
174
175 // TfHash support.
176 template <class HashState>
177 friend void TfHashAppend(HashState &h, HdRprimCollection const &rc) {
178 h.Append(rc._name,
179 rc._reprSelector,
180 rc._forcedRepr,
181 rc._rootPaths,
182 rc._excludePaths,
183 rc._materialTag);
184 }
185
186 HD_API
187 bool operator==(HdRprimCollection const & lhs) const;
188 HD_API
189 bool operator!=(HdRprimCollection const & lhs) const;
190
191private:
192 HD_API
193 friend std::ostream & operator <<(std::ostream &out,
194 HdRprimCollection const & v);
195
196 TfToken _name;
197 HdReprSelector _reprSelector;
198 bool _forcedRepr;
199 TfToken _materialTag;
200 SdfPathVector _rootPaths;
201 SdfPathVector _excludePaths;
202};
203
204// VtValue requirements
205HD_API
206std::ostream& operator<<(std::ostream& out, HdRprimCollection const & v);
207
208// Overload hash_value for HdRprimCollection. Used by things like boost::hash.
209HD_API
210size_t hash_value(HdRprimCollection const &col);
211
212
213PXR_NAMESPACE_CLOSE_SCOPE
214
215#endif //PXR_IMAGING_HD_RPRIM_COLLECTION_H
Describes one or more authored display representations for an rprim.
Definition: repr.h:32
A named, semantic collection of objects.
HD_API SdfPathVector const & GetRootPaths() const
Returns the paths at which all Rprims must be rooted to be included in this collection.
HD_API HdRprimCollection(TfToken const &name, HdReprSelector const &reprSelector, SdfPath const &rootPath, bool forcedRepr=false, TfToken const &materialTag=TfToken())
Constructs an rprim collection, excluding all Rprims not prefixed by rootPath.
HD_API void SetExcludePaths(SdfPathVector const &excludePaths)
Sets all exclude paths for this collection.
HD_API HdRprimCollection(TfToken const &name, HdReprSelector const &reprSelector, bool forcedRepr=false, TfToken const &materialTag=TfToken())
Constructs an rprim collection with reprSelector.
HD_API SdfPathVector const & GetExcludePaths() const
Returns the excluded paths.
HdReprSelector const & GetReprSelector() const
Returns the representation name.
HD_API void SetRootPaths(SdfPathVector const &rootPaths)
Sets all root paths for this collection, replacing any existing paths that were present previously.
TfToken const & GetName() const
Returns the semantic name of this collection.
HD_API HdRprimCollection(HdRprimCollection const &col)
Copy constructor.
void SetName(TfToken const &name)
Sets the semantic name of this collection.
HD_API HdRprimCollection CreateInverseCollection() const
Constructs and returns a collection with the root and exclude paths swapped.
HD_API void SetMaterialTag(TfToken const &tag)
A MaterialTag can be used to ensure only prims whos material have a matching tag will end up in the c...
HD_API void SetRootPath(SdfPath const &rootPath)
Sets the path at which all Rprims must be rooted to be included in this collection,...
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
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].
size_t hash_value(const half h)
Overload hash_value for half.
Definition: half.h:28
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...