24 #ifndef PXR_USD_USD_UTILS_SPARSE_VALUE_WRITER_H
25 #define PXR_USD_USD_UTILS_SPARSE_VALUE_WRITER_H
34 #include "pxr/base/vt/value.h"
36 #include "pxr/usd/usdUtils/api.h"
37 #include "pxr/usd/usd/attribute.h"
38 #include "pxr/usd/usd/timeCode.h"
40 PXR_NAMESPACE_OPEN_SCOPE
145 void _InitializeSparseAuthoring(
VtValue *defaultValue);
157 bool _didWritePrevValue=
true;
265 _attrValueWriterMap.clear();
271 std::vector<UsdUtilsSparseAttrValueWriter>
276 template <
typename T>
282 inline size_t operator() (
const UsdAttribute &attr)
const {
283 return hash_value(attr);
287 using _AttrValueWriterMap = std::unordered_map<
UsdAttribute,
290 _AttrValueWriterMap _attrValueWriterMap;
293 PXR_NAMESPACE_CLOSE_SCOPE
A utility class for authoring time-varying attribute values with simple run-length encoding...
USDUTILS_API std::vector< UsdUtilsSparseAttrValueWriter > GetSparseAttrValueWriters() const
Returns a new vector of UsdUtilsSparseAttrValueWriter populated from the attrValueWriter map...
bool SetAttribute(const UsdAttribute &attr, T &value, const UsdTimeCode time=UsdTimeCode::Default())
Scenegraph object for authoring and retrieving numeric, string, and array valued data, sampled over time.
USDUTILS_API bool SetTimeSample(const VtValue &value, const UsdTimeCode time)
Sets a new time-sample on the attribute with given value at the given time.
Utility class that manages sparse authoring of a set of UsdAttributes.
static VtValue Take(T &obj)
Create a new VtValue, taking its contents from obj.
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
const UsdAttribute & GetAttr() const
Returns the attribute that's held in the sparse value writer.
USDUTILS_API UsdUtilsSparseAttrValueWriter(const UsdAttribute &attr, const VtValue &defaultValue=VtValue())
The constructor initializes the data required for run-length encoding of time-samples.
USDUTILS_API void Clear()
Clears the internal map, thereby releasing all the memory used by the sparse value-writers.
static constexpr UsdTimeCode Default()
Produce a UsdTimeCode representing the sentinel value for 'default'.
Provides a container which may hold any type, and provides introspection and iteration over array typ...
USDUTILS_API bool SetAttribute(const UsdAttribute &attr, const VtValue &value, const UsdTimeCode time=UsdTimeCode::Default())
Sets the value of attr to value at time time.