7#ifndef PXR_USD_USD_UTILS_SPARSE_VALUE_WRITER_H
8#define PXR_USD_USD_UTILS_SPARSE_VALUE_WRITER_H
17#include "pxr/base/vt/value.h"
19#include "pxr/usd/usdUtils/api.h"
20#include "pxr/usd/usd/attribute.h"
21#include "pxr/usd/usd/timeCode.h"
23PXR_NAMESPACE_OPEN_SCOPE
128 void _InitializeSparseAuthoring(
VtValue *defaultValue);
140 bool _didWritePrevValue=
true;
248 _attrValueWriterMap.clear();
254 std::vector<UsdUtilsSparseAttrValueWriter>
259 template <
typename T>
265 inline size_t operator() (
const UsdAttribute &attr)
const {
270 using _AttrValueWriterMap = std::unordered_map<
UsdAttribute,
273 _AttrValueWriterMap _attrValueWriterMap;
276PXR_NAMESPACE_CLOSE_SCOPE
Scenegraph object for authoring and retrieving numeric, string, and array valued data,...
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
static constexpr UsdTimeCode Default()
Produce a UsdTimeCode representing the sentinel value for 'default'.
A utility class for authoring time-varying attribute values with simple run-length encoding,...
USDUTILS_API UsdUtilsSparseAttrValueWriter(const UsdAttribute &attr, VtValue *defaultValue)
The constructor initializes the data required for run-length encoding of time-samples.
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.
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 bool SetTimeSample(VtValue *value, const UsdTimeCode time)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Utility class that manages sparse authoring of a set of UsdAttributes.
USDUTILS_API bool SetAttribute(const UsdAttribute &attr, VtValue *value, const UsdTimeCode time=UsdTimeCode::Default())
This is an overloaded member function, provided for convenience. It differs from the above function o...
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.
USDUTILS_API void Clear()
Clears the internal map, thereby releasing all the memory used by the sparse value-writers.
bool SetAttribute(const UsdAttribute &attr, T &value, const UsdTimeCode time=UsdTimeCode::Default())
This is an overloaded member function, provided for convenience. It differs from the above function o...
USDUTILS_API std::vector< UsdUtilsSparseAttrValueWriter > GetSparseAttrValueWriters() const
Returns a new vector of UsdUtilsSparseAttrValueWriter populated from the attrValueWriter map.
Provides a container which may hold any type, and provides introspection and iteration over array typ...
static VtValue Take(T &obj)
Create a new VtValue, taking its contents from obj.
size_t hash_value(const TfToken &x)
Overload hash_value for TfToken.