Loading...
Searching...
No Matches
dataSourceAttributeTypeName.h
1//
2// Copyright 2023 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_ATTRIBUTE_TYPENAME_H
8#define PXR_USD_IMAGING_USD_IMAGING_DATA_SOURCE_ATTRIBUTE_TYPENAME_H
9
10#include "pxr/usd/usd/attribute.h"
11#include "pxr/usdImaging/usdImaging/api.h"
12#include "pxr/imaging/hd/dataSource.h"
13#include "pxr/imaging/hd/dataSourceTypeDefs.h"
14
15PXR_NAMESPACE_OPEN_SCOPE
16
22{
23public:
24
25 HD_DECLARE_DATASOURCE(UsdImagingDataSourceAttributeTypeName);
26
29 VtValue GetValue(HdSampledDataSource::Time shutterOffset) override
30 {
31 return VtValue(GetTypedValue(shutterOffset));
32 }
33
37 TfToken GetTypedValue(HdSampledDataSource::Time shutterOffset) override
38 {
39 if (!_usdAttr) {
40 return {};
41 }
42 TF_UNUSED(shutterOffset);
43 // We are using the GetAsToken() here since we do not expect an alias
44 // other than the "official" type name.
45 return _usdAttr.GetTypeName().GetAsToken();
46 }
47
51 HdSampledDataSource::Time startTime,
52 HdSampledDataSource::Time endTime,
53 std::vector<HdSampledDataSource::Time> *outSampleTimes) override
54 {
55 TF_UNUSED(startTime);
56 TF_UNUSED(endTime);
57 return false;
58 }
59
60private:
61
66
67private:
68 UsdAttribute _usdAttr;
69};
70
71
72PXR_NAMESPACE_CLOSE_SCOPE
73
74#endif // PXR_USD_IMAGING_USD_IMAGING_DATA_SOURCE_ATTRIBUTE_TYPENAME_H
A datasource representing a concretely-typed sampled value.
Definition dataSource.h:248
SDF_API TfToken GetAsToken() const
Returns the type name as a token.
Token for efficient comparison, assignment, and hashing of known strings.
Definition token.h:71
Scenegraph object for authoring and retrieving numeric, string, and array valued data,...
Definition attribute.h:183
USD_API SdfValueTypeName GetTypeName() const
Return the "scene description" value type name for this attribute.
A data source that represents the type name on a USD Attribute.
TfToken GetTypedValue(HdSampledDataSource::Time shutterOffset) override
Returns the extracted TfToken value of the type info metadata on the attribute.
bool GetContributingSampleTimesForInterval(HdSampledDataSource::Time startTime, HdSampledDataSource::Time endTime, std::vector< HdSampledDataSource::Time > *outSampleTimes) override
Returns false since we do not expect the type info to vary over time.
VtValue GetValue(HdSampledDataSource::Time shutterOffset) override
Returns the VtValue of the type info for the attribute.
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition value.h:90
#define TF_UNUSED(x)
Stops compiler from producing unused argument or variable warnings.
Definition tf.h:168