Loading...
Searching...
No Matches
dataSourcePrim.h
1//
2// Copyright 2020 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_IMAGING_USD_IMAGING_DATA_SOURCE_PRIM_H
25#define PXR_USD_IMAGING_USD_IMAGING_DATA_SOURCE_PRIM_H
26
27#include "pxr/imaging/hd/dataSource.h"
28#include "pxr/imaging/hd/dataSourceTypeDefs.h"
29
30#include "pxr/usd/usd/prim.h"
31
34
35#include "pxr/usdImaging/usdImaging/api.h"
36#include "pxr/usdImaging/usdImaging/dataSourceStageGlobals.h"
37#include "pxr/usdImaging/usdImaging/dataSourcePrimvars.h"
38#include "pxr/usdImaging/usdImaging/types.h"
39
40PXR_NAMESPACE_OPEN_SCOPE
41
46{
47public:
48 HD_DECLARE_DATASOURCE(UsdImagingDataSourceVisibility);
49
54
58 HdDataSourceBaseHandle Get(const TfToken &name) override;
59
60private:
69 const UsdAttributeQuery &visibilityQuery,
70 const SdfPath &sceneIndexPath,
71 const UsdImagingDataSourceStageGlobals &stageGlobals);
72
73private:
74 UsdAttributeQuery _visibilityQuery;
75 const UsdImagingDataSourceStageGlobals &_stageGlobals;
76};
77
78HD_DECLARE_DATASOURCE_HANDLES(UsdImagingDataSourceVisibility);
79
80
81// ----------------------------------------------------------------------------
82
87{
88public:
89 HD_DECLARE_DATASOURCE(UsdImagingDataSourcePurpose);
90
95
99 HdDataSourceBaseHandle Get(const TfToken &name) override;
100
101private:
109 const UsdAttributeQuery &purposeQuery,
110 const UsdImagingDataSourceStageGlobals &stageGlobals);
111
112private:
113 UsdAttributeQuery _purposeQuery;
114 const UsdImagingDataSourceStageGlobals &_stageGlobals;
115};
116
117HD_DECLARE_DATASOURCE_HANDLES(UsdImagingDataSourcePurpose);
118
119
120// ----------------------------------------------------------------------------
121
127{
128public:
129 HD_DECLARE_DATASOURCE(UsdImagingDataSourceExtentCoordinate);
130
132 VtValue GetValue(HdSampledDataSource::Time shutterOffset) override;
133
135 GfVec3d GetTypedValue(HdSampledDataSource::Time shutterOffset) override;
136
140 HdSampledDataSource::Time startTime,
141 HdSampledDataSource::Time endTime,
142 std::vector<HdSampledDataSource::Time> *outSampleTimes) override;
143
144private:
153 const HdVec3fArrayDataSourceHandle &extentDs,
154 const SdfPath &attrPath,
155 unsigned int index);
156
157private:
158 HdVec3fArrayDataSourceHandle _extentDs;
159 SdfPath _attrPath;
160 unsigned int _index;
161};
162
163// ----------------------------------------------------------------------------
164
169{
170public:
171 HD_DECLARE_DATASOURCE(UsdImagingDataSourceExtent);
172
177
181 HdDataSourceBaseHandle Get(const TfToken &name) override;
182
183private:
192 const UsdAttributeQuery &extentQuery,
193 const SdfPath &sceneIndexPath,
194 const UsdImagingDataSourceStageGlobals &stageGlobals);
195
196private:
197 // Note: the constructor takes sceneIndexPath for change-tracking,
198 // but here we're storing the USD attribute path for error reporting!
199 SdfPath _attrPath;
200 HdVec3fArrayDataSourceHandle _extentDs;
201};
202
203HD_DECLARE_DATASOURCE_HANDLES(UsdImagingDataSourceExtent);
204
205// ----------------------------------------------------------------------------
206
211{
212public:
213 HD_DECLARE_DATASOURCE(UsdImagingDataSourceExtentsHint);
214
223
226 HdDataSourceBaseHandle Get(const TfToken &name) override;
227
228private:
237 const UsdAttributeQuery &extentQuery,
238 const SdfPath &sceneIndexPath,
239 const UsdImagingDataSourceStageGlobals &stageGlobals);
240
241private:
242 // Note: the constructor takes sceneIndexPath for change-tracking,
243 // but here we're storing the USD attribute path for error reporting!
244 SdfPath _attrPath;
245 HdVec3fArrayDataSourceHandle _extentDs;
246};
247
248HD_DECLARE_DATASOURCE_HANDLES(UsdImagingDataSourceExtent);
249
250// ----------------------------------------------------------------------------
251
257{
258public:
259 HD_DECLARE_DATASOURCE(UsdImagingDataSourceXformResetXformStack);
260
262 VtValue GetValue(HdSampledDataSource::Time shutterOffset) override;
263
265 bool GetTypedValue(HdSampledDataSource::Time shutterOffset) override;
266
270 HdSampledDataSource::Time startTime,
271 HdSampledDataSource::Time endTime,
272 std::vector<HdSampledDataSource::Time> *outSampleTimes) override {
273 return false;
274 }
275
276private:
287 const UsdGeomXformable::XformQuery &xformQuery,
288 const UsdImagingDataSourceStageGlobals &stageGlobals);
289
290private:
292 const UsdImagingDataSourceStageGlobals &_stageGlobals;
293};
294
295HD_DECLARE_DATASOURCE_HANDLES(UsdImagingDataSourceXformResetXformStack);
296
297// ----------------------------------------------------------------------------
298
306{
307public:
308
309 HD_DECLARE_DATASOURCE(UsdImagingDataSourceXformMatrix);
310
314 VtValue GetValue(HdSampledDataSource::Time shutterOffset) override;
315
319 GfMatrix4d GetTypedValue(HdSampledDataSource::Time shutterOffset) override;
320
325 HdSampledDataSource::Time startTime,
326 HdSampledDataSource::Time endTime,
327 std::vector<HdSampledDataSource::Time> *outSampleTimes) override;
328
329private:
340 const UsdGeomXformable::XformQuery &xformQuery,
341 const UsdImagingDataSourceStageGlobals &stageGlobals);
342
343private:
345 const UsdImagingDataSourceStageGlobals &_stageGlobals;
346};
347
348HD_DECLARE_DATASOURCE_HANDLES(UsdImagingDataSourceXformMatrix);
349
350// ----------------------------------------------------------------------------
351
362{
363public:
364 HD_DECLARE_DATASOURCE(UsdImagingDataSourceXform);
365
371
376 HdDataSourceBaseHandle Get(const TfToken &name) override;
377
378private:
389 const UsdGeomXformable::XformQuery &xformQuery,
390 const SdfPath &sceneIndexPath,
391 const UsdImagingDataSourceStageGlobals &stageGlobals);
392
393private:
395 const UsdImagingDataSourceStageGlobals &_stageGlobals;
396};
397
398HD_DECLARE_DATASOURCE_HANDLES(UsdImagingDataSourceXform);
399
400// ----------------------------------------------------------------------------
401
408{
409public:
410 HD_DECLARE_DATASOURCE(UsdImagingDataSourcePrimOrigin);
411
413
416 HdDataSourceBaseHandle Get(const TfToken &name) override;
417
418private:
420
421private:
422 UsdPrim _usdPrim;
423};
424
425HD_DECLARE_DATASOURCE_HANDLES(UsdImagingDataSourcePrimOrigin);
426
427// ----------------------------------------------------------------------------
428
447{
448public:
449 HD_DECLARE_DATASOURCE(UsdImagingDataSourcePrim);
450
454 USDIMAGING_API
456
459 USDIMAGING_API
460 HdDataSourceBaseHandle Get(const TfToken &name) override;
461
464 USDIMAGING_API
466 UsdPrim const& prim,
467 const TfToken &subprim,
468 const TfTokenVector &properties,
469 UsdImagingPropertyInvalidationType invalidationType);
470
471protected:
484 USDIMAGING_API
486 const SdfPath &sceneIndexPath,
487 UsdPrim usdPrim,
488 const UsdImagingDataSourceStageGlobals &stageGlobals);
489
490 // Accessors, for derived classes...
491 const SdfPath &_GetSceneIndexPath() const {
492 return _sceneIndexPath;
493 }
494
495 const UsdPrim &_GetUsdPrim() const {
496 return _usdPrim;
497 }
498
499 const UsdImagingDataSourceStageGlobals &_GetStageGlobals() const {
500 return _stageGlobals;
501 }
502
503private:
504 const SdfPath _sceneIndexPath;
505 UsdPrim _usdPrim;
506 const UsdImagingDataSourceStageGlobals &_stageGlobals;
507};
508
509HD_DECLARE_DATASOURCE_HANDLES(UsdImagingDataSourcePrim);
510
511PXR_NAMESPACE_CLOSE_SCOPE
512
513#endif // PXR_USD_IMAGING_USD_IMAGING_DATA_SOURCE_PRIM_H
Stores a 4x4 matrix of double elements.
Definition: matrix4d.h:88
Basic type for a vector of 3 double components.
Definition: vec3d.h:63
A datasource representing structured (named, hierarchical) data, for example a geometric primitive or...
Definition: dataSource.h:116
Represents a set of data source locators closed under descendancy.
A datasource representing a concretely-typed sampled value.
Definition: dataSource.h:210
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:290
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:88
Object for efficiently making repeated queries for attribute values.
Helper class that caches the ordered vector of UsGeomXformOps that contribute to the local transforma...
Definition: xformable.h:379
Data source representing either the minimum or maximum of the local prim extent.
GfVec3d GetTypedValue(HdSampledDataSource::Time shutterOffset) override
Returns bool at a given shutterOffset for the value of this flag.
bool GetContributingSampleTimesForInterval(HdSampledDataSource::Time startTime, HdSampledDataSource::Time endTime, std::vector< HdSampledDataSource::Time > *outSampleTimes) override
Fills the outSampleTimes with the times between startTime and endTime that have valid sample data and...
VtValue GetValue(HdSampledDataSource::Time shutterOffset) override
Returns VtValue at a given shutterOffset for the value of this flag.
Data source representing local prim extent.
TfTokenVector GetNames() override
Returns the names contained in this datasource.
HdDataSourceBaseHandle Get(const TfToken &name) override
Returns the data source for the given 'name'.
Data source representing extents hint of a geom model API prim.
TfTokenVector GetNames() override
Returns names of (hydra) purposes for which we have extentsHint.
HdDataSourceBaseHandle Get(const TfToken &name) override
Takes the hydra name of a purpose and returns the corresponding values from extentsHint as HdExtentSc...
Data source representing a basic USD prim.
USDIMAGING_API TfTokenVector GetNames() override
Returns the names for which this data source can return meaningful results.
USDIMAGING_API UsdImagingDataSourcePrim(const SdfPath &sceneIndexPath, UsdPrim usdPrim, const UsdImagingDataSourceStageGlobals &stageGlobals)
Use to construct a new UsdImagingDataSourcePrim.
static USDIMAGING_API HdDataSourceLocatorSet Invalidate(UsdPrim const &prim, const TfToken &subprim, const TfTokenVector &properties, UsdImagingPropertyInvalidationType invalidationType)
Returns the hydra attribute set we should invalidate if the value of the USD properties in properties...
USDIMAGING_API HdDataSourceBaseHandle Get(const TfToken &name) override
Returns the data source representing name, if valid.
Data source to access the underlying UsdPrim.
TfTokenVector GetNames() override
Returns the list of names for which Get(...) is expected to return a non-null value.
HdDataSourceBaseHandle Get(const TfToken &name) override
Get(UsdImagingTokens->usdPrim) returns a data source containing the underyling UsdPrim.
Data source representing prim purpose for a USD imageable.
TfTokenVector GetNames() override
Returns the names contained in this data source.
HdDataSourceBaseHandle Get(const TfToken &name) override
Returns the data source for the given 'name'.
This class is used as a context object with global stage information, that gets passed down to dataso...
Data source representing prim visibility for a USD imageable.
TfTokenVector GetNames() override
Returns the names contained in this data source.
HdDataSourceBaseHandle Get(const TfToken &name) override
Returns the data source for the given 'name'.
Data source representing a container that stores a USD Xformable.
TfTokenVector GetNames() override
Returns the names contained in this data source.
HdDataSourceBaseHandle Get(const TfToken &name) override
Returns the data source for the given 'name'.
Data source representing a generic transform value accessor for a USD Xformable.
bool GetContributingSampleTimesForInterval(HdSampledDataSource::Time startTime, HdSampledDataSource::Time endTime, std::vector< HdSampledDataSource::Time > *outSampleTimes) override
Fills the outSampleTimes with the times between startTime and endTime that have valid sample data and...
GfMatrix4d GetTypedValue(HdSampledDataSource::Time shutterOffset) override
Returns GfMatrix4d at a given shutterOffset for the value of this xform.
VtValue GetValue(HdSampledDataSource::Time shutterOffset) override
Returns VtValue at a given shutterOffset for the value of this xform.
Data source representing the "reset xform stack" flag for a USD xformable.
bool GetTypedValue(HdSampledDataSource::Time shutterOffset) override
Returns bool at a given shutterOffset for the value of this flag.
bool GetContributingSampleTimesForInterval(HdSampledDataSource::Time startTime, HdSampledDataSource::Time endTime, std::vector< HdSampledDataSource::Time > *outSampleTimes) override
Fills the outSampleTimes with the times between startTime and endTime that have valid sample data and...
VtValue GetValue(HdSampledDataSource::Time shutterOffset) override
Returns VtValue at a given shutterOffset for the value of this flag.
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:134
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:164
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:457