Loading...
Searching...
No Matches
keyFrameUtils.h
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
8#ifndef PXR_BASE_TS_KEY_FRAME_UTILS_H
9#define PXR_BASE_TS_KEY_FRAME_UTILS_H
10
11#include "pxr/pxr.h"
12#include "pxr/base/ts/api.h"
13#include "pxr/base/ts/types.h"
14#include "pxr/base/ts/loopParams.h"
15
16PXR_NAMESPACE_OPEN_SCOPE
17
18class Ts_Data;
19class TsKeyFrame;
20class TsKeyFrameMap;
21
24const TsKeyFrame* Ts_GetClosestKeyFrame(
25 const TsKeyFrameMap &keyframes,
26 const TsTime targetTime );
27
30const TsKeyFrame* Ts_GetClosestKeyFrameBefore(
31 const TsKeyFrameMap &keyframes,
32 const TsTime targetTime );
33
36const TsKeyFrame* Ts_GetClosestKeyFrameAfter(
37 const TsKeyFrameMap &keyframes,
38 const TsTime targetTime );
39
43std::pair<const TsKeyFrame *, const TsKeyFrame *>
44Ts_GetClosestKeyFramesSurrounding(
45 const TsKeyFrameMap &keyframes,
46 const TsTime targetTime );
47
50bool Ts_IsSegmentFlat(const TsKeyFrame &kf1, const TsKeyFrame &kf2 );
51
53bool Ts_IsKeyFrameRedundant(
54 const TsKeyFrameMap &keyframes,
55 const TsKeyFrame &keyFrame,
56 const TsLoopParams &loopParams=TsLoopParams(),
57 const VtValue& defaultValue=VtValue());
58
59// Return a pointer to the Ts_Data object held by the keyframe.
60// XXX: exported because used by templated functions starting from TsEvaluator
61TS_API
62Ts_Data* Ts_GetKeyFrameData(TsKeyFrame &kf);
63
64// Return a const pointer to the Ts_Data object held by the keyframe.
65// XXX: exported because used by templated functions starting from TsEvaluator
66TS_API
67Ts_Data const* Ts_GetKeyFrameData(TsKeyFrame const& kf);
68
69// Uses a fixed epsilon to compare the values, iff both are float or double,
70// else falls back to VtValue ==.
71bool Ts_IsClose(const VtValue &v0, const VtValue &v1);
72
73PXR_NAMESPACE_CLOSE_SCOPE
74
75#endif
Holds the data for an TsKeyFrame.
Definition: data.h:33
Specifies the value of an TsSpline object at a particular point in time.
Definition: keyFrame.h:50
An ordered sequence of keyframes with STL-compliant API for finding, inserting, and erasing keyframes...
Definition: keyFrameMap.h:33
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:147