HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dataSourceAttributeColorSpace.h
Go to the documentation of this file.
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"
14 
16 
17 /// \class UsdImagingDataSourceAttributeColorSpace
18 ///
19 /// A data source that represents the metadata on a USD Attribute
20 ///
22 {
23 public:
24 
26 
27  /// Returns the VtValue of the colorspace for the attribute
28  ///
29  VtValue GetValue(HdSampledDataSource::Time shutterOffset) override
30  {
31  return VtValue(GetTypedValue(shutterOffset));
32  }
33 
34  /// Returns the extracted TfToken value of the color space metadata
35  /// on the attribute.
36  ///
38  {
39  TF_UNUSED(shutterOffset);
40  return _usdAttr.GetColorSpace();
41  }
42 
43  /// Returns false since we do not expect the color space value to vary
44  /// over time.
45  ///
47  HdSampledDataSource::Time startTime,
49  std::vector<HdSampledDataSource::Time> *outSampleTimes) override
50  {
51  TF_UNUSED(startTime);
52  TF_UNUSED(endTime);
53  return false;
54  }
55 
56 private:
57 
58  /// Constructs a new UsdImagingDataSourceAttributeColorSpace for the given
59  /// \p usdAttr
60  ///
62 
63 private:
64  UsdAttribute _usdAttr;
65 };
66 
67 
69 
70 #endif // PXR_USD_IMAGING_USD_IMAGING_DATA_SOURCE_ATTRIBUTE_COLORSPACE_H
VtValue GetValue(HdSampledDataSource::Time shutterOffset) override
HD_DECLARE_DATASOURCE(UsdImagingDataSourceAttributeColorSpace)
TfToken GetTypedValue(HdSampledDataSource::Time shutterOffset) override
bool GetContributingSampleTimesForInterval(HdSampledDataSource::Time startTime, HdSampledDataSource::Time endTime, std::vector< HdSampledDataSource::Time > *outSampleTimes) override
Definition: token.h:70
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define TF_UNUSED(x)
Definition: tf.h:168
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
USD_API TfToken GetColorSpace() const
Definition: value.h:146