24 #ifndef PXR_USD_IMAGING_USD_IMAGING_DATA_SOURCE_ATTRIBUTE_H 25 #define PXR_USD_IMAGING_USD_IMAGING_DATA_SOURCE_ATTRIBUTE_H 27 #include "pxr/usd/usd/attribute.h" 28 #include "pxr/usd/usd/attributeQuery.h" 29 #include "pxr/usdImaging/usdImaging/api.h" 30 #include "pxr/usdImaging/usdImaging/dataSourceStageGlobals.h" 31 #include "pxr/imaging/hd/dataSource.h" 32 #include "pxr/imaging/hd/dataSourceTypeDefs.h" 34 PXR_NAMESPACE_OPEN_SCOPE
56 T
GetTypedValue(HdSampledDataSource::Time shutterOffset)
override 64 _usdAttrQuery.Get<T>(&result, time);
72 HdSampledDataSource::Time startTime,
73 HdSampledDataSource::Time endTime,
74 std::vector<HdSampledDataSource::Time> *outSampleTimes)
override 77 if (!_usdAttrQuery.ValueMightBeTimeVarying() ||
85 std::vector<double> timeSamples;
86 _usdAttrQuery.GetTimeSamplesInInterval(interval, &timeSamples);
89 if (timeSamples.empty() || timeSamples[0] > interval.GetMin()) {
90 timeSamples.insert(timeSamples.begin(), interval.GetMin());
92 if (timeSamples.back() < interval.GetMax()) {
93 timeSamples.push_back(interval.GetMax());
98 outSampleTimes->resize(timeSamples.size());
99 for (
size_t i = 0; i < timeSamples.size(); ++i) {
100 (*outSampleTimes)[i] = timeSamples[i] - time.
GetValue();
122 UsdImagingDataSourceAttribute(
130 UsdImagingDataSourceAttribute(
149 HdSampledDataSourceHandle
150 UsdImagingDataSourceAttributeNew(
159 HdSampledDataSourceHandle
160 UsdImagingDataSourceAttributeNew(
170 UsdImagingDataSourceAttribute<T>::UsdImagingDataSourceAttribute(
175 : _usdAttrQuery(usdAttr)
176 , _stageGlobals(stageGlobals)
178 if (!timeVaryingFlagLocator.IsEmpty()) {
179 if (_usdAttrQuery.ValueMightBeTimeVarying()) {
180 _stageGlobals.FlagAsTimeVarying(
181 sceneIndexPath, timeVaryingFlagLocator);
187 UsdImagingDataSourceAttribute<T>::UsdImagingDataSourceAttribute(
192 : _usdAttrQuery(usdAttrQuery)
193 , _stageGlobals(stageGlobals)
195 if (!timeVaryingFlagLocator.IsEmpty()) {
196 if (_usdAttrQuery.ValueMightBeTimeVarying()) {
197 _stageGlobals.FlagAsTimeVarying(
198 sceneIndexPath, timeVaryingFlagLocator);
203 PXR_NAMESPACE_CLOSE_SCOPE
205 #endif // PXR_USD_IMAGING_USD_IMAGING_DATA_SOURCE_ATTRIBUTE_H virtual bool GetContributingSampleTimesForInterval(Time startTime, Time endTime, std::vector< Time > *outSampleTimes)=0
Given a shutter window of interest (startTime and endTime relative to the current frame),...
Object for efficiently making repeated queries for attribute values.
Scenegraph object for authoring and retrieving numeric, string, and array valued data,...
bool IsNumeric() const
Return true if this time represents a numeric value, false otherwise.
virtual VtValue GetValue(Time shutterOffset)=0
Returns the value of this data source at frame-relative time shutterOffset.
Represents an object that can identify the location of a data source.
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
This class is used as a context object with global stage information, that gets passed down to dataso...
A data source that represents a USD Attribute.
A datasource representing a concretely-typed sampled value.
A basic mathematical interval class.
A path value used to locate objects in layers or scenegraphs.
virtual T GetTypedValue(Time shutterOffset)=0
Returns the value of this data source at frame-relative time shutterOffset, as type T.
static HD_API const HdDataSourceLocator & EmptyLocator()
Returns a common empty locator.
double GetValue() const
Return the numeric value for this time.
static SDF_API const SdfPath & EmptyPath()
The empty path value, equivalent to SdfPath().
Provides a container which may hold any type, and provides introspection and iteration over array typ...