All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
dataSourcePrim.h
1//
2// Copyright 2020 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_IMAGING_USD_IMAGING_DATA_SOURCE_PRIM_H
8#define PXR_USD_IMAGING_USD_IMAGING_DATA_SOURCE_PRIM_H
9
10#include "pxr/imaging/hd/dataSource.h"
11#include "pxr/imaging/hd/dataSourceTypeDefs.h"
12
13#include "pxr/usd/usd/prim.h"
14
17
18#include "pxr/usdImaging/usdImaging/api.h"
19#include "pxr/usdImaging/usdImaging/dataSourceStageGlobals.h"
20#include "pxr/usdImaging/usdImaging/dataSourcePrimvars.h"
21#include "pxr/usdImaging/usdImaging/types.h"
22
23PXR_NAMESPACE_OPEN_SCOPE
24
29{
30public:
31 HD_DECLARE_DATASOURCE(UsdImagingDataSourceVisibility);
32
37
41 HdDataSourceBaseHandle Get(const TfToken &name) override;
42
43private:
52 const UsdAttributeQuery &visibilityQuery,
53 const SdfPath &sceneIndexPath,
54 const UsdImagingDataSourceStageGlobals &stageGlobals);
55
56private:
57 UsdAttributeQuery _visibilityQuery;
58 const UsdImagingDataSourceStageGlobals &_stageGlobals;
59};
60
61HD_DECLARE_DATASOURCE_HANDLES(UsdImagingDataSourceVisibility);
62
63
64// ----------------------------------------------------------------------------
65
70{
71public:
72 HD_DECLARE_DATASOURCE(UsdImagingDataSourcePurpose);
73
78
82 HdDataSourceBaseHandle Get(const TfToken &name) override;
83
84private:
92 const UsdAttributeQuery &purposeQuery,
93 const UsdImagingDataSourceStageGlobals &stageGlobals);
94
95private:
96 UsdAttributeQuery _purposeQuery;
97 const UsdImagingDataSourceStageGlobals &_stageGlobals;
98};
99
100HD_DECLARE_DATASOURCE_HANDLES(UsdImagingDataSourcePurpose);
101
102
103// ----------------------------------------------------------------------------
104
110{
111public:
112 HD_DECLARE_DATASOURCE(UsdImagingDataSourceExtentCoordinate);
113
115 VtValue GetValue(HdSampledDataSource::Time shutterOffset) override;
116
118 GfVec3d GetTypedValue(HdSampledDataSource::Time shutterOffset) override;
119
123 HdSampledDataSource::Time startTime,
124 HdSampledDataSource::Time endTime,
125 std::vector<HdSampledDataSource::Time> *outSampleTimes) override;
126
127private:
136 const HdVec3fArrayDataSourceHandle &extentDs,
137 const SdfPath &attrPath,
138 unsigned int index);
139
140private:
141 HdVec3fArrayDataSourceHandle _extentDs;
142 SdfPath _attrPath;
143 unsigned int _index;
144};
145
146// ----------------------------------------------------------------------------
147
152{
153public:
154 HD_DECLARE_DATASOURCE(UsdImagingDataSourceExtent);
155
160
164 HdDataSourceBaseHandle Get(const TfToken &name) override;
165
166private:
175 const UsdAttributeQuery &extentQuery,
176 const SdfPath &sceneIndexPath,
177 const UsdImagingDataSourceStageGlobals &stageGlobals);
178
179private:
180 // Note: the constructor takes sceneIndexPath for change-tracking,
181 // but here we're storing the USD attribute path for error reporting!
182 SdfPath _attrPath;
183 HdVec3fArrayDataSourceHandle _extentDs;
184};
185
186HD_DECLARE_DATASOURCE_HANDLES(UsdImagingDataSourceExtent);
187
188// ----------------------------------------------------------------------------
189
194{
195public:
196 HD_DECLARE_DATASOURCE(UsdImagingDataSourceExtentsHint);
197
206
209 HdDataSourceBaseHandle Get(const TfToken &name) override;
210
211private:
220 const UsdAttributeQuery &extentQuery,
221 const SdfPath &sceneIndexPath,
222 const UsdImagingDataSourceStageGlobals &stageGlobals);
223
224private:
225 // Note: the constructor takes sceneIndexPath for change-tracking,
226 // but here we're storing the USD attribute path for error reporting!
227 SdfPath _attrPath;
228 HdVec3fArrayDataSourceHandle _extentDs;
229};
230
231HD_DECLARE_DATASOURCE_HANDLES(UsdImagingDataSourceExtent);
232
233// ----------------------------------------------------------------------------
234
240{
241public:
242 HD_DECLARE_DATASOURCE(UsdImagingDataSourceXformResetXformStack);
243
245 VtValue GetValue(HdSampledDataSource::Time shutterOffset) override;
246
248 bool GetTypedValue(HdSampledDataSource::Time shutterOffset) override;
249
253 HdSampledDataSource::Time startTime,
254 HdSampledDataSource::Time endTime,
255 std::vector<HdSampledDataSource::Time> *outSampleTimes) override {
256 return false;
257 }
258
259private:
270 const UsdGeomXformable::XformQuery &xformQuery,
271 const UsdImagingDataSourceStageGlobals &stageGlobals);
272
273private:
275 const UsdImagingDataSourceStageGlobals &_stageGlobals;
276};
277
278HD_DECLARE_DATASOURCE_HANDLES(UsdImagingDataSourceXformResetXformStack);
279
280// ----------------------------------------------------------------------------
281
289{
290public:
291
292 HD_DECLARE_DATASOURCE(UsdImagingDataSourceXformMatrix);
293
297 VtValue GetValue(HdSampledDataSource::Time shutterOffset) override;
298
302 GfMatrix4d GetTypedValue(HdSampledDataSource::Time shutterOffset) override;
303
308 HdSampledDataSource::Time startTime,
309 HdSampledDataSource::Time endTime,
310 std::vector<HdSampledDataSource::Time> *outSampleTimes) override;
311
312private:
323 const UsdGeomXformable::XformQuery &xformQuery,
324 const UsdImagingDataSourceStageGlobals &stageGlobals);
325
326private:
328 const UsdImagingDataSourceStageGlobals &_stageGlobals;
329};
330
331HD_DECLARE_DATASOURCE_HANDLES(UsdImagingDataSourceXformMatrix);
332
333// ----------------------------------------------------------------------------
334
345{
346public:
347 HD_DECLARE_DATASOURCE(UsdImagingDataSourceXform);
348
354
359 HdDataSourceBaseHandle Get(const TfToken &name) override;
360
361private:
372 const UsdGeomXformable::XformQuery &xformQuery,
373 const SdfPath &sceneIndexPath,
374 const UsdImagingDataSourceStageGlobals &stageGlobals);
375
376private:
378 const UsdImagingDataSourceStageGlobals &_stageGlobals;
379};
380
381HD_DECLARE_DATASOURCE_HANDLES(UsdImagingDataSourceXform);
382
383// ----------------------------------------------------------------------------
384
391{
392public:
393 HD_DECLARE_DATASOURCE(UsdImagingDataSourcePrimOrigin);
394
396
399 HdDataSourceBaseHandle Get(const TfToken &name) override;
400
401private:
403
404private:
405 UsdPrim _usdPrim;
406};
407
408HD_DECLARE_DATASOURCE_HANDLES(UsdImagingDataSourcePrimOrigin);
409
410// ----------------------------------------------------------------------------
411
430{
431public:
432 HD_DECLARE_DATASOURCE(UsdImagingDataSourcePrim);
433
437 USDIMAGING_API
439
442 USDIMAGING_API
443 HdDataSourceBaseHandle Get(const TfToken &name) override;
444
447 USDIMAGING_API
449 UsdPrim const& prim,
450 const TfToken &subprim,
451 const TfTokenVector &properties,
452 UsdImagingPropertyInvalidationType invalidationType);
453
454protected:
467 USDIMAGING_API
469 const SdfPath &sceneIndexPath,
470 UsdPrim usdPrim,
471 const UsdImagingDataSourceStageGlobals &stageGlobals);
472
473 // Accessors, for derived classes...
474 const SdfPath &_GetSceneIndexPath() const {
475 return _sceneIndexPath;
476 }
477
478 const UsdPrim &_GetUsdPrim() const {
479 return _usdPrim;
480 }
481
482 const UsdImagingDataSourceStageGlobals &_GetStageGlobals() const {
483 return _stageGlobals;
484 }
485
486private:
487 const SdfPath _sceneIndexPath;
488 UsdPrim _usdPrim;
489 const UsdImagingDataSourceStageGlobals &_stageGlobals;
490};
491
492HD_DECLARE_DATASOURCE_HANDLES(UsdImagingDataSourcePrim);
493
494PXR_NAMESPACE_CLOSE_SCOPE
495
496#endif // PXR_USD_IMAGING_USD_IMAGING_DATA_SOURCE_PRIM_H
Stores a 4x4 matrix of double elements.
Definition: matrix4d.h:71
Basic type for a vector of 3 double components.
Definition: vec3d.h:46
A datasource representing structured (named, hierarchical) data, for example a geometric primitive or...
Definition: dataSource.h:99
Represents a set of data source locators closed under descendancy.
A datasource representing a concretely-typed sampled value.
Definition: dataSource.h:193
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
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:362
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:117
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:147
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440