8#ifndef PXR_BASE_TS_KEY_FRAME_H
9#define PXR_BASE_TS_KEY_FRAME_H
12#include "pxr/base/ts/api.h"
14#include "pxr/base/ts/types.h"
15#include "pxr/base/ts/data.h"
16#include "pxr/base/vt/value.h"
24PXR_NAMESPACE_OPEN_SCOPE
68 TsKnotType knotType = TsKnotLinear,
69 const T & leftTangentSlope = TsTraits<T>::zero,
70 const T & rightTangentSlope = TsTraits<T>::zero,
71 TsTime leftTangentLength = 0,
72 TsTime rightTangentLength = 0);
78 TsKnotType knotType = TsKnotLinear,
81 TsTime leftTangentLength = 0,
82 TsTime rightTangentLength = 0);
89 TsKnotType knotType = TsKnotLinear,
90 const T & leftTangentSlope = TsTraits<T>::zero,
91 const T & rightTangentSlope = TsTraits<T>::zero,
92 TsTime leftTangentLength = 0,
93 TsTime rightTangentLength = 0);
100 TsKnotType knotType = TsKnotLinear,
103 TsTime leftTangentLength = 0,
104 TsTime rightTangentLength = 0);
140 return _holder.Get()->GetTime();
146 _holder.GetMutable()->SetTime(newTime);
358 const VtValue & leftTangentSlope,
359 const VtValue & rightTangentSlope,
360 TsTime leftTangentLength,
361 TsTime rightTangentLength);
365 void _InitializeKnotType(TsKnotType knotType);
367 void _InitializeTangentLength(TsTime leftTangentLength,
368 TsTime rightTangentLength);
372 bool _ValidateTangentSetting()
const;
376 Ts_PolymorphicDataHolder _holder;
388 const T & leftTangentSlope,
389 const T & rightTangentSlope,
390 TsTime leftTangentLength,
391 TsTime rightTangentLength)
393 static_assert( TsTraits<T>::isSupportedSplineValueType );
395 _holder.New(time,
false ,
396 val, val, leftTangentSlope, rightTangentSlope);
398 _InitializeKnotType(knotType);
399 _InitializeTangentLength(leftTangentLength,rightTangentLength);
407 const T & leftTangentSlope,
408 const T & rightTangentSlope,
409 TsTime leftTangentLength,
410 TsTime rightTangentLength)
412 static_assert( TsTraits<T>::isSupportedSplineValueType );
414 _holder.New(time,
true , lhv, rhv,
415 leftTangentSlope, rightTangentSlope);
417 _InitializeKnotType(knotType);
418 _InitializeTangentLength(leftTangentLength,rightTangentLength);
421PXR_NAMESPACE_CLOSE_SCOPE
Low-level utilities for informing users of various internal and external diagnostic conditions.
Holds the data for an TsKeyFrame.
Specifies the value of an TsSpline object at a particular point in time.
TS_API bool IsInterpolatable() const
Gets whether the value type of this keyframe is interpolatable.
TS_API VtValue GetValueDerivative() const
Gets the value of the derivative at this keyframe.
TS_API TsKeyFrame(const TsTime &time, const VtValue &lhv, const VtValue &rhv, TsKnotType knotType=TsKnotLinear, const VtValue &leftTangentSlope=VtValue(), const VtValue &rightTangentSlope=VtValue(), TsTime leftTangentLength=0, TsTime rightTangentLength=0)
Constructs a dual-valued keyframe with VtValues.
TS_API void ResetTangentSymmetryBroken()
Sets the flag that enforces tangent symmetry based on whether the tangets are already symmetric.
TS_API TsKeyFrame(const TsKeyFrame &kf)
Constructs a keyframe by duplicating an existing TsKeyFrame.
TS_API bool IsExtrapolatable() const
Gets whether the value type of this keyframe is extrapolatable.
TS_API void SetRightTangentLength(TsTime)
Sets the right-side tangent length (in time) of this knot.
TS_API bool GetIsDualValued() const
Gets whether this knot is dual-valued.
TS_API void SetLeftTangentSlope(VtValue)
Sets the left-side tangent slope (in units per frame) of this knot.
TS_API TsKeyFrame & operator=(const TsKeyFrame &rhs)
Assignment operator.
TS_API void SetKnotType(TsKnotType knotType)
Sets the knot type.
TS_API ~TsKeyFrame()
Non-virtual destructor; this class should not be subclassed.
TS_API TsKnotType GetKnotType() const
Gets the knot type.
TS_API TsKeyFrame()
Constructs a default double keyframe.
TS_API void SetLeftValue(VtValue val)
Sets the left value of this dual-valued knot.
TS_API VtValue GetLeftValueDerivative() const
Gets the value of the derivative on the left side.
TS_API bool HasTangents() const
Gets whether the knot of this keyframe has tangents.
TS_API bool GetTangentSymmetryBroken() const
Gets whether tangent symmetry has been broken.
TS_API bool SupportsTangents() const
Gets whether the value type of this keyframe supports tangents.
TS_API void SetValue(VtValue val)
Sets the value at this keyframe.
TS_API bool CanSetKnotType(TsKnotType, std::string *reason=NULL) const
Checks whether the key frame's value type supports the given knot type.
TS_API void SetTangentSymmetryBroken(bool broken)
Sets whether tangent symmetry is broken.
TS_API TsKeyFrame(const TsTime &time, const VtValue &val, TsKnotType knotType=TsKnotLinear, const VtValue &leftTangentSlope=VtValue(), const VtValue &rightTangentSlope=VtValue(), TsTime leftTangentLength=0, TsTime rightTangentLength=0)
Constructs a single-valued keyframe with VtValues.
TS_API void SetLeftTangentLength(TsTime)
Sets the left-side tangent length (in time) of this knot.
TS_API void SetRightTangentSlope(VtValue newSlope)
Sets the right-side tangent slope (in units per frame) of this knot.
TS_API VtValue GetLeftValue() const
Gets the left value of this dual-valued knot.
TS_API void SetIsDualValued(bool isDual)
Sets whether this knot is dual-valued.
TS_API VtValue GetLeftTangentSlope() const
Gets the left-side tangent slope (in units per frame) of this knot.
TS_API TsTime GetRightTangentLength() const
Gets the length of the projection of the knot's right tangent onto the time axis.
TS_API VtValue GetRightTangentSlope() const
Gets the right-side tangent slope (in units per frame) of this knot.
TS_API VtValue GetValue(TsSide side) const
Gets the value at this keyframe on the given side.
TS_API void SetTime(const TsTime &newTime)
Sets the time of this keyframe.
TS_API VtValue GetValue() const
Gets the value at this keyframe.
TS_API TsTime GetLeftTangentLength() const
Gets the length of the projection of the knot's left tangent onto the time axis.
TS_API bool IsEquivalentAtSide(const TsKeyFrame &keyFrame, TsSide side) const
Gets whether this key frame is at the same time and is equivalent to keyFrame on the given side.
TS_API void SetValue(VtValue val, TsSide side)
Sets the value at this keyframe on the given side.
TS_API bool operator==(const TsKeyFrame &) const
Compare this keyframe with another.
TS_API TsTime GetTime() const
Gets the time of this keyframe.
TS_API VtValue GetZero() const
Gets a zero for this keyframe's value type.
Represents a spline value object.
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Demangle C++ typenames generated by the typeid() facility.
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].
Definitions of basic string utilities in tf.