Loading...
Searching...
No Matches
dataSourceAttributeColorSpace.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_COLORSPACE_H
8#define PXR_USD_IMAGING_USD_IMAGING_DATA_SOURCE_ATTRIBUTE_COLORSPACE_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(UsdImagingDataSourceAttributeColorSpace);
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
43 TF_UNUSED(shutterOffset);
44 return _usdAttr.GetColorSpace();
45 }
46
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_COLORSPACE_H
A datasource representing a concretely-typed sampled value.
Definition: dataSource.h:193
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 TfToken GetColorSpace() const
Gets the color space in which the attribute is authored if it has been explicitly set.
A data source that represents the metadata on a USD Attribute.
TfToken GetTypedValue(HdSampledDataSource::Time shutterOffset) override
Returns the extracted TfToken value of the color space 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 color space value to vary over time.
VtValue GetValue(HdSampledDataSource::Time shutterOffset) override
Returns the VtValue of the colorspace 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