Loading...
Searching...
No Matches
rprimCollection.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_IMAGING_HD_RPRIM_COLLECTION_H
25#define PXR_IMAGING_HD_RPRIM_COLLECTION_H
26
27#include "pxr/pxr.h"
28#include "pxr/imaging/hd/api.h"
29#include "pxr/imaging/hd/version.h"
30#include "pxr/imaging/hd/repr.h"
31#include "pxr/usd/sdf/path.h"
32#include "pxr/base/tf/token.h"
33
34#include <string>
35
36PXR_NAMESPACE_OPEN_SCOPE
37
38
55public:
56 HD_API
58
66 HD_API
68 HdReprSelector const& reprSelector,
69 bool forcedRepr=false,
70 TfToken const& materialTag = TfToken());
71
80 HD_API
82 HdReprSelector const& reprSelector,
83 SdfPath const& rootPath,
84 bool forcedRepr=false,
85 TfToken const& materialTag = TfToken());
86
88 HD_API
90
91 // Destructor.
92 HD_API
93 virtual ~HdRprimCollection();
94
97 HD_API
99
104 TfToken const& GetName() const {
105 return _name;
106 }
107
109 void SetName(TfToken const& name) {
110 _name = name;
111 }
112
120 return _reprSelector;
121 }
122
123 void SetReprSelector(HdReprSelector const& reprSelector) {
124 _reprSelector = reprSelector;
125 }
126
127 bool IsForcedRepr() const {
128 return _forcedRepr;
129 }
130
131 void SetForcedRepr(bool flag) {
132 _forcedRepr = flag;
133 }
134
140 HD_API
141 SdfPathVector const& GetRootPaths() const;
142
146 HD_API
147 void SetRootPaths(SdfPathVector const& rootPaths);
148
152 HD_API
153 void SetRootPath(SdfPath const& rootPath);
154
157 HD_API
158 void SetExcludePaths(SdfPathVector const& excludePaths);
159
163 HD_API
164 SdfPathVector const& GetExcludePaths() const;
165
177 HD_API
178 void SetMaterialTag(TfToken const& tag);
179
180 HD_API
181 TfToken const& GetMaterialTag() const;
182
183 HD_API
184 size_t ComputeHash() const;
185
186 struct Hash {
187 size_t operator()(HdRprimCollection const& value) const {
188 return value.ComputeHash();
189 }
190 };
191
192 // TfHash support.
193 template <class HashState>
194 friend void TfHashAppend(HashState &h, HdRprimCollection const &rc) {
195 h.Append(rc._name,
196 rc._reprSelector,
197 rc._forcedRepr,
198 rc._rootPaths,
199 rc._excludePaths,
200 rc._materialTag);
201 }
202
203 HD_API
204 bool operator==(HdRprimCollection const & lhs) const;
205 HD_API
206 bool operator!=(HdRprimCollection const & lhs) const;
207
208private:
209 HD_API
210 friend std::ostream & operator <<(std::ostream &out,
211 HdRprimCollection const & v);
212
213 TfToken _name;
214 HdReprSelector _reprSelector;
215 bool _forcedRepr;
216 TfToken _materialTag;
217 SdfPathVector _rootPaths;
218 SdfPathVector _excludePaths;
219};
220
221// VtValue requirements
222HD_API
223std::ostream& operator<<(std::ostream& out, HdRprimCollection const & v);
224
225// Overload hash_value for HdRprimCollection. Used by things like boost::hash.
226HD_API
227size_t hash_value(HdRprimCollection const &col);
228
229
230PXR_NAMESPACE_CLOSE_SCOPE
231
232#endif //PXR_IMAGING_HD_RPRIM_COLLECTION_H
Describes one or more authored display representations for an rprim.
Definition: repr.h:49
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:291
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:88
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:45
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...